@jsenv/navi 0.29.454 → 0.29.455
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/dev/jsenv_navi.js +29 -69
- package/dist/dev/jsenv_navi.js.map +5 -5
- package/dist/jsenv_navi.js +26 -68
- package/dist/jsenv_navi.js.map +5 -5
- package/docs/control_value.md +18 -0
- package/package.json +1 -1
package/dist/jsenv_navi.js
CHANGED
|
@@ -39582,18 +39582,20 @@ const callLiftOverCallbacks = () => {
|
|
|
39582
39582
|
*
|
|
39583
39583
|
* A picker's `action` waits for its popup to close: what is done in there is
|
|
39584
39584
|
* one answer, given when the person is done. A change made while the popup is
|
|
39585
|
-
* closed — a chip's cross, a paste, a cut, a value proposed
|
|
39586
|
-
* (`--navi-update`) — has no close coming, so nothing would ever
|
|
39587
|
-
* value moves on screen and the record behind it stays. Each of
|
|
39588
|
-
* calls this right after setting the value; a failing action
|
|
39589
|
-
* back (resetOnError), as it does after a close.
|
|
39585
|
+
* closed — the clear cross, a chip's cross, a paste, a cut, a value proposed
|
|
39586
|
+
* from beside it (`--navi-update`) — has no close coming, so nothing would ever
|
|
39587
|
+
* send it: the value moves on screen and the record behind it stays. Each of
|
|
39588
|
+
* those gestures calls this right after setting the value; a failing action
|
|
39589
|
+
* puts the value back (resetOnError), as it does after a close.
|
|
39590
39590
|
*
|
|
39591
39591
|
* Called by gestures only. A value set without one — a bound signal followed, a
|
|
39592
39592
|
* cancel or a failure rolled back — is the picker being told, not asked, which
|
|
39593
39593
|
* is why this is not a reaction to every value set on a closed picker.
|
|
39594
39594
|
*
|
|
39595
|
-
* The
|
|
39596
|
-
*
|
|
39595
|
+
* The action is requested the way the close requests it, not through
|
|
39596
|
+
* `--navi-send`: a send also answers the surface around the control (a slide
|
|
39597
|
+
* moves on, an open dialog closes — see resolveAfterSend in commands.js), and a
|
|
39598
|
+
* cross pressed on a picker in a dialog is not the dialog being answered.
|
|
39597
39599
|
*/
|
|
39598
39600
|
|
|
39599
39601
|
|
|
@@ -39616,6 +39618,13 @@ const sendClosedPickerChange = (element, { event, name, requester }) => {
|
|
|
39616
39618
|
if (props.picksNothing) {
|
|
39617
39619
|
return;
|
|
39618
39620
|
}
|
|
39621
|
+
// A source with an action of its own made the request already: `<Button
|
|
39622
|
+
// action={remove} command="--navi-clear">` runs the removal, and the command
|
|
39623
|
+
// that follows only brings the picker in line with it. Sending the picker's
|
|
39624
|
+
// action on top would ask twice.
|
|
39625
|
+
if (requester?.__uiStateController__?.props.action) {
|
|
39626
|
+
return;
|
|
39627
|
+
}
|
|
39619
39628
|
// `requester`: the source of a command may have claimed the press to send
|
|
39620
39629
|
// this very change (see isAimedAtSelfInteractionsBelow).
|
|
39621
39630
|
dispatchRequestAction(controlHost, { event, name, requester });
|
|
@@ -40013,20 +40022,6 @@ registerNaviCommand("--navi-clear", (source, event) => {
|
|
|
40013
40022
|
return undefined;
|
|
40014
40023
|
}
|
|
40015
40024
|
const fromInput = source.closest(`[navi-control="input"]`);
|
|
40016
|
-
// A control that commits on an explicit send — a picker, whose list sends the
|
|
40017
|
-
// moment a value is chosen — has nothing that would commit a clear: its
|
|
40018
|
-
// action never runs on a ui state change. Left alone, the field goes empty
|
|
40019
|
-
// while the caller still holds the value it gave, and renders it right back.
|
|
40020
|
-
//
|
|
40021
|
-
// Unless the source committed the clear itself: a clear button given its own
|
|
40022
|
-
// action (`<Button action={remove} command="--navi-clear">`) already made the
|
|
40023
|
-
// request — the ui state is being brought in line with what just happened, and
|
|
40024
|
-
// sending the picker's own action on top would ask twice.
|
|
40025
|
-
const sourceController = source.__uiStateController__;
|
|
40026
|
-
const fromSendOnlyControl = Boolean(
|
|
40027
|
-
source.closest?.(`[navi-control=picker]`) &&
|
|
40028
|
-
!sourceController?.props.action,
|
|
40029
|
-
);
|
|
40030
40025
|
|
|
40031
40026
|
const performClear = (clearEvent) => {
|
|
40032
40027
|
dispatchRequestInteraction(target, {
|
|
@@ -40037,46 +40032,11 @@ registerNaviCommand("--navi-clear", (source, event) => {
|
|
|
40037
40032
|
requester: source,
|
|
40038
40033
|
prevented: () => clearEvent.preventDefault(),
|
|
40039
40034
|
allowed: () => {
|
|
40040
|
-
// What the control holds, before it holds nothing: the clear is
|
|
40041
|
-
// optimistic — the field empties now and the send that commits it may
|
|
40042
|
-
// still fail — so what it emptied has to be kept to be put back.
|
|
40043
|
-
const uiStateBefore = getUIStateFromElement(target);
|
|
40044
40035
|
dispatchRequestClearUIState(target, clearEvent);
|
|
40045
|
-
|
|
40046
|
-
|
|
40047
|
-
|
|
40048
|
-
|
|
40049
|
-
// state signal, so this sends the value the control now holds.
|
|
40050
|
-
const actionHost = findControlHost(target) || target;
|
|
40051
|
-
const completion = watchActionCompletion(actionHost, () => {
|
|
40052
|
-
triggerNaviCommand(source, "--navi-send", clearEvent, {
|
|
40053
|
-
optional: true,
|
|
40054
|
-
});
|
|
40055
|
-
});
|
|
40056
|
-
completion.whenSettled(({ error, aborted }) => {
|
|
40057
|
-
if (!error && !aborted) {
|
|
40058
|
-
return;
|
|
40059
|
-
}
|
|
40060
|
-
// The removal did not happen, so the field must stop saying it did.
|
|
40061
|
-
// The error itself stays where the action put it — on the control,
|
|
40062
|
-
// which is still there, unlike the cross that has just gone with the
|
|
40063
|
-
// value it cleared (see addErrorMessage in use_execute_action.js).
|
|
40064
|
-
//
|
|
40065
|
-
// Put back from the inside ("clear_rollback" is an internal event
|
|
40066
|
-
// type, see ui_state_controller.js) rather than asked for the way a
|
|
40067
|
-
// user would: nobody acted, the control is being returned to the
|
|
40068
|
-
// state its caller still holds. Asked from the outside it would be
|
|
40069
|
-
// answered with "this element is busy" — the action is still
|
|
40070
|
-
// settling — over the very error that explains why the value is back.
|
|
40071
|
-
const controller = actionHost.__uiStateController__;
|
|
40072
|
-
if (!controller) {
|
|
40073
|
-
return;
|
|
40074
|
-
}
|
|
40075
|
-
const rollbackEvent = new CustomEvent("clear_rollback", {
|
|
40076
|
-
detail: {},
|
|
40077
|
-
});
|
|
40078
|
-
chainEvent(rollbackEvent, clearEvent);
|
|
40079
|
-
controller.setUIState(uiStateBefore, rollbackEvent);
|
|
40036
|
+
sendClosedPickerChange(target, {
|
|
40037
|
+
event: clearEvent,
|
|
40038
|
+
name: "--navi-clear",
|
|
40039
|
+
requester: source,
|
|
40080
40040
|
});
|
|
40081
40041
|
},
|
|
40082
40042
|
});
|
|
@@ -40816,6 +40776,7 @@ registerNaviCommand("--navi-select", (source, event) => {
|
|
|
40816
40776
|
return dispatchCustomEvent(target, "navi_request_select", {
|
|
40817
40777
|
event,
|
|
40818
40778
|
id: resolveCommandValue(source, event),
|
|
40779
|
+
requester: source,
|
|
40819
40780
|
});
|
|
40820
40781
|
},
|
|
40821
40782
|
};
|
|
@@ -40832,6 +40793,7 @@ registerNaviCommand("--navi-unselect", (source, event) => {
|
|
|
40832
40793
|
return dispatchCustomEvent(target, "navi_request_unselect", {
|
|
40833
40794
|
event,
|
|
40834
40795
|
id: resolveCommandValue(source, event),
|
|
40796
|
+
requester: source,
|
|
40835
40797
|
});
|
|
40836
40798
|
},
|
|
40837
40799
|
};
|
|
@@ -44672,12 +44634,6 @@ const INTERNAL_EVENT_SET = new Set([
|
|
|
44672
44634
|
// on registration, and group pushing value/defaultValue to children on registerChild.
|
|
44673
44635
|
// Equivalent to defaultValue initialization: no uiAction, no commands, no parent notification.
|
|
44674
44636
|
"initial_state_push",
|
|
44675
|
-
// navi undoing its own optimistic write: the clear cross emptied the control
|
|
44676
|
-
// before the send that commits it, the send failed, and the value it emptied
|
|
44677
|
-
// goes back where it was (see the --navi-clear command). Nothing acted — the
|
|
44678
|
-
// control is being put back on the state the caller still holds — so this
|
|
44679
|
-
// must not fire a uiAction, a command, or a report on the way.
|
|
44680
|
-
"clear_rollback",
|
|
44681
44637
|
// A picker's popup closed on a cancel (the no button, Escape, a click
|
|
44682
44638
|
// outside): what the picker held at open goes back. Nobody acted — no
|
|
44683
44639
|
// command — but the value really did move back, so uiAction and the parent
|
|
@@ -82530,7 +82486,8 @@ const requestPickerListEntry = (pickerEl, pickerInputEl, e, goal) => {
|
|
|
82530
82486
|
return;
|
|
82531
82487
|
}
|
|
82532
82488
|
const {
|
|
82533
|
-
id: entry
|
|
82489
|
+
id: entry,
|
|
82490
|
+
requester
|
|
82534
82491
|
} = e.detail;
|
|
82535
82492
|
const isThere = uiState.some(item => compareTwoJsValues(item, entry));
|
|
82536
82493
|
if (goal === "select" ? isThere : !isThere) {
|
|
@@ -82547,7 +82504,8 @@ const requestPickerListEntry = (pickerEl, pickerInputEl, e, goal) => {
|
|
|
82547
82504
|
});
|
|
82548
82505
|
sendClosedPickerChange(pickerInputEl, {
|
|
82549
82506
|
event: e,
|
|
82550
|
-
name: goal
|
|
82507
|
+
name: goal,
|
|
82508
|
+
requester
|
|
82551
82509
|
});
|
|
82552
82510
|
}
|
|
82553
82511
|
});
|