@things-factory/worklist 5.0.14 → 6.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/client/components/activity-/{bowner-view.js → bowner-view.ts} +27 -34
  2. package/client/components/{activity-instance-preview.js → activity-instance-preview.ts} +38 -50
  3. package/client/components/{activity-reporter-view.js → activity-reporter-view.ts} +27 -39
  4. package/client/components/{activity-starter-form.js → activity-starter-form.ts} +53 -68
  5. package/client/pages/activity/activity-list-page.ts +4 -3
  6. package/client/pages/activity/{activity-model-item-list.js → activity-model-item-list.ts} +11 -18
  7. package/client/pages/activity/{activity-page.js → activity-page.ts} +36 -40
  8. package/client/pages/activity/{starter-list-page.js → starter-list-page.ts} +15 -20
  9. package/client/pages/activity-instance/{activity-instance-list-page.js → activity-instance-list-page.ts} +22 -30
  10. package/client/pages/activity-instance/{activity-instance-page.js → activity-instance-page.ts} +36 -41
  11. package/client/pages/activity-store/{activity-store-page.js → activity-store-page.ts} +22 -29
  12. package/client/pages/activity-supervisor/{reporter-list-page.js → reporter-list-page.ts} +14 -21
  13. package/client/pages/activity-template/{activity-template-importer.js → activity-template-importer.ts} +32 -38
  14. package/client/pages/activity-template/{activity-template-list-page.js → activity-template-list-page.ts} +30 -37
  15. package/client/pages/activity-template/{activity-template-model-item-list.js → activity-template-model-item-list.ts} +5 -4
  16. package/client/pages/activity-thread/{activity-thread-importer.js → activity-thread-importer.ts} +32 -37
  17. package/client/pages/activity-thread/{activity-thread-list-page.js → activity-thread-list-page.ts} +20 -27
  18. package/client/pages/activity-thread/{activity-thread-page.js → activity-thread-page.ts} +36 -40
  19. package/client/pages/dashboard/{dashboard-home.js → dashboard-home.ts} +3 -7
  20. package/client/pages/todo/{assigned-list-page.js → assigned-list-page.ts} +13 -20
  21. package/client/pages/todo/{draft-list-page.js → draft-list-page.ts} +13 -20
  22. package/client/pages/todo/{pickable-list-page.js → pickable-list-page.ts} +13 -20
  23. package/client/pages/todo/{todo-list-page.js → todo-list-page.ts} +12 -19
  24. package/client/pages/worklist-home.ts +1 -1
  25. package/dist-client/components/activity-/bowner-view.d.ts +1 -1
  26. package/dist-client/components/activity-/bowner-view.js +44 -36
  27. package/dist-client/components/activity-/bowner-view.js.map +1 -1
  28. package/dist-client/components/activity-instance-preview.d.ts +2 -1
  29. package/dist-client/components/activity-instance-preview.js +58 -51
  30. package/dist-client/components/activity-instance-preview.js.map +1 -1
  31. package/dist-client/components/activity-reporter-view.d.ts +1 -1
  32. package/dist-client/components/activity-reporter-view.js +44 -37
  33. package/dist-client/components/activity-reporter-view.js.map +1 -1
  34. package/dist-client/components/activity-starter-form.d.ts +16 -0
  35. package/dist-client/components/activity-starter-form.js +68 -67
  36. package/dist-client/components/activity-starter-form.js.map +1 -1
  37. package/dist-client/pages/activity/activity-list-page.d.ts +1 -0
  38. package/dist-client/pages/activity/activity-list-page.js +7 -4
  39. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  40. package/dist-client/pages/activity/activity-model-item-list.d.ts +13 -180
  41. package/dist-client/pages/activity/activity-model-item-list.js +52 -44
  42. package/dist-client/pages/activity/activity-model-item-list.js.map +1 -1
  43. package/dist-client/pages/activity/activity-page.d.ts +29 -22
  44. package/dist-client/pages/activity/activity-page.js +53 -44
  45. package/dist-client/pages/activity/activity-page.js.map +1 -1
  46. package/dist-client/pages/activity/starter-list-page.d.ts +14 -120
  47. package/dist-client/pages/activity/starter-list-page.js +47 -31
  48. package/dist-client/pages/activity/starter-list-page.js.map +1 -1
  49. package/dist-client/pages/activity-instance/activity-instance-list-page.d.ts +9 -114
  50. package/dist-client/pages/activity-instance/activity-instance-list-page.js +40 -30
  51. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  52. package/dist-client/pages/activity-instance/activity-instance-page.d.ts +22 -22
  53. package/dist-client/pages/activity-instance/activity-instance-page.js +57 -44
  54. package/dist-client/pages/activity-instance/activity-instance-page.js.map +1 -1
  55. package/dist-client/pages/activity-store/activity-store-page.d.ts +23 -150
  56. package/dist-client/pages/activity-store/activity-store-page.js +40 -31
  57. package/dist-client/pages/activity-store/activity-store-page.js.map +1 -1
  58. package/dist-client/pages/activity-supervisor/reporter-list-page.d.ts +13 -120
  59. package/dist-client/pages/activity-supervisor/reporter-list-page.js +47 -31
  60. package/dist-client/pages/activity-supervisor/reporter-list-page.js.map +1 -1
  61. package/dist-client/pages/activity-template/activity-template-importer.d.ts +7 -21
  62. package/dist-client/pages/activity-template/activity-template-importer.js +42 -36
  63. package/dist-client/pages/activity-template/activity-template-importer.js.map +1 -1
  64. package/dist-client/pages/activity-template/activity-template-list-page.d.ts +17 -218
  65. package/dist-client/pages/activity-template/activity-template-list-page.js +58 -37
  66. package/dist-client/pages/activity-template/activity-template-list-page.js.map +1 -1
  67. package/dist-client/pages/activity-template/activity-template-model-item-list.js +10 -5
  68. package/dist-client/pages/activity-template/activity-template-model-item-list.js.map +1 -1
  69. package/dist-client/pages/activity-thread/activity-thread-importer.d.ts +7 -21
  70. package/dist-client/pages/activity-thread/activity-thread-importer.js +42 -36
  71. package/dist-client/pages/activity-thread/activity-thread-importer.js.map +1 -1
  72. package/dist-client/pages/activity-thread/activity-thread-list-page.d.ts +16 -100
  73. package/dist-client/pages/activity-thread/activity-thread-list-page.js +55 -36
  74. package/dist-client/pages/activity-thread/activity-thread-list-page.js.map +1 -1
  75. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +26 -19
  76. package/dist-client/pages/activity-thread/activity-thread-page.js +53 -44
  77. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  78. package/dist-client/pages/dashboard/dashboard-home.js +8 -7
  79. package/dist-client/pages/dashboard/dashboard-home.js.map +1 -1
  80. package/dist-client/pages/todo/assigned-list-page.d.ts +12 -100
  81. package/dist-client/pages/todo/assigned-list-page.js +45 -30
  82. package/dist-client/pages/todo/assigned-list-page.js.map +1 -1
  83. package/dist-client/pages/todo/draft-list-page.d.ts +13 -174
  84. package/dist-client/pages/todo/draft-list-page.js +46 -30
  85. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  86. package/dist-client/pages/todo/pickable-list-page.d.ts +13 -126
  87. package/dist-client/pages/todo/pickable-list-page.js +46 -30
  88. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  89. package/dist-client/pages/todo/todo-list-page.d.ts +12 -206
  90. package/dist-client/pages/todo/todo-list-page.js +44 -30
  91. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  92. package/dist-client/pages/worklist-home.js +1 -1
  93. package/dist-client/pages/worklist-home.js.map +1 -1
  94. package/dist-client/route.d.ts +1 -1
  95. package/dist-client/tsconfig.tsbuildinfo +1 -1
  96. package/dist-server/controllers/activity-instance/abort.js +4 -3
  97. package/dist-server/controllers/activity-instance/abort.js.map +1 -1
  98. package/dist-server/controllers/activity-instance/adjust.js +2 -1
  99. package/dist-server/controllers/activity-instance/adjust.js.map +1 -1
  100. package/dist-server/controllers/activity-instance/assign.js +3 -3
  101. package/dist-server/controllers/activity-instance/assign.js.map +1 -1
  102. package/dist-server/controllers/activity-instance/delegate.js +4 -3
  103. package/dist-server/controllers/activity-instance/delegate.js.map +1 -1
  104. package/dist-server/controllers/activity-instance/draft.js +3 -3
  105. package/dist-server/controllers/activity-instance/draft.js.map +1 -1
  106. package/dist-server/controllers/activity-instance/end.js +4 -3
  107. package/dist-server/controllers/activity-instance/end.js.map +1 -1
  108. package/dist-server/controllers/activity-instance/pick.js +4 -3
  109. package/dist-server/controllers/activity-instance/pick.js.map +1 -1
  110. package/dist-server/controllers/activity-instance/post.js +17 -3
  111. package/dist-server/controllers/activity-instance/post.js.map +1 -1
  112. package/dist-server/controllers/activity-instance/start.js +2 -1
  113. package/dist-server/controllers/activity-instance/start.js.map +1 -1
  114. package/dist-server/controllers/activity-instance/terminate.js +4 -3
  115. package/dist-server/controllers/activity-instance/terminate.js.map +1 -1
  116. package/dist-server/controllers/activity-thread/abort.js +4 -3
  117. package/dist-server/controllers/activity-thread/abort.js.map +1 -1
  118. package/dist-server/controllers/activity-thread/adjust.js +2 -1
  119. package/dist-server/controllers/activity-thread/adjust.js.map +1 -1
  120. package/dist-server/controllers/activity-thread/delegate.js +4 -3
  121. package/dist-server/controllers/activity-thread/delegate.js.map +1 -1
  122. package/dist-server/controllers/activity-thread/end.js +4 -3
  123. package/dist-server/controllers/activity-thread/end.js.map +1 -1
  124. package/dist-server/controllers/activity-thread/save.js +2 -1
  125. package/dist-server/controllers/activity-thread/save.js.map +1 -1
  126. package/dist-server/controllers/activity-thread/start.js +2 -1
  127. package/dist-server/controllers/activity-thread/start.js.map +1 -1
  128. package/dist-server/controllers/activity-thread/terminate.js +4 -3
  129. package/dist-server/controllers/activity-thread/terminate.js.map +1 -1
  130. package/dist-server/controllers/common.js +8 -4
  131. package/dist-server/controllers/common.js.map +1 -1
  132. package/dist-server/service/activity/activity-history.js +6 -7
  133. package/dist-server/service/activity/activity-history.js.map +1 -1
  134. package/dist-server/service/activity/activity-mutation.js +10 -4
  135. package/dist-server/service/activity/activity-mutation.js.map +1 -1
  136. package/dist-server/service/activity/activity-query.js +18 -19
  137. package/dist-server/service/activity/activity-query.js.map +1 -1
  138. package/dist-server/service/activity/activity-type.js +6 -7
  139. package/dist-server/service/activity/activity-type.js.map +1 -1
  140. package/dist-server/service/activity/activity.js +6 -7
  141. package/dist-server/service/activity/activity.js.map +1 -1
  142. package/dist-server/service/activity-instance/activity-instance-history.js +7 -8
  143. package/dist-server/service/activity-instance/activity-instance-history.js.map +1 -1
  144. package/dist-server/service/activity-instance/activity-instance-mutation.js +2 -2
  145. package/dist-server/service/activity-instance/activity-instance-mutation.js.map +1 -1
  146. package/dist-server/service/activity-instance/activity-instance-query.js +24 -25
  147. package/dist-server/service/activity-instance/activity-instance-query.js.map +1 -1
  148. package/dist-server/service/activity-instance/activity-instance-subscription.js +1 -2
  149. package/dist-server/service/activity-instance/activity-instance-subscription.js.map +1 -1
  150. package/dist-server/service/activity-instance/activity-instance-type.js +4 -5
  151. package/dist-server/service/activity-instance/activity-instance-type.js.map +1 -1
  152. package/dist-server/service/activity-instance/activity-instance.js +7 -8
  153. package/dist-server/service/activity-instance/activity-instance.js.map +1 -1
  154. package/dist-server/service/activity-instance/event-subscriber.js +0 -5
  155. package/dist-server/service/activity-instance/event-subscriber.js.map +1 -1
  156. package/dist-server/service/activity-template/activity-template-history.js +3 -4
  157. package/dist-server/service/activity-template/activity-template-history.js.map +1 -1
  158. package/dist-server/service/activity-template/activity-template-mutation.js +4 -4
  159. package/dist-server/service/activity-template/activity-template-mutation.js.map +1 -1
  160. package/dist-server/service/activity-template/activity-template-query.js +9 -11
  161. package/dist-server/service/activity-template/activity-template-query.js.map +1 -1
  162. package/dist-server/service/activity-template/activity-template.js +3 -4
  163. package/dist-server/service/activity-template/activity-template.js.map +1 -1
  164. package/dist-server/service/activity-thread/activity-thread-mutation.js +10 -6
  165. package/dist-server/service/activity-thread/activity-thread-mutation.js.map +1 -1
  166. package/dist-server/service/activity-thread/activity-thread-query.js +11 -13
  167. package/dist-server/service/activity-thread/activity-thread-query.js.map +1 -1
  168. package/dist-server/service/activity-thread/activity-thread.js +4 -5
  169. package/dist-server/service/activity-thread/activity-thread.js.map +1 -1
  170. package/dist-server/service/activity-thread/event-subscriber.js +15 -3
  171. package/dist-server/service/activity-thread/event-subscriber.js.map +1 -1
  172. package/dist-server/tsconfig.tsbuildinfo +1 -1
  173. package/package.json +7 -7
  174. package/server/controllers/activity-instance/abort.ts +7 -3
  175. package/server/controllers/activity-instance/adjust.ts +7 -2
  176. package/server/controllers/activity-instance/assign.ts +3 -3
  177. package/server/controllers/activity-instance/delegate.ts +3 -2
  178. package/server/controllers/activity-instance/draft.ts +6 -3
  179. package/server/controllers/activity-instance/end.ts +3 -2
  180. package/server/controllers/activity-instance/pick.ts +4 -3
  181. package/server/controllers/activity-instance/post.ts +21 -4
  182. package/server/controllers/activity-instance/start.ts +3 -2
  183. package/server/controllers/activity-instance/terminate.ts +3 -2
  184. package/server/controllers/activity-thread/abort.ts +7 -3
  185. package/server/controllers/activity-thread/adjust.ts +7 -2
  186. package/server/controllers/activity-thread/delegate.ts +3 -2
  187. package/server/controllers/activity-thread/end.ts +3 -2
  188. package/server/controllers/activity-thread/save.ts +3 -2
  189. package/server/controllers/activity-thread/start.ts +8 -2
  190. package/server/controllers/activity-thread/terminate.ts +3 -2
  191. package/server/controllers/common.ts +15 -11
  192. package/server/service/activity/activity-mutation.ts +19 -10
  193. package/server/service/activity/activity-query.ts +14 -14
  194. package/server/service/activity-instance/activity-instance-mutation.ts +8 -8
  195. package/server/service/activity-instance/activity-instance-query.ts +27 -21
  196. package/server/service/activity-instance/activity-instance-subscription.ts +1 -2
  197. package/server/service/activity-instance/event-subscriber.ts +0 -6
  198. package/server/service/activity-template/activity-template-mutation.ts +13 -10
  199. package/server/service/activity-template/activity-template-query.ts +8 -9
  200. package/server/service/activity-thread/activity-thread-mutation.ts +22 -15
  201. package/server/service/activity-thread/activity-thread-query.ts +10 -11
  202. package/server/service/activity-thread/event-subscriber.ts +15 -3
  203. package/translations/en.json +3 -0
  204. package/translations/ko.json +3 -0
  205. package/translations/ms.json +3 -0
  206. package/translations/zh.json +3 -0
