@things-factory/worklist 10.1.256 → 10.1.257

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 (78) hide show
  1. package/dist-client/activity-state-counts.d.ts +3 -3
  2. package/dist-client/activity-state-counts.js +6 -5
  3. package/dist-client/activity-state-counts.js.map +1 -1
  4. package/dist-client/chip-counts.d.ts +1 -1
  5. package/dist-client/chip-counts.js +1 -1
  6. package/dist-client/chip-counts.js.map +1 -1
  7. package/dist-client/chip-filters.d.ts +3 -2
  8. package/dist-client/chip-filters.js +5 -3
  9. package/dist-client/chip-filters.js.map +1 -1
  10. package/dist-client/components/activity-/bowner-view.js +26 -40
  11. package/dist-client/components/activity-/bowner-view.js.map +1 -1
  12. package/dist-client/components/activity-instance-preview.js +37 -49
  13. package/dist-client/components/activity-instance-preview.js.map +1 -1
  14. package/dist-client/components/activity-intro-view.js +26 -40
  15. package/dist-client/components/activity-intro-view.js.map +1 -1
  16. package/dist-client/components/activity-reporter-view.js +26 -40
  17. package/dist-client/components/activity-reporter-view.js.map +1 -1
  18. package/dist-client/components/activity-starter-form.d.ts +2 -3
  19. package/dist-client/components/activity-starter-form.js +52 -64
  20. package/dist-client/components/activity-starter-form.js.map +1 -1
  21. package/dist-client/components/mutation-outcome.d.ts +6 -0
  22. package/dist-client/components/mutation-outcome.js +9 -0
  23. package/dist-client/components/mutation-outcome.js.map +1 -1
  24. package/dist-client/components/say-outcome.d.ts +3 -0
  25. package/dist-client/components/say-outcome.js +3 -0
  26. package/dist-client/components/say-outcome.js.map +1 -1
  27. package/dist-client/entity360/person-open-work-section.d.ts +2 -3
  28. package/dist-client/entity360/person-open-work-section.js +17 -31
  29. package/dist-client/entity360/person-open-work-section.js.map +1 -1
  30. package/dist-client/pages/activity/activity-list-page.d.ts +4 -2
  31. package/dist-client/pages/activity/activity-list-page.js +6 -11
  32. package/dist-client/pages/activity/activity-list-page.js.map +1 -1
  33. package/dist-client/pages/activity/activity-page.d.ts +13 -7
  34. package/dist-client/pages/activity/activity-page.js +111 -167
  35. package/dist-client/pages/activity/activity-page.js.map +1 -1
  36. package/dist-client/pages/activity-approval/activity-approval-page.d.ts +14 -8
  37. package/dist-client/pages/activity-approval/activity-approval-page.js +107 -123
  38. package/dist-client/pages/activity-approval/activity-approval-page.js.map +1 -1
  39. package/dist-client/pages/activity-catalog/activity-catalog-page.d.ts +10 -9
  40. package/dist-client/pages/activity-catalog/activity-catalog-page.js +38 -70
  41. package/dist-client/pages/activity-catalog/activity-catalog-page.js.map +1 -1
  42. package/dist-client/pages/activity-catalog/activity-detail-page.d.ts +6 -6
  43. package/dist-client/pages/activity-catalog/activity-detail-page.js +30 -57
  44. package/dist-client/pages/activity-catalog/activity-detail-page.js.map +1 -1
  45. package/dist-client/pages/activity-instance/activity-instance-list-page.js +2 -2
  46. package/dist-client/pages/activity-instance/activity-instance-list-page.js.map +1 -1
  47. package/dist-client/pages/activity-instance/activity-instance-search-page.d.ts +6 -3
  48. package/dist-client/pages/activity-instance/activity-instance-search-page.js +27 -29
  49. package/dist-client/pages/activity-instance/activity-instance-search-page.js.map +1 -1
  50. package/dist-client/pages/activity-instance/activity-instance-start-page.d.ts +15 -8
  51. package/dist-client/pages/activity-instance/activity-instance-start-page.js +130 -239
  52. package/dist-client/pages/activity-instance/activity-instance-start-page.js.map +1 -1
  53. package/dist-client/pages/activity-instance/activity-instance-view.d.ts +2 -2
  54. package/dist-client/pages/activity-instance/activity-instance-view.js +109 -118
  55. package/dist-client/pages/activity-instance/activity-instance-view.js.map +1 -1
  56. package/dist-client/pages/activity-thread/activity-thread-page.d.ts +15 -6
  57. package/dist-client/pages/activity-thread/activity-thread-page.js +128 -131
  58. package/dist-client/pages/activity-thread/activity-thread-page.js.map +1 -1
  59. package/dist-client/pages/activity-thread/activity-thread-view-page.d.ts +6 -6
  60. package/dist-client/pages/activity-thread/activity-thread-view-page.js +28 -53
  61. package/dist-client/pages/activity-thread/activity-thread-view-page.js.map +1 -1
  62. package/dist-client/pages/todo/approval-done-list-page.d.ts +3 -3
  63. package/dist-client/pages/todo/approval-done-list-page.js +5 -14
  64. package/dist-client/pages/todo/approval-done-list-page.js.map +1 -1
  65. package/dist-client/pages/todo/approval-pending-list-page.d.ts +19 -9
  66. package/dist-client/pages/todo/approval-pending-list-page.js +46 -59
  67. package/dist-client/pages/todo/approval-pending-list-page.js.map +1 -1
  68. package/dist-client/pages/todo/draft-list-page.d.ts +8 -2
  69. package/dist-client/pages/todo/draft-list-page.js +24 -23
  70. package/dist-client/pages/todo/draft-list-page.js.map +1 -1
  71. package/dist-client/pages/todo/pickable-list-page.d.ts +3 -3
  72. package/dist-client/pages/todo/pickable-list-page.js +5 -14
  73. package/dist-client/pages/todo/pickable-list-page.js.map +1 -1
  74. package/dist-client/pages/todo/todo-list-page.d.ts +11 -5
  75. package/dist-client/pages/todo/todo-list-page.js +33 -36
  76. package/dist-client/pages/todo/todo-list-page.js.map +1 -1
  77. package/dist-client/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +14 -12
