{
await super.willUpdate(changedProperties);
//console.log("files willUpdate", Array.from(changedProperties.keys()), this.uid, this.weavy)
if (
(changedProperties.has("uid") || changedProperties.has("weavy") || changedProperties.has("user")) &&
this.uid &&
this.weavy &&
this.user
) {
this.persistState.observe(
[
{ name: "view", override: true },
{ name: "order", override: true },
{ name: "showTrashed", override: true },
],
this.uid.toString(),
`u${this.user.id}`,
);
//this.history.observe(['view'], this.uid.toString())
}
}
protected override render() {
const isDragActive = this.componentFeatures?.allowsFeature(Feature.FileUpload) && this.dropZone.isDragActive;
const header = normalizeAppearanceMode(this.header);
return html`
${header !== "none"
? html`
{
if (e.detail.file && e.detail.action === ActionType.Edit) {
this.preview(e.detail.file.id, { edit: true });
} else if (isActionEvent(e, ActionKindType.File) && e.detail.file && e.detail.action === ActionType.Select) {
// Only selects the created file. It is not highlighted, because loading the list around a
// file outside the loaded pages makes the infinite pagers load pages repeatedly.
this.selectedId = e.detail.file.id;
}
}}
@order=${(e: OrderEventType) => {
this.order = e.detail.order;
}}
@show-trashed=${(e: ShowTrashedEventType) => {
this.showTrashed = e.detail.showTrashed;
}}
@view=${(e: ViewEventType) => {
this.view = e.detail.view;
}}
@subscribe=${(e: SubscribeEventType) => this.subscribe(e.detail.subscribe)}
>
`
: nothing}
) => {
this.order = e.detail.order;
}}
@wy-action=${(e: WyActionEventType) => {
if (isActionEvent(e, ActionKindType.File) && e.detail.action === ActionType.Select) {
this.selectedId = e.detail.file?.id;
}
}}
>
`;
}
}