@portel/photon 1.17.2 → 1.17.3
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.
- package/dist/beam-form.bundle.js +186 -2
- package/dist/beam-form.bundle.js.map +4 -4
- package/dist/beam.bundle.js +222 -20
- package/dist/beam.bundle.js.map +4 -4
- package/package.json +2 -2
package/dist/beam-form.bundle.js
CHANGED
|
@@ -1782,6 +1782,187 @@ function showToast(message, type = "info", duration = 3e3, action) {
|
|
|
1782
1782
|
ToastManager.show(message, type, duration, action);
|
|
1783
1783
|
}
|
|
1784
1784
|
|
|
1785
|
+
// src/auto-ui/frontend/components/confirm-dialog.ts
|
|
1786
|
+
var ConfirmDialog = class extends i4 {
|
|
1787
|
+
constructor() {
|
|
1788
|
+
super(...arguments);
|
|
1789
|
+
this.open = false;
|
|
1790
|
+
this.message = "";
|
|
1791
|
+
this.confirmLabel = "OK";
|
|
1792
|
+
this.cancelLabel = "Cancel";
|
|
1793
|
+
this.destructive = false;
|
|
1794
|
+
}
|
|
1795
|
+
show(message, options) {
|
|
1796
|
+
this.message = message;
|
|
1797
|
+
this.confirmLabel = options?.confirm ?? "OK";
|
|
1798
|
+
this.cancelLabel = options?.cancel ?? "Cancel";
|
|
1799
|
+
this.destructive = options?.destructive ?? false;
|
|
1800
|
+
this.open = true;
|
|
1801
|
+
return new Promise((resolve) => {
|
|
1802
|
+
this._resolve = resolve;
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
_handleConfirm() {
|
|
1806
|
+
this.open = false;
|
|
1807
|
+
this._resolve?.(true);
|
|
1808
|
+
}
|
|
1809
|
+
_handleCancel() {
|
|
1810
|
+
this.open = false;
|
|
1811
|
+
this._resolve?.(false);
|
|
1812
|
+
}
|
|
1813
|
+
_handleKeydown(e5) {
|
|
1814
|
+
if (e5.key === "Escape") this._handleCancel();
|
|
1815
|
+
if (e5.key === "Enter") this._handleConfirm();
|
|
1816
|
+
}
|
|
1817
|
+
render() {
|
|
1818
|
+
return b2`
|
|
1819
|
+
<div class="dialog" @keydown=${(e5) => this._handleKeydown(e5)}>
|
|
1820
|
+
<div class="message">${this.message}</div>
|
|
1821
|
+
<div class="actions">
|
|
1822
|
+
<button class="btn-cancel" @click=${() => this._handleCancel()}>
|
|
1823
|
+
${this.cancelLabel}
|
|
1824
|
+
</button>
|
|
1825
|
+
<button
|
|
1826
|
+
class="btn-confirm ${this.destructive ? "destructive" : ""}"
|
|
1827
|
+
@click=${() => this._handleConfirm()}
|
|
1828
|
+
>
|
|
1829
|
+
${this.confirmLabel}
|
|
1830
|
+
</button>
|
|
1831
|
+
</div>
|
|
1832
|
+
</div>
|
|
1833
|
+
`;
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
ConfirmDialog.styles = [
|
|
1837
|
+
theme,
|
|
1838
|
+
i`
|
|
1839
|
+
:host {
|
|
1840
|
+
display: none;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
@keyframes backdrop-in {
|
|
1844
|
+
from {
|
|
1845
|
+
opacity: 0;
|
|
1846
|
+
}
|
|
1847
|
+
to {
|
|
1848
|
+
opacity: 1;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
@keyframes content-in {
|
|
1853
|
+
from {
|
|
1854
|
+
opacity: 0;
|
|
1855
|
+
transform: scale(0.95) translateY(8px);
|
|
1856
|
+
}
|
|
1857
|
+
to {
|
|
1858
|
+
opacity: 1;
|
|
1859
|
+
transform: scale(1) translateY(0);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
:host([open]) {
|
|
1864
|
+
display: flex;
|
|
1865
|
+
position: fixed;
|
|
1866
|
+
inset: 0;
|
|
1867
|
+
background: rgba(0, 0, 0, 0.6);
|
|
1868
|
+
backdrop-filter: blur(4px);
|
|
1869
|
+
z-index: 10001;
|
|
1870
|
+
align-items: center;
|
|
1871
|
+
justify-content: center;
|
|
1872
|
+
animation: backdrop-in 0.15s ease-out both;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
.dialog {
|
|
1876
|
+
background: var(--bg-panel);
|
|
1877
|
+
border: 1px solid var(--border-glass);
|
|
1878
|
+
border-radius: var(--radius-md, 12px);
|
|
1879
|
+
padding: 24px;
|
|
1880
|
+
max-width: 400px;
|
|
1881
|
+
width: 90%;
|
|
1882
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
|
|
1883
|
+
animation: content-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
1884
|
+
animation-delay: 0.05s;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
.message {
|
|
1888
|
+
font-size: 14px;
|
|
1889
|
+
line-height: 1.5;
|
|
1890
|
+
color: var(--t-primary);
|
|
1891
|
+
margin-bottom: 20px;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
.actions {
|
|
1895
|
+
display: flex;
|
|
1896
|
+
justify-content: flex-end;
|
|
1897
|
+
gap: 8px;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
button {
|
|
1901
|
+
padding: 8px 16px;
|
|
1902
|
+
border-radius: var(--radius-sm, 6px);
|
|
1903
|
+
font-size: 13px;
|
|
1904
|
+
font-weight: 500;
|
|
1905
|
+
cursor: pointer;
|
|
1906
|
+
transition: all 0.15s ease;
|
|
1907
|
+
font-family: inherit;
|
|
1908
|
+
border: none;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
.btn-cancel {
|
|
1912
|
+
background: var(--bg-glass);
|
|
1913
|
+
color: var(--t-primary);
|
|
1914
|
+
border: 1px solid var(--border-glass);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
.btn-cancel:hover {
|
|
1918
|
+
background: var(--bg-glass-strong, rgba(255, 255, 255, 0.08));
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.btn-confirm {
|
|
1922
|
+
background: var(--accent);
|
|
1923
|
+
color: #fff;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
.btn-confirm:hover {
|
|
1927
|
+
opacity: 0.9;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
.btn-confirm.destructive {
|
|
1931
|
+
background: hsl(0, 60%, 50%);
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
.btn-confirm.destructive:hover {
|
|
1935
|
+
background: hsl(0, 60%, 45%);
|
|
1936
|
+
}
|
|
1937
|
+
`
|
|
1938
|
+
];
|
|
1939
|
+
__decorateClass([
|
|
1940
|
+
n4({ type: Boolean, reflect: true })
|
|
1941
|
+
], ConfirmDialog.prototype, "open", 2);
|
|
1942
|
+
__decorateClass([
|
|
1943
|
+
n4({ type: String })
|
|
1944
|
+
], ConfirmDialog.prototype, "message", 2);
|
|
1945
|
+
__decorateClass([
|
|
1946
|
+
n4({ type: String })
|
|
1947
|
+
], ConfirmDialog.prototype, "confirmLabel", 2);
|
|
1948
|
+
__decorateClass([
|
|
1949
|
+
n4({ type: String })
|
|
1950
|
+
], ConfirmDialog.prototype, "cancelLabel", 2);
|
|
1951
|
+
__decorateClass([
|
|
1952
|
+
n4({ type: Boolean })
|
|
1953
|
+
], ConfirmDialog.prototype, "destructive", 2);
|
|
1954
|
+
ConfirmDialog = __decorateClass([
|
|
1955
|
+
t3("confirm-dialog")
|
|
1956
|
+
], ConfirmDialog);
|
|
1957
|
+
async function confirmDialog(message, options) {
|
|
1958
|
+
let dialog = document.querySelector("confirm-dialog");
|
|
1959
|
+
if (!dialog) {
|
|
1960
|
+
dialog = document.createElement("confirm-dialog");
|
|
1961
|
+
document.body.appendChild(dialog);
|
|
1962
|
+
}
|
|
1963
|
+
return dialog.show(message, options);
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1785
1966
|
// src/auto-ui/frontend/utils/format-label.ts
|
|
1786
1967
|
function formatLabel(name) {
|
|
1787
1968
|
if (!name) return name;
|
|
@@ -3365,8 +3546,11 @@ var InvokeForm = class extends i4 {
|
|
|
3365
3546
|
this.dispatchEvent(new CustomEvent("submit", { detail: { args: this._values } }));
|
|
3366
3547
|
}
|
|
3367
3548
|
/** Cancel with dirty check. Called by parent chrome wrapper. */
|
|
3368
|
-
handleCancel() {
|
|
3369
|
-
if (this.isDirty && !
|
|
3549
|
+
async handleCancel() {
|
|
3550
|
+
if (this.isDirty && !await confirmDialog("You have unsaved changes. Discard them?", {
|
|
3551
|
+
confirm: "Discard",
|
|
3552
|
+
destructive: true
|
|
3553
|
+
})) {
|
|
3370
3554
|
return;
|
|
3371
3555
|
}
|
|
3372
3556
|
this.dispatchEvent(new CustomEvent("cancel"));
|