@things-factory/worklist 6.0.27 → 6.0.32

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.
Files changed (195) hide show
  1. package/client/bootstrap.ts +9 -1
  2. package/client/components/activity-starter-form.ts +35 -10
  3. package/client/grist-editor/grist-editor-activity-search-key.ts +79 -0
  4. package/client/grist-editor/popup-activity-search-keys-input.ts +167 -0
  5. package/client/pages/activity/activity-list-page.ts +122 -11
  6. package/client/pages/activity/activity-partial-view.ts +85 -0
  7. package/client/pages/activity/starter-list-page.ts +1 -0
  8. package/client/pages/activity-approval/activity-approval-page.ts +6 -6
  9. package/client/pages/activity-instance/activity-instance-search-page.ts +377 -0
  10. package/client/pages/activity-instance/activity-instance-view.ts +135 -0
  11. package/client/pages/activity-store/activity-store-page.ts +1 -1
  12. package/client/pages/activity-template/activity-template-list-page.ts +29 -1
  13. package/client/pages/activity-thread/activity-thread-page.ts +8 -3
  14. package/client/pages/activity-thread/activity-thread-view.ts +102 -0
  15. package/client/pages/installable-activity/installable-activity-list-page.ts +29 -1
  16. package/client/pages/todo/approval-waiting-list-page.ts +19 -9
  17. package/client/pages/todo/done-list-page.ts +344 -0
  18. package/client/pages/todo/draft-list-page.ts +13 -2
  19. package/client/pages/todo/todo-list-page.ts +14 -3
  20. package/client/route.ts +8 -0
  21. package/client/types/activity-instance-type.ts +123 -0
  22. package/client/types/activity-instance.ts +124 -0
  23. package/client/types/activity-model-type.ts +40 -0
  24. package/client/types/activity-search-key-item-type.ts +9 -0
  25. package/client/types/activity-thread-type.ts +19 -0
  26. package/client/types/activity-thread.ts +88 -0
  27. package/client/types/activity.ts +103 -0
  28. package/client/{types.js → types/types.ts} +0 -9
  29. package/dist-client/bootstrap.js +4 -1
  30. package/dist-client/bootstrap.js.map +1 -1
  31. package/dist-client/components/activity-starter-form.d.ts +1 -1
  32. package/dist-client/components/activity-starter-form.js +34 -9
  33. package/dist-client/components/activity-starter-form.js.map +1 -1
  34. package/dist-client/grist-editor/grist-editor-activity-search-key.d.ts +12 -0
  35. package/dist-client/grist-editor/grist-editor-activity-search-key.js +70 -0
  36. package/dist-client/grist-editor/grist-editor-activity-search-key.js.map +1 -0
  37. package/dist-client/grist-editor/popup-activity-search-keys-input.d.ts +17 -0
  38. package/dist-client/grist-editor/popup-activity-search-keys-input.js +177 -0
  39. package/dist-client/grist-editor/popup-activity-search-keys-input.js.map +1 -0
  40. package/dist-client/pages/activity/activity-list-page.d.ts +4 -0
  41. package/dist-client/pages/activity/activity-list-page.js +121 -11
  42. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  43. package/dist-client/pages/activity/activity-partial-view.d.ts +13 -0
  44. package/dist-client/pages/activity/activity-partial-view.js +56 -0
  45. package/dist-client/pages/activity/activity-partial-view.js.map +1 -0
  46. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  47. package/dist-client/pages/activity-approval/activity-approval-page.js +6 -6
  48. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  49. package/dist-client/pages/activity-instance/activity-instance-search-page.d.ts +76 -0
  50. package/dist-client/pages/activity-instance/activity-instance-search-page.js +371 -0
  51. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -0
  52. package/dist-client/pages/activity-instance/activity-instance-view.d.ts +14 -0
  53. package/dist-client/pages/activity-instance/activity-instance-view.js +130 -0
  54. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -0
  55. package/dist-client/pages/activity-store/activity-store-page.js +1 -1
  56. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  57. package/dist-client/pages/activity-template/activity-template-list-page.js +29 -1
  58. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  59. package/dist-client/pages/activity-thread/activity-thread-page.js +8 -3
  60. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  61. package/dist-client/pages/activity-thread/activity-thread-view.d.ts +11 -0
  62. package/dist-client/pages/activity-thread/activity-thread-view.js +103 -0
  63. package/dist-client/pages/activity-thread/activity-thread-view.js.map +1 -0
  64. package/dist-client/pages/installable-activity/installable-activity-list-page.js +29 -1
  65. package/dist-client/pages/installable-activity/installable-activity-list-page.js.map +1 -1
  66. package/dist-client/pages/todo/approval-waiting-list-page.js +19 -9
  67. package/dist-client/pages/todo/approval-waiting-list-page.js.map +1 -1
  68. package/dist-client/pages/todo/done-list-page.d.ts +44 -0
  69. package/dist-client/pages/todo/done-list-page.js +342 -0
  70. package/dist-client/pages/todo/done-list-page.js.map +1 -0
  71. package/dist-client/pages/todo/draft-list-page.js +12 -2
  72. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  73. package/dist-client/pages/todo/todo-list-page.js +13 -3
  74. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  75. package/dist-client/route.d.ts +1 -1
  76. package/dist-client/route.js +6 -0
  77. package/dist-client/route.js.map +1 -1
  78. package/dist-client/tsconfig.tsbuildinfo +1 -1
  79. package/dist-client/types/activity-instance-type.d.ts +76 -0
  80. package/dist-client/types/activity-instance-type.js +11 -0
  81. package/dist-client/types/activity-instance-type.js.map +1 -0
  82. package/dist-client/types/activity-instance.d.ts +70 -0
  83. package/dist-client/types/activity-instance.js +36 -0
  84. package/dist-client/types/activity-instance.js.map +1 -0
  85. package/dist-client/types/activity-model-type.d.ts +31 -0
  86. package/dist-client/types/activity-model-type.js +18 -0
  87. package/dist-client/types/activity-model-type.js.map +1 -0
  88. package/dist-client/types/activity-search-key-item-type.d.ts +6 -0
  89. package/dist-client/types/activity-search-key-item-type.js +3 -0
  90. package/dist-client/types/activity-search-key-item-type.js.map +1 -0
  91. package/dist-client/types/activity-thread-type.d.ts +15 -0
  92. package/dist-client/types/activity-thread-type.js +7 -0
  93. package/dist-client/types/activity-thread-type.js.map +1 -0
  94. package/dist-client/types/activity-thread.d.ts +37 -0
  95. package/dist-client/types/activity-thread.js +51 -0
  96. package/dist-client/types/activity-thread.js.map +1 -0
  97. package/dist-client/types/activity.d.ts +65 -0
  98. package/dist-client/types/activity.js +35 -0
  99. package/dist-client/types/activity.js.map +1 -0
  100. package/dist-client/{types.d.ts → types/types.d.ts} +3 -7
  101. package/dist-client/{types.js → types/types.js} +0 -8
  102. package/dist-client/types/types.js.map +1 -0
  103. package/dist-server/controllers/activity-approval/approve.js +2 -0
  104. package/dist-server/controllers/activity-approval/approve.js.map +1 -1
  105. package/dist-server/controllers/activity-approval/reject.js +2 -0
  106. package/dist-server/controllers/activity-approval/reject.js.map +1 -1
  107. package/dist-server/controllers/{activity-installation-controller.js → activity-installation/activity-installation-controller.js} +8 -0
  108. package/dist-server/controllers/activity-installation/activity-installation-controller.js.map +1 -0
  109. package/dist-server/controllers/activity-installation/call-webhook.js.map +1 -0
  110. package/dist-server/controllers/activity-instance/abort.js +1 -1
  111. package/dist-server/controllers/activity-instance/abort.js.map +1 -1
  112. package/dist-server/controllers/activity-instance/adjust.js +1 -1
  113. package/dist-server/controllers/activity-instance/adjust.js.map +1 -1
  114. package/dist-server/controllers/activity-instance/delegate.js +5 -0
  115. package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
  116. package/dist-server/controllers/activity-instance/draft.js +16 -1
  117. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  118. package/dist-server/controllers/activity-instance/post.js +38 -3
  119. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  120. package/dist-server/controllers/activity-instance/start.js +1 -1
  121. package/dist-server/controllers/activity-instance/start.js.map +1 -1
  122. package/dist-server/controllers/activity-thread/submit.js +1 -1
  123. package/dist-server/controllers/activity-thread/submit.js.map +1 -1
  124. package/dist-server/controllers/common.js +72 -25
  125. package/dist-server/controllers/common.js.map +1 -1
  126. package/dist-server/controllers/index.js +1 -1
  127. package/dist-server/controllers/index.js.map +1 -1
  128. package/dist-server/service/activity/activity-history.js +38 -1
  129. package/dist-server/service/activity/activity-history.js.map +1 -1
  130. package/dist-server/service/activity/activity-search-key-item-type.js +28 -0
  131. package/dist-server/service/activity/activity-search-key-item-type.js.map +1 -0
  132. package/dist-server/service/activity/activity-type.js +56 -0
  133. package/dist-server/service/activity/activity-type.js.map +1 -1
  134. package/dist-server/service/activity/activity.js +40 -4
  135. package/dist-server/service/activity/activity.js.map +1 -1
  136. package/dist-server/service/activity-approval/event-subscriber.js +1 -1
  137. package/dist-server/service/activity-approval/event-subscriber.js.map +1 -1
  138. package/dist-server/service/activity-instance/activity-instance-history.js +53 -0
  139. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  140. package/dist-server/service/activity-instance/activity-instance-query.js +29 -0
  141. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  142. package/dist-server/service/activity-instance/activity-instance-type.js +16 -0
  143. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  144. package/dist-server/service/activity-instance/activity-instance.js +63 -0
  145. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  146. package/dist-server/service/activity-instance/event-subscriber.js +4 -4
  147. package/dist-server/service/activity-instance/event-subscriber.js.map +1 -1
  148. package/dist-server/service/activity-thread/activity-thread-query.js +27 -0
  149. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  150. package/dist-server/service/activity-thread/activity-thread.js +4 -1
  151. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  152. package/dist-server/service/installable-activity/installable-activity-mutation.js +1 -1
  153. package/dist-server/service/installable-activity/installable-activity-mutation.js.map +1 -1
  154. package/dist-server/service/installable-activity/installable-activity-query.js +1 -1
  155. package/dist-server/service/installable-activity/installable-activity-query.js.map +1 -1
  156. package/dist-server/service/installable-activity/installable-activity.js.map +1 -1
  157. package/dist-server/tsconfig.tsbuildinfo +1 -1
  158. package/package.json +9 -8
  159. package/server/controllers/activity-approval/approve.ts +3 -0
  160. package/server/controllers/activity-approval/reject.ts +3 -0
  161. package/server/controllers/{activity-installation-controller.ts → activity-installation/activity-installation-controller.ts} +12 -1
  162. package/server/controllers/activity-instance/abort.ts +1 -1
  163. package/server/controllers/activity-instance/adjust.ts +1 -1
  164. package/server/controllers/activity-instance/delegate.ts +9 -1
  165. package/server/controllers/activity-instance/draft.ts +16 -5
  166. package/server/controllers/activity-instance/post.ts +54 -6
  167. package/server/controllers/activity-instance/start.ts +1 -1
  168. package/server/controllers/activity-thread/submit.ts +1 -0
  169. package/server/controllers/common.ts +85 -28
  170. package/server/controllers/index.ts +1 -1
  171. package/server/service/activity/activity-history.ts +32 -1
  172. package/server/service/activity/activity-search-key-item-type.ts +16 -0
  173. package/server/service/activity/activity-type.ts +46 -1
  174. package/server/service/activity/activity.ts +34 -4
  175. package/server/service/activity-approval/event-subscriber.ts +1 -1
  176. package/server/service/activity-instance/activity-instance-history.ts +41 -0
  177. package/server/service/activity-instance/activity-instance-query.ts +30 -1
  178. package/server/service/activity-instance/activity-instance-type.ts +12 -0
  179. package/server/service/activity-instance/activity-instance.ts +49 -0
  180. package/server/service/activity-instance/event-subscriber.ts +4 -4
  181. package/server/service/activity-thread/activity-thread-query.ts +24 -0
  182. package/server/service/activity-thread/activity-thread.ts +6 -3
  183. package/server/service/installable-activity/installable-activity-mutation.ts +1 -1
  184. package/server/service/installable-activity/installable-activity-query.ts +1 -1
  185. package/server/service/installable-activity/installable-activity.ts +3 -1
  186. package/things-factory.config.js +5 -1
  187. package/translations/en.json +7 -0
  188. package/translations/ko.json +7 -0
  189. package/translations/ms.json +7 -0
  190. package/translations/zh.json +7 -0
  191. package/dist-client/types.js.map +0 -1
  192. package/dist-server/controllers/activity-installation-controller.js.map +0 -1
  193. package/dist-server/controllers/call-webhook.js.map +0 -1
  194. /package/dist-server/controllers/{call-webhook.js → activity-installation/call-webhook.js} +0 -0
  195. /package/server/controllers/{call-webhook.ts → activity-installation/call-webhook.ts} +0 -0
