@umbraco-cms/backoffice 14.0.0--preview006-0bd2add0 → 14.0.0--preview006-7e57fcfa

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.
@@ -30,6 +30,7 @@ export declare class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceCon
30
30
  getVariant(variantId: UmbVariantId): import("../types.js").UmbDocumentVariantModel | undefined;
31
31
  getName(variantId?: UmbVariantId): string | undefined;
32
32
  setName(name: string, variantId?: UmbVariantId): void;
33
+ setTemplate(templateUnique: string): void;
33
34
  propertyStructureById(propertyId: string): Promise<import("rxjs").Observable<import("../../../core/content-type/index.js").UmbPropertyTypeModel | undefined>>;
34
35
  propertyValueByAlias<PropertyValueType = unknown>(propertyAlias: string, variantId?: UmbVariantId): Promise<import("rxjs").Observable<PropertyValueType>>;
35
36
  /**
@@ -102,6 +102,9 @@ export class UmbDocumentWorkspaceContext extends UmbEditableWorkspaceContextBase
102
102
  const variants = partialUpdateFrozenArray(oldVariants, { name }, variantId ? (x) => variantId.compare(x) : () => true);
103
103
  __classPrivateFieldGet(this, _UmbDocumentWorkspaceContext_currentData, "f").update({ variants });
104
104
  }
105
+ setTemplate(templateUnique) {
106
+ __classPrivateFieldGet(this, _UmbDocumentWorkspaceContext_currentData, "f").update({ template: { unique: templateUnique } });
107
+ }
105
108
  async propertyStructureById(propertyId) {
106
109
  return this.structure.propertyStructureById(propertyId);
107
110
  }
@@ -6,6 +6,7 @@ export declare class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement {
6
6
  private _nodeName;
7
7
  private _documentTypeId;
8
8
  private _documentUnique;
9
+ private _templateUnique;
9
10
  private _workspaceContext?;
10
11
  private _editDocumentTypePath;
11
12
  private _urls?;
@@ -4,17 +4,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
7
13
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
14
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
15
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
16
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
17
  };
12
- var _UmbDocumentWorkspaceViewInfoElement_instances, _UmbDocumentWorkspaceViewInfoElement_renderLinksSection, _UmbDocumentWorkspaceViewInfoElement_renderGeneralSection;
18
+ var _UmbDocumentWorkspaceViewInfoElement_instances, _UmbDocumentWorkspaceViewInfoElement_modalManagerContext, _UmbDocumentWorkspaceViewInfoElement_renderLinksSection, _UmbDocumentWorkspaceViewInfoElement_renderGeneralSection, _UmbDocumentWorkspaceViewInfoElement_openTemplatePicker;
13
19
  import { TimeOptions } from './utils.js';
14
20
  import { css, html, customElement, state, repeat } from '../../../../../../external/lit/index.js';
15
21
  import { UmbLitElement } from '../../../../../../shared/lit-element/index.js';
16
22
  import { UMB_WORKSPACE_CONTEXT } from '../../../../../core/workspace/index.js';
17
- import { UMB_WORKSPACE_MODAL, UmbModalRouteRegistrationController } from '../../../../../core/modal/index.js';
23
+ import { UMB_MODAL_MANAGER_CONTEXT, UMB_TEMPLATE_PICKER_MODAL, UMB_WORKSPACE_MODAL, UmbModalRouteRegistrationController, } from '../../../../../core/modal/index.js';
18
24
  import { UmbTextStyles } from '../../../../../../shared/style/index.js';
19
25
  import './document-workspace-view-info-history.element.js';
20
26
  import './document-workspace-view-info-reference.element.js';
@@ -25,8 +31,10 @@ let UmbDocumentWorkspaceViewInfoElement = class UmbDocumentWorkspaceViewInfoElem
25
31
  this._nodeName = '';
26
32
  this._documentTypeId = '';
27
33
  this._documentUnique = '';
34
+ this._templateUnique = '';
28
35
  this._editDocumentTypePath = '';
29
36
  this._createDate = 'Unknown';
37
+ _UmbDocumentWorkspaceViewInfoElement_modalManagerContext.set(this, void 0);
30
38
  new UmbModalRouteRegistrationController(this, UMB_WORKSPACE_MODAL)
31
39
  .addAdditionalPath('document-type')
32
40
  .onSetup(() => {
@@ -39,6 +47,9 @@ let UmbDocumentWorkspaceViewInfoElement = class UmbDocumentWorkspaceViewInfoElem
39
47
  this._workspaceContext = nodeContext;
40
48
  this._observeContent();
41
49
  });
50
+ this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (modalManagerContext) => {
51
+ __classPrivateFieldSet(this, _UmbDocumentWorkspaceViewInfoElement_modalManagerContext, modalManagerContext, "f");
52
+ });
42
53
  }
43
54
  _observeContent() {
44
55
  if (!this._workspaceContext)
@@ -50,7 +61,10 @@ let UmbDocumentWorkspaceViewInfoElement = class UmbDocumentWorkspaceViewInfoElem
50
61
  });
51
62
  this.observe(this._workspaceContext.unique, (unique) => {
52
63
  this._documentUnique = unique;
53
- });
64
+ }, '_documentUnique');
65
+ this.observe(this._workspaceContext.templateId, (templateUnique) => {
66
+ this._templateUnique = templateUnique;
67
+ }, '_templateUnique');
54
68
  /** TODO: Doubt this is the right way to get the create date... */
