docblocks-react-ui 0.8.2 → 0.8.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/CHANGELOG.md +15 -0
- package/dist/{Editor-ByjnrYiw.mjs → Editor-PO0xG3XK.mjs} +200 -155
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/mermaid/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e207327: The database grid's datetime cell commits the draft (the picked date + the
|
|
8
|
+
typed time) on Enter over the open picker and closes it, and Escape cancels
|
|
9
|
+
the in-flight draft without a write; the close over the outside press / the
|
|
10
|
+
trigger press / the session's teardown keeps the deferred commit stand.
|
|
11
|
+
- d6d6c7a: The filter builder's date-and-time value picker (the shared
|
|
12
|
+
`DateTimePicker`) stands the same key contract as the database grid's
|
|
13
|
+
datetime cell: Enter commits the draft (the picked date + the typed time)
|
|
14
|
+
and closes the picker, Escape cancels the in-flight draft without a
|
|
15
|
+
write; the close over the outside press / the trigger press keeps the
|
|
16
|
+
deferred commit stand.
|
|
17
|
+
|
|
3
18
|
## 0.8.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -5658,13 +5658,14 @@ function datePart(value) {
|
|
|
5658
5658
|
* box in one portaled popover.
|
|
5659
5659
|
*
|
|
5660
5660
|
* The component is controlled: the `value` is a local-calendar `Date`, and
|
|
5661
|
-
* `onSelect` commits the picked date + the typed time (the commit stands
|
|
5662
|
-
* the popover close — the
|
|
5663
|
-
*
|
|
5664
|
-
*
|
|
5665
|
-
*
|
|
5666
|
-
*
|
|
5667
|
-
*
|
|
5661
|
+
* `onSelect` commits the picked date + the typed time (the commit stands
|
|
5662
|
+
* on the popover close — the outside press / an explicit close — and on
|
|
5663
|
+
* the Enter over the popover as one step; the Escape cancels the in-flight
|
|
5664
|
+
* draft without a commit; a no-op close stands no commit). The drafts
|
|
5665
|
+
* stand from the value at the open (the in-flight draft stands the
|
|
5666
|
+
* mid-session value changes), the day pick edits the draft date (the
|
|
5667
|
+
* same-day toggle stands no reset — the deferred commit's contract), the
|
|
5668
|
+
* time box edits the draft time; the extra props stand on the
|
|
5668
5669
|
* trigger button (the `data-*` hooks included; the native `value` /
|
|
5669
5670
|
* `onSelect` button props are omitted — they stand the picker's contract).
|
|
5670
5671
|
*/
|
|
@@ -5672,22 +5673,40 @@ function DateTimePicker({ value, onSelect, className, placeholder = "—", ...tr
|
|
|
5672
5673
|
const [open, setOpen] = React.useState(false);
|
|
5673
5674
|
const [draftDate, setDraftDate] = React.useState(null);
|
|
5674
5675
|
const [draftTime, setDraftTime] = React.useState(null);
|
|
5676
|
+
const cancelledRef = React.useRef(false);
|
|
5675
5677
|
const timeSegmentsId = React.useId();
|
|
5678
|
+
/** The draft's commit (the single commit path): the no-op stand (the
|
|
5679
|
+
* draft stands the value) stands no commit. */
|
|
5680
|
+
const commitDraft = () => {
|
|
5681
|
+
const committed = draftDate === null ? null : datePart(draftDate);
|
|
5682
|
+
if (draftTime !== null && committed !== null) {
|
|
5683
|
+
const [hours, minutes, seconds] = draftTime.split(":");
|
|
5684
|
+
committed.setHours(Number(hours), Number(minutes), Number(seconds));
|
|
5685
|
+
}
|
|
5686
|
+
if ((value?.getTime() ?? null) === (committed?.getTime() ?? null)) return;
|
|
5687
|
+
onSelect(committed);
|
|
5688
|
+
};
|
|
5676
5689
|
const handleOpenChange = (next) => {
|
|
5677
5690
|
if (next) {
|
|
5691
|
+
cancelledRef.current = false;
|
|
5678
5692
|
setDraftDate(value !== null ? datePart(value) : null);
|
|
5679
5693
|
setDraftTime(value !== null && hasTime$1(value) ? format(value, "HH:mm:ss") : null);
|
|
5680
5694
|
setOpen(true);
|
|
5681
5695
|
return;
|
|
5682
5696
|
}
|
|
5683
5697
|
setOpen(false);
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5698
|
+
if (cancelledRef.current) return;
|
|
5699
|
+
commitDraft();
|
|
5700
|
+
};
|
|
5701
|
+
const cancelDraft = () => {
|
|
5702
|
+
cancelledRef.current = true;
|
|
5703
|
+
setOpen(false);
|
|
5704
|
+
};
|
|
5705
|
+
const commitAndClose = (event) => {
|
|
5706
|
+
if (event.target.closest("[data-day]") !== null) return;
|
|
5707
|
+
event.preventDefault();
|
|
5708
|
+
setOpen(false);
|
|
5709
|
+
commitDraft();
|
|
5691
5710
|
};
|
|
5692
5711
|
const onDraftDateSelect = (date) => {
|
|
5693
5712
|
if (date === void 0 || date === null) return;
|
|
@@ -5708,6 +5727,13 @@ function DateTimePicker({ value, onSelect, className, placeholder = "—", ...tr
|
|
|
5708
5727
|
})
|
|
5709
5728
|
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
5710
5729
|
className: "w-auto p-0",
|
|
5730
|
+
onKeyDown: (event) => {
|
|
5731
|
+
if (event.key === "Enter") commitAndClose(event);
|
|
5732
|
+
},
|
|
5733
|
+
onEscapeKeyDown: (event) => {
|
|
5734
|
+
event.preventDefault();
|
|
5735
|
+
cancelDraft();
|
|
5736
|
+
},
|
|
5711
5737
|
children: [
|
|
5712
5738
|
/* @__PURE__ */ jsx(Calendar, {
|
|
5713
5739
|
mode: "single",
|
|
@@ -7629,6 +7655,145 @@ function validateProtocolDescriptor(descriptor) {
|
|
|
7629
7655
|
for (const capability of BASELINE_CAPABILITIES) if (!capabilities.has(capability)) throw new BridgeError("protocol_mismatch", `The bridge lacks the required protocol capability "${capability}".`);
|
|
7630
7656
|
return capabilities;
|
|
7631
7657
|
}
|
|
7658
|
+
/** The cursor's continuation's retry bound (the `cursor_expired` over
|
|
7659
|
+
* the concurrent commit stands the fresh snapshot; the bound stands the
|
|
7660
|
+
* churn's livelock — over it the partial page set stands the lenient
|
|
7661
|
+
* read). */
|
|
7662
|
+
const REF_LOAD_ATTEMPTS = 3;
|
|
7663
|
+
/** Loads one page set over the cursor's continuation (the full page set
|
|
7664
|
+
* — the loop runs to the tail; the `cursor_expired` over the concurrent
|
|
7665
|
+
* commit stands the fresh snapshot's retry). The schema stands the first
|
|
7666
|
+
* snapshot's (the page set's stand — the color column's id lookup). */
|
|
7667
|
+
async function loadFullPages(bridge, tableId) {
|
|
7668
|
+
for (let attempt = 0; attempt < REF_LOAD_ATTEMPTS; attempt += 1) {
|
|
7669
|
+
const snapshot = await bridge.snapshotTable(tableId, { limit: 200 });
|
|
7670
|
+
const rows = [...snapshot.page.rows];
|
|
7671
|
+
const columns = snapshot.columns;
|
|
7672
|
+
let cursor = snapshot.page.nextCursor;
|
|
7673
|
+
let asOfSeq = snapshot.page.asOfSeq;
|
|
7674
|
+
let queryFingerprint = snapshot.page.queryFingerprint;
|
|
7675
|
+
while (cursor !== null) try {
|
|
7676
|
+
const page = await bridge.queryNextPage(tableId, {
|
|
7677
|
+
cursor,
|
|
7678
|
+
asOfSeq,
|
|
7679
|
+
queryFingerprint
|
|
7680
|
+
});
|
|
7681
|
+
for (const row of page.rows) rows.push(row);
|
|
7682
|
+
cursor = page.nextCursor;
|
|
7683
|
+
asOfSeq = page.asOfSeq;
|
|
7684
|
+
queryFingerprint = page.queryFingerprint;
|
|
7685
|
+
} catch (pageError) {
|
|
7686
|
+
if (isBridgeError(pageError) && pageError.code === "cursor_expired" && attempt < 2) break;
|
|
7687
|
+
throw pageError;
|
|
7688
|
+
}
|
|
7689
|
+
if (cursor === null) return {
|
|
7690
|
+
rows,
|
|
7691
|
+
asOfSeq,
|
|
7692
|
+
columns
|
|
7693
|
+
};
|
|
7694
|
+
if (attempt === 2) return {
|
|
7695
|
+
rows,
|
|
7696
|
+
asOfSeq,
|
|
7697
|
+
columns
|
|
7698
|
+
};
|
|
7699
|
+
}
|
|
7700
|
+
return null;
|
|
7701
|
+
}
|
|
7702
|
+
/** The entry's map key (the table + the declared display column — two
|
|
7703
|
+
* columns over one table with different displays stand distinct
|
|
7704
|
+
* entries). */
|
|
7705
|
+
function refEntryKey(entry) {
|
|
7706
|
+
return `${entry.tableId}\u0000${entry.displayColumn ?? ""}`;
|
|
7707
|
+
}
|
|
7708
|
+
/**
|
|
7709
|
+
* Loads the ref tables' data (the rows + the displays) and keeps it live
|
|
7710
|
+
* over the tables' own events. `entries` — the distinct ref entries (the
|
|
7711
|
+
* caller dedups — the serialized key stands the fetch + the
|
|
7712
|
+
* subscription set); the displays resolve over each entry's declared
|
|
7713
|
+
* display column (the row-link's `refDisplayColumn`).
|
|
7714
|
+
*/
|
|
7715
|
+
function useRefTables(bridge, entries) {
|
|
7716
|
+
const key = entries.map(refEntryKey).sort().join("");
|
|
7717
|
+
const [data, setData] = useState({});
|
|
7718
|
+
useEffect(() => {
|
|
7719
|
+
if (key === "") {
|
|
7720
|
+
setData({});
|
|
7721
|
+
return;
|
|
7722
|
+
}
|
|
7723
|
+
let live = true;
|
|
7724
|
+
const entryKeys = key.split("");
|
|
7725
|
+
const loaded = /* @__PURE__ */ new Map();
|
|
7726
|
+
const refreshEntry = async (entryKey) => {
|
|
7727
|
+
const [tableId, displayColumn] = entryKey.split("\0");
|
|
7728
|
+
try {
|
|
7729
|
+
const pageSet = await loadFullPages(bridge, tableId);
|
|
7730
|
+
if (pageSet === null) return;
|
|
7731
|
+
const rows = pageSet.rows;
|
|
7732
|
+
const rowIds = rows.map((row) => row.id);
|
|
7733
|
+
const rawDisplays = await bridge.resolveRowDisplay(tableId, {
|
|
7734
|
+
rowIds,
|
|
7735
|
+
...displayColumn === "" || displayColumn === void 0 ? {} : { displayColumn }
|
|
7736
|
+
});
|
|
7737
|
+
const displays = {};
|
|
7738
|
+
for (const [rowId, display] of Object.entries(rawDisplays)) if (display !== null) displays[rowId] = display;
|
|
7739
|
+
const colorColumnId = pageSet.columns.find((column) => column.name === ENUM_OPTION_COLOR_COLUMN)?.id;
|
|
7740
|
+
const colors = {};
|
|
7741
|
+
for (const row of rows) {
|
|
7742
|
+
const color = colorColumnId !== void 0 ? row.cells[colorColumnId] : void 0;
|
|
7743
|
+
if (typeof color === "string" && color !== "") colors[row.id] = color;
|
|
7744
|
+
}
|
|
7745
|
+
const value = {
|
|
7746
|
+
rowIds,
|
|
7747
|
+
displays,
|
|
7748
|
+
colors
|
|
7749
|
+
};
|
|
7750
|
+
loaded.set(entryKey, value);
|
|
7751
|
+
if (live) setData(Object.fromEntries(loaded));
|
|
7752
|
+
} catch {
|
|
7753
|
+
loaded.set(entryKey, {
|
|
7754
|
+
rowIds: [],
|
|
7755
|
+
displays: {},
|
|
7756
|
+
colors: {}
|
|
7757
|
+
});
|
|
7758
|
+
if (live) setData(Object.fromEntries(loaded));
|
|
7759
|
+
}
|
|
7760
|
+
};
|
|
7761
|
+
const refreshAll = async () => {
|
|
7762
|
+
for (const entryKey of entryKeys) await refreshEntry(entryKey);
|
|
7763
|
+
};
|
|
7764
|
+
refreshAll();
|
|
7765
|
+
const handles = [];
|
|
7766
|
+
const open = async (entryKey) => {
|
|
7767
|
+
const tableId = entryKey.split("\0")[0];
|
|
7768
|
+
try {
|
|
7769
|
+
const snapshot = await bridge.snapshotTable(tableId, { limit: 200 });
|
|
7770
|
+
if (!live) return;
|
|
7771
|
+
let handle = null;
|
|
7772
|
+
handle = bridge.subscribeTable(tableId, { afterSeq: snapshot.page.asOfSeq }, {
|
|
7773
|
+
ready: () => void 0,
|
|
7774
|
+
event: () => void refreshEntry(entryKey),
|
|
7775
|
+
status: () => void 0,
|
|
7776
|
+
error: () => void 0,
|
|
7777
|
+
reset: () => {
|
|
7778
|
+
if (!live) return;
|
|
7779
|
+
if (handle !== null) {
|
|
7780
|
+
handles.splice(handles.indexOf(handle), 1);
|
|
7781
|
+
handle.unsubscribe();
|
|
7782
|
+
}
|
|
7783
|
+
open(entryKey);
|
|
7784
|
+
}
|
|
7785
|
+
});
|
|
7786
|
+
handles.push(handle);
|
|
7787
|
+
} catch {}
|
|
7788
|
+
};
|
|
7789
|
+
for (const entryKey of entryKeys) open(entryKey);
|
|
7790
|
+
return () => {
|
|
7791
|
+
live = false;
|
|
7792
|
+
for (const handle of handles) handle.unsubscribe();
|
|
7793
|
+
};
|
|
7794
|
+
}, [bridge, key]);
|
|
7795
|
+
return data;
|
|
7796
|
+
}
|
|
7632
7797
|
//#endregion
|
|
7633
7798
|
//#region src/database/grid/utils.ts
|
|
7634
7799
|
/** The database grid's pure helpers: the visible-column derivation, the
|
|
@@ -7786,145 +7951,6 @@ function emptyColumnForm(entry) {
|
|
|
7786
7951
|
newTableName: ""
|
|
7787
7952
|
};
|
|
7788
7953
|
}
|
|
7789
|
-
/** The cursor's continuation's retry bound (the `cursor_expired` over
|
|
7790
|
-
* the concurrent commit stands the fresh snapshot; the bound stands the
|
|
7791
|
-
* churn's livelock — over it the partial page set stands the lenient
|
|
7792
|
-
* read). */
|
|
7793
|
-
const REF_LOAD_ATTEMPTS = 3;
|
|
7794
|
-
/** Loads one page set over the cursor's continuation (the full page set
|
|
7795
|
-
* — the loop runs to the tail; the `cursor_expired` over the concurrent
|
|
7796
|
-
* commit stands the fresh snapshot's retry). The schema stands the first
|
|
7797
|
-
* snapshot's (the page set's stand — the color column's id lookup). */
|
|
7798
|
-
async function loadFullPages(bridge, tableId) {
|
|
7799
|
-
for (let attempt = 0; attempt < REF_LOAD_ATTEMPTS; attempt += 1) {
|
|
7800
|
-
const snapshot = await bridge.snapshotTable(tableId, { limit: 200 });
|
|
7801
|
-
const rows = [...snapshot.page.rows];
|
|
7802
|
-
const columns = snapshot.columns;
|
|
7803
|
-
let cursor = snapshot.page.nextCursor;
|
|
7804
|
-
let asOfSeq = snapshot.page.asOfSeq;
|
|
7805
|
-
let queryFingerprint = snapshot.page.queryFingerprint;
|
|
7806
|
-
while (cursor !== null) try {
|
|
7807
|
-
const page = await bridge.queryNextPage(tableId, {
|
|
7808
|
-
cursor,
|
|
7809
|
-
asOfSeq,
|
|
7810
|
-
queryFingerprint
|
|
7811
|
-
});
|
|
7812
|
-
for (const row of page.rows) rows.push(row);
|
|
7813
|
-
cursor = page.nextCursor;
|
|
7814
|
-
asOfSeq = page.asOfSeq;
|
|
7815
|
-
queryFingerprint = page.queryFingerprint;
|
|
7816
|
-
} catch (pageError) {
|
|
7817
|
-
if (isBridgeError(pageError) && pageError.code === "cursor_expired" && attempt < 2) break;
|
|
7818
|
-
throw pageError;
|
|
7819
|
-
}
|
|
7820
|
-
if (cursor === null) return {
|
|
7821
|
-
rows,
|
|
7822
|
-
asOfSeq,
|
|
7823
|
-
columns
|
|
7824
|
-
};
|
|
7825
|
-
if (attempt === 2) return {
|
|
7826
|
-
rows,
|
|
7827
|
-
asOfSeq,
|
|
7828
|
-
columns
|
|
7829
|
-
};
|
|
7830
|
-
}
|
|
7831
|
-
return null;
|
|
7832
|
-
}
|
|
7833
|
-
/** The entry's map key (the table + the declared display column — two
|
|
7834
|
-
* columns over one table with different displays stand distinct
|
|
7835
|
-
* entries). */
|
|
7836
|
-
function refEntryKey(entry) {
|
|
7837
|
-
return `${entry.tableId}\u0000${entry.displayColumn ?? ""}`;
|
|
7838
|
-
}
|
|
7839
|
-
/**
|
|
7840
|
-
* Loads the ref tables' data (the rows + the displays) and keeps it live
|
|
7841
|
-
* over the tables' own events. `entries` — the distinct ref entries (the
|
|
7842
|
-
* caller dedups — the serialized key stands the fetch + the
|
|
7843
|
-
* subscription set); the displays resolve over each entry's declared
|
|
7844
|
-
* display column (the row-link's `refDisplayColumn`).
|
|
7845
|
-
*/
|
|
7846
|
-
function useRefTables(bridge, entries) {
|
|
7847
|
-
const key = entries.map(refEntryKey).sort().join("");
|
|
7848
|
-
const [data, setData] = useState({});
|
|
7849
|
-
useEffect(() => {
|
|
7850
|
-
if (key === "") {
|
|
7851
|
-
setData({});
|
|
7852
|
-
return;
|
|
7853
|
-
}
|
|
7854
|
-
let live = true;
|
|
7855
|
-
const entryKeys = key.split("");
|
|
7856
|
-
const loaded = /* @__PURE__ */ new Map();
|
|
7857
|
-
const refreshEntry = async (entryKey) => {
|
|
7858
|
-
const [tableId, displayColumn] = entryKey.split("\0");
|
|
7859
|
-
try {
|
|
7860
|
-
const pageSet = await loadFullPages(bridge, tableId);
|
|
7861
|
-
if (pageSet === null) return;
|
|
7862
|
-
const rows = pageSet.rows;
|
|
7863
|
-
const rowIds = rows.map((row) => row.id);
|
|
7864
|
-
const rawDisplays = await bridge.resolveRowDisplay(tableId, {
|
|
7865
|
-
rowIds,
|
|
7866
|
-
...displayColumn === "" || displayColumn === void 0 ? {} : { displayColumn }
|
|
7867
|
-
});
|
|
7868
|
-
const displays = {};
|
|
7869
|
-
for (const [rowId, display] of Object.entries(rawDisplays)) if (display !== null) displays[rowId] = display;
|
|
7870
|
-
const colorColumnId = pageSet.columns.find((column) => column.name === ENUM_OPTION_COLOR_COLUMN)?.id;
|
|
7871
|
-
const colors = {};
|
|
7872
|
-
for (const row of rows) {
|
|
7873
|
-
const color = colorColumnId !== void 0 ? row.cells[colorColumnId] : void 0;
|
|
7874
|
-
if (typeof color === "string" && color !== "") colors[row.id] = color;
|
|
7875
|
-
}
|
|
7876
|
-
const value = {
|
|
7877
|
-
rowIds,
|
|
7878
|
-
displays,
|
|
7879
|
-
colors
|
|
7880
|
-
};
|
|
7881
|
-
loaded.set(entryKey, value);
|
|
7882
|
-
if (live) setData(Object.fromEntries(loaded));
|
|
7883
|
-
} catch {
|
|
7884
|
-
loaded.set(entryKey, {
|
|
7885
|
-
rowIds: [],
|
|
7886
|
-
displays: {},
|
|
7887
|
-
colors: {}
|
|
7888
|
-
});
|
|
7889
|
-
if (live) setData(Object.fromEntries(loaded));
|
|
7890
|
-
}
|
|
7891
|
-
};
|
|
7892
|
-
const refreshAll = async () => {
|
|
7893
|
-
for (const entryKey of entryKeys) await refreshEntry(entryKey);
|
|
7894
|
-
};
|
|
7895
|
-
refreshAll();
|
|
7896
|
-
const handles = [];
|
|
7897
|
-
const open = async (entryKey) => {
|
|
7898
|
-
const tableId = entryKey.split("\0")[0];
|
|
7899
|
-
try {
|
|
7900
|
-
const snapshot = await bridge.snapshotTable(tableId, { limit: 200 });
|
|
7901
|
-
if (!live) return;
|
|
7902
|
-
let handle = null;
|
|
7903
|
-
handle = bridge.subscribeTable(tableId, { afterSeq: snapshot.page.asOfSeq }, {
|
|
7904
|
-
ready: () => void 0,
|
|
7905
|
-
event: () => void refreshEntry(entryKey),
|
|
7906
|
-
status: () => void 0,
|
|
7907
|
-
error: () => void 0,
|
|
7908
|
-
reset: () => {
|
|
7909
|
-
if (!live) return;
|
|
7910
|
-
if (handle !== null) {
|
|
7911
|
-
handles.splice(handles.indexOf(handle), 1);
|
|
7912
|
-
handle.unsubscribe();
|
|
7913
|
-
}
|
|
7914
|
-
open(entryKey);
|
|
7915
|
-
}
|
|
7916
|
-
});
|
|
7917
|
-
handles.push(handle);
|
|
7918
|
-
} catch {}
|
|
7919
|
-
};
|
|
7920
|
-
for (const entryKey of entryKeys) open(entryKey);
|
|
7921
|
-
return () => {
|
|
7922
|
-
live = false;
|
|
7923
|
-
for (const handle of handles) handle.unsubscribe();
|
|
7924
|
-
};
|
|
7925
|
-
}, [bridge, key]);
|
|
7926
|
-
return data;
|
|
7927
|
-
}
|
|
7928
7954
|
//#endregion
|
|
7929
7955
|
//#region src/database/filter-builder/utils.ts
|
|
7930
7956
|
/** The empty filter payload (the "no filter" shape the Clear writes). */
|
|
@@ -10487,15 +10513,17 @@ function DatabaseCell({ rowId, column, value, revision, rowIndex, colIndex, firs
|
|
|
10487
10513
|
const sessionStoodOpenRef = useRef(false);
|
|
10488
10514
|
const closeCommittedRef = useRef(false);
|
|
10489
10515
|
const committedIsoRef = useRef(void 0);
|
|
10516
|
+
const dateTimeCancelledRef = useRef(false);
|
|
10490
10517
|
useEffect(() => {
|
|
10491
10518
|
if (!isDateTime) return;
|
|
10492
10519
|
if (editing) {
|
|
10493
10520
|
sessionStoodOpenRef.current = true;
|
|
10494
10521
|
closeCommittedRef.current = false;
|
|
10522
|
+
dateTimeCancelledRef.current = false;
|
|
10495
10523
|
committedIsoRef.current = void 0;
|
|
10496
10524
|
return;
|
|
10497
10525
|
}
|
|
10498
|
-
if (!sessionStoodOpenRef.current || closeCommittedRef.current) return;
|
|
10526
|
+
if (!sessionStoodOpenRef.current || closeCommittedRef.current || dateTimeCancelledRef.current) return;
|
|
10499
10527
|
sessionStoodOpenRef.current = false;
|
|
10500
10528
|
commitDateTime();
|
|
10501
10529
|
}, [editing]);
|
|
@@ -10540,10 +10568,22 @@ function DatabaseCell({ rowId, column, value, revision, rowIndex, colIndex, firs
|
|
|
10540
10568
|
const dateTimeOnOpenChange = (open) => {
|
|
10541
10569
|
if (!open) {
|
|
10542
10570
|
closeCommittedRef.current = true;
|
|
10543
|
-
commitDateTime();
|
|
10571
|
+
if (!dateTimeCancelledRef.current) commitDateTime();
|
|
10544
10572
|
onEditEnd();
|
|
10545
10573
|
}
|
|
10546
10574
|
};
|
|
10575
|
+
const cancelDateTimeDraft = () => {
|
|
10576
|
+
dateTimeCancelledRef.current = true;
|
|
10577
|
+
onEditEnd();
|
|
10578
|
+
};
|
|
10579
|
+
const onDateTimePopoverKeyDown = (event) => {
|
|
10580
|
+
if (event.key !== "Enter") return;
|
|
10581
|
+
if (event.target.closest("[data-day]") !== null) return;
|
|
10582
|
+
event.preventDefault();
|
|
10583
|
+
closeCommittedRef.current = true;
|
|
10584
|
+
commitDateTime();
|
|
10585
|
+
onEditEnd();
|
|
10586
|
+
};
|
|
10547
10587
|
const onCheckboxPress = (event) => {
|
|
10548
10588
|
if (event.detail > 1) return;
|
|
10549
10589
|
if (!booleanPress.current.armed) return;
|
|
@@ -10600,6 +10640,11 @@ function DatabaseCell({ rowId, column, value, revision, rowIndex, colIndex, firs
|
|
|
10600
10640
|
align: "start",
|
|
10601
10641
|
sideOffset: 4,
|
|
10602
10642
|
className: "w-auto p-0",
|
|
10643
|
+
onKeyDown: onDateTimePopoverKeyDown,
|
|
10644
|
+
onEscapeKeyDown: (event) => {
|
|
10645
|
+
event.preventDefault();
|
|
10646
|
+
cancelDateTimeDraft();
|
|
10647
|
+
},
|
|
10603
10648
|
children: [
|
|
10604
10649
|
/* @__PURE__ */ jsx(Calendar, {
|
|
10605
10650
|
mode: "single",
|
package/dist/index.d.mts
CHANGED
|
@@ -337,7 +337,7 @@ declare function AlertDescription({ className, ...props }: React.ComponentProps<
|
|
|
337
337
|
//#endregion
|
|
338
338
|
//#region src/shared/ui/Badge.d.ts
|
|
339
339
|
declare const badgeVariants: (props?: ({
|
|
340
|
-
variant?: "default" | "
|
|
340
|
+
variant?: "default" | "custom" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
341
341
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
342
342
|
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
343
343
|
asChild?: boolean;
|
|
@@ -348,7 +348,7 @@ declare function BareSelect({ className, children, ...props }: React.ComponentPr
|
|
|
348
348
|
//#endregion
|
|
349
349
|
//#region src/shared/ui/Button.d.ts
|
|
350
350
|
declare const buttonVariants: (props?: ({
|
|
351
|
-
variant?: "link" | "default" | "
|
|
351
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
352
352
|
size?: "default" | "icon" | "sm" | "lg" | "xl" | null | undefined;
|
|
353
353
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
354
354
|
declare function Button({ className, variant, size, asChild, type, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SelectScrollUpButton, A as parseCellValue, At as CardAction, B as useText, Bt as badgeVariants, C as validateProtocolDescriptor, Ct as PopoverDescription, D as isBridgeErrorCode, Dt as Input, E as isBridgeError, Et as PopoverTrigger, F as useMeta, Ft as CardTitle, G as SegmentSelector, H as useEditorContext, Ht as AlertDescription, I as usePresence, It as Button, J as SelectContent, Jt as Eye, K as ScrollArea, Kt as renderRuns, L as usePresenceSharing, Lt as buttonVariants, M as columnAnnotation, Mt as CardDescription, N as useBlock, Nt as CardFooter, O as toBridgeError, Ot as Checkbox, P as useDoc, Pt as CardHeader, Q as SelectScrollDownButton, R as useSelection, Rt as BareSelect, S as isDatabaseBridge, St as PopoverContent, T as BridgeError, Tt as PopoverTitle, U as DEFAULT_EMBED_SANDBOX, Ut as AlertTitle, V as EditorProvider, Vt as Alert, W as Skeleton, Wt as DocblocksI18nProvider, X as SelectItem, Xt as BookOpen, Y as SelectGroup, Z as SelectLabel, Zt as createMemoryBlobStore, _ as FilterBuilder, _t as DropdownMenuSubTrigger, a as SHAPE_FONT_STACKS, at as DropdownMenuCheckboxItem, b as BASELINE_CAPABILITIES, bt as Popover, ct as DropdownMenuItem, d as insertNative, dt as DropdownMenuRadioGroup, et as SelectSeparator, f as mdToBlocks, ft as DropdownMenuRadioItem, g as newMutationContext, gt as DropdownMenuSubContent, h as cellValueEqual, ht as DropdownMenuSub, i as SHAPE_FONT_OPTIONS, it as DropdownMenu, j as TEXT_TYPES, jt as CardContent, k as conditionMatches, kt as Card, l as markToggleAction, lt as DropdownMenuLabel, m as useDatabaseTable, mt as DropdownMenuShortcut, nt as SelectValue, ot as DropdownMenuContent, p as GridBody, pt as DropdownMenuSeparator, q as Select, qt as Pen, rt as Label, s as FORMAT_PALETTE, st as DropdownMenuGroup, t as Editor, tt as SelectTrigger, u as htmlToBlocks, ut as DropdownMenuPortal, v as emptyFilter, vt as DropdownMenuTrigger, w as BRIDGE_ERROR_CODES, wt as PopoverHeader, x as PROTOCOL_VERSION, xt as PopoverAnchor, y as filterIsComplete, yt as Separator, z as useSelectionView, zt as Badge } from "./Editor-
|
|
1
|
+
import { $ as SelectScrollUpButton, A as parseCellValue, At as CardAction, B as useText, Bt as badgeVariants, C as validateProtocolDescriptor, Ct as PopoverDescription, D as isBridgeErrorCode, Dt as Input, E as isBridgeError, Et as PopoverTrigger, F as useMeta, Ft as CardTitle, G as SegmentSelector, H as useEditorContext, Ht as AlertDescription, I as usePresence, It as Button, J as SelectContent, Jt as Eye, K as ScrollArea, Kt as renderRuns, L as usePresenceSharing, Lt as buttonVariants, M as columnAnnotation, Mt as CardDescription, N as useBlock, Nt as CardFooter, O as toBridgeError, Ot as Checkbox, P as useDoc, Pt as CardHeader, Q as SelectScrollDownButton, R as useSelection, Rt as BareSelect, S as isDatabaseBridge, St as PopoverContent, T as BridgeError, Tt as PopoverTitle, U as DEFAULT_EMBED_SANDBOX, Ut as AlertTitle, V as EditorProvider, Vt as Alert, W as Skeleton, Wt as DocblocksI18nProvider, X as SelectItem, Xt as BookOpen, Y as SelectGroup, Z as SelectLabel, Zt as createMemoryBlobStore, _ as FilterBuilder, _t as DropdownMenuSubTrigger, a as SHAPE_FONT_STACKS, at as DropdownMenuCheckboxItem, b as BASELINE_CAPABILITIES, bt as Popover, ct as DropdownMenuItem, d as insertNative, dt as DropdownMenuRadioGroup, et as SelectSeparator, f as mdToBlocks, ft as DropdownMenuRadioItem, g as newMutationContext, gt as DropdownMenuSubContent, h as cellValueEqual, ht as DropdownMenuSub, i as SHAPE_FONT_OPTIONS, it as DropdownMenu, j as TEXT_TYPES, jt as CardContent, k as conditionMatches, kt as Card, l as markToggleAction, lt as DropdownMenuLabel, m as useDatabaseTable, mt as DropdownMenuShortcut, nt as SelectValue, ot as DropdownMenuContent, p as GridBody, pt as DropdownMenuSeparator, q as Select, qt as Pen, rt as Label, s as FORMAT_PALETTE, st as DropdownMenuGroup, t as Editor, tt as SelectTrigger, u as htmlToBlocks, ut as DropdownMenuPortal, v as emptyFilter, vt as DropdownMenuTrigger, w as BRIDGE_ERROR_CODES, wt as PopoverHeader, x as PROTOCOL_VERSION, xt as PopoverAnchor, y as filterIsComplete, yt as Separator, z as useSelectionView, zt as Badge } from "./Editor-PO0xG3XK.mjs";
|
|
2
2
|
import { a as preventDefault, s as cn } from "./constants-D8PSgkwi.mjs";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
package/dist/mermaid/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as SegmentSelector, Gt as INLINE_CODE_CLASS, H as useEditorContext, Ht as AlertDescription, Jt as Eye, Ut as AlertTitle, Vt as Alert, W as Skeleton, Yt as CodeXml, c as textOf, n as childrenSlot, o as TextBlock, r as CodeHeader } from "../Editor-
|
|
1
|
+
import { G as SegmentSelector, Gt as INLINE_CODE_CLASS, H as useEditorContext, Ht as AlertDescription, Jt as Eye, Ut as AlertTitle, Vt as Alert, W as Skeleton, Yt as CodeXml, c as textOf, n as childrenSlot, o as TextBlock, r as CodeHeader } from "../Editor-PO0xG3XK.mjs";
|
|
2
2
|
import { f as LoaderCircle, l as TriangleAlert } from "../constants-D8PSgkwi.mjs";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
package/package.json
CHANGED