entityKey to entityId

This commit is contained in:
Niels Lyngsø
2023-04-04 13:50:04 +02:00
parent 9e31bad997
commit 43e4fd2e50
9 changed files with 35 additions and 35 deletions

View File

@@ -22,17 +22,17 @@ export class UmbDocumentTypeWorkspaceViewEditTabElement extends UmbLitElement {
`,
];
private _ownerTabKey?: string | undefined;
private _ownerTabId?: string | undefined;
@property({ type: String })
public get ownerTabKey(): string | undefined {
return this._ownerTabKey;
public get ownerTabId(): string | undefined {
return this._ownerTabId;
}
public set ownerTabKey(value: string | undefined) {
if (value === this._ownerTabKey) return;
const oldValue = this._ownerTabKey;
this._ownerTabKey = value;
this.requestUpdate('ownerTabKey', oldValue);
public set ownerTabId(value: string | undefined) {
if (value === this._ownerTabId) return;
const oldValue = this._ownerTabId;
this._ownerTabId = value;
this.requestUpdate('ownerTabId', oldValue);
}
private _tabName?: string | undefined;
@@ -78,7 +78,7 @@ export class UmbDocumentTypeWorkspaceViewEditTabElement extends UmbLitElement {
#onAddGroup = () => {
// Idea, maybe we can gather the sortOrder from the last group rendered and add 1 to it?
this._groupStructureHelper.addGroup(this._ownerTabKey);
this._groupStructureHelper.addGroup(this._ownerTabId);
};
render() {

View File

@@ -92,7 +92,7 @@ export class UmbDocumentTypeWorkspaceViewEditElement extends UmbLitElement {
component: () => import('./document-type-workspace-view-edit-tab.element'),
setup: (component: Promise<HTMLElement>) => {
(component as any).tabName = tabName;
(component as any).ownerTabKey = tab.id;
(component as any).ownerTabId = tab.id;
},
});
});

View File

@@ -200,7 +200,7 @@ export class UmbWorkspacePackageBuilderElement extends UmbLitElement {
.value=${this._package.contentNodeId ?? ''}
max="1"
@change="${(e: CustomEvent) =>
(this._package.contentNodeId = (e.target as UmbInputDocumentPickerElement).selectedKeys[0])}">
(this._package.contentNodeId = (e.target as UmbInputDocumentPickerElement).selectedIds[0])}">
</umb-input-document-picker>
<uui-checkbox
label="Include child nodes"
@@ -216,9 +216,9 @@ export class UmbWorkspacePackageBuilderElement extends UmbLitElement {
return html`
<div slot="editor">
<umb-input-media-picker
.selectedKeys=${this._package.mediaIds ?? []}
.selectedIds=${this._package.mediaIds ?? []}
@change="${(e: CustomEvent) =>
(this._package.mediaIds = (e.target as UmbInputMediaPickerElement).selectedKeys)}"></umb-input-media-picker>
(this._package.mediaIds = (e.target as UmbInputMediaPickerElement).selectedIds)}"></umb-input-media-picker>
<uui-checkbox
label="Include child nodes"
.checked="${this._package.mediaLoadChildNodes ?? false}"

View File