@@ -1 +1 @@
1
- {"version":3,"file":"activity-page.js","sourceRoot":"","sources":["../../../client/pages/activity/activity-page.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAC7C,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OA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AR,KAAK,EAAE;;+CAA0B;AA+JR;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;iDAAiB;AAzL/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA+YxB","sourcesContent":["import '@operato/list-state/ox-page-state.js'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ranMutation } from '../../components/say-outcome.js'\nimport { PageView } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { provider } from '@operato/board/board-provider.js'\n\nfunction getSafeFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n try {\n const safeLocale = locale || 'en-US'\n return new Intl.DateTimeFormat(safeLocale, options)\n } catch (e) {\n console.warn(`Invalid locale or options provided: ${locale}, falling back to default en-US.`, e)\n return new Intl.DateTimeFormat('en-US', options)\n }\n}\n\nconst formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nexport const ActivityInstanceStatus = {\n Draft: 'draft',\n Issued: 'issued',\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Pending: 'pending',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-page')\nexport class ActivityPage extends localize(i18next)(PageView) {\n static styles = [\n /*\n * The frame owns the page shell; the task's content is what it sizes (ADR-0060 decision 8).\n * `ox-board-viewer` asks for `height: 100%`, which only means something inside a box whose own\n * height is settled - the frame settles it.\n */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n css`\n [content] {\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) activityInstance: any\n @property({ type: Object }) board: any\n\n @state() loaded = false\n @state() loadError: unknown = null\n\n /** The id this screen last read, so retry asks for the same task. */\n private lastId?: string\n\n get context() {\n const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(\n this.activityInstance?.state\n )\n\n const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state)\n const savable = finishable\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n startable && {\n title: i18next.t('button.play'),\n action: this._startActivityInstance.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n\n finishable && {\n title: i18next.t('button.finish'),\n action: this._endActivityInstance.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() {\n /*\n * Reading and failing both drew the same empty header, so a task that could not be read looked\n * like a task with nothing in it (ADR-0060 decision 8).\n */\n return html`<ox-page-state\n .loading=${!this.loaded && !this.loadError}\n .error=${this.loadError}\n @retry=${() => this.lastId && this.fetchActivityInstance(this.lastId)}\n >${this.renderActivity()}</ox-page-state\n >`\n }\n\n renderActivity() {\n const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {}\n return html`\n <div header class=\"page-headroom\">\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>posted at: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <img src=${thumbnail} />\n </div>\n\n <div content class=\"page-fill\">${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityInstance?.uiType) {\n case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() {\n const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options }\n })\n }\n\n getOutputSpec() {\n const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options }\n })\n }\n\n generatedContent() {\n var { input, output } = this.activityInstance || {}\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view data-name=\"input\" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => (this.activityInstance.output = e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n }\n\n boardContent() {\n const { uiSource: boardId, input, output } = this.activityInstance\n\n if (!this.board || this.board.id !== boardId) {\n this.board = { id: boardId }\n }\n\n return html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n }\n\n @query('ox-board-viewer') boardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.boardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n updated(changes) {\n if (changes.has('activityInstance')) {\n this.updateContext()\n }\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.fetchActivityInstance(lifecycle.resourceId)\n }\n }\n\n async fetchActivityInstance(id) {\n this.lastId = id\n this.loadError = null\n\n try {\n const response = await client.query({\n query: gql`\n query activityInstance($id: String!) {\n activityInstance(id: $id) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id }\n })\n\n if (response.errors?.length || !response.data?.activityInstance) {\n throw (\n response.errors?.[0] || new Error(i18next.t('error.activity-instance not found', { activityInstance: id }))\n )\n }\n\n this.activityInstance = response.data.activityInstance\n this.loaded = true\n } catch (error) {\n this.loadError = error\n }\n }\n\n async _startActivityInstance() {\n var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() =>\n client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object) {\n startActivityInstance(id: $id, output: $output) {\n name\n }\n }\n `,\n variables: { id, output }\n })\n )\n\n if (!outcome.ok) {\n return\n }\n\n await this.fetchActivityInstance(this.activityInstance.id)\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully') } })\n )\n }\n\n async _saveActivityInstance() {\n var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() =>\n client.mutate({\n mutation: gql`\n mutation ($id: String!, $save: ActivityInstanceSave!) {\n draftActivityInstance(id: $id, save: $save) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id, save: { output } }\n })\n )\n\n if (!outcome.ok) {\n return\n }\n\n this.activityInstance = outcome.data.saveActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } })\n )\n }\n\n async _endActivityInstance() {\n var { id, output, reason, uiType } = this.activityInstance\n if (uiType === 'board') {\n output = this.getOutputFromBoard()\n }\n\n const outcome = await ranMutation(() =>\n client.mutate({\n mutation: gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n endActivityInstance(id: $id, output: $output, reason: $reason) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n variables: { id, output, reason }\n })\n )\n\n if (!outcome.ok) {\n return\n }\n\n this.activityInstance = outcome.data.endActivityInstance\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully') } })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"activity-page.js","sourceRoot":"","sources":["../../../client/pages/activity/activity-page.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAC7C,OAAO,wDAAwD,CAAA;AAC/D,OAAO,mCAAmC,CAAA;AAE1C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EA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AAM;QACR,CAAC;QAED,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,oCAAoC,CAAC,EAAE,EAAE,CAAC,CACpG,CAAA;IACH,CAAC;;AA/U2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAAW;AAGrB;IAAhB,KAAK,EAAE;;gDAAwB;AAmQN;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;iDAAiB;AA5R/B,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAsWxB","sourcesContent":["import '@operato/list-state/ox-page-state.js'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { MutationController, QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { mutationOutcome } from '../../components/mutation-outcome.js'\nimport { sayFailure } from '../../components/say-outcome.js'\nimport { PageView, DraftController } from '@operato/shell'\nimport { CommonButtonStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { provider } from '@operato/board/board-provider.js'\n\nfunction getSafeFormatter(locale: string, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n try {\n const safeLocale = locale || 'en-US'\n return new Intl.DateTimeFormat(safeLocale, options)\n } catch (e) {\n console.warn(`Invalid locale or options provided: ${locale}, falling back to default en-US.`, e)\n return new Intl.DateTimeFormat('en-US', options)\n }\n}\n\nconst formatter = getSafeFormatter(navigator.language, { dateStyle: 'full', timeStyle: 'short' })\n\nexport const ActivityInstanceStatus = {\n Draft: 'draft',\n Issued: 'issued',\n Unassigned: 'unassigned',\n Assigned: 'assigned',\n Started: 'started',\n Pending: 'pending',\n Ended: 'ended',\n Aborted: 'aborted'\n}\n\n@customElement('activity-page')\nexport class ActivityPage extends localize(i18next)(PageView) {\n static styles = [\n /*\n * The frame owns the page shell; the task's content is what it sizes (ADR-0060 decision 8).\n * `ox-board-viewer` asks for `height: 100%`, which only means something inside a box whose own\n * height is settled - the frame settles it.\n */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n css`\n [content] {\n display: block;\n padding: 5px;\n }\n\n ox-board-viewer {\n width: 100%;\n height: 100%;\n }\n `\n ]\n\n @property({ type: Object }) board: any\n\n /** The task the address names. */\n @state() private instanceId = ''\n\n /* The task shown, read for the id the address names (ADR-0190). */\n private record = new QueryController(\n this,\n gql`\n query activityInstance($id: String!) {\n activityInstance(id: $id) {\n id\n name\n description\n state\n activity {\n model {\n name\n description\n active\n tag\n inout\n type\n unit\n options\n quantifier\n spec\n }\n }\n thumbnail\n input\n output\n uiType\n uiSource\n dueAt\n createdAt\n }\n }\n `,\n { variables: () => (this.instanceId ? { id: this.instanceId } : undefined) }\n )\n\n /* What is written here over the task read; another task drops it (ADR-0190 decision 2). */\n private draft = new DraftController<{ output: any }>(this, {\n read: () => this.activityInstance,\n key: () => this.instanceId\n })\n\n /*\n * The changes made here: each reads what it changed again once done. This screen says its own failure\n * (sayFailure), so the GraphQL link stays quiet about it (ADR-0190).\n */\n private start = new MutationController(\n this,\n gql`\n mutation ($id: String!, $output: Object) {\n startActivityInstance(id: $id, output: $output) {\n id\n }\n }\n `,\n { refetch: () => [this.record], showsError: true }\n )\n\n private save = new MutationController(\n this,\n gql`\n mutation ($id: String!, $save: ActivityInstanceSave!) {\n draftActivityInstance(id: $id, save: $save) {\n id\n }\n }\n `,\n { refetch: () => [this.record], showsError: true }\n )\n\n private end = new MutationController(\n this,\n gql`\n mutation ($id: String!, $output: Object, $reason: String) {\n endActivityInstance(id: $id, output: $output, reason: $reason) {\n id\n }\n }\n `,\n { refetch: () => [this.record], showsError: true }\n )\n\n get activityInstance(): any {\n return this.record.data?.activityInstance\n }\n\n get loaded(): boolean {\n return this.record.data !== undefined\n }\n\n /** Why the task could not be read - ox-page-state says it, with retry (ADR-0060 decision 8). */\n get loadError(): unknown {\n return (\n this.record.error ??\n (this.loaded && !this.activityInstance\n ? new Error(i18next.t('error.activity-instance not found', { activityInstance: this.instanceId }))\n : null)\n )\n }\n\n get context() {\n const startable = [ActivityInstanceStatus.Assigned, ActivityInstanceStatus.Issued].includes(\n this.activityInstance?.state\n )\n\n const finishable = [ActivityInstanceStatus.Started].includes(this.activityInstance?.state)\n const savable = finishable\n\n return {\n title: this.lifecycle?.params?.['title'] || i18next.t('title.activity'),\n help: 'worklist/activity',\n actions: [\n startable && {\n title: i18next.t('button.play'),\n action: this._startActivityInstance.bind(this),\n ...CommonButtonStyles.play\n },\n\n savable && {\n title: i18next.t('button.save'),\n action: this._saveActivityInstance.bind(this),\n ...CommonButtonStyles.save\n },\n\n finishable && {\n title: i18next.t('button.finish'),\n action: this._endActivityInstance.bind(this),\n ...CommonButtonStyles.save\n }\n ].filter(Boolean /* truthy only */)\n }\n }\n\n render() {\n /*\n * Reading and failing both drew the same empty header, so a task that could not be read looked\n * like a task with nothing in it (ADR-0060 decision 8).\n */\n return html`<ox-page-state\n .loading=${!this.loaded && !this.loadError}\n .error=${this.loadError}\n @retry=${() => this.record.refetch()}\n >${this.renderActivity()}</ox-page-state\n >`\n }\n\n renderActivity() {\n const { name, description, state, thumbnail, dueAt, createdAt } = this.activityInstance || {}\n return html`\n <div header class=\"page-headroom\">\n <div>name: ${name}</div>\n <div>description: ${description}</div>\n <div>state: ${state}</div>\n <div>posted at: ${createdAt && formatter.format(new Date(createdAt))}</div>\n <div>due at: ${dueAt && formatter.format(new Date(dueAt))}</div>\n <img src=${thumbnail} />\n </div>\n\n <div content class=\"page-fill\">${this.activityContent()}</div>\n `\n }\n\n activityContent() {\n switch (this.activityInstance?.uiType) {\n case 'template':\n return this.templateContent()\n case 'generated':\n return this.generatedContent()\n case 'board':\n return this.boardContent()\n case 'page':\n case 'external':\n default:\n return html``\n }\n }\n\n templateContent() {\n const { uiSource: template } = this.activityInstance\n return unsafeHTML(template)\n }\n\n getInputSpec() {\n const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'in' || item.inout === 'inout')\n .map(item => {\n return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options }\n })\n }\n\n getOutputSpec() {\n const model = this.activityInstance?.activity?.model\n\n return (model || [])\n .filter(item => item.inout === 'inout' || item.inout === 'out')\n .map(item => {\n return { ...item, name: item.tag, label: item.tKey || item.name, property: item.options }\n })\n }\n\n generatedContent() {\n var { input } = this.activityInstance || {}\n var output = this.draft.value('output')\n\n const inputSpec = this.getInputSpec()\n const outputSpec = this.getOutputSpec()\n\n if (!output) {\n output = inputSpec\n .filter(item => item.inout === 'inout')\n .reduce((inout, item) => {\n inout[item.name] = input[item.name]\n return inout\n }, {})\n }\n\n return html`\n <fieldset>\n <legend>Input</legend>\n <ox-properties-dynamic-view data-name=\"input\" .props=${inputSpec} .value=${input}></ox-properties-dynamic-view>\n </fieldset>\n\n <fieldset>\n <legend>Output</legend>\n <ox-properties-dynamic-view\n data-name=\"output\"\n .props=${outputSpec}\n .value=${output}\n @property-change=${e => this.draft.set('output', e.currentTarget.value)}\n ></ox-properties-dynamic-view>\n </fieldset>\n `\n }\n\n boardContent() {\n const { uiSource: boardId, input } = this.activityInstance\n const output = this.draft.value('output')\n\n if (!this.board || this.board.id !== boardId) {\n this.board = { id: boardId }\n }\n\n return html`\n <ox-board-viewer\n style=\"background-color: white;\"\n .board=${this.board}\n .provider=${provider}\n .values=${{ ...input, ...output }}\n hide-fullscreen\n hide-navigation\n ></ox-board-viewer>\n `\n }\n\n @query('ox-board-viewer') boardViewer: any\n\n getOutputFromBoard() {\n const outputSpec = this.getOutputSpec()\n const data = this.boardViewer.getSceneValues()\n\n return outputSpec.reduce((output, spec) => {\n output[spec.name] = data[spec.name]\n return output\n }, {})\n }\n\n async pageUpdated(changes, lifecycle, changedBefore) {\n if (this.active) {\n this.instanceId = lifecycle.resourceId\n }\n }\n\n /** What this task's output is to be: the board's values, or what was written over the task read. */\n private outputToSend() {\n return this.activityInstance.uiType === 'board' ? this.getOutputFromBoard() : this.draft.value('output')\n }\n\n /*\n * Each change sends what is written now and reads the task again once it went through; its answer is not kept\n * (ADR-0190 decision 2). The edits sent are cleared then, and a failure keeps them.\n */\n async _startActivityInstance() {\n const { id } = this.activityInstance\n const output = this.outputToSend()\n\n const started = await this.draft.submit(() => this.start.run({ id, output }))\n\n if (!started) {\n sayFailure(mutationOutcome(this.start.error))\n return\n }\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_started_successfully') } })\n )\n }\n\n async _saveActivityInstance() {\n const { id } = this.activityInstance\n const output = this.outputToSend()\n\n const saved = await this.draft.submit(() => this.save.run({ id, save: { output } }))\n\n if (!saved) {\n sayFailure(mutationOutcome(this.save.error))\n return\n }\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } })\n )\n }\n\n async _endActivityInstance() {\n const { id, reason } = this.activityInstance\n const output = this.outputToSend()\n\n const ended = await this.draft.submit(() => this.end.run({ id, output, reason }))\n\n if (!ended) {\n sayFailure(mutationOutcome(this.end.error))\n return\n }\n\n document.dispatchEvent(\n new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_finished_successfully') } })\n )\n }\n}\n"]}
@@ -18,7 +18,15 @@ export declare const ActivityThreadStatus: {
18
18
  declare const ActivityApprovalPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
19
19
  export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
20
20
  static styles: import("lit").CSSResult[];
21
- activityApproval: any;
21
+ /** The approval the address names. */
22
+ private approvalId;
23
+ private approval;
24
+ private draft;
25
+ private reject;
26
+ private approve;
27
+ private save;
28
+ get activityApproval(): any;
29
+ get activityThread(): any;
22
30
  /**
23
31
  * 타임라인이 옆에 설 만큼 넓은가.
24
32
  *
@@ -35,13 +43,12 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
35
43
  *
36
44
  * 조회가 끝난 뒤에만 그 말을 한다. 그 전에는 아무 말도 하지 않는다.
37
45
  */
38
- loaded: boolean;
46
+ get loaded(): boolean;
39
47
  /** Why the approval could not be read - ox-page-state says it, with retry (ADR-0060 decision 8). */
40
- loadError: unknown;
41
- private lastId?;
42
- private approvalRead;
43
- activityThread: any;
48
+ get loadError(): unknown;
44
49
  board: any;
50
+ /** The custom element and the approval read it was made for: another answer makes it again. */
51
+ private custom?;
45
52
  commentInput: HTMLTextAreaElement;
46
53
  /**
47
54
  * Is the reader seated here as a reference — someone who comments and does not decide?
@@ -147,9 +154,8 @@ export declare class ActivityApprovalPage extends ActivityApprovalPage_base {
147
154
  */
148
155
  private focusedFor?;
149
156
  private focusComment;
150
- updated(changes: any): void;
157
+ updated(): void;
151
158
  pageUpdated(changes: any, lifecycle: any, changedBefore: any): Promise<void>;
152
- fetchActivityApproval(id: any): Promise<void>;
153
159
  confirmIfIrreversible(): Promise<boolean>;
154
160
  rejectActivityApproval(): Promise<void>;
155
161
  approveActivityApproval(): Promise<void>;
@@ -10,12 +10,13 @@ import { css, html, nothing, unsafeCSS } from 'lit';
10
10
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
11
11
  import { customElement, query, state } from 'lit/decorators.js';
12
12
  import { keyed } from 'lit/directives/keyed.js';
13
- import { client } from '@operato/graphql';
13
+ import { MutationController, QueryController } from '@operato/graphql';
14
14
  import { OxPrompt } from '@operato/popup';
15
15
  import { i18next, localize } from '@operato/i18n';
16
- import { ranMutation } from '../../components/say-outcome.js';
16
+ import { mutationOutcome } from '../../components/mutation-outcome.js';
17
+ import { sayFailure } from '../../components/say-outcome.js';
17
18
  import { approvalGate } from './approval-gate.js';
18
- import { PageView } from '@operato/shell';
19
+ import { PageView, DraftController } from '@operato/shell';
19
20
  import { DocumentPageStyles, ScrollbarStyles } from '@operato/styles';
20
21
  import { provider } from '@operato/board/board-provider.js';
21
22
  import { isReferenceStep } from '@things-factory/organization/dist-client';
@@ -115,6 +116,44 @@ const BESIDE = '(min-width: 1504px)';
115
116
  let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(PageView) {
116
117
  constructor() {
117
118
  super(...arguments);
119
+ /** The approval the address names. */
120
+ this.approvalId = '';
121
+ /* The approval shown, read for the id the address names (ADR-0190). */
122
+ this.approval = new QueryController(this, gql `
123
+ query activityApproval($id: String!) {
124
+ activityApproval(id: $id) ${ActivityApprovalFetchResult}
125
+ }
126
+ `, { variables: () => (this.approvalId ? { id: this.approvalId } : undefined) });
127
+ /* The opinion written here over the approval read; another approval drops it (ADR-0190 decision 2). */
128
+ this.draft = new DraftController(this, {
129
+ read: () => this.activityApproval,
130
+ key: () => this.approvalId
131
+ });
132
+ /*
133
+ * The changes made here: each reads what it changed again once done. This screen says its own failure
134
+ * (sayFailure), so the GraphQL link stays quiet about it (ADR-0190).
135
+ */
136
+ this.reject = new MutationController(this, gql `
137
+ mutation ($id: String!, $comment: String!) {
138
+ rejectActivityApproval(id: $id, comment: $comment) {
139
+ id
140
+ }
141
+ }
142
+ `, { refetch: () => [this.approval], showsError: true });
143
+ this.approve = new MutationController(this, gql `
144
+ mutation ($id: String!, $comment: String) {
145
+ approveActivityApproval(id: $id, comment: $comment) {
146
+ id
147
+ }
148
+ }
149
+ `, { refetch: () => [this.approval], showsError: true });
150
+ this.save = new MutationController(this, gql `
151
+ mutation ($id: String!, $comment: String) {
152
+ saveActivityApproval(id: $id, comment: $comment) {
153
+ id
154
+ }
155
+ }
156
+ `, { refetch: () => [this.approval], showsError: true });
118
157
  /**
119
158
  * 타임라인이 옆에 설 만큼 넓은가.
120
159
  *
@@ -122,19 +161,6 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
122
161
  * 않도록 물음은 하나이고(`BESIDE`), 그 물음을 CSS 와 여기가 함께 쓴다.
123
162
  */
124
163
  this.beside = false;
125
- /**
126
- * 조회를 마쳤나 — **「아직 안 읽었다」와 「없다」는 다르다.**
127
- *
128
- * 전에는 값이 없으면 곧바로 「업무활동 정보가 없습니다」를 그렸다. 그런데 이 화면은 열리자마자
129
- * 조회를 시작하므로, 응답이 오기 전까지 **없다고 단언하는 화면**이 보인다. 목록에서 줄을 눌러
130
- * 들어온 사람은 방금 본 건이 없다는 말을 먼저 읽는다.
131
- *
132
- * 조회가 끝난 뒤에만 그 말을 한다. 그 전에는 아무 말도 하지 않는다.
133
- */
134
- this.loaded = false;
135
- /** Why the approval could not be read - ox-page-state says it, with retry (ADR-0060 decision 8). */
136
- this.loadError = null;
137
- this.approvalRead = 0;
138
164
  this.onBeside = () => (this.beside = !!this.media?.matches);
139
165
  }
140
166
  static { this.styles = [
@@ -306,6 +332,31 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
306
332
  }
307
333
  `
308
334
  ]; }
335
+ get activityApproval() {
336
+ return this.approval.data?.activityApproval;
337
+ }
338
+ get activityThread() {
339
+ return this.activityApproval?.activityThread;
340
+ }
341
+ /**
342
+ * 조회를 마쳤나 — **「아직 안 읽었다」와 「없다」는 다르다.**
343
+ *
344
+ * 전에는 값이 없으면 곧바로 「업무활동 정보가 없습니다」를 그렸다. 그런데 이 화면은 열리자마자
345
+ * 조회를 시작하므로, 응답이 오기 전까지 **없다고 단언하는 화면**이 보인다. 목록에서 줄을 눌러
346
+ * 들어온 사람은 방금 본 건이 없다는 말을 먼저 읽는다.
347
+ *
348
+ * 조회가 끝난 뒤에만 그 말을 한다. 그 전에는 아무 말도 하지 않는다.
349
+ */
350
+ get loaded() {
351
+ return this.approval.data !== undefined;
352
+ }
353
+ /** Why the approval could not be read - ox-page-state says it, with retry (ADR-0060 decision 8). */
354
+ get loadError() {
355
+ return (this.approval.error ??
356
+ (this.loaded && !this.activityApproval
357
+ ? new Error(i18next.t('error.activity-approval not found', { activityApproval: this.approvalId }))
358
+ : null));
359
+ }
309
360
  /**
310
361
  * Is the reader seated here as a reference — someone who comments and does not decide?
311
362
  *
@@ -402,7 +453,7 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
402
453
  <ox-page-state
403
454
  .loading=${!this.loaded && !this.loadError}
404
455
  .error=${this.loadError}
405
- @retry=${() => this.lastId && this.fetchActivityApproval(this.lastId)}
456
+ @retry=${() => this.approval.refetch()}
406
457
  >${this.activityThread
407
458
  ? this.renderApproval()
408
459
  : this.loaded
@@ -444,13 +495,8 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
444
495
  placeholder=${String(i18next.t(this.isReference
445
496
  ? 'text.write-your-comment-as-reference'
446
497
  : 'text.explain the reason for approval/rejection'))}
447
- .value=${this.activityApproval?.comment}
448
- @input=${(e) => {
449
- this.activityApproval.comment = e.target.value;
450
- }}
451
- @change=${(e) => {
452
- this.activityApproval.comment = e.target.value;
453
- }}
498
+ .value=${this.draft.value('comment') ?? ''}
499
+ @input=${(e) => this.draft.set('comment', e.target.value)}
454
500
  ></textarea>
455
501
  <!--
456
502
  반려는 의견이 필수다(rejectActivityApproval). 전에는 그 규칙을 **누른 뒤에** 토스트로
@@ -663,12 +709,17 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
663
709
  /* The caller draws the notice — unwrapped, because the notice is its own card. */
664
710
  return undefined;
665
711
  }
712
+ /* Made once per answer: the opinion typed below redraws the page, and the element shows the same approval. */
713
+ if (this.custom && this.custom.for === this.activityApproval) {
714
+ return this.custom.element;
715
+ }
666
716
  const element = document.createElement(tagName);
667
717
  element.id = 'custom-content';
668
718
  element.activityId = activityInstance.activity.id;
669
719
  element.input = input;
670
720
  element.output = output;
671
721
  element.activityApproval = this.activityApproval;
722
+ this.custom = { for: this.activityApproval, element };
672
723
  return element;
673
724
  }
674
725
  /** The activity names a screen and nothing registered it. Says what to judge by instead. */
@@ -694,57 +745,16 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
694
745
  this.commentInput?.focus({ preventScroll: true });
695
746
  this.focusedFor = id;
696
747
  }
697
- updated(changes) {
698
- if (changes.has('activityApproval')) {
699
- this.updateContext();
700
- this.focusComment();
701
- }
748
+ updated() {
749
+ this.focusComment();
702
750
  }
703
751
  async pageUpdated(changes, lifecycle, changedBefore) {
704
752
  if (this.active && lifecycle.resourceId) {
705
- // Entity 360 changes only the query address. Do not reload the same approval and erase its unsaved opinion.
706
- if (this.lastId === lifecycle.resourceId && !('active' in changes))
707
- return;
708
- this.fetchActivityApproval(lifecycle.resourceId);
709
- }
710
- }
711
- async fetchActivityApproval(id) {
712
- const read = ++this.approvalRead;
713
- if (this.lastId !== id) {
714
- this.activityApproval = undefined;
715
- this.activityThread = undefined;
716
- this.loaded = false;
717
- }
718
- this.lastId = id;
719
- this.loadError = null;
720
- let response;
721
- try {
722
- response = await client.query({
723
- query: gql `
724
- query activityApproval($id: String!) { activityApproval(id: $id) ${ActivityApprovalFetchResult}
725
- }
726
- `,
727
- variables: { id }
728
- });
753
+ /* Entity 360 changes only the query address: the same approval is not read again, and its unsaved opinion stays. */
754
+ /* Coming back to the tab, PageView reads the declared approval again; the opinion typed stays (the draft). */
755
+ if (this.approvalId !== lifecycle.resourceId)
756
+ this.approvalId = lifecycle.resourceId;
729
757
  }
730
- catch (error) {
731
- if (read !== this.approvalRead)
732
- return;
733
- this.loadError = error;
734
- return;
735
- }
736
- if (read !== this.approvalRead)
737
- return;
738
- if (response.errors?.length || !response.data?.activityApproval) {
739
- this.loadError = response.errors?.length
740
- ? response.errors
741
- : new Error(i18next.t('error.activity-approval not found', { activityApproval: id }));
742
- return;
743
- }
744
- this.activityApproval = response.data.activityApproval;
745
- this.loaded = true;
746
- this.activityThread = this.activityApproval.activityThread;
747
- this.updateContext();
748
758
  }
749
759
  /*
750
760
  * The approval declared that it cannot be undone: ask once, as a destructive confirmation, before
@@ -766,83 +776,57 @@ let ActivityApprovalPage = class ActivityApprovalPage extends localize(i18next)(
766
776
  cancelButton: { text: i18next.t('button.cancel') }
767
777
  });
768
778
  }
779
+ /*
780
+ * Each decision sends the opinion written now and reads the approval again once it went through; its answer is not
781
+ * kept (ADR-0190 decision 2). The opinion sent is cleared then, and a failure keeps it.
782
+ */
769
783
  async rejectActivityApproval() {
770
- var { id, comment } = this.activityApproval;
784
+ const { id } = this.activityApproval;
785
+ const comment = this.draft.value('comment');
771
786
  if (!comment) {
772
787
  document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.enter a comment') } }));
773
788
  this.commentInput.focus();
774
789
  return;
775
790
  }
776
- const outcome = await ranMutation(() => client.mutate({
777
- mutation: gql `
778
- mutation ($id: String!, $comment: String!) { rejectActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
779
- }
780
- `,
781
- variables: { id, comment }
782
- }));
783
- if (outcome.ok) {
784
- this.activityApproval = outcome.data.rejectActivityApproval;
785
- this.activityThread = this.activityApproval.activityThread;
786
- this.updateContext();
787
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_rejected_successfully') } }));
791
+ const rejected = await this.draft.submit(() => this.reject.run({ id, comment }));
792
+ if (!rejected) {
793
+ sayFailure(mutationOutcome(this.reject.error));
794
+ return;
788
795
  }
796
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_rejected_successfully') } }));
789
797
  }
790
798
  async approveActivityApproval() {
791
- var { id, comment } = this.activityApproval;
799
+ const { id } = this.activityApproval;
800
+ const comment = this.draft.value('comment');
792
801
  if (!(await this.confirmIfIrreversible())) {
793
802
  return;
794
803
  }
795
- const outcome = await ranMutation(() => client.mutate({
796
- mutation: gql `
797
- mutation ($id: String!, $comment: String) { approveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
798
- }
799
- `,
800
- variables: { id, comment }
801
- }));
802
- if (outcome.ok) {
803
- this.activityApproval = outcome.data.approveActivityApproval;
804
- this.activityThread = this.activityApproval.activityThread;
805
- this.updateContext();
806
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_approved_successfully') } }));
804
+ const approved = await this.draft.submit(() => this.approve.run({ id, comment }));
805
+ if (!approved) {
806
+ sayFailure(mutationOutcome(this.approve.error));
807
+ return;
807
808
  }
809
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_approved_successfully') } }));
808
810
  }
809
811
  async saveActivityApproval() {
810
- var { id, comment } = this.activityApproval;
811
- const outcome = await ranMutation(() => client.mutate({
812
- mutation: gql `
813
- mutation ($id: String!, $comment: String) { saveActivityApproval(id: $id, comment: $comment) ${ActivityApprovalFetchResult}
814
- }
815
- `,
816
- variables: { id, comment }
817
- }));
818
- if (outcome.ok) {
819
- this.activityApproval = outcome.data.saveActivityApproval;
820
- this.activityThread = this.activityApproval.activityThread;
821
- this.updateContext();
822
- document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } }));
812
+ const { id } = this.activityApproval;
813
+ const comment = this.draft.value('comment');
814
+ const saved = await this.draft.submit(() => this.save.run({ id, comment }));
815
+ if (!saved) {
816
+ sayFailure(mutationOutcome(this.save.error));
817
+ return;
823
818
  }
819
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message: i18next.t('text.task_is_saved_successfully') } }));
824
820
  }
825
821
  };
826
822
  __decorate([
827
823
  state(),
828
824
  __metadata("design:type", Object)
829
- ], ActivityApprovalPage.prototype, "activityApproval", void 0);
825
+ ], ActivityApprovalPage.prototype, "approvalId", void 0);
830
826
  __decorate([
831
827
  state(),
832
828
  __metadata("design:type", Object)
833
829
  ], ActivityApprovalPage.prototype, "beside", void 0);
834
- __decorate([
835
- state(),
836
- __metadata("design:type", Object)
837
- ], ActivityApprovalPage.prototype, "loaded", void 0);
838
- __decorate([
839
- state(),
840
- __metadata("design:type", Object)
841
- ], ActivityApprovalPage.prototype, "loadError", void 0);
842
- __decorate([
843
- state(),
844
- __metadata("design:type", Object)
845
- ], ActivityApprovalPage.prototype, "activityThread", void 0);
846
830
  __decorate([
847
831
  state(),
848
832
  __metadata("design:type", Object)