@umbraco-cms/backoffice 14.0.0--preview007-b64c7cb9 → 14.0.0--preview007-02546fcd

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.
@@ -6263,11 +6263,6 @@
6263
6263
  }
6264
6264
  ],
6265
6265
  "properties": [
6266
- {
6267
- "name": "config",
6268
- "type": "UmbSorterConfig<PropertyTypeContainerModelBaseModel>",
6269
- "default": "{}"
6270
- },
6271
6266
  {
6272
6267
  "name": "ownerTabId",
6273
6268
  "attribute": "ownerTabId",
@@ -6287,9 +6282,6 @@
6287
6282
  "name": "styles",
6288
6283
  "type": "array",
6289
6284
  "default": "[\"UmbTextStyles\",null]"
6290
- },
6291
- {
6292
- "name": "sorter"
6293
6285
  }
6294
6286
  ]
6295
6287
  },
@@ -6297,18 +6289,10 @@
6297
6289
  "name": "umb-document-type-workspace-view-edit",
6298
6290
  "path": "./../src/packages/documents/document-types/workspace/views/design/document-type-workspace-view-edit.element.ts",
6299
6291
  "properties": [
6300
- {
6301
- "name": "config",
6302
- "type": "UmbSorterConfig<PropertyTypeContainerModelBaseModel>",
6303
- "default": "{}"
6304
- },
6305
6292
  {
6306
6293
  "name": "styles",
6307
6294
  "type": "array",
6308
6295
  "default": "[\"UmbTextStyles\",null]"
6309
- },
6310
- {
6311
- "name": "sorter"
6312
6296
  }
6313
6297
  ]
6314
6298
  },
@@ -1004,6 +1004,46 @@ export const data = [
1004
1004
  labelOnTop: false,
1005
1005
  },
1006
1006
  },
1007
+ {
1008
+ id: 'a92de6ac-1a22-4a45-a481-b6cae1cccbba',
1009
+ container: { id: '2e845ca8-1e3e-4b03-be1d-0b4149ce2120' },
1010
+ alias: 'alchemyElement',
1011
+ name: 'Alchemy Element',
1012
+ description: null,
1013
+ dataType: { id: '0cc0eba1-9960-42c9-bf9b-60e150b429ae' },
1014
+ variesByCulture: false,
1015
+ variesBySegment: false,
1016
+ sortOrder: 0,
1017
+ validation: {
1018
+ mandatory: false,
1019
+ mandatoryMessage: null,
1020
+ regEx: null,
1021
+ regExMessage: null,
1022
+ },
1023
+ appearance: {
1024
+ labelOnTop: false,
1025
+ },
1026
+ },
1027
+ {
1028
+ id: 'c92de6ac-1a22-4a45-a481-b6cae1cccbba',
1029
+ container: { id: '2e845ca8-1e3e-4b03-be1d-0b4149ce2120' },
1030
+ alias: 'acidScale',
1031
+ name: 'Acid Scale',
1032
+ description: null,
1033
+ dataType: { id: '0cc0eba1-9960-42c9-bf9b-60e150b429ae' },
1034
+ variesByCulture: false,
1035
+ variesBySegment: false,
1036
+ sortOrder: 0,
1037
+ validation: {
1038
+ mandatory: false,
1039
+ mandatoryMessage: null,
1040
+ regEx: null,
1041
+ regExMessage: null,
1042
+ },
1043
+ appearance: {
1044
+ labelOnTop: false,
1045
+ },
1046
+ },
1007
1047
  ],
1008
1048
  containers: [
1009
1049
  {
@@ -1013,6 +1053,13 @@ export const data = [
1013
1053
  type: 'Group',
1014
1054
  sortOrder: 0,
1015
1055
  },
1056
+ {
1057
+ id: '2e845ca8-1e3e-4b03-be1d-0b4149ce2120',
1058
+ parent: null,
1059
+ name: 'Alchemy',
1060
+ type: 'Group',
1061
+ sortOrder: 0,
1062
+ },
1016
1063
  ],
1017
1064
  allowedDocumentTypes: [],
1018
1065
  compositions: [],
@@ -42,6 +42,7 @@ export declare class UmbInputDocumentTypeElement extends UmbInputDocumentTypeEle
42
42
  get selectedIds(): Array<string>;
43
43
  set selectedIds(ids: Array<string> | undefined);
44
44
  set value(idsString: string);
45
+ get value(): string;
45
46
  private _items?;
46
47
  private _editDocumentTypePath;
47
48
  constructor();
@@ -51,6 +51,9 @@ let UmbInputDocumentTypeElement = class UmbInputDocumentTypeElement extends Form
51
51
  // Its with full purpose we don't call super.value, as thats being handled by the observation of the context selection.
52
52
  this.selectedIds = splitStringToArray(idsString);
53
53
  }