@@ -61,12 +61,12 @@ export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElemen
@property({ type: String, attribute: 'min-message' })
maxMessage = 'This field exceeds the allowed amount of items';
// TODO: do we need both selectedKeys and value? If we just use value we follow the same pattern as native form controls.
// TODO: do we need both selectedIds and value? If we just use value we follow the same pattern as native form controls.
private _selectedIds: Array<string> = [];
public get selectedKeys(): Array<string> {
public get selectedIds(): Array<string> {
return this._selectedIds;
}
public set selectedKeys(ids: Array<string>) {
public set selectedIds(ids: Array<string>) {
this._selectedIds = ids;
super.value = ids.join(',');
this._observePickedDocuments();
@@ -75,7 +75,7 @@ export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElemen
@property()
public set value(idsString: string) {
if (idsString !== this._value) {
this.selectedKeys = idsString.split(/[ ,]+/);
this.selectedIds = idsString.split(/[ ,]+/);
}
}
@@ -150,7 +150,7 @@ export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElemen
}
private _setSelection(newSelection: Array<string>) {
this.selectedKeys = newSelection;
this.selectedIds = newSelection;
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
}

View File

@@ -28,12 +28,12 @@ export class UmbInputDocumentTypePickerElement extends FormControlMixin(UmbLitEl
`,
];
// TODO: do we need both selectedKeys and value? If we just use value we follow the same pattern as native form controls.
// TODO: do we need both selectedIds and value? If we just use value we follow the same pattern as native form controls.
private _selectedIds: Array<string> = [];
public get selectedKeys(): Array<string> {
public get selectedIds(): Array<string> {
return this._selectedIds;
}
public set selectedKeys(ids: Array<string>) {
public set selectedIds(ids: Array<string>) {
this._selectedIds = ids;
super.value = ids.join(',');
this._observePickedDocuments();
@@ -42,7 +42,7 @@ export class UmbInputDocumentTypePickerElement extends FormControlMixin(UmbLitEl
@property()
public set value(idsString: string) {
if (idsString !== this._value) {
this.selectedKeys = idsString.split(/[ ,]+/);
this.selectedIds = idsString.split(/[ ,]+/);
}
}
@@ -80,7 +80,7 @@ export class UmbInputDocumentTypePickerElement extends FormControlMixin(UmbLitEl
}
private _openPicker() {
// We send a shallow copy(good enough as its just an array of keys) of our this._selectedKeys, as we don't want the modal to manipulate our data:
// We send a shallow copy(good enough as its just an array of keys) of our this._selectedIds, as we don't want the modal to manipulate our data:
const modalHandler = this._modalContext?.open(UMB_DOCUMENT_TYPE_PICKER_MODAL, {
multiple: true,
selection: [...this._selectedIds],
@@ -105,7 +105,7 @@ export class UmbInputDocumentTypePickerElement extends FormControlMixin(UmbLitEl
}
private _setSelection(newSelection: Array<string>) {
this.selectedKeys = newSelection;
this.selectedIds = newSelection;
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
}

View File

@@ -72,12 +72,12 @@ export class UmbInputMediaPickerElement extends FormControlMixin(UmbLitElement)
@property({ type: String, attribute: 'min-message' })
maxMessage = 'This field exceeds the allowed amount of items';
// TODO: do we need both selectedKeys and value? If we just use value we follow the same pattern as native form controls.
// TODO: do we need both selectedIds and value? If we just use value we follow the same pattern as native form controls.
private _selectedIds: Array<string> = [];
public get selectedKeys(): Array<string> {
public get selectedIds(): Array<string> {
return this._selectedIds;
}
public set selectedKeys(ids: Array<string>) {
public set selectedIds(ids: Array<string>) {
this._selectedIds = ids;
super.value = ids.join(',');
this._observePickedMedias();
@@ -86,7 +86,7 @@ export class UmbInputMediaPickerElement extends FormControlMixin(UmbLitElement)
@property()
public set value(idsString: string) {
if (idsString !== this._value) {
this.selectedKeys = idsString.split(/[ ,]+/);
this.selectedIds = idsString.split(/[ ,]+/);
}
}
@@ -139,7 +139,7 @@ export class UmbInputMediaPickerElement extends FormControlMixin(UmbLitElement)
}
private _openPicker() {
// We send a shallow copy(good enough as its just an array of keys) of our this._selectedKeys, as we don't want the modal to manipulate our data:
// We send a shallow copy(good enough as its just an array of keys) of our this._selectedIds, as we don't want the modal to manipulate our data:
const modalHandler = this._modalContext?.open(UMB_MEDIA_PICKER_MODAL, {
multiple: this.max === 1 ? false : true,
selection: [...this._selectedIds],
@@ -165,7 +165,7 @@ export class UmbInputMediaPickerElement extends FormControlMixin(UmbLitElement)
}
private _setSelection(newSelection: Array<string>) {
this.selectedKeys = newSelection;
this.selectedIds = newSelection;
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
}

View File

@@ -54,7 +54,7 @@ export class UmbPropertyEditorUICheckboxListElement extends UmbLitElement implem
render() {
return html`<umb-input-checkbox-list
@change="${this.#onChange}"
.selectedKeys="${this.#value}"
.selectedIds="${this.#value}"
.list="${this._list}"></umb-input-checkbox-list>`;
}
}

View File

@@ -32,7 +32,7 @@ export class UmbPropertyEditorUIContentPickerElement extends UmbLitElement imple
private _limitMax?: number;
private _onChange(event: CustomEvent) {
this.value = (event.target as UmbInputDocumentPickerElement).selectedKeys;
this.value = (event.target as UmbInputDocumentPickerElement).selectedIds;
this.dispatchEvent(new CustomEvent('property-value-change'));
}
@@ -41,7 +41,7 @@ export class UmbPropertyEditorUIContentPickerElement extends UmbLitElement imple
return html`
<umb-input-document-picker
@change=${this._onChange}
.selectedKeys=${this._value}
.selectedIds=${this._value}
.min=${this._limitMin}
.max=${this._limitMax}
>Add</umb-input-document-picker

View File

@@ -35,7 +35,7 @@ export class UmbPropertyEditorUIMediaPickerElement extends UmbLitElement impleme
private _limitMax?: number;
private _onChange(event: CustomEvent) {
this.value = (event.target as UmbInputMediaPickerElement).selectedKeys;
this.value = (event.target as UmbInputMediaPickerElement).selectedIds;
this.dispatchEvent(new CustomEvent('property-value-change'));
}
@@ -43,7 +43,7 @@ export class UmbPropertyEditorUIMediaPickerElement extends UmbLitElement impleme
return html`
<umb-input-media-picker
@change=${this._onChange}
.selectedKeys=${this._value}
.selectedIds=${this._value}
.min=${this._limitMin}
.max=${this._limitMax}
>Add</umb-input-media-picker