@@ -4,6 +4,7 @@ import './activity-template-model-item-list.js'
4
4
 
5
5
  import gql from 'graphql-tag'
6
6
  import { css, html } from 'lit'
7
+ import { customElement, property, query } from 'lit/decorators.js'
7
8
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
9
 
9
10
  import { getEditor, getRenderer } from '@operato/data-grist'
@@ -16,30 +17,25 @@ import { isMobileDevice } from '@operato/utils'
16
17
 
17
18
  import { ActivityTypes, ActivityUITypes } from '../../types.js'
18
19
 
20
+ @customElement('activity-template-list-page')
19
21
  export class ActivityTemplateListPage extends connect(store)(localize(i18next)(PageView)) {
20
- static get properties() {
21
- return {
22
- gristConfig: Object,
23
- mode: String
24
- }
25
- }
22
+ static styles = [
23
+ ScrollbarStyles,
24
+ CommonGristStyles,
25
+ css`
26
+ :host {
27
+ display: flex;
26
28
 
27
- static get styles() {
28
- return [
29
- ScrollbarStyles,
30
- CommonGristStyles,
31
- css`
32
- :host {
33
- display: flex;
29
+ width: 100%;
34
30
 
35
- width: 100%;
31
+ --grid-record-emphasized-background-color: red;
32
+ --grid-record-emphasized-color: yellow;
33
+ }
34
+ `
35
+ ]
36
36
 
37
- --grid-record-emphasized-background-color: red;
38
- --grid-record-emphasized-color: yellow;
39
- }
40
- `
41
- ]
42
- }
37
+ @property({ type: Object }) gristConfig: any
38
+ @property({ type: String }) mode?: 'GRID' | 'LIST' | 'CARD' = isMobileDevice() ? 'CARD' : 'GRID'
43
39
 