54
+ get value() {
55
+ return this.selectedIds.join(',');
56
+ }
54
57
  constructor() {
55
58
  super();
56
59
  _UmbInputDocumentTypeElement_instances.add(this);
@@ -1,8 +1,8 @@
1
+ import { UmbLitElement } from '../../../../../core/lit-element/index.js';
1
2
  import './document-type-workspace-view-edit-property.element.js';
2
3
  import type { UmbDocumentTypeDetailModel } from '../../../types.js';
3
4
  import type { UmbPropertyContainerTypes, UmbPropertyTypeModel } from '../../../../../core/content-type/index.js';
4
5
  import { UmbContentTypePropertyStructureHelper } from '../../../../../core/content-type/index.js';
5
- import { UmbLitElement } from '../../../../../core/lit-element/index.js';
6
6
  export declare class UmbDocumentTypeWorkspaceViewEditPropertiesElement extends UmbLitElement {
7
7
  #private;
8
8
  private _containerId;
@@ -9,27 +9,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  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
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _UmbDocumentTypeWorkspaceViewEditPropertiesElement_instances, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_propertySorter, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_setModel, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_addProperty;
12
+ var _UmbDocumentTypeWorkspaceViewEditPropertiesElement_instances, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_model, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_sorter, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_addProperty;
13
+ import { UmbLitElement } from '../../../../../core/lit-element/index.js';
13
14
  import './document-type-workspace-view-edit-property.element.js';
14
15
  import { css, html, customElement, property, state, repeat, ifDefined } from '../../../../../../external/lit/index.js';
15
16
  import { UmbTextStyles } from '../../../../../../shared/style/index.js';
16
17
  import { UmbContentTypePropertyStructureHelper } from '../../../../../core/content-type/index.js';
17
18
  import { UmbSorterController } from '../../../../../core/sorter/index.js';
18
- import { UmbLitElement } from '../../../../../core/lit-element/index.js';
19
19
  import { UMB_WORKSPACE_CONTEXT } from '../../../../../core/workspace/index.js';
20
20
  import { UMB_PROPERTY_SETTINGS_MODAL, UmbModalRouteRegistrationController } from '../../../../../core/modal/index.js';
21
- const SORTER_CONFIG = {
22
- getUniqueOfElement: (element) => {
23
- return element.getAttribute('data-umb-property-id');
24
- },
25
- getUniqueOfModel: (modelEntry) => {
26
- return modelEntry.id;
27
- },
28
- identifier: 'content-type-property-sorter',
29
- itemSelector: '[data-umb-property-id]',
30
- disabledItemSelector: '[inherited]',
31
- containerSelector: '#property-list',
32
- };
33
21
  let UmbDocumentTypeWorkspaceViewEditPropertiesElement = class UmbDocumentTypeWorkspaceViewEditPropertiesElement extends UmbLitElement {
34
22
  get containerId() {
35
23
  return this._containerId;
@@ -56,37 +44,39 @@ let UmbDocumentTypeWorkspaceViewEditPropertiesElement = class UmbDocumentTypeWor
56
44
  constructor() {
57
45
  super();
58
46
  _UmbDocumentTypeWorkspaceViewEditPropertiesElement_instances.add(this);
59
- _UmbDocumentTypeWorkspaceViewEditPropertiesElement_propertySorter.set(this, new UmbSorterController(this, {
60
- ...SORTER_CONFIG,
61
- performItemInsert: (args) => {
62
- let sortOrder = 0;
63
- if (this._propertyStructure.length > 0) {
64
- if (args.newIndex === 0) {
65
- sortOrder = (this._propertyStructure[0].sortOrder ?? 0) - 1;
66
- }
67
- else {
68
- sortOrder =
69
- (this._propertyStructure[Math.min(args.newIndex, this._propertyStructure.length - 1)].sortOrder ?? 0) + 1;
70
- }
71
- }
72
- return this._propertyStructureHelper.insertProperty(args.item, sortOrder);
47
+ _UmbDocumentTypeWorkspaceViewEditPropertiesElement_model.set(this, []);
48
+ _UmbDocumentTypeWorkspaceViewEditPropertiesElement_sorter.set(this, new UmbSorterController(this, {
49
+ getUniqueOfElement: (element) => {
50
+ return element.getAttribute('data-umb-property-id');
73
51
  },
74
- performItemRemove: (args) => {
75
- return this._propertyStructureHelper.removeProperty(args.item.id);
52
+ getUniqueOfModel: (modelEntry) => {
53
+ return modelEntry.id;
76
54
  },
77
- performItemMove: (args) => {
78
- this._propertyStructureHelper.removeProperty(args.item.id);
79
- let sortOrder = 0;
80
- if (this._propertyStructure.length > 0) {
81
- if (args.newIndex === 0) {
82
- sortOrder = (this._propertyStructure[0].sortOrder ?? 0) - 1;
83
- }
84
- else {
85
- sortOrder =
86
- (this._propertyStructure[Math.min(args.newIndex, this._propertyStructure.length - 1)].sortOrder ?? 0) + 1;
87
- }
55
+ identifier: 'document-type-property-sorter',
56
+ itemSelector: 'umb-document-type-workspace-view-edit-property',
57
+ disabledItemSelector: '[inherited]',
58
+ //TODO: Set the property list (sorter wrapper) to inherited, if its inherited
59
+ // This is because we don't want to move local properties into an inherited group container.
60
+ // Or maybe we do, but we still need to check if the group exists locally, if not, then it needs to be created before we move a property into it.
61
+ // TODO: Fix bug where a local property turn into an inherited when moved to a new group container.
62
+ containerSelector: '#property-list',
63
+ onChange: ({ item, model }) => {
64
+ const isInNewContainer = model.find((entry) => entry?.container?.id !== this._containerId && this._containerId);
65
+ if (isInNewContainer) {
66
+ model.forEach((entry, index) => {
67
+ entry.id === item.id
68
+ ? this._propertyStructureHelper.partialUpdateProperty(entry.id, {
69
+ sortOrder: index,
70
+ container: { id: this._containerId },
71
+ })
72
+ : this._propertyStructureHelper.partialUpdateProperty(entry.id, { sortOrder: index });
73
+ });
74
+ }
75
+ else {
76
+ model.forEach((entry, index) => {
77
+ this._propertyStructureHelper.partialUpdateProperty(entry.id, { sortOrder: index });
78
+ });
88
79
  }
89
- return this._propertyStructureHelper.insertProperty(args.item, sortOrder);
90
80
  },
91
81
  }));
92
82
  this._propertyStructureHelper = new UmbContentTypePropertyStructureHelper(this);
@@ -95,7 +85,12 @@ let UmbDocumentTypeWorkspaceViewEditPropertiesElement = class UmbDocumentTypeWor
95
85
  this._propertyStructureHelper.setStructureManager(workspaceContext.structure);
96
86
  this.observe(workspaceContext.isSorting, (isSorting) => {
97
87
  this._sortModeActive = isSorting;
98
- __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_instances, "m", _UmbDocumentTypeWorkspaceViewEditPropertiesElement_setModel).call(this, isSorting);
88
+ if (isSorting) {
89
+ __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_sorter, "f").setModel(this._propertyStructure);
90
+ }
91
+ else {
92
+ __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_sorter, "f").setModel([]);
93
+ }
99
94
  }, '_observeIsSorting');
100
95
  const docTypesObservable = await this._propertyStructureHelper.ownerDocumentTypes();
101
96
  if (!docTypesObservable)
@@ -130,26 +125,30 @@ let UmbDocumentTypeWorkspaceViewEditPropertiesElement = class UmbDocumentTypeWor
130
125
  });
131
126
  }
132
127
  render() {
133
- return html `<div id="property-list">
134
- ${repeat(this._propertyStructure, (property) => property.id ?? '' + property.container?.id ?? '' + property.sortOrder ?? '', (property) => {
128
+ return html `
129
+ <div id="property-list" ?sort-mode-active=${this._sortModeActive}>
130
+ ${repeat(this._propertyStructure, (property) => '' + property.container?.id + property.id + '' + property.sortOrder, (property) => {
135
131
  // Note: This piece might be moved into the property component
136
132
  const inheritedFromDocument = this._ownerDocumentTypes?.find((types) => types.containers?.find((containers) => containers.id === property.container?.id));
137
- return html `<umb-document-type-workspace-view-edit-property
138
- data-umb-property-id=${property.id}
139
- owner-document-type-id=${ifDefined(inheritedFromDocument?.unique)}
140
- owner-document-type-name=${ifDefined(inheritedFromDocument?.name)}
141
- ?inherited=${property.container?.id !== this.containerId}
142
- ?sort-mode-active=${this._sortModeActive}
143
- .property=${property}
144
- @partial-property-update=${(event) => {
133
+ return html `
134
+ <umb-document-type-workspace-view-edit-property
135
+ data-umb-property-id=${property.id}
136
+ owner-document-type-id=${ifDefined(inheritedFromDocument?.unique)}
137
+ owner-document-type-name=${ifDefined(inheritedFromDocument?.name)}
138
+ ?inherited=${property.container?.id !== this.containerId}
139
+ ?sort-mode-active=${this._sortModeActive}
140
+ .property=${property}
141
+ @partial-property-update=${(event) => {
145
142
  this._propertyStructureHelper.partialUpdateProperty(property.id, event.detail);
146
143
  }}
147
- @property-delete=${() => {
144
+ @property-delete=${() => {
148
145
  this._propertyStructureHelper.removeProperty(property.id);
149
146
  }}>
150
- </umb-document-type-workspace-view-edit-property>`;
147
+ </umb-document-type-workspace-view-edit-property>
148
+ `;
151
149
  })}
152
150
  </div>
151
+
153
152
  ${!this._sortModeActive
154
153
  ? html `<uui-button
155
154
  label=${this.localize.term('contentTypeEditor_addProperty')}
@@ -158,20 +157,13 @@ let UmbDocumentTypeWorkspaceViewEditPropertiesElement = class UmbDocumentTypeWor
158
157
  href=${ifDefined(this._modalRouteNewProperty)}>
159
158
  <umb-localize key="contentTypeEditor_addProperty">Add property</umb-localize>
160
159
  </uui-button> `
161
- : ''} `;
160
+ : ''}
161
+ `;
162
162
  }
163
163
  };
164
- _UmbDocumentTypeWorkspaceViewEditPropertiesElement_propertySorter = new WeakMap();
164
+ _UmbDocumentTypeWorkspaceViewEditPropertiesElement_model = new WeakMap();
165
+ _UmbDocumentTypeWorkspaceViewEditPropertiesElement_sorter = new WeakMap();
165
166
  _UmbDocumentTypeWorkspaceViewEditPropertiesElement_instances = new WeakSet();
166
- _UmbDocumentTypeWorkspaceViewEditPropertiesElement_setModel = function _UmbDocumentTypeWorkspaceViewEditPropertiesElement_setModel(isSorting) {
167
- if (isSorting) {
168
- __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_propertySorter, "f").setModel(this._propertyStructure);
169
- }
170
- else {
171
- // TODO: Make a more proper way to disable sorting:
172
- __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditPropertiesElement_propertySorter, "f").setModel([]);
173
- }
174
- };
175
167
  _UmbDocumentTypeWorkspaceViewEditPropertiesElement_addProperty = async function _UmbDocumentTypeWorkspaceViewEditPropertiesElement_addProperty(propertyData) {
176
168
  const propertyPlaceholder = await this._propertyStructureHelper.addProperty(this._containerId);
177
169
  if (!propertyPlaceholder)
@@ -184,6 +176,11 @@ UmbDocumentTypeWorkspaceViewEditPropertiesElement.styles = [
184
176
  #add {
185
177
  width: 100%;
186
178
  }
179
+
180
+ #property-list[sort-mode-active]:not(:has(umb-document-type-workspace-view-edit-property)) {
181
+ /* Some height so that the sorter can target the area if the group is empty*/
182
+ min-height: var(--uui-size-layout-1);
183
+ }
187
184
  `,
188
185
  ];
189
186
  __decorate([
@@ -112,6 +112,7 @@ let UmbDocumentTypeWorkspacePropertyElement = class UmbDocumentTypeWorkspaceProp
112
112
  type="number"
113
113
  ?readonly=${this.inherited}
114
114
  label="sort order"
115
+ @change=${(e) => this._partialUpdate({ sortOrder: parseInt(e.target.value) || 0 })}
115
116
  .value=${this.property.sortOrder ?? 0}></uui-input>
116
117
  `;
117
118
  }
@@ -440,6 +441,10 @@ UmbDocumentTypeWorkspacePropertyElement.styles = [
440
441
  a {
441
442
  color: inherit;
442
443
  }
444
+
445
+ :host([drag-placeholder]) {
446
+ opacity: 0.2;
447
+ }
443
448
  `,
444
449
  ];
445
450
  __decorate([
@@ -1,14 +1,9 @@
1
1
  import type { UmbDocumentTypeDetailModel } from '../../../types.js';
2
- import { UmbContentTypeContainerStructureHelper } from '../../../../../core/content-type/index.js';
3
2
  import { UmbLitElement } from '../../../../../core/lit-element/index.js';
4
- import type { PropertyTypeContainerModelBaseModel } from '../../../../../../external/backend-api/index.js';
5
- import type { UmbSorterConfig } from '../../../../../core/sorter/index.js';
6
- import { UmbSorterController } from '../../../../../core/sorter/index.js';
3
+ import { UmbContentTypeContainerStructureHelper, type UmbPropertyTypeContainerModel } from '../../../../../core/content-type/index.js';
7
4
  import './document-type-workspace-view-edit-properties.element.js';
8
5
  export declare class UmbDocumentTypeWorkspaceViewEditTabElement extends UmbLitElement {
9
6
  #private;
10
- sorter?: UmbSorterController<PropertyTypeContainerModelBaseModel>;
11
- config: UmbSorterConfig<PropertyTypeContainerModelBaseModel>;
12
7
  private _ownerTabId?;
13
8
  get ownerTabId(): string | null | undefined;
14
9
  set ownerTabId(value: string | null | undefined);
@@ -19,7 +14,7 @@ export declare class UmbDocumentTypeWorkspaceViewEditTabElement extends UmbLitEl
19
14
  get noTabName(): boolean;
20
15
  set noTabName(value: boolean);
21
16
  _groupStructureHelper: UmbContentTypeContainerStructureHelper<UmbDocumentTypeDetailModel>;
22
- _groups: Array<PropertyTypeContainerModelBaseModel>;
17
+ _groups: Array<UmbPropertyTypeContainerModel>;
23
18
  _hasProperties: boolean;
24
19
  _sortModeActive?: boolean;
25
20
  constructor();
@@ -9,26 +9,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  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
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _UmbDocumentTypeWorkspaceViewEditTabElement_onAddGroup;
12
+ var _UmbDocumentTypeWorkspaceViewEditTabElement_instances, _UmbDocumentTypeWorkspaceViewEditTabElement_sorter, _UmbDocumentTypeWorkspaceViewEditTabElement_onAddGroup, _UmbDocumentTypeWorkspaceViewEditTabElement_renderHeader, _UmbDocumentTypeWorkspaceViewEditTabElement_renderInputGroupName, _UmbDocumentTypeWorkspaceViewEditTabElement_renderAddGroupButton;
13
+ import { UmbLitElement } from '../../../../../core/lit-element/index.js';
13
14
  import { css, html, customElement, property, state, repeat, ifDefined } from '../../../../../../external/lit/index.js';
14
15
  import { UmbTextStyles } from '../../../../../../shared/style/index.js';
15
- import { UmbContentTypeContainerStructureHelper } from '../../../../../core/content-type/index.js';
16
- import { UmbLitElement } from '../../../../../core/lit-element/index.js';
16
+ import { UmbContentTypeContainerStructureHelper, } from '../../../../../core/content-type/index.js';
17
17
  import { UMB_WORKSPACE_CONTEXT } from '../../../../../core/workspace/index.js';
18
- import { UmbSorterController } from '../../../../../core/sorter/index.js';
19
18
  import './document-type-workspace-view-edit-properties.element.js';
20
- const SORTER_CONFIG = {
21
- getUniqueOfElement: (element) => {
22
- return element.getAttribute('data-umb-group-id');
23
- },
24
- getUniqueOfModel: (modelEntry) => {
25
- return modelEntry.id;
26
- },
27
- identifier: 'content-type-group-sorter',
28
- itemSelector: '[data-umb-group-id]',
29
- disabledItemSelector: '[inherited]',
30
- containerSelector: '#group-list',
31
- };
19
+ import { UmbSorterController } from '../../../../../core/sorter/index.js';
32
20
  let UmbDocumentTypeWorkspaceViewEditTabElement = class UmbDocumentTypeWorkspaceViewEditTabElement extends UmbLitElement {
33
21
  // TODO: get rid of this:
34
22
  get ownerTabId() {
@@ -62,31 +50,19 @@ let UmbDocumentTypeWorkspaceViewEditTabElement = class UmbDocumentTypeWorkspaceV
62
50
  }
63
51
  constructor() {
64
52
  super();
65
- this.config = {
66
- ...SORTER_CONFIG,
67
- // TODO: Missing handlers to work properly: performItemMove and performItemRemove
68
- performItemInsert: async (args) => {
69
- if (!this._groups)
70
- return false;
71
- const oldIndex = this._groups.findIndex((group) => group.id === args.item.id);
72
- if (args.newIndex === oldIndex)
73
- return true;
74
- let sortOrder = 0;
75
- //TODO the sortOrder set is not correct
76
- if (this._groups.length > 0) {
77
- if (args.newIndex === 0) {
78
- sortOrder = (this._groups[0].sortOrder ?? 0) - 1;
79
- }
80
- else {
81
- sortOrder = (this._groups[Math.min(args.newIndex, this._groups.length - 1)].sortOrder ?? 0) + 1;
82
- }
83
- if (sortOrder !== args.item.sortOrder) {
84
- await this._groupStructureHelper.partialUpdateContainer(args.item.id, { sortOrder });
85
- }
86
- }
87
- return true;
53
+ _UmbDocumentTypeWorkspaceViewEditTabElement_instances.add(this);
54
+ _UmbDocumentTypeWorkspaceViewEditTabElement_sorter.set(this, new UmbSorterController(this, {
55
+ getUniqueOfElement: (element) => element.querySelector('umb-document-type-workspace-view-edit-properties').getAttribute('container-id'),
56
+ getUniqueOfModel: (modelEntry) => modelEntry.id,
57
+ identifier: 'document-type-container-sorter',
58
+ itemSelector: '.container-handle',
59
+ containerSelector: '.container-list',
60
+ onChange: ({ model }) => {
61
+ model.forEach((modelItem, index) => {
62
+ this._groupStructureHelper.partialUpdateContainer(modelItem.id, { sortOrder: index });
63
+ });
88
64
  },
89
- };
65
+ }));
90
66
  this._groupStructureHelper = new UmbContentTypeContainerStructureHelper(this);
91
67
  this._groups = [];
92
68
  this._hasProperties = false;
@@ -94,16 +70,15 @@ let UmbDocumentTypeWorkspaceViewEditTabElement = class UmbDocumentTypeWorkspaceV
94
70
  // Idea, maybe we can gather the sortOrder from the last group rendered and add 1 to it?
95
71
  this._groupStructureHelper.addContainer(this._ownerTabId);
96
72
  });
97
- this.sorter = new UmbSorterController(this, this.config);
98
73
  this.consumeContext(UMB_WORKSPACE_CONTEXT, (context) => {
99
74
  this._groupStructureHelper.setStructureManager(context.structure);
100
75
  this.observe(context.isSorting, (isSorting) => {
101
76
  this._sortModeActive = isSorting;
102
77
  if (isSorting) {
103
- this.sorter?.setModel(this._groups);
78
+ __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_sorter, "f").setModel(this._groups);
104
79
  }
105
80
  else {
106
- this.sorter?.setModel([]);
81
+ __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_sorter, "f").setModel([]);
107
82
  }
108
83
  }, '_observeIsSorting');
109
84
  });
@@ -118,7 +93,14 @@ let UmbDocumentTypeWorkspaceViewEditTabElement = class UmbDocumentTypeWorkspaceV
118
93
  }
119
94
  render() {
120
95
  return html `
121
- ${!this._noTabName
96
+ ${this._sortModeActive
97
+ ? html `<uui-button
98
+ id="convert-to-tab"
99
+ label=${this.localize.term('contentTypeEditor_convertToTab') + '(Not implemented)'}
100
+ look="placeholder"></uui-button>`
101
+ : ''}
102
+
103
+ ${!this._noTabName
122
104
  ? html `
123
105
  <uui-box>
124
106
  <umb-document-type-workspace-view-edit-properties
@@ -128,63 +110,77 @@ let UmbDocumentTypeWorkspaceViewEditTabElement = class UmbDocumentTypeWorkspaceV
128
110
  </uui-box>
129
111
  `
130
112
  : ''}
131
- <div id="group-list">
132
- ${repeat(this._groups, (group) => group.id ?? '' + group.name, (group) => html `<span data-umb-group-id=${ifDefined(group.id)}>
133
- <uui-box>
134
- ${this._groupStructureHelper.isOwnerChildContainer(group.id)
135
- ? html `
136
- <div slot="header">
137
- <div>
138
- ${this._sortModeActive ? html `<uui-icon name="icon-navigation"></uui-icon>` : ''}
139
-
140
- <uui-input
141
- label="Group name"
142
- placeholder="Enter a group name"
143
- value=${group.name ?? ''}
144
- @change=${(e) => {
145
- const newName = e.target.value;
146
- this._groupStructureHelper.updateContainerName(group.id, group.parent?.id ?? null, newName);
147
- }}>
148
- </uui-input>
149
- </div>
150
- ${this._sortModeActive
151
- ? html `<uui-input type="number" label="sort order" .value=${group.sortOrder ?? 0}></uui-input>`
152
- : ''}
153
- </div>
154
- `
155
- : html `<div slot="header">
156
- <div><uui-icon name="icon-merge"></uui-icon><b>${group.name ?? ''}</b> (Inherited)</div>
157
- ${!this._sortModeActive
158
- ? html `<uui-input
159
- readonly
160
- type="number"
161
- label="sort order"
162
- .value=${group.sortOrder ?? 0}></uui-input>`
163
- : ''}
164
- </div>`}
165
- </div>
166
- <umb-document-type-workspace-view-edit-properties
167
- container-id=${ifDefined(group.id)}
168
- container-type="Group"
169
- container-name=${group.name || ''}></umb-document-type-workspace-view-edit-properties>
170
- </uui-box></span>`)}
113
+ <div class="container-list" ?sort-mode-active=${this._sortModeActive}>
114
+ ${repeat(this._groups, (group) => group.id ?? '' + group.name, (group) => html `<uui-box class="container-handle">
115
+ ${__classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_instances, "m", _UmbDocumentTypeWorkspaceViewEditTabElement_renderHeader).call(this, group)}
116
+ <umb-document-type-workspace-view-edit-properties
117
+ container-id=${ifDefined(group.id)}
118
+ container-type="Group"
119
+ container-name=${group.name || ''}></umb-document-type-workspace-view-edit-properties>
120
+ </uui-box> `)}
121
+ </div>
122
+ ${__classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_instances, "m", _UmbDocumentTypeWorkspaceViewEditTabElement_renderAddGroupButton).call(this)}
171
123
  </div>
172
- ${!this._sortModeActive
173
- ? html `<uui-button
174
- label=${this.localize.term('contentTypeEditor_addGroup')}
175
- id="add"
176
- look="placeholder"
177
- @click=${__classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_onAddGroup, "f")}>
178
- ${this.localize.term('contentTypeEditor_addGroup')}
179
- </uui-button>`
180
- : ''}
181
124
  `;
182
125
  }
183
126
  };
127
+ _UmbDocumentTypeWorkspaceViewEditTabElement_sorter = new WeakMap();
184
128
  _UmbDocumentTypeWorkspaceViewEditTabElement_onAddGroup = new WeakMap();
129
+ _UmbDocumentTypeWorkspaceViewEditTabElement_instances = new WeakSet();
130
+ _UmbDocumentTypeWorkspaceViewEditTabElement_renderHeader = function _UmbDocumentTypeWorkspaceViewEditTabElement_renderHeader(group) {
131
+ const inherited = !this._groupStructureHelper.isOwnerChildContainer(group.id);
132
+ if (this._sortModeActive) {
133
+ return html `<div slot="header">
134
+ <div>
135
+ <uui-icon name=${inherited ? 'icon-merge' : 'icon-navigation'}></uui-icon>
136
+ ${__classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_instances, "m", _UmbDocumentTypeWorkspaceViewEditTabElement_renderInputGroupName).call(this, group)}
137
+ </div>
138
+ <uui-input
139
+ type="number"
140
+ label=${this.localize.term('sort_sortOrder')}
141
+ @change=${(e) => {
142
+ this._groupStructureHelper.partialUpdateContainer(group.id, {
143
+ sortOrder: parseInt(e.target.value) || 0,
144
+ });
145
+ }}
146
+ .value=${group.sortOrder || 0}
147
+ ?disabled=${inherited}></uui-input>
148
+ </div> `;
149
+ }
150
+ else {
151
+ return html `<div slot="header">
152
+ ${inherited ? html `<uui-icon name="icon-merge"></uui-icon>` : __classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_instances, "m", _UmbDocumentTypeWorkspaceViewEditTabElement_renderInputGroupName).call(this, group)}
153
+ </div> `;
154
+ }
155
+ };
156
+ _UmbDocumentTypeWorkspaceViewEditTabElement_renderInputGroupName = function _UmbDocumentTypeWorkspaceViewEditTabElement_renderInputGroupName(group) {
157
+ return html `<uui-input
158
+ label=${this.localize.term('contentTypeEditor_group')}
159
+ placeholder=${this.localize.term('placeholders_entername')}
160
+ .value=${group.name}
161
+ @change=${(e) => {
162
+ const newName = e.target.value;
163
+ this._groupStructureHelper.updateContainerName(group.id, group.parent?.id ?? null, newName);
164
+ }}></uui-input>`;
165
+ };
166
+ _UmbDocumentTypeWorkspaceViewEditTabElement_renderAddGroupButton = function _UmbDocumentTypeWorkspaceViewEditTabElement_renderAddGroupButton() {
167
+ if (this._sortModeActive)
168
+ return;
169
+ return html `<uui-button
170
+ label=${this.localize.term('contentTypeEditor_addGroup')}
171
+ id="add"
172
+ look="placeholder"
173
+ @click=${__classPrivateFieldGet(this, _UmbDocumentTypeWorkspaceViewEditTabElement_onAddGroup, "f")}>
174
+ ${this.localize.term('contentTypeEditor_addGroup')}
175
+ </uui-button>`;
176
+ };
185
177
  UmbDocumentTypeWorkspaceViewEditTabElement.styles = [
186
178
  UmbTextStyles,
187
179
  css `
180
+ [drag-placeholder] {
181
+ opacity: 0.2;
182
+ }
183
+
188
184
  #add {
189
185
  width: 100%;
190
186
  }
@@ -192,6 +188,7 @@ UmbDocumentTypeWorkspaceViewEditTabElement.styles = [
192
188
  #add:first-child {
193
189
  margin-top: var(--uui-size-layout-1);
194
190
  }
191
+
195
192
  uui-box {
196
193
  margin-bottom: var(--uui-size-layout-1);
197
194
  }
@@ -202,6 +199,7 @@ UmbDocumentTypeWorkspaceViewEditTabElement.styles = [
202
199
  }
203
200
 
204
201
  div[slot='header'] {
202
+ flex: 1;
205
203
  display: flex;
206
204
  align-items: center;
207
205
  justify-content: space-between;
@@ -217,20 +215,18 @@ UmbDocumentTypeWorkspaceViewEditTabElement.styles = [
217
215
  max-width: 75px;
218
216
  }
219
217
 
220
- .sorting {
218
+ [sort-mode-active] div[slot='header'] {
221
219
  cursor: grab;
222
220
  }
223
221
 
224
- .--umb-sorter-placeholder > uui-box {
225
- visibility: hidden;
222
+ .container-list {
223
+ display: grid;
224
+ gap: 10px;
226
225
  }
227
226
 
228
- .--umb-sorter-placeholder::after {
229
- content: '';
230
- inset: 0;
231
- position: absolute;
232
- border-radius: var(--uui-border-radius);
233
- border: 1px dashed var(--uui-color-divider-emphasis);
227
+ #convert-to-tab {
228
+ margin-bottom: var(--uui-size-layout-1);
229
+ display: flex;
234
230
  }
235
231
  `,
236
232
  ];