@@ -7,11 +7,16 @@ import { store } from '@operato/shell'
7
7
  import { openOverlay, TOOL_POSITION } from '@operato/layout'
8
8
  import { APPEND_CONTEXT_TOOL } from '@things-factory/context-ui'
9
9
 
10
- import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist'
10
+ import {
11
+ OxGristRendererJson5,
12
+ registerEditor as registerGristEditor,
13
+ registerRenderer as registerGristRenderer
14
+ } from '@operato/data-grist'
11
15
  import { OxGristEditorDuration } from '@operato/grist-editor/ox-grist-editor-duration.js'
12
16
  import { OxGristEditorQuantifier } from '@operato/grist-editor/ox-grist-editor-quantifier.js'
13
17
  import { OxGristRendererDuration } from '@operato/grist-editor/ox-grist-renderer-duration.js'
14
18
  import { OxGristRendererQuantifier } from '@operato/grist-editor/ox-grist-renderer-quantifier.js'
19
+ import { GristEditorActivitySearchKeys } from './grist-editor/grist-editor-activity-search-key.js'
15
20
 
16
21
  export default function bootstrap() {
17
22
  ;[
@@ -47,4 +52,7 @@ export default function bootstrap() {
47
52
  registerGristRenderer('duration', OxGristRendererDuration)
48
53
  registerGristEditor('quantifier', OxGristEditorQuantifier)
49
54
  registerGristRenderer('quantifier', OxGristRendererQuantifier)
55
+
56
+ registerGristEditor('activity-search-keys', GristEditorActivitySearchKeys)
57
+ registerGristRenderer('activity-search-keys', OxGristRendererJson5)
50
58
  }
@@ -5,7 +5,7 @@ import '@things-factory/organization'
5
5
 
6
6
  import gql from 'graphql-tag'
7
7
  import { css, html, LitElement } from 'lit'
8
- import { customElement, property } from 'lit/decorators.js'
8
+ import { customElement, property, state } from 'lit/decorators.js'
9
9
  import { when } from 'lit/directives/when.js'
10
10
 
11
11
  import { client } from '@operato/graphql'
@@ -55,11 +55,12 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
55
55
  ]
56
56
 
57
57
  @property({ type: String }) activityId?: string
58
- @property({ type: Object }) activity?: any
59
- @property({ type: Object }) activityInstance: any = {}
58
+
59
+ @state() activity: any
60
+ @state() activityInstance: any = {}
60
61
 
61
62
  render() {
62
- const { model, thumbnail } = this.activity || {}
63
+ var { model, thumbnail } = this.activity || {}
63
64
 
64
65
  const inputSpec = (model || [])
65
66
  .filter(item => item.inout === 'in' || item.inout === 'inout')
@@ -70,17 +71,18 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
70
71
  }
71
72
  })