44
40
  get context() {
45
41
  return {
@@ -67,8 +63,11 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
67
63
  }
68
64
  }
69
65
 
66
+ @query('#sorter-control') sorterControl?: any
67
+ @query('ox-grist') grist?: HTMLElement & { fetch: any; selected: any; dirtyRecords: any; dirtyData: any }
68
+
70
69
  render() {
71
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
70
+ const mode = this.mode
72
71
 
73
72
  return html`
74
73
  <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
@@ -82,7 +81,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
82
81
  <mwc-icon
83
82
  @click=${e => {
84
83
  const target = e.currentTarget
85
- this.renderRoot.querySelector('#sorter-control').open({
84
+ this.sorterControl.open({
86
85
  right: 0,
87
86
  top: target.offsetTop + target.offsetHeight
88
87
  })
@@ -104,10 +103,6 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
104
103
  `
105
104
  }
106
105
 
107
- get grist() {
108
- return this.renderRoot.querySelector('ox-grist')
109
- }
110
-
111
106
  async pageInitialized(lifecycle) {
112
107
  this.gristConfig = {
113
108
  list: {
@@ -135,7 +130,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
135
130
  }
136
131
  )
137
132
  popup.onclosed = () => {
138
- this.grist.fetch()
133
+ this.grist?.fetch()
139
134
  }
140
135
  }
