@umbraco-cms/backoffice 14.0.0--preview004-a5715beb → 14.0.0--preview004-3f36df26

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.
@@ -9,6 +9,7 @@ import { UmbDictionaryWorkspaceEditorElement } from './dictionary-workspace-edit
9
9
  import { UmbTextStyles } from '../../../../shared/style/index.js';
10
10
  import { html, customElement, state } from '../../../../external/lit/index.js';
11
11
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
12
+ import { UmbWorkspaceIsNewRedirectController } from '../../../core/workspace/index.js';
12
13
  export let UmbWorkspaceDictionaryElement = class UmbWorkspaceDictionaryElement extends UmbLitElement {
13
14
  constructor() {
14
15
  super(...arguments);
@@ -26,9 +27,10 @@ export let UmbWorkspaceDictionaryElement = class UmbWorkspaceDictionaryElement e
26
27
  {
27
28
  path: 'create/:parentId',
28
29
  component: () => this.#element,
29
- setup: (_component, info) => {
30
+ setup: async (_component, info) => {
30
31
  const parentId = info.match.params.parentId === 'null' ? null : info.match.params.parentId;
31
- this.#workspaceContext.create(parentId);
32
+ await this.#workspaceContext.create(parentId);
33
+ new UmbWorkspaceIsNewRedirectController(this, this.#workspaceContext, this.shadowRoot.querySelector('umb-router-slot'));
32
34
  },
33
35
  },
34
36
  ];
@@ -1,4 +1,3 @@
1
- import { PropertyValueMap } from '../../../../external/lit/index.js';
2
1
  import { UmbLitElement } from '../../../../shared/lit-element/index.js';
3
2
  export declare class UmbScriptsWorkspaceEditElement extends UmbLitElement {
4
3
  #private;
@@ -12,7 +11,6 @@ export declare class UmbScriptsWorkspaceEditElement extends UmbLitElement {
12
11
  private _modalContext?;
13
12
  private inputQuery$;
14
13
  constructor();
15
- protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
16
14
  render(): import("lit-html").TemplateResult<1>;
17
15
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
18
16
  }
@@ -43,6 +43,7 @@ export let UmbScriptsWorkspaceEditElement = class UmbScriptsWorkspaceEditElement
43
43
  });
44
44
  this.observe(this.#scriptsWorkspaceContext.path, (path) => {
45
45
  this._path = path;
46
+ this._dirName = this._path?.substring(0, this._path?.lastIndexOf('\\'))?.replace(/\\/g, '/');
46
47
  });
47
48
  this.observe(this.#scriptsWorkspaceContext.isNew, (isNew) => {
48
49
  this.#isNew = !!isNew;
@@ -55,11 +56,6 @@ export let UmbScriptsWorkspaceEditElement = class UmbScriptsWorkspaceEditElement
55
56
  });
56
57
  });
57
58
  }
58
- willUpdate(_changedProperties) {
59
- if (_changedProperties.has('_path')) {
60
- this._dirName = this._path?.substring(0, this._path?.lastIndexOf('/'));
61
- }
62
- }
63
59
  #onNameInput(event) {
64
60
  const target = event.target;
65
61
  const value = target.value;
