Implement deletion button to permanently delete collections

This commit is contained in:
Lennart
2025-06-23 13:48:00 +02:00
parent 7d18faff69
commit 79b67a17c3
15 changed files with 301 additions and 252 deletions

View File

@@ -1,10 +1,11 @@
import { i as c, x as u } from "./lit-CWlWuEHk.mjs";
import { e as d, n as m, a as o, t as h } from "./ref-DuYNkSJ_.mjs";
import { n as o, t as h } from "./property-DYFkTqgI.mjs";
import { e as d, n as m } from "./ref-nf9JiOyl.mjs";
import { a as b } from "./webdav-Bz4I5vNH.mjs";
var y = Object.defineProperty, f = Object.getOwnPropertyDescriptor, a = (t, s, l, r) => {
for (var e = r > 1 ? void 0 : r ? f(s, l) : s, n = t.length - 1, p; n >= 0; n--)
(p = t[n]) && (e = (r ? p(s, l, e) : p(e)) || e);
return r && e && y(s, l, e), e;
var y = Object.defineProperty, f = Object.getOwnPropertyDescriptor, r = (t, a, n, s) => {
for (var e = s > 1 ? void 0 : s ? f(a, n) : a, l = t.length - 1, p; l >= 0; l--)
(p = t[l]) && (e = (s ? p(a, n, e) : p(e)) || e);
return s && e && y(a, n, e), e;
};
let i = class extends c {
constructor() {
@@ -65,19 +66,19 @@ let i = class extends c {
}), window.location.reload(), null;
}
};
a([
r([
o()
], i.prototype, "user", 2);
a([
r([
o()
], i.prototype, "id", 2);
a([
r([
o()
], i.prototype, "displayname", 2);
a([
r([
o()
], i.prototype, "description", 2);
i = a([
i = r([
h("create-addressbook-form")
], i);
export {

View File

@@ -1,14 +1,15 @@
import { i as u, x as c } from "./lit-CWlWuEHk.mjs";
import { e as d, n as m, a as o, t as h } from "./ref-DuYNkSJ_.mjs";
import { n as o, t as h } from "./property-DYFkTqgI.mjs";
import { e as m, n as d } from "./ref-nf9JiOyl.mjs";
import { a as b } from "./webdav-Bz4I5vNH.mjs";
var y = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, a = (t, e, l, s) => {
for (var i = s > 1 ? void 0 : s ? $(e, l) : e, n = t.length - 1, p; n >= 0; n--)
(p = t[n]) && (i = (s ? p(e, l, i) : p(i)) || i);
return s && i && y(e, l, i), i;
var y = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, a = (t, e, n, s) => {
for (var i = s > 1 ? void 0 : s ? $(e, n) : e, l = t.length - 1, p; l >= 0; l--)
(p = t[l]) && (i = (s ? p(e, n, i) : p(i)) || i);
return s && i && y(e, n, i), i;
};
let r = class extends u {
constructor() {
super(), this.client = b("/caldav"), this.user = "", this.id = "", this.displayname = "", this.description = "", this.color = "", this.subscriptionUrl = "", this.components = /* @__PURE__ */ new Set(), this.dialog = d(), this.form = d();
super(), this.client = b("/caldav"), this.user = "", this.id = "", this.displayname = "", this.description = "", this.color = "", this.subscriptionUrl = "", this.components = /* @__PURE__ */ new Set(), this.dialog = m(), this.form = m();
}
createRenderRoot() {
return this;
@@ -16,9 +17,9 @@ let r = class extends u {
render() {
return c`
<button @click=${() => this.dialog.value.showModal()}>Create calendar</button>
<dialog ${m(this.dialog)}>
<dialog ${d(this.dialog)}>
<h3>Create calendar</h3>
<form @submit=${this.submit} ${m(this.form)}>
<form @submit=${this.submit} ${d(this.form)}>
<label>
id
<input type="text" name="id" @change=${(t) => this.id = t.target.value} />

View File

@@ -0,0 +1,46 @@
import { i as c, x as p } from "./lit-CWlWuEHk.mjs";
import { n as h, t as u } from "./property-DYFkTqgI.mjs";
var f = Object.defineProperty, d = Object.getOwnPropertyDescriptor, i = (r, t, n, o) => {
for (var e = o > 1 ? void 0 : o ? d(t, n) : t, l = r.length - 1, a; l >= 0; l--)
(a = r[l]) && (e = (o ? a(t, n, e) : a(e)) || e);
return o && e && f(t, n, e), e;
};
let s = class extends c {
constructor() {
super(), this.trash = !1;
}
createRenderRoot() {
return this;
}
render() {
let r = this.trash ? "Move to trash" : "Delete";
return p`<button class="delete" @click=${(t) => this._onClick(t)}>${r}</button>`;
}
async _onClick(r) {
if (r.preventDefault(), !this.trash && !confirm("Do you want to delete this collection permanently?"))
return;
let t = await fetch(this.href, {
method: "DELETE",
headers: {
"X-No-Trashbin": this.trash ? "0" : "1"
}
});
if (t.status < 200 || t.status >= 300) {
alert("An error occured, look into the console"), console.error(t);
return;
}
window.location.reload();
}
};
i([
h({ type: Boolean })
], s.prototype, "trash", 2);
i([
h()
], s.prototype, "href", 2);
s = i([
u("delete-button")
], s);
export {
s as DeleteButton
};

View File

@@ -0,0 +1,47 @@
import { f as d, u as l } from "./lit-CWlWuEHk.mjs";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const f = (t) => (r, e) => {
e !== void 0 ? e.addInitializer(() => {
customElements.define(t, r);
}) : customElements.define(t, r);
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const p = { attribute: !0, type: String, converter: l, reflect: !1, hasChanged: d }, u = (t = p, r, e) => {
const { kind: i, metadata: a } = e;
let n = globalThis.litPropertyMetadata.get(a);
if (n === void 0 && globalThis.litPropertyMetadata.set(a, n = /* @__PURE__ */ new Map()), i === "setter" && ((t = Object.create(t)).wrapped = !0), n.set(e.name, t), i === "accessor") {
const { name: o } = e;
return { set(s) {
const c = r.get.call(this);
r.set.call(this, s), this.requestUpdate(o, c, t);
}, init(s) {
return s !== void 0 && this.C(o, void 0, t, s), s;
} };
}
if (i === "setter") {
const { name: o } = e;
return function(s) {
const c = this[o];
r.call(this, s), this.requestUpdate(o, c, t);
};
}
throw Error("Unsupported decorator location: " + i);
};
function m(t) {
return (r, e) => typeof e == "object" ? u(t, r, e) : ((i, a, n) => {
const o = a.hasOwnProperty(n);
return a.constructor.createProperty(n, i), o ? Object.getOwnPropertyDescriptor(a, n) : void 0;
})(t, r, e);
}
export {
m as n,
f as t
};

View File

@@ -1,172 +0,0 @@
import { f, u as _, E as $ } from "./lit-CWlWuEHk.mjs";
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const T = (t) => (e, s) => {
s !== void 0 ? s.addInitializer(() => {
customElements.define(t, e);
}) : customElements.define(t, e);
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const A = { attribute: !0, type: String, converter: _, reflect: !1, hasChanged: f }, p = (t = A, e, s) => {
const { kind: i, metadata: n } = s;
let r = globalThis.litPropertyMetadata.get(n);
if (r === void 0 && globalThis.litPropertyMetadata.set(n, r = /* @__PURE__ */ new Map()), i === "setter" && ((t = Object.create(t)).wrapped = !0), r.set(s.name, t), i === "accessor") {
const { name: o } = s;
return { set(h) {
const l = e.get.call(this);
e.set.call(this, h), this.requestUpdate(o, l, t);
}, init(h) {
return h !== void 0 && this.C(o, void 0, t, h), h;
} };
}
if (i === "setter") {
const { name: o } = s;
return function(h) {
const l = this[o];
e.call(this, h), this.requestUpdate(o, l, t);
};
}
throw Error("Unsupported decorator location: " + i);
};
function O(t) {
return (e, s) => typeof s == "object" ? p(t, e, s) : ((i, n, r) => {
const o = n.hasOwnProperty(r);
return n.constructor.createProperty(r, i), o ? Object.getOwnPropertyDescriptor(n, r) : void 0;
})(t, e, s);
}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const v = (t) => t.strings === void 0;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const g = { CHILD: 2 }, C = (t) => (...e) => ({ _$litDirective$: t, values: e });
class m {
constructor(e) {
}
get _$AU() {
return this._$AM._$AU;
}
_$AT(e, s, i) {
this._$Ct = e, this._$AM = s, this._$Ci = i;
}
_$AS(e, s) {
return this.update(e, s);
}
update(e, s) {
return this.render(...s);
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const c = (t, e) => {
var i;
const s = t._$AN;
if (s === void 0) return !1;
for (const n of s) (i = n._$AO) == null || i.call(n, e, !1), c(n, e);
return !0;
}, a = (t) => {
let e, s;
do {
if ((e = t._$AM) === void 0) break;
s = e._$AN, s.delete(t), t = e;
} while ((s == null ? void 0 : s.size) === 0);
}, u = (t) => {
for (let e; e = t._$AM; t = e) {
let s = e._$AN;
if (s === void 0) e._$AN = s = /* @__PURE__ */ new Set();
else if (s.has(t)) break;
s.add(t), M(e);
}
};
function y(t) {
this._$AN !== void 0 ? (a(this), this._$AM = t, u(this)) : this._$AM = t;
}
function G(t, e = !1, s = 0) {
const i = this._$AH, n = this._$AN;
if (n !== void 0 && n.size !== 0) if (e) if (Array.isArray(i)) for (let r = s; r < i.length; r++) c(i[r], !1), a(i[r]);
else i != null && (c(i, !1), a(i));
else c(this, t);
}
const M = (t) => {
t.type == g.CHILD && (t._$AP ?? (t._$AP = G), t._$AQ ?? (t._$AQ = y));
};
class b extends m {
constructor() {
super(...arguments), this._$AN = void 0;
}
_$AT(e, s, i) {
super._$AT(e, s, i), u(this), this.isConnected = e._$AU;
}
_$AO(e, s = !0) {
var i, n;
e !== this.isConnected && (this.isConnected = e, e ? (i = this.reconnected) == null || i.call(this) : (n = this.disconnected) == null || n.call(this)), s && (c(this, e), a(this));
}
setValue(e) {
if (v(this._$Ct)) this._$Ct._$AI(e, this);
else {
const s = [...this._$Ct._$AH];
s[this._$Ci] = e, this._$Ct._$AI(s, this, 0);
}
}
disconnected() {
}
reconnected() {
}
}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const P = () => new w();
class w {
}
const d = /* @__PURE__ */ new WeakMap(), U = C(class extends b {
render(t) {
return $;
}
update(t, [e]) {
var i;
const s = e !== this.G;
return s && this.G !== void 0 && this.rt(void 0), (s || this.lt !== this.ct) && (this.G = e, this.ht = (i = t.options) == null ? void 0 : i.host, this.rt(this.ct = t.element)), $;
}
rt(t) {
if (this.isConnected || (t = void 0), typeof this.G == "function") {
const e = this.ht ?? globalThis;
let s = d.get(e);
s === void 0 && (s = /* @__PURE__ */ new WeakMap(), d.set(e, s)), s.get(this.G) !== void 0 && this.G.call(this.ht, void 0), s.set(this.G, t), t !== void 0 && this.G.call(this.ht, t);
} else this.G.value = t;
}
get lt() {
var t, e;
return typeof this.G == "function" ? (t = d.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.G) : (e = this.G) == null ? void 0 : e.value;
}
disconnected() {
this.lt === this.ct && this.rt(void 0);
}
reconnected() {
this.rt(this.ct);
}
});
export {
O as a,
P as e,
U as n,
T as t
};

View File

@@ -0,0 +1,128 @@
import { E as $ } from "./lit-CWlWuEHk.mjs";
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const d = (t) => t.strings === void 0;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const _ = { CHILD: 2 }, a = (t) => (...s) => ({ _$litDirective$: t, values: s });
class A {
constructor(s) {
}
get _$AU() {
return this._$AM._$AU;
}
_$AT(s, e, i) {
this._$Ct = s, this._$AM = e, this._$Ci = i;
}
_$AS(s, e) {
return this.update(s, e);
}
update(s, e) {
return this.render(...e);
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const n = (t, s) => {
var i;
const e = t._$AN;
if (e === void 0) return !1;
for (const h of e) (i = h._$AO) == null || i.call(h, s, !1), n(h, s);
return !0;
}, r = (t) => {
let s, e;
do {
if ((s = t._$AM) === void 0) break;
e = s._$AN, e.delete(t), t = s;
} while ((e == null ? void 0 : e.size) === 0);
}, l = (t) => {
for (let s; s = t._$AM; t = s) {
let e = s._$AN;
if (e === void 0) s._$AN = e = /* @__PURE__ */ new Set();
else if (e.has(t)) break;
e.add(t), v(s);
}
};
function f(t) {
this._$AN !== void 0 ? (r(this), this._$AM = t, l(this)) : this._$AM = t;
}
function u(t, s = !1, e = 0) {
const i = this._$AH, h = this._$AN;
if (h !== void 0 && h.size !== 0) if (s) if (Array.isArray(i)) for (let o = e; o < i.length; o++) n(i[o], !1), r(i[o]);
else i != null && (n(i, !1), r(i));
else n(this, t);
}
const v = (t) => {
t.type == _.CHILD && (t._$AP ?? (t._$AP = u), t._$AQ ?? (t._$AQ = f));
};
class p extends A {
constructor() {
super(...arguments), this._$AN = void 0;
}
_$AT(s, e, i) {
super._$AT(s, e, i), l(this), this.isConnected = s._$AU;
}
_$AO(s, e = !0) {
var i, h;
s !== this.isConnected && (this.isConnected = s, s ? (i = this.reconnected) == null || i.call(this) : (h = this.disconnected) == null || h.call(this)), e && (n(this, s), r(this));
}
setValue(s) {
if (d(this._$Ct)) this._$Ct._$AI(s, this);
else {
const e = [...this._$Ct._$AH];
e[this._$Ci] = s, this._$Ct._$AI(e, this, 0);
}
}
disconnected() {
}
reconnected() {
}
}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const g = () => new C();
class C {
}
const c = /* @__PURE__ */ new WeakMap(), M = a(class extends p {
render(t) {
return $;
}
update(t, [s]) {
var i;
const e = s !== this.G;
return e && this.G !== void 0 && this.rt(void 0), (e || this.lt !== this.ct) && (this.G = s, this.ht = (i = t.options) == null ? void 0 : i.host, this.rt(this.ct = t.element)), $;
}
rt(t) {
if (this.isConnected || (t = void 0), typeof this.G == "function") {
const s = this.ht ?? globalThis;
let e = c.get(s);
e === void 0 && (e = /* @__PURE__ */ new WeakMap(), c.set(s, e)), e.get(this.G) !== void 0 && this.G.call(this.ht, void 0), e.set(this.G, t), t !== void 0 && this.G.call(this.ht, t);
} else this.G.value = t;
}
get lt() {
var t, s;
return typeof this.G == "function" ? (t = c.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.G) : (s = this.G) == null ? void 0 : s.value;
}
disconnected() {
this.lt === this.ct && this.rt(void 0);
}
reconnected() {
this.rt(this.ct);
}
});
export {
g as e,
M as n
};

View File

@@ -160,12 +160,12 @@ table {
display: grid;
min-height: 80px;
grid-template-areas:
". . color-chip"
"title comps color-chip"
"description . color-chip"
"subscription-url . color-chip"
"actions . color-chip"
". . color-chip";
". . color-chip"
"title comps color-chip"
"description description color-chip"
"subscription-url subscription-url color-chip"
"actions actions color-chip"
". . color-chip";
grid-template-rows: 12px auto auto auto auto 12px;
grid-template-columns: min-content auto 80px;
color: inherit;
@@ -220,6 +220,8 @@ table {
.actions {
grid-area: actions;
width: fit-content;
display: flex;
gap: 12px;
}
&:hover {