55
69
  this.observe(this._workspaceContext.variants, (variants) => {
56
70
  this._createDate = Array.isArray(variants) ? variants[0].createDate || 'Unknown' : 'Unknown';
@@ -73,6 +87,7 @@ let UmbDocumentWorkspaceViewInfoElement = class UmbDocumentWorkspaceViewInfoElem
73
87
  </div>`;
74
88
  }
75
89
  };
90
+ _UmbDocumentWorkspaceViewInfoElement_modalManagerContext = new WeakMap();
76
91
  _UmbDocumentWorkspaceViewInfoElement_instances = new WeakSet();
77
92
  _UmbDocumentWorkspaceViewInfoElement_renderLinksSection = function _UmbDocumentWorkspaceViewInfoElement_renderLinksSection() {
78
93
  /** TODO Make sure link section is completed */
@@ -119,7 +134,10 @@ _UmbDocumentWorkspaceViewInfoElement_renderGeneralSection = function _UmbDocumen
119
134
  </div>
120
135
  <div class="general-item">
121
136
  <strong><umb-localize key="template_template"></umb-localize></strong>
122
- <uui-button look="secondary" label="Template picker TODO"></uui-button>
137
+ <uui-button
138
+ look="secondary"
139
+ label="${this.localize.term('template_template')}"
140
+ @click=${__classPrivateFieldGet(this, _UmbDocumentWorkspaceViewInfoElement_instances, "m", _UmbDocumentWorkspaceViewInfoElement_openTemplatePicker)}></uui-button>
123
141
  </div>
124
142
  <div class="general-item">
125
143
  <strong><umb-localize key="template_id"></umb-localize></strong>
@@ -127,6 +145,24 @@ _UmbDocumentWorkspaceViewInfoElement_renderGeneralSection = function _UmbDocumen
127
145
  </div>
128
146
  `;
129
147
  };
148
+ _UmbDocumentWorkspaceViewInfoElement_openTemplatePicker = async function _UmbDocumentWorkspaceViewInfoElement_openTemplatePicker() {
149
+ const modal = __classPrivateFieldGet(this, _UmbDocumentWorkspaceViewInfoElement_modalManagerContext, "f")?.open(UMB_TEMPLATE_PICKER_MODAL, {
150
+ data: {
151
+ hideTreeRoot: true,
152
+ multiple: false,
153
+ },
154
+ value: {
155
+ selection: [this._templateUnique],
156
+ },
157
+ });
158
+ const result = await modal?.onSubmit().catch(() => undefined);
159
+ if (!result?.selection.length)
160
+ return;
161
+ const templateUnique = result.selection[0];
162
+ if (!templateUnique)
163
+ return;
164
+ this._workspaceContext?.setTemplate(templateUnique);
165
+ };
130
166
  UmbDocumentWorkspaceViewInfoElement.styles = [
131
167
  UmbTextStyles,
132
168
  css `
@@ -208,6 +244,9 @@ __decorate([
208
244
  __decorate([
209
245
  state()
210
246
  ], UmbDocumentWorkspaceViewInfoElement.prototype, "_documentUnique", void 0);
247
+ __decorate([
248
+ state()
249
+ ], UmbDocumentWorkspaceViewInfoElement.prototype, "_templateUnique", void 0);
211
250
  __decorate([
212
251
  state()
213
252
  ], UmbDocumentWorkspaceViewInfoElement.prototype, "_editDocumentTypePath", void 0);