@nexdom/uimed-vue 2.0.0-beta.47 → 2.0.0-beta.48
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/components.d.ts +4 -2
- package/dist/components.js +19 -8
- package/package.json +1 -1
package/dist/components.d.ts
CHANGED
|
@@ -575,8 +575,8 @@ declare const __VLS_export$16: import("vue", { with: { "resolution-mode": "impor
|
|
|
575
575
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
576
576
|
}>, {
|
|
577
577
|
variant: TextFieldVariant;
|
|
578
|
-
type: TextFieldType;
|
|
579
578
|
clearable: boolean;
|
|
579
|
+
type: TextFieldType;
|
|
580
580
|
}, {}, {}, {}, string, import("vue", { with: { "resolution-mode": "import" } }).ComponentProvideOptions, false, {}, any>;
|
|
581
581
|
//#endregion
|
|
582
582
|
//#region src/components/inputs/checkbox/types.d.ts
|
|
@@ -1715,6 +1715,8 @@ type DialogProps = {
|
|
|
1715
1715
|
* Buttons displayed at the bottom of the dialog, right-aligned, in the given order.
|
|
1716
1716
|
* Place the main action last. When undefined or empty, no actions area is rendered.
|
|
1717
1717
|
* Clicking an action doesn't close the dialog: set `v-model` to `false` in `onClick`.
|
|
1718
|
+
* While any action is `loading`, the user can't close the dialog with `Esc`, a click outside or
|
|
1719
|
+
* the browser's back button, but setting `v-model` to `false` still closes it.
|
|
1718
1720
|
*/
|
|
1719
1721
|
actions?: DialogButtonAction[];
|
|
1720
1722
|
/**
|
|
@@ -1730,7 +1732,7 @@ type DialogProps = {
|
|
|
1730
1732
|
};
|
|
1731
1733
|
/**
|
|
1732
1734
|
* A single action rendered inside {@link Dialog}'s actions area. Same shape as `USection`'s
|
|
1733
|
-
* actions.
|
|
1735
|
+
* actions. While it's `loading`, the user can't close the dialog, but setting `v-model` to `false` still does.
|
|
1734
1736
|
*/
|
|
1735
1737
|
interface DialogButtonAction extends ButtonProps {
|
|
1736
1738
|
/**
|
package/dist/components.js
CHANGED
|
@@ -100,7 +100,7 @@ function useNavigationSearchShortcut(options) {
|
|
|
100
100
|
input.select();
|
|
101
101
|
}
|
|
102
102
|
function findInput() {
|
|
103
|
-
return field
|
|
103
|
+
return toValue(field).$el.querySelector("input");
|
|
104
104
|
}
|
|
105
105
|
function close() {
|
|
106
106
|
open.value = false;
|
|
@@ -1175,23 +1175,23 @@ const focusable = [
|
|
|
1175
1175
|
function useDialogFocus(isActive, card) {
|
|
1176
1176
|
/** Focus state of this dialog, shared with the dialogs opened from it. */
|
|
1177
1177
|
const focusState = {
|
|
1178
|
-
isOpen: isActive,
|
|
1178
|
+
isOpen: () => toValue(isActive),
|
|
1179
1179
|
origin: null
|
|
1180
1180
|
};
|
|
1181
|
-
onMounted(() => onActiveChange(isActive
|
|
1182
|
-
watch(isActive, onActiveChange);
|
|
1181
|
+
onMounted(() => onActiveChange(toValue(isActive)));
|
|
1182
|
+
watch(() => toValue(isActive), onActiveChange);
|
|
1183
1183
|
function onActiveChange(active) {
|
|
1184
1184
|
if (active) {
|
|
1185
1185
|
focusState.origin = document.activeElement;
|
|
1186
1186
|
return;
|
|
1187
1187
|
}
|
|
1188
|
-
const element = card
|
|
1188
|
+
const element = toValue(card);
|
|
1189
1189
|
if (element) closedDialogs.set(element, focusState);
|
|
1190
1190
|
const target = findFocusTarget(focusState.origin);
|
|
1191
1191
|
if (hasFocus(element) && (target instanceof HTMLElement || target instanceof SVGElement)) target.focus();
|
|
1192
1192
|
}
|
|
1193
1193
|
function focusFirstElement() {
|
|
1194
|
-
card
|
|
1194
|
+
toValue(card)?.querySelector(focusable)?.focus();
|
|
1195
1195
|
}
|
|
1196
1196
|
return { focusFirstElement };
|
|
1197
1197
|
}
|
|
@@ -1214,6 +1214,17 @@ function hasFocus(card) {
|
|
|
1214
1214
|
return !!card && (card.contains(active) || active.contains(card));
|
|
1215
1215
|
}
|
|
1216
1216
|
//#endregion
|
|
1217
|
+
//#region src/composables/dialogs/use-dialog-loading.ts
|
|
1218
|
+
/**
|
|
1219
|
+
* Tells whether any action of a dialog is loading, during which the user can't close it with
|
|
1220
|
+
* `Esc`, a click outside or the browser's back button. Internal to the dialog components.
|
|
1221
|
+
* @param actions - The dialog's actions, if any.
|
|
1222
|
+
* @returns `isLoading`, which is `true` while at least one action is `loading`.
|
|
1223
|
+
*/
|
|
1224
|
+
function useDialogLoading(actions) {
|
|
1225
|
+
return { isLoading: computed(() => toValue(actions)?.some((action) => action.loading) ?? false) };
|
|
1226
|
+
}
|
|
1227
|
+
//#endregion
|
|
1217
1228
|
//#region src/components/dialogs/dialog/dialog.vue?vue&type=script&setup=true&lang.ts
|
|
1218
1229
|
const _hoisted_1$1 = ["id"];
|
|
1219
1230
|
//#endregion
|
|
@@ -1266,6 +1277,7 @@ var dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
1266
1277
|
*/
|
|
1267
1278
|
const isActive = ref(model.value);
|
|
1268
1279
|
watch(model, (value) => isActive.value = value);
|
|
1280
|
+
const { isLoading } = useDialogLoading(() => props.actions);
|
|
1269
1281
|
const { focusFirstElement } = useDialogFocus(() => isActive.value, () => card.value?.$el);
|
|
1270
1282
|
function onAfterLeave() {
|
|
1271
1283
|
model.value = false;
|
|
@@ -1275,7 +1287,7 @@ var dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
1275
1287
|
return openBlock(), createBlock(unref(VDialog), {
|
|
1276
1288
|
modelValue: isActive.value,
|
|
1277
1289
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isActive.value = $event),
|
|
1278
|
-
persistent: unref(
|
|
1290
|
+
persistent: unref(isLoading),
|
|
1279
1291
|
"max-width": maxWidth.value,
|
|
1280
1292
|
role: role.value,
|
|
1281
1293
|
"aria-label": title.value,
|
|
@@ -1352,7 +1364,6 @@ var dialog_host_default = /* @__PURE__ */ defineComponent({
|
|
|
1352
1364
|
});
|
|
1353
1365
|
provide(dialogHostKey, {
|
|
1354
1366
|
role: () => request.value?.role,
|
|
1355
|
-
persistent: () => isRunning.value,
|
|
1356
1367
|
afterLeave: showNext
|
|
1357
1368
|
});
|
|
1358
1369
|
onMounted(() => owners$1.value.push(owner));
|