141
136
  }
@@ -339,7 +334,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
339
334
 
340
335
  async _deleteActivityTemplate() {
341
336
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
342
- const ids = this.grist.selected.map(record => record.id)
337
+ const ids = this.grist?.selected.map(record => record.id)
343
338
  if (ids && ids.length > 0) {
344
339
  const response = await client.mutate({
345
340
  mutation: gql`
@@ -353,7 +348,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
353
348
  })
354
349
 
355
350
  if (!response.errors) {
356
- this.grist.fetch()
351
+ this.grist?.fetch()
357
352
  notify({
358
353
  message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
359
354
  })
@@ -363,7 +358,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
363
358
  }
364
359
 
365
360
  async _updateActivityTemplate() {
366
- let patches = this.grist.dirtyRecords
361
+ let patches = this.grist?.dirtyRecords
367
362
  if (patches && patches.length) {
368
363
  patches = patches.map(patch => {
369
364
  let patchField = patch.id ? { id: patch.id } : {}
@@ -371,7 +366,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
371
366
  for (let key in dirtyFields) {
372
367
  patchField[key] = dirtyFields[key].after
373
368
  }
374
- patchField.cuFlag = patch.__dirty__
369
+ ;(patchField as any).cuFlag = patch.__dirty__
375
370
 
376
371
  return patchField
377
372
  })
@@ -393,13 +388,13 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
393
388
  })
394
389
 
395
390
  if (!response.errors) {
396
- this.grist.fetch()
391
+ this.grist?.fetch()
397
392
  }
398
393
  }
399
394
  }
400
395
 
401
396
  async exportHandler() {
402
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
397
+ const exportTargets = this.grist?.selected.length ? this.grist.selected : this.grist?.dirtyData.records
403
398
  const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
404
399
 
405
400
  return exportTargets.map(activityTemplate => {
@@ -419,7 +414,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
419
414
  .activityTemplates=${records}
420
415
  @imported=${() => {
421
416
  history.back()
422
- this.grist.fetch()
417
+ this.grist?.fetch()
423
418
  }}
424
419
  ></activity-template-importer>
425
420
  `,
@@ -431,9 +426,7 @@ export class ActivityTemplateListPage extends connect(store)(localize(i18next)(P
431
426
  )
432
427
 
433
428
  popup.onclosed = () => {
434
- this.grist.fetch()
429
+ this.grist?.fetch()
435
430
  }
436
431
  }
437
432
  }
438
-
439
- window.customElements.define('activity-template-list-page', ActivityTemplateListPage)
@@ -1,13 +1,16 @@
1
1
  import gql from 'graphql-tag'
2
2
 
3
+ import { customElement } from 'lit/decorators.js'
4
+
3
5
  import { client } from '@operato/graphql'
4
6
  import { i18next } from '@operato/i18n'
5
7
 
6
8
  import { ActivityModelItemList } from '../activity/activity-model-item-list'
7
9
 
10
+ @customElement('activity-template-model-item-list')
8
11
  class ActivityTemplateModelItemList extends ActivityModelItemList {
9
12
  async _updateDataItems() {
10
- this.grist.commit()
13
+ this.grist?.commit()
11
14
 
12
15
  const response = await client.mutate({
13
16
  mutation: gql`
@@ -20,7 +23,7 @@ class ActivityTemplateModelItemList extends ActivityModelItemList {
20
23
  variables: {
21
24
  id: this.activity.id,
22
25
  patch: {
23
- model: this.grist.data.records,
26
+ model: this.grist?.data.records,
24
27
  cuFlag: 'M'
25
28
  }
26
29
  }
@@ -39,5 +42,3 @@ class ActivityTemplateModelItemList extends ActivityModelItemList {
39
42
  }
40
43
  }
41
44
  }
42
-
43
- window.customElements.define('activity-template-model-item-list', ActivityTemplateModelItemList)
@@ -2,18 +2,41 @@ import '@operato/data-grist'
2
2
 
3
3
  import gql from 'graphql-tag'
4
4
  import { css, html, LitElement } from 'lit'
5
+ import { customElement, property } from 'lit/decorators.js'
5
6
 
6
7
  import { client } from '@operato/graphql'
7
8
  import { i18next } from '@operato/i18n'
8
9
  import { isMobileDevice } from '@operato/utils'
9
10
 
11
+ @customElement('activity-thread-importer')
10
12
  export class ActivityThreadImporter extends LitElement {
11
- static get properties() {
12
- return {
13
- columns: Object,
14
- activityThreads: Array
15
- }
16
- }
13
+ static styles = [
14
+ css`
15
+ :host {
16
+ display: flex;
17
+ flex-direction: column;
18
+
19
+ background-color: #fff;
20
+ }
21
+
22
+ ox-grist {
23
+ flex: 1;
24
+ }
25
+
26
+ .button-container {
27
+ display: flex;
28
+ margin-left: auto;
29
+ padding: var(--padding-default);
30
+ }
31
+
32
+ mwc-button {
33
+ margin-left: var(--margin-default);
34
+ }
35
+ `
36
+ ]
37
+
38
+ @property({ type: Object }) columns?: any
39
+ @property({ type: Array }) activityThreads?: any
17
40
 
18
41
  constructor() {
19
42
  super()
@@ -43,32 +66,6 @@ export class ActivityThreadImporter extends LitElement {
43
66
  }
44
67
  }
45
68
 
46
- static get styles() {
47
- return [
48
- css`
49
- :host {
50
- display: flex;
51
- flex-direction: column;
52
-
53
- background-color: #fff;
54
- }
55
-
56
- ox-grist {
57
- flex: 1;
58
- }
59
-
60
- .button-container {
61
- display: flex;
62
- margin-left: auto;
63
- padding: var(--padding-default);
64
- }
65
-
66
- mwc-button {
67
- margin-left: var(--margin-default);
68
- }
69
- `
70
- ]
71
- }
72
69
 
73
70
  render() {
74
71
  return html`
@@ -76,8 +73,8 @@ export class ActivityThreadImporter extends LitElement {
76
73
  .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
77
74
  .config=${this.columns}
78
75
  .data=${
79
- {
80
- records: this.activityThreads
76
+ {
77
+ records: this.activityThreads
81
78
  }
82
79
  }
83
80
  ></ox-grist>
@@ -98,10 +95,8 @@ export class ActivityThreadImporter extends LitElement {
98
95
  variables: { activityThreads: this.activityThreads }
99
96
  })
100
97
 
101
- if (response.error?.length) return
98
+ if (response.errors?.length) return
102
99
 
103
100
  this.dispatchEvent(new CustomEvent('imported'))
104
101
  }
105
102
  }
106
-
107
- window.customElements.define('activity-thread-importer', ActivityThreadImporter)
@@ -3,6 +3,7 @@ import './activity-thread-importer.js'
3
3
 
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit'
6
+ import { customElement, property, query } from 'lit/decorators.js'
6
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
7
8
 
8
9
  import { client } from '@operato/graphql'
@@ -12,16 +13,9 @@ import { PageView, store } from '@operato/shell'
12
13
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
13
14
  import { isMobileDevice } from '@operato/utils'
14
15
 
16
+ @customElement('activity-thread-list-page')
15
17
  export class ActivityThreadListPage extends connect(store)(localize(i18next)(PageView)) {
16
- static get properties() {
17
- return {
18
- gristConfig: Object,
19
- mode: String
20
- }
21
- }
22
-
23
- static get styles() {
24
- return [
18
+ static styles = [
25
19
  ScrollbarStyles,
26
20
  CommonGristStyles,
27
21
  css`
@@ -35,7 +29,9 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
35
29
  }
36
30
  `
37
31
  ]
38
- }
32
+
33
+ @property({ type: Object }) gristConfig?: any
34
+ @property({ type: String }) mode?: 'GRID' | 'LIST' | 'CARD' = (isMobileDevice() ? 'LIST' : 'GRID')
39
35
 
40
36
  get context() {
41
37
  return {
@@ -63,8 +59,11 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
63
59
  }
64
60
  }
65
61
 
62
+ @query('#sorter-control') sorterControl?: any
63
+ @query('ox-grist') grist?: HTMLElement & { fetch: any; selected: any; dirtyRecords: any; dirtyData: any }
64
+
66
65
  render() {
67
- const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID')
66
+ const mode = this.mode
68
67
 
69
68
  return html`
70
69
  <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
@@ -77,8 +76,8 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
77
76
  Sort
78
77
  <mwc-icon
79
78
  @click=${e => {
80
- const target = e.currentTarget
81
- this.renderRoot.querySelector('#sorter-control').open({
79
+ const target = e.currentTarget;
80
+ this.sorterControl.open({
82
81
  right: 0,
83
82
  top: target.offsetTop + target.offsetHeight
84
83
  })
@@ -100,10 +99,6 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
100
99
  `
101
100
  }
102
101
 
103
- get grist() {
104
- return this.renderRoot.querySelector('ox-grist')
105
- }
106
-
107
102
  async pageInitialized(lifecycle) {
108
103
  this.gristConfig = {
109
104
  list: {
@@ -221,7 +216,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
221
216
 
222
217
  async _deleteActivityThread() {
223
218
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
224
- const ids = this.grist.selected.map(record => record.id)
219
+ const ids = this.grist?.selected.map(record => record.id)
225
220
  if (ids && ids.length > 0) {
226
221
  const response = await client.mutate({
227
222
  mutation: gql`
@@ -235,7 +230,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
235
230
  })
236
231
 
237
232
  if (!response.errors) {
238
- this.grist.fetch()
233
+ this.grist?.fetch()
239
234
  notify({
240
235
  message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
241
236
  })
@@ -245,7 +240,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
245
240
  }
246
241
 
247
242
  async _updateActivityThread() {
248
- let patches = this.grist.dirtyRecords
243
+ let patches = this.grist?.dirtyRecords
249
244
  if (patches && patches.length) {
250
245
  patches = patches.map(patch => {
251
246
  let patchField = patch.id ? { id: patch.id } : {}
@@ -253,7 +248,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
253
248
  for (let key in dirtyFields) {
254
249
  patchField[key] = dirtyFields[key].after
255
250
  }
256
- patchField.cuFlag = patch.__dirty__
251
+ (patchField as any).cuFlag = patch.__dirty__
257
252
 
258
253
  return patchField
259
254
  })
@@ -272,13 +267,13 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
272
267
  })
273
268
 
274
269
  if (!response.errors) {
275
- this.grist.fetch()
270
+ this.grist?.fetch()
276
271
  }
277
272
  }
278
273
  }
279
274
 
280
275
  async exportHandler() {
281
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
276
+ const exportTargets = this.grist?.selected.length ? this.grist?.selected : this.grist?.dirtyData.records
282
277
  const targetFieldSet = new Set(['id', 'name', 'description', 'active'])
283
278
 
284
279
  return exportTargets.map(activityThread => {
@@ -298,7 +293,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
298
293
  .activityThreads=${records}
299
294
  @imported=${() => {
300
295
  history.back()
301
- this.grist.fetch()
296
+ this.grist?.fetch()
302
297
  }}
303
298
  ></activity-thread-importer>
304
299
  `,
@@ -310,9 +305,7 @@ export class ActivityThreadListPage extends connect(store)(localize(i18next)(Pag
310
305
  )
311
306
 
312
307
  popup.onclosed = () => {
313
- this.grist.fetch()
308
+ this.grist?.fetch()
314
309
  }
315
310
  }
316
311
  }
317
-
318
- window.customElements.define('activity-thread-list-page', ActivityThreadListPage)
@@ -4,6 +4,7 @@ import '@operato/board/ox-board-viewer.js'
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit'
6
6
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'
7
+ import { customElement, property, query } from 'lit/decorators.js'
7
8
  import { connect } from 'pwa-helpers/connect-mixin.js'
8
9
 
9
10
  import { client } from '@operato/graphql'
@@ -16,7 +17,7 @@ const formatter = new Intl.DateTimeFormat(navigator.language, { dateStyle: 'full
16
17
 
17
18
  const ActivityThreadFetchResult = `\
18
19
  {
19
- id
20
+ id
20
21
  state
21
22
  dueAt
22
23
  assignedAt
@@ -62,46 +63,41 @@ export const ActivityThreadStatus = {
62
63
  Aborted: 'aborted'
63
64
  }
64
65
 
66
+ @customElement('activity-thread-page')
65
67
  export class ActivityThreadPage extends connect(store)(localize(i18next)(PageView)) {
66
- static get properties() {
67
- return {
68
- activityThread: Object,
69
- board: Object
70
- }
71
- }
68
+ static styles = [
69
+ ScrollbarStyles,
70
+ CommonGristStyles,
71
+ css`
72
+ :host {
73
+ display: flex;
74
+ flex-direction: column;
75
+
76
+ width: 100%;
77
+ padding: 5px;
78
+ overflow: auto;
79
+ }
72
80
 
73
- static get styles() {
74
- return [
75
- ScrollbarStyles,
76
- CommonGristStyles,
77
- css`
78
- :host {
79
- display: flex;
80
- flex-direction: column;
81
-
82
- width: 100%;
83
- padding: 5px;
84
- overflow: auto;
85
- }
81
+ [header] {
82
+ display: block;
83
+ padding: 5px;
84
+ }
86
85
 
87
- [header] {
88
- display: block;
89
- padding: 5px;
90
- }
86
+ [content] {
87
+ flex: 1;
88
+ display: block;
89
+ padding: 5px;
90
+ }
91
91
 
92
- [content] {
93
- flex: 1;
94
- display: block;
95
- padding: 5px;
96
- }
92
+ ox-board-viewer {
93
+ width: 100%;
94
+ height: 100%;
95
+ }
96
+ `
97
+ ]
97
98
 
98
- ox-board-viewer {
99
- width: 100%;
100
- height: 100%;
101
- }
102
- `
103
- ]
104
- }
99
+ @property({ type: Object }) activityThread: any
100
+ @property({ type: Object }) board: any
105
101
 
106
102
  get context() {
107
103
  const startable = [ActivityThreadStatus.Assigned].includes(this.activityThread?.state)
@@ -128,7 +124,7 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
128
124
  endable && {
129
125
  title: i18next.t('button.finish'),
130
126
  action: this._endActivityThread.bind(this),
131
- ...CommonButtonStyles.finish
127
+ ...CommonButtonStyles.save
132
128
  }
133
129
  ].filter(Boolean /* truthy only */)
134
130
  }
@@ -255,9 +251,11 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
255
251
  `
256
252
  }
257
253
 
254
+ @query('ox-board-viewer') oxBoardViewer: any
255
+
258
256
  getOutputFromBoard() {
259
257
  const outputSpec = this.getOutputSpec()
260
- const data = this.renderRoot.querySelector('ox-board-viewer').getSceneData()
258
+ const data = this.oxBoardViewer.getSceneData()
261
259
 
262
260
  return outputSpec.reduce((output, spec) => {
263
261
  output[spec.name] = data[spec.name]
@@ -394,5 +392,3 @@ export class ActivityThreadPage extends connect(store)(localize(i18next)(PageVie
394
392
  }
395
393
  }
396
394
  }
397
-
398
- window.customElements.define('activity-thread-page', ActivityThreadPage)
@@ -1,13 +1,11 @@
1
- import { html } from 'lit-element'
1
+ import { html } from 'lit'
2
+ import { customElement } from 'lit/decorators.js'
2
3
  import { connect } from 'pwa-helpers/connect-mixin.js'
3
4
 
4
5
  import { PageView, store } from '@operato/shell'
5
6
 
7
+ @customElement('worklist-dashboard')
6
8
  class WorklistDashboardHome extends connect(store)(PageView) {
7
- static get properties() {
8
- return {}
9
- }
10
-
11
9
  render() {
12
10
  return html`
13
11
  <section>
@@ -16,5 +14,3 @@ class WorklistDashboardHome extends connect(store)(PageView) {
16
14
  `
17
15
  }
18
16
  }
19
-
20
- window.customElements.define('worklist-dashboard', WorklistDashboardHome)
@@ -2,6 +2,7 @@ import '@operato/data-grist'
2
2
 
3
3
  import gql from 'graphql-tag'
4
4
  import { css, html } from 'lit'
5
+ import { customElement, property, query } from 'lit/decorators.js'
5
6
  import { connect } from 'pwa-helpers/connect-mixin.js'
6
7
 
7
8
  import { getRenderer } from '@operato/data-grist'
@@ -11,16 +12,9 @@ import { PageView, store } from '@operato/shell'
11
12
  import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
12
13
  import { isMobileDevice } from '@operato/utils'
13
14
 
15
+ @customElement('assigned-list-page')
14
16
  export class AssignedListPage extends connect(store)(localize(i18next)(PageView)) {
15
- static get properties() {
16
- return {
17
- gristConfig: Object,
18
- mode: String
19
- }
20
- }
21
-
22
- static get styles() {
23
- return [
17
+ static styles = [
24
18
  ScrollbarStyles,
25
19
  CommonGristStyles,
26
20
  css`
@@ -34,7 +28,9 @@ export class AssignedListPage extends connect(store)(localize(i18next)(PageView)
34
28
  }
35
29
  `
36
30
  ]
37
- }
31
+
32
+ @property({ type: Object }) gristConfig?: any
33
+ @property({ type: String }) mode : 'GRID' | 'LIST' | 'CARD' = (isMobileDevice() ? 'LIST' : 'GRID')
38
34
 
39
35
  get context() {
40
36
  return {
@@ -44,8 +40,11 @@ export class AssignedListPage extends connect(store)(localize(i18next)(PageView)
44
40
  }
45
41
  }
46
42
 
43
+ @query('#sorter-control') sorterControl?: any
44
+ @query('ox-grist') grist?: HTMLElement & { fetch: any; }
45
+
47
46
  render() {
48
- const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')
47
+ const mode = this.mode
49
48
 
50
49
  return html`
51
50
  <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
@@ -58,8 +57,8 @@ export class AssignedListPage extends connect(store)(localize(i18next)(PageView)
58
57
  Sort
59
58
  <mwc-icon
60
59
  @click=${e => {
61
- const target = e.currentTarget
62
- this.renderRoot.querySelector('#sorter-control').open({
60
+ const target = e.currentTarget;
61
+ this.sorterControl.open({
63
62
  right: 0,
64
63
  top: target.offsetTop + target.offsetHeight
65
64
  })
@@ -81,10 +80,6 @@ export class AssignedListPage extends connect(store)(localize(i18next)(PageView)
81
80
  `
82
81
  }
83
82
 
84
- get grist() {
85
- return this.renderRoot.querySelector('ox-grist')
86
- }
87
-
88
83
  async pageInitialized(lifecycle) {
89
84
  this.gristConfig = {
90
85
  list: {
@@ -196,7 +191,7 @@ export class AssignedListPage extends connect(store)(localize(i18next)(PageView)
196
191
 
197
192
  async pageUpdated(changes, lifecycle, changedBefore) {
198
193
  if (this.active) {
199
- this.grist.fetch()
194
+ this.grist?.fetch()
200
195
  }
201
196
  }
202
197
 
@@ -241,5 +236,3 @@ export class AssignedListPage extends connect(store)(localize(i18next)(PageView)
241
236
  }
242
237
  }
243
238
  }
244
-
245
- window.customElements.define('assigned-list-page', AssignedListPage)