72
73
 
73
- const {
74
+ var {
74
75
  id,
75
76
  name,
76
77
  description,
77
78
  input,
78
79
  state,
79
- approvalLine,
80
- assignees,
80
+ approvalLine = this.activity?.approvalLine,
81
+ assignees = this.activity?.assignees,
81
82
  threadsMin = 0,
82
83
  threadsMax = 0
83
- } = this.activityInstance || {}
84
+ } = this.activityInstance
85
+
84
86
  const draftable = !id
85
87
  const postable = id && state === 'draft'
86
88
 
@@ -202,6 +204,26 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
202
204
  name
203
205
  description
204
206
  state
207
+ assignees {
208
+ type
209
+ value
210
+ assignee {
211
+ id
212
+ name
213
+ description
214
+ controlNo
215
+ }
216
+ }
217
+ approvalLine {
218
+ type
219
+ value
220
+ approver {
221
+ id
222
+ name
223
+ description
224
+ controlNo
225
+ }
226
+ }
205
227
  thumbnail
206
228
  model {
207
229
  name
@@ -228,11 +250,14 @@ export class ActivityStarterForm extends localize(i18next)(LitElement) {
228
250
 
229
251
  async draftActivityInstance() {
230
252
  const { activityId } = this
253
+ var { name, description, assignees, approvalLine } = this.activity
231
254
 
232
255
  const activityInstance = {
233
256
  activityId,
234
- name: this.activity.name,
235
- description: this.activity.description,
257
+ name,
258
+ description,
259
+ assignees,
260
+ approvalLine,
236
261
  ...this.activityInstance
237
262
  }
238
263
 
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '../grist-editor/popup-activity-search-keys-input.js'
6
+
7
+ import { html } from 'lit'
8
+ import { customElement } from 'lit/decorators.js'
9
+
10
+ import { OxGristEditor } from '@operato/data-grist'
11
+ import { i18next } from '@operato/i18n'
12
+ import { openPopup, PopupHandle } from '@operato/popup'
13
+
14
+ @customElement('grist-editor-activity-search-keys')
15
+ export class GristEditorActivitySearchKeys extends OxGristEditor {
16
+ private popup?: PopupHandle
17
+
18
+ get editorTemplate() {
19
+ const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
20
+ return html` <div tabindex="0">${value || ''}</div> `
21
+ }
22
+
23
+ _onclick(e: Event): void {
24
+ e.stopPropagation()
25
+ this.openEditorPopup()
26
+ }
27
+
28
+ _onkeydown(e: KeyboardEvent): void {
29
+ const key = e.key
30
+ if (key == 'Enter') {
31
+ e.stopPropagation()
32
+ this.openEditorPopup()
33
+ }
34
+ }
35
+
36
+ async openEditorPopup() {
37
+ if (this.popup) {
38
+ delete this.popup
39
+ }
40
+
41
+ const { name, help } = this.column.record?.options || {}
42
+
43
+ const confirmCallback = (newval: any) => {
44
+ this.dispatchEvent(
45
+ new CustomEvent('field-change', {
46
+ bubbles: true,
47
+ composed: true,
48
+ detail: {
49
+ before: this.value,
50
+ after: newval,
51
+ record: this.record,
52
+ column: this.column,
53
+ row: this.row
54
+ }
55
+ })
56
+ )
57
+ }
58
+
59
+ /*
60
+ 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
61
+ layout의 구성에 변화가 발생하면, 다시 render된다.
62
+ 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
63
+ 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
64
+ 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
65
+ 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
66
+ */
67
+ var template = html`
68
+ <popup-activity-search-keys-input .value=${this.value} .confirmCallback=${confirmCallback}>
69
+ </popup-activity-search-keys-input>
70
+ `
71
+
72
+ this.popup = openPopup(template, {
73
+ backdrop: true,
74
+ size: 'large',
75
+ title: `${name?.toUpperCase() || i18next.t('field.search-keys')} `,
76
+ help
77
+ })
78
+ }
79
+ }
@@ -0,0 +1,167 @@
1
+ import { css, html, LitElement } from 'lit'
2
+ import { customElement, property, query, state } from 'lit/decorators.js'
3
+
4
+ import { i18next } from '@operato/i18n'
5
+ import { closePopup } from '@operato/popup'
6
+ import { ScrollbarStyles } from '@operato/styles'
7
+ import { isMobileDevice } from '@operato/utils'
8
+ import { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
9
+ import { ActivitySearchKeyItem } from '../types/activity-search-key-item-type'
10
+
11
+ @customElement('popup-activity-search-keys-input')
12
+ export class PopupActivitySearchKeysInput extends LitElement {
13
+ static styles = [
14
+ ScrollbarStyles,
15
+ css`
16
+ :host {
17
+ display: flex;
18
+ flex-direction: column;
19
+
20
+ background-color: #fff;
21
+
22
+ width: var(--overlay-center-normal-width, 50%);
23
+ height: var(--overlay-center-normal-height, 50%);
24
+ }
25
+
26
+ ox-grist {
27
+ flex: 1;
28
+ }
29
+
30
+ .button-container {
31
+ display: flex;
32
+ margin-left: auto;
33
+ padding: var(--padding-default);
34
+ }
35
+ `
36
+ ]
37
+
38
+ @property({ type: Array }) value: ActivitySearchKeyItem[] = []
39
+ @property({ type: Object }) confirmCallback!: (newval: any) => void
40
+
41
+ @state() gristConfig: any = {
42
+ list: { fields: ['name', 'description', 'active'] },
43
+ columns: [
44
+ { type: 'gutter', gutterName: 'sequence' },
45
+ {
46
+ type: 'gutter',
47
+ gutterName: 'button',
48
+ icon: 'add',
49
+ handlers: {
50
+ click: 'record-copy'
51
+ }
52
+ },
53
+ {
54
+ type: 'gutter',
55
+ gutterName: 'button',
56
+ icon: 'delete',
57
+ handlers: {
58
+ click: 'record-delete'
59
+ }
60
+ },
61
+ {
62
+ type: 'gutter',
63
+ gutterName: 'button',
64
+ icon: 'arrow_upward',
65
+ handlers: {
66
+ click: 'move-up'
67
+ }
68
+ },
69
+ {
70
+ type: 'gutter',
71
+ gutterName: 'button',
72
+ icon: 'arrow_downward',
73
+ handlers: {
74
+ click: 'move-down'
75
+ }
76
+ },
77
+ {
78
+ type: 'string',
79
+ name: 'name',
80
+ header: i18next.t('field.name'),
81
+ record: {
82
+ editable: true
83
+ },
84
+ width: 140
85
+ },
86
+ {
87
+ type: 'string',
88
+ name: 'description',
89
+ header: i18next.t('field.description'),
90
+ record: {
91
+ editable: true
92
+ },
93
+ width: 180
94
+ },
95
+ {
96
+ type: 'string',
97
+ name: 'inputKey',
98
+ header: i18next.t('field.input-key'),
99
+ record: {
100
+ editable: true
101
+ },
102
+ width: 180
103
+ },
104
+ {
105
+ type: 'string',
106
+ name: 'tKey',
107
+ header: i18next.t('field.t-key'),
108
+ record: {
109
+ editable: true
110
+ },
111
+ width: 180
112
+ }
113
+ ],
114
+ rows: {
115
+ selectable: false
116
+ },
117
+ pagination: {
118
+ infinite: true
119
+ },
120
+ sorters: []
121
+ }
122
+
123
+ @query('ox-grist') private grist!: DataGrist
124
+
125
+ render() {
126
+ return html`
127
+ <ox-grist
128
+ .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
129
+ .config=${this.gristConfig}
130
+ .fetchHandler=${this.fetchHandler.bind(this)}
131
+ ></ox-grist>
132
+
133
+ <div class="button-container">
134
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
135
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
136
+ </div>
137
+ `
138
+ }
139
+
140
+ async fetchHandler({ filters, page, limit, sortings = [] }: FetchOption) {
141
+ const records = this.value || []
142
+ return {
143
+ total: records.length,
144
+ records
145
+ }
146
+ }
147
+
148
+ private onCancel(e: Event) {
149
+ closePopup(this)
150
+ }
151
+
152
+ private onConfirm(e: Event) {
153
+ this.grist.commit()
154
+
155
+ this.value = this.grist.data.records.map(({ name, description, inputKey, tKey }) => {
156
+ return {
157
+ name,
158
+ description,
159
+ inputKey,
160
+ tKey
161
+ }
162
+ })
163
+
164
+ this.confirmCallback && this.confirmCallback(this.value)
165
+ closePopup(this)
166
+ }
167
+ }
@@ -5,6 +5,7 @@ import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit'
6
6
  import { customElement, property, query } from 'lit/decorators.js'
7
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
+ import moment from 'moment-timezone'
8
9
 
9
10
  import { DataGrist, getEditor, getRenderer } from '@operato/data-grist'
10
11
  import { client } from '@operato/graphql'
@@ -14,7 +15,16 @@ import { PageView, store } from '@operato/shell'
14
15
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
15
16
  import { isMobileDevice } from '@operato/utils'
16
17
 
17
- import { ActivityTypes, ActivityUITypes } from '../../types.js'
18
+ import { ActivityTypes, ActivityUITypes } from '../../types/types.js'
19
+
20
+ export const ActivityStatus = [
21
+ { display: '', value: '' },
22
+ { display: 'Draft', value: 'draft' },
23
+ { display: 'Released', value: 'released' },
24
+ { display: 'Deprecated', value: 'deprecated' }
25
+ ]
26
+ const DEFAULT_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
27
+ const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
18
28
 
19
29
  @customElement('activity-list-page')
20
30
  export class ActivityListPage extends connect(store)(localize(i18next)(PageView)) {
@@ -153,6 +163,17 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
153
163
  filter: 'search',
154
164
  width: 200
155
165
  },
166
+ {
167
+ type: 'select',
168
+ name: 'state',
169
+ header: i18next.t('field.status'),
170
+ record: {
171
+ editable: true,
172
+ options: ActivityStatus
173
+ },
174
+ filter: true,
175
+ width: 60
176
+ },
156
177
  {
157
178
  type: 'select',
158
179
  name: 'activityType',
@@ -166,16 +187,16 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
166
187
  // filter: true,
167
188
  width: 60
168
189
  },
169
- // {
170
- // type: 'json5',
171
- // name: 'model',
172
- // label: true,
173
- // header: i18next.t('field.model'),
174
- // record: {
175
- // editable: true
176
- // },
177
- // width: 120
178
- // },
190
+ {
191
+ type: 'activity-search-keys',
192
+ name: 'searchKeys',
193
+ label: true,
194
+ header: i18next.t('field.search-keys'),
195
+ record: {
196
+ editable: true
197
+ },
198
+ width: 120
199
+ },
179
200
  {
180
201
  type: 'number',
181
202
  name: 'priority',
@@ -208,6 +229,22 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
208
229
  },
209
230
  width: 80
210
231
  },
232
+ {
233
+ type: 'select',
234
+ name: 'timezone',
235
+ header: i18next.t('field.timezone'),
236
+ record: {
237
+ editable: true,
238
+ options: TIMEZONE_OPTIONS
239
+ },
240
+ width: 120,
241
+ imex: {
242
+ width: 13,
243
+ header: i18next.t('field.timezone'),
244
+ type: 'select',
245
+ key: 'timezone'
246
+ }
247
+ },
211
248
  {
212
249
  type: 'image',
213
250
  name: 'thumbnail',
@@ -257,6 +294,24 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
257
294
  filter: 'search',
258
295
  width: 120
259
296
  },
297
+ {
298
+ type: 'assignees',
299
+ name: 'assignees',
300
+ header: i18next.t('field.assignees'),
301
+ record: {
302
+ editable: true
303
+ },
304
+ width: 120
305
+ },
306
+ {
307
+ type: 'approval-line',
308
+ name: 'approvalLine',
309
+ header: i18next.t('field.approval-line'),
310
+ record: {
311
+ editable: true
312
+ },
313
+ width: 120
314
+ },
260
315
  {
261
316
  type: 'select',
262
317
  name: 'uiType',
@@ -285,6 +340,34 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
285
340
  },
286
341
  width: 140
287
342
  },
343
+ {
344
+ type: 'select',
345
+ name: 'viewType',
346
+ label: true,
347
+ header: i18next.t('field.view-type'),
348
+ record: {
349
+ editable: true,
350
+ options: ActivityUITypes
351
+ },
352
+ width: 80
353
+ },
354
+ {
355
+ type: 'string',
356
+ name: 'viewSource',
357
+ header: i18next.t('field.view-source'),
358
+ record: {
359
+ editable: true,
360
+ editor: function (value, column, record, rowIndex, field) {
361
+ var type = record.viewType !== 'board' ? 'script' : 'board'
362
+ return getEditor(type)(value, column, record, rowIndex, field)
363
+ },
364
+ renderer: function (value, column, record, rowIndex, field) {
365
+ var type = record.viewType !== 'board' ? 'script' : 'board'
366
+ return getRenderer(type)(value, column, record, rowIndex, field)
367
+ }
368
+ },
369
+ width: 140
370
+ },
288
371
  {
289
372
  type: 'select',
290
373
  name: 'reportType',
@@ -400,6 +483,13 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
400
483
  name
401
484
  description
402
485
  activityType
486
+ searchKeys {
487
+ name
488
+ description
489
+ inputKey
490
+ tKey
491
+ }
492
+ state
403
493
  model {
404
494
  name
405
495
  description
@@ -426,12 +516,33 @@ export class ActivityListPage extends connect(store)(localize(i18next)(PageView)
426
516
  id
427
517
  name
428
518
  }
519
+ assignees {
520
+ type
521
+ value
522
+ assignee {
523
+ id
524
+ name
525
+ description
526
+ controlNo
527
+ }
528
+ }
529
+ approvalLine {
530
+ type
531
+ value
532
+ approver {
533
+ id
534
+ name
535
+ description
536
+ controlNo
537
+ }
538
+ }
429
539
  uiType
430
540
  uiSource
431
541
  reportType
432
542
  reportSource
433
543
  startable
434
544
  schedule
545
+ timezone
435
546
  standardTime
436
547
  leadTime
437
548
  cycleTime
@@ -0,0 +1,85 @@
1
+ import { css, html, LitElement } from 'lit'
2
+ import { customElement, property, query, state } from 'lit/decorators.js'
3
+
4
+ import { i18next, localize } from '@operato/i18n'
5
+ import { ScrollbarStyles } from '@operato/styles'
6
+ import { Activity } from '../../types/activity'
7
+ import { ActivitySearchKeyItem } from '../../types/activity-search-key-item-type'
8
+ import { ActivityModelItem } from '../../types/activity-model-type'
9
+
10
+ @customElement('activity-partial-view')
11
+ export class ActivityView extends localize(i18next)(LitElement) {
12
+ static styles = [
13
+ ScrollbarStyles,
14
+ css`
15
+ :host {
16
+ display: flex;
17
+ flex-direction: column;
18
+
19
+ background-color: #fff;
20
+ }
21
+
22
+ div[content] {
23
+ flex: 1;
24
+
25
+ display: flex;
26
+ overflow: auto;
27
+ }
28
+ `
29
+ ]
30
+
31
+ @property({ type: Object }) activity?: Activity
32
+
33
+ render() {
34
+ if (!this.activity) {
35
+ return html`<div>no activity info.</div>`
36
+ }
37
+
38
+ const {
39
+ id,
40
+ name,
41
+ description,
42
+ activityType,
43
+ state,
44
+ searchKeys,
45
+ model,
46
+ priority,
47
+ startable,
48
+ schedule,
49
+ timzeone,
50
+ standardTime,
51
+ cycleTime,
52
+ tactTime,
53
+ leadTime,
54
+ issuerRole,
55
+ assigneeRole,
56
+ supervisoryRole,
57
+ assignees,
58
+ approvalLine,
59
+ uiType,
60
+ uiSource,
61
+ viewType,
62
+ viewSource,
63
+ reportType,
64
+ reportSource
65
+ } = this.activity
66
+
67
+ return html`
68
+ <div>name: ${name}</div>
69
+ <div>description: ${description}</div>
70
+ <div>activityType: ${activityType}</div>
71
+ <div>state: ${state}</div>
72
+ ${this.renderSearchKeys(searchKeys!)} ${this.renderModel(model!)}
73
+ <div>priority: ${priority}</div>
74
+ <div>startable: ${startable}</div>
75
+ `
76
+ }
77
+
78
+ renderSearchKeys(searchKeys: ActivitySearchKeyItem[]) {
79
+ return html``
80
+ }
81
+
82
+ renderModel(model: ActivityModelItem[]) {
83
+ return html``
84
+ }
85
+ }
@@ -29,6 +29,7 @@ const FILTERS = [
29
29
  value: 'Warehouse'
30
30
  }
31
31
  ]
32
+
32
33
  @customElement('starter-list-page')
33
34
  export class StarterListPage extends connect(store)(localize(i18next)(PageView)) {
34
35
  static styles = [
@@ -67,8 +67,8 @@ const ActivityApprovalFetchResult = `\
67
67
  thumbnail
68
68
  input
69
69
  output
70
- uiType
71
- uiSource
70
+ viewType
71
+ viewSource
72
72
  dueAt
73
73
  createdAt
74
74
  }
@@ -181,7 +181,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
181
181
  }
182
182
 
183
183
  activityContent() {
184
- switch (this.activityThread?.activityInstance?.uiType) {
184
+ switch (this.activityThread?.activityInstance?.viewType) {
185
185
  case 'template':
186
186
  return this.templateContent()
187
187
  case 'generated':
@@ -198,7 +198,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
198
198
  }
199
199
 
200
200
  templateContent() {
201
- const { uiSource: template } = this.activityThread?.activityInstance
201
+ const { viewSource: template } = this.activityThread?.activityInstance
202
202
  return unsafeHTML(template)
203
203
  }
204
204
 
@@ -271,7 +271,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
271
271
 
272
272
  boardContent() {
273
273
  const { output, activityInstance } = this.activityThread
274
- const { uiSource: boardId, input } = activityInstance || {}
274
+ const { viewSource: boardId, input } = activityInstance || {}
275
275
 
276
276
  if (!this.board || this.board.id !== boardId) {
277
277
  this.board = {
@@ -296,7 +296,7 @@ export class ActivityApprovalPage extends connect(store)(localize(i18next)(PageV
296
296
 
297
297
  customElementContent() {
298
298
  const { output, activityInstance } = this.activityThread
299
- const { uiSource: tagName, input } = activityInstance || {}
299
+ const { viewSource: tagName, input } = activityInstance || {}
300
300
 
301
301
  const element = document.createElement(tagName)
302
302
  element.id = 'custom-content'