@@ -4,6 +4,7 @@ export declare class UmbStylesheetWorkspaceEditorElement extends UmbLitElement {
4
4
  private get _name();
5
5
  private set _name(value);
6
6
  private _path?;
7
+ private _dirName?;
7
8
  private inputQuery$;
8
9
  constructor();
9
10
  render(): import("lit-html").TemplateResult<1>;
@@ -34,8 +34,11 @@ export let UmbStylesheetWorkspaceEditorElement = class UmbStylesheetWorkspaceEdi
34
34
  #observeNameAndPath() {
35
35
  if (!this.#workspaceContext)
36
36
  return;
37
- this.observe(this.#workspaceContext.name, (name) => (this._name = name ?? ''), '_observeName');
38
- this.observe(this.#workspaceContext.path, (path) => (this._path = path ?? ''), '_observePath');
37
+ this.observe(this.#workspaceContext.path, (path) => {
38
+ this._path = path;
39
+ this._dirName = this._path?.substring(0, this._path?.lastIndexOf('\\') + 1)?.replace(/\\/g, '/');
40
+ }, '_observeStylesheetPath');
41
+ this.observe(this.#workspaceContext.name, (name) => (this._name = name), '_observeStylesheetName');
39
42
  }
40
43
  #onNameChange(event) {
41
44
  const target = event.target;
@@ -53,7 +56,7 @@ export let UmbStylesheetWorkspaceEditorElement = class UmbStylesheetWorkspaceEdi
53
56
  .value=${this._name}
54
57
  @input="${this.#onNameChange}">
55
58
  </uui-input>
56
- <small>/css/${this._path}</small>
59
+ <small>/css/${this._dirName}${this._name}.css</small>
57
60
  </div>
58
61
 
59
62
  <div slot="footer-info">
@@ -101,6 +104,9 @@ __decorate([
101
104
  __decorate([
102
105
  state()
103
106
  ], UmbStylesheetWorkspaceEditorElement.prototype, "_path", void 0);
107
+ __decorate([
108
+ state()
109
+ ], UmbStylesheetWorkspaceEditorElement.prototype, "_dirName", void 0);
104
110
  UmbStylesheetWorkspaceEditorElement = __decorate([
105
111
  customElement('umb-stylesheet-workspace-editor')
106
112
  ], UmbStylesheetWorkspaceEditorElement);
@@ -7,7 +7,7 @@ import { UmbContextToken } from '../../../../libs/context-api/index.js';
7
7
  export type RichTextRuleModelSortable = RichTextRuleModel & {
8
8
  sortOrder?: number;
9
9
  };
10
- export declare class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext<UmbStylesheetRepository, StylesheetDetails> implements UmbSaveableWorkspaceContextInterface {
10
+ export declare class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext<UmbStylesheetRepository, StylesheetDetails> implements UmbSaveableWorkspaceContextInterface<StylesheetDetails | undefined> {
11
11
  #private;
12
12
  data: import("rxjs").Observable<import("../../../../external/backend-api/index.js").TextFileResponseModelBaseModel | undefined>;
13
13
  rules: import("rxjs").Observable<RichTextRuleModelSortable[]>;
@@ -34,7 +34,10 @@ export class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext {
34
34
  return 'stylesheet';
35
35
  }
36
36
  getEntityId() {
37
- return this.getData()?.path || '';
37
+ const path = this.getData()?.path;
38
+ const name = this.getData()?.name;
39
+ // TODO: %2F is a slash (/). Should we make it an actual slash in the URL? (%2F for now so that the server can find the correct stylesheet via URL)
40
+ return path && name ? `${path}%2F${name}` : name || '';
38
41
  }
39
42
  getData() {
40
43
  return this.#data.getValue();
@@ -115,18 +118,23 @@ export class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext {
115
118
  content: stylesheet.content,
116
119
  parentPath: stylesheet.path ?? '',
117
120
  };
118
- this.repository.create(createRequestBody);
121
+ const { error } = await this.repository.create(createRequestBody);
122
+ if (!error) {
123
+ this.setIsNew(false);
124
+ }
125
+ return Promise.resolve();
126
+ }
127
+ else {
128
+ if (!stylesheet.path)
129
+ return Promise.reject('There is no path');
130
+ const updateRequestBody = {
131
+ name: stylesheet.name,
132
+ existingPath: stylesheet.path,
133
+ content: stylesheet.content,
134
+ };
135
+ this.repository.save(stylesheet.path, updateRequestBody);
119
136
  return Promise.resolve();
120
137
  }
121
- if (!stylesheet.path)
122
- return Promise.reject('There is no path');
123
- const updateRequestBody = {
124
- name: stylesheet.name,
125
- existingPath: stylesheet.path,
126
- content: stylesheet.content,
127
- };
128
- this.repository.save(stylesheet.path, updateRequestBody);
129
- return Promise.resolve();
130
138
  }
131
139
  async create(parentKey) {
132
140
  const newStylesheet = {