@crombolo/backoffice-host 0.53.2 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/approvals-tree.js +105 -0
- package/plugin/content-strip-items.js +20 -10
- package/plugin/definition-tree.js +157 -126
- package/plugin/dictionary-chip.js +233 -0
- package/plugin/dictionary-words-client.js +52 -0
- package/plugin/dictionary-words.js +196 -0
- package/plugin/form-word-input-model.js +33 -13
- package/plugin/form-word-input.js +21 -125
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/seo/umbraco-package.json +1 -1
- package/plugin/settings-cards.js +8 -1
- package/plugin/settings-section.js +43 -18
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/template-picker-modal.js +276 -0
- package/plugin/template-picker-model.js +77 -0
- package/plugin/template-picker.js +43 -0
- package/plugin/tsx-editors.js +5 -0
- package/plugin/tsx-highlighting.js +81 -0
- package/plugin/umbraco-package.json +96 -41
- package/plugin/workflow-client.js +3 -0
- package/plugin/workflow-designer.js +0 -7
- package/plugin/workflow-requests.js +111 -105
- package/plugin/workflow-send-condition.js +2 -0
- package/plugin/workflow-send-model.js +20 -0
- package/plugin/workflow-send-unpublish.js +2 -0
- package/plugin/workflow-send.js +231 -0
- package/plugin/workflow-tab.js +32 -86
package/plugin/workflow-tab.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A page's Workflow tab (story 028): which workflow covers it, where a request
|
|
3
|
-
* stands in its graph, what
|
|
4
|
-
*
|
|
5
|
-
* Sending for approval sends what is saved: the editor saves first, as they
|
|
6
|
-
* would before publishing. A workflow that allows it lets the request say when
|
|
7
|
-
* to publish or take the page down (story 029): one time for the whole page.
|
|
3
|
+
* stands in its graph, what an approver may do about it, and its history. A page
|
|
4
|
+
* is sent for approval from the bottom bar (`workflow-send.js`).
|
|
8
5
|
*/
|
|
9
6
|
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document'
|
|
10
7
|
import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'
|
|
11
8
|
import { css, html, LitElement, nothing, unsafeCSS } from '@umbraco-cms/backoffice/external/lit'
|
|
12
|
-
import { decide, pageApproval
|
|
9
|
+
import { decide, pageApproval } from './workflow-client.js'
|
|
13
10
|
import { drawGraph, GRAPH_STYLES } from './workflow-graph.js'
|
|
14
|
-
import {
|
|
11
|
+
import { APPROVAL_CHANGED } from './workflow-send.js'
|
|
12
|
+
import { describeWhen } from './workflow-time.js'
|
|
15
13
|
|
|
16
14
|
const KIND = {
|
|
17
15
|
sent: 'Sent for approval',
|
|
@@ -41,15 +39,25 @@ export default class CromboloWorkflowTabElement extends UmbElementMixin(LitEleme
|
|
|
41
39
|
_message: { state: true },
|
|
42
40
|
_busy: { state: true },
|
|
43
41
|
_comment: { state: true },
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#changed = (event) => {
|
|
45
|
+
if (event.detail?.key === this._key) this.#load()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
super.connectedCallback()
|
|
50
|
+
window.addEventListener(APPROVAL_CHANGED, this.#changed)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
super.disconnectedCallback()
|
|
55
|
+
window.removeEventListener(APPROVAL_CHANGED, this.#changed)
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
constructor() {
|
|
49
59
|
super()
|
|
50
60
|
this._comment = ''
|
|
51
|
-
this._publishAt = ''
|
|
52
|
-
this._unpublishAt = ''
|
|
53
61
|
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (context) => {
|
|
54
62
|
if (!context) return
|
|
55
63
|
this.observe(context.unique, (unique) => {
|
|
@@ -76,9 +84,8 @@ export default class CromboloWorkflowTabElement extends UmbElementMixin(LitEleme
|
|
|
76
84
|
return
|
|
77
85
|
}
|
|
78
86
|
this._comment = ''
|
|
79
|
-
this._publishAt = ''
|
|
80
|
-
this._unpublishAt = ''
|
|
81
87
|
await this.#load()
|
|
88
|
+
window.dispatchEvent(new CustomEvent(APPROVAL_CHANGED, { detail: { key: this._key } }))
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
render() {
|
|
@@ -88,84 +95,25 @@ export default class CromboloWorkflowTabElement extends UmbElementMixin(LitEleme
|
|
|
88
95
|
return html`
|
|
89
96
|
<uui-box headline=${workflow ? `Workflow: ${workflow.name}` : 'Workflow'}>
|
|
90
97
|
${
|
|
91
|
-
workflow
|
|
92
|
-
? html`<p class="lead">
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
: 'Publishing this page goes through this workflow.'
|
|
97
|
-
}
|
|
98
|
-
</p>`
|
|
99
|
-
: html`<p class="lead">No workflow covers this page: it publishes as soon as someone who may publish does.</p>`
|
|
98
|
+
!workflow
|
|
99
|
+
? html`<p class="lead">No workflow covers this page: it publishes as soon as someone who may publish does.</p>`
|
|
100
|
+
: can.publishDirectly
|
|
101
|
+
? nothing
|
|
102
|
+
: html`<p class="lead">Publishing this page goes through this workflow.</p>`
|
|
100
103
|
}
|
|
101
104
|
${this._message ? html`<p class="message">${this._message}</p>` : nothing}
|
|
102
|
-
${request ? this.#renderRequest(request) : workflow ? this.#renderSend(workflow, can) : nothing}
|
|
103
|
-
</uui-box>
|
|
104
|
-
${past.length > 0 ? html`<uui-box headline="Earlier requests">${past.map((r) => this.#renderPast(r))}</uui-box>` : nothing}
|
|
105
|
-
`
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
#renderSend(workflow, can) {
|
|
109
|
-
if (!can.send && !can.requestUnpublish) return nothing
|
|
110
|
-
return html`
|
|
111
|
-
<div class="graph-wrap">${drawGraph(workflow.stages)}</div>
|
|
112
|
-
<uui-textarea
|
|
113
|
-
label="A note for the approvers"
|
|
114
|
-
placeholder="A note for the approvers (optional)"
|
|
115
|
-
.value=${this._comment}
|
|
116
|
-
@input=${(e) => {
|
|
117
|
-
this._comment = e.target.value
|
|
118
|
-
}}
|
|
119
|
-
></uui-textarea>
|
|
120
|
-
${workflow.scheduling ? this.#renderTimes(can) : nothing}
|
|
121
|
-
<div class="actions">
|
|
122
|
-
${
|
|
123
|
-
can.send
|
|
124
|
-
? html`<uui-button look="primary" ?disabled=${this._busy} label="Send for approval"
|
|
125
|
-
@click=${() => this.#act(() => sendForApproval(this._key, 'publish', this._comment, this.#schedule('publish')))}
|
|
126
|
-
>Send for approval</uui-button>`
|
|
127
|
-
: nothing
|
|
128
|
-
}
|
|
129
105
|
${
|
|
130
|
-
|
|
131
|
-
?
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
106
|
+
request
|
|
107
|
+
? this.#renderRequest(request)
|
|
108
|
+
: workflow
|
|
109
|
+
? html`<div class="graph-wrap">${drawGraph(workflow.stages)}</div>`
|
|
110
|
+
: nothing
|
|
135
111
|
}
|
|
136
|
-
</
|
|
112
|
+
</uui-box>
|
|
113
|
+
${past.length > 0 ? html`<uui-box headline="Earlier requests">${past.map((r) => this.#renderPast(r))}</uui-box>` : nothing}
|
|
137
114
|
`
|
|
138
115
|
}
|
|
139
116
|
|
|
140
|
-
/** Optional times, both for the whole page; left empty, approval publishes at once. */
|
|
141
|
-
#renderTimes(can) {
|
|
142
|
-
return html`<div class="times">
|
|
143
|
-
${
|
|
144
|
-
can.send
|
|
145
|
-
? html`<uui-label for="publish-at">Publish at
|
|
146
|
-
<uui-input id="publish-at" type="datetime-local" label="Publish at" .value=${this._publishAt}
|
|
147
|
-
@input=${(e) => {
|
|
148
|
-
this._publishAt = e.target.value
|
|
149
|
-
}}></uui-input></uui-label>`
|
|
150
|
-
: nothing
|
|
151
|
-
}
|
|
152
|
-
<uui-label for="unpublish-at">Take down at
|
|
153
|
-
<uui-input id="unpublish-at" type="datetime-local" label="Take down at" .value=${this._unpublishAt}
|
|
154
|
-
@input=${(e) => {
|
|
155
|
-
this._unpublishAt = e.target.value
|
|
156
|
-
}}></uui-input></uui-label>
|
|
157
|
-
<small>Leave empty to publish as soon as it is approved.</small>
|
|
158
|
-
</div>`
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
#schedule(action) {
|
|
162
|
-
const publishTime = action === 'publish' ? fromLocalInput(this._publishAt) : null
|
|
163
|
-
const unpublishTime = fromLocalInput(this._unpublishAt)
|
|
164
|
-
return publishTime || unpublishTime
|
|
165
|
-
? [{ culture: null, publishTime, unpublishTime }]
|
|
166
|
-
: undefined
|
|
167
|
-
}
|
|
168
|
-
|
|
169
117
|
#renderRequest(request) {
|
|
170
118
|
const states = Object.fromEntries(request.stages.map((s) => [s.alias, s.state]))
|
|
171
119
|
const progress = request.stages
|
|
@@ -250,8 +198,6 @@ export default class CromboloWorkflowTabElement extends UmbElementMixin(LitEleme
|
|
|
250
198
|
.message { color: var(--uui-color-danger); }
|
|
251
199
|
.graph-wrap { overflow-x: auto; margin: var(--uui-size-space-4) 0; }
|
|
252
200
|
.when { font-weight: 600; }
|
|
253
|
-
.times { display: flex; flex-wrap: wrap; align-items: end; gap: var(--uui-size-space-4); margin: var(--uui-size-space-3) 0; }
|
|
254
|
-
.times uui-label { display: flex; flex-direction: column; gap: var(--uui-size-space-1); }
|
|
255
201
|
.actions { display: flex; gap: var(--uui-size-space-3); margin: var(--uui-size-space-3) 0; }
|
|
256
202
|
uui-textarea { width: 100%; }
|
|
257
203
|
.history { padding-left: var(--uui-size-space-5); }
|