@maple-design/ui-vue 1.1.0 → 1.1.1
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/es/_components/field-presentation/EditorPanel.vue.mjs +3 -3
- package/es/_components/field-presentation/editor-pending.mjs +4 -0
- package/es/_components/field-presentation/form-bridge.mjs +1 -1
- package/es/_components/field-presentation/with-field-presentation.mjs +51 -8
- package/es/_components/picker-field/PickerField.vue.mjs +3 -13
- package/es/_components/picker-field/TemporalCurrent.vue.mjs +2 -3
- package/es/_components/picker-field/range-labels.mjs +18 -0
- package/es/_components/selected-options/style/index.css +33 -15
- package/es/_components/selection-field/use-selection-session.mjs +1 -0
- package/es/_components/virtual-list-v2/VirtualList2.vue.mjs +26 -4
- package/es/action-sheet/ActionSheet2.vue.mjs +2 -3
- package/es/auto-complete/auto-complete.mjs +2 -2
- package/es/auto-complete/presentation.mjs +1 -0
- package/es/auto-complete/props.mjs +2 -0
- package/es/auto-complete/style/index.css +7 -2
- package/es/back-top/style/index.css +1 -1
- package/es/breadcrumb/style/index.css +1 -1
- package/es/button/base.mjs +7 -0
- package/es/button/index.mjs +9 -9
- package/es/button/style/index.css +1 -1
- package/es/card/Card.vue.mjs +55 -13
- package/es/carousel/style/index.css +1 -1
- package/es/carousel/use-carousel-locale.mjs +10 -3
- package/es/cascader/CascaderMenu.vue.mjs +2 -2
- package/es/cascader/cascader-option.mjs +15 -6
- package/es/cascader/field-adapter.mjs +1 -0
- package/es/cascader/props.mjs +2 -0
- package/es/cascader/style/index.css +36 -9
- package/es/cascader/style/index.mjs +1 -0
- package/es/cascader/use-cascader-focus.mjs +9 -6
- package/es/checkbox/CheckboxGroup.vue.mjs +2 -2
- package/es/checkbox/base.mjs +7 -0
- package/es/checkbox/index.mjs +1 -1
- package/es/checkbox/presentation.mjs +2 -2
- package/es/checkbox/style/index.css +1 -1
- package/es/countdown/use-countdown.mjs +9 -2
- package/es/date/DatePanelActions.vue.mjs +4 -4
- package/es/date/DateRangeQuickPanel.vue.mjs +2 -2
- package/es/date/DateShortcuts.vue.mjs +2 -2
- package/es/date/field-adapter.mjs +2 -3
- package/es/date/picker-panels/DayPickerPanel2.vue.mjs +4 -5
- package/es/date/picker-panels/MonthPickerPanel2.vue.mjs +5 -6
- package/es/date/picker-panels/PanelHeader2.vue.mjs +6 -7
- package/es/date/picker-panels/YearPickerPanel2.vue.mjs +2 -2
- package/es/date/presentation/CalendarContent2.vue.mjs +13 -14
- package/es/date/presentation/CalendarViewport.vue.mjs +2 -3
- package/es/date/presentation/use-date-locale.mjs +2 -3
- package/es/date/presentation/use-field-locale.mjs +5 -6
- package/es/date/presentation/use-panel-actions-locale.mjs +4 -5
- package/es/date-range/presentation/RangeContent2.vue.mjs +4 -5
- package/es/dialog/Dialog.vue.mjs +3 -3
- package/es/ellipsis/style/index.css +1 -1
- package/es/fab/Fab.mjs +4 -5
- package/es/form/FormItemLabel.vue.mjs +4 -3
- package/es/form/focus-explicit-label.mjs +52 -0
- package/es/input/base.mjs +7 -0
- package/es/input/index.mjs +19 -19
- package/es/locale/date-text.mjs +38 -0
- package/es/locale/misc-text.mjs +23 -0
- package/es/locale/temporal-text.mjs +22 -0
- package/es/locale/zh-CN.mjs +235 -131
- package/es/maple-vue.mjs +1 -1
- package/es/maple.css +273 -207
- package/es/maple.esm.js +19385 -18978
- package/es/nav-menu/style/index.css +1 -1
- package/es/notice-bar/NoticeBar2.vue.mjs +2 -3
- package/es/number-keyboard/NumberKeyboard2.vue.mjs +5 -6
- package/es/pagination/PageInput.vue.mjs +2 -2
- package/es/pagination/style/index.css +2 -2
- package/es/people-select/PeopleSelect.mjs +35 -54
- package/es/people-select/Person.vue.mjs +3 -3
- package/es/people-select/emits.mjs +1 -1
- package/es/people-select/people-select.mjs +6 -8
- package/es/people-select/presentation.mjs +3 -1
- package/es/people-select/props.mjs +9 -3
- package/es/people-select/selection.mjs +64 -0
- package/es/people-select/style/index.css +6 -0
- package/es/picker/Picker.vue.mjs +2 -2
- package/es/picker/Picker2.vue.mjs +4 -5
- package/es/picker/base.mjs +7 -0
- package/es/picker/index.mjs +5 -5
- package/es/progress/style/index.css +2 -2
- package/es/radio/style/index.css +1 -1
- package/es/rate/style/index.css +2 -2
- package/es/ripple/index.mjs +78 -0
- package/es/search/HistoryContent.vue.mjs +4 -4
- package/es/search/Search.vue.mjs +4 -4
- package/es/search/props.mjs +1 -2
- package/es/select/props.mjs +2 -0
- package/es/select/select.mjs +14 -4
- package/es/select/style/index.css +22 -12
- package/es/select/use-select-controller.mjs +22 -2
- package/es/slider/Slider.vue.mjs +43 -21
- package/es/slider/SliderInput.vue.mjs +14 -2
- package/es/slider/style/index.css +2 -2
- package/es/steps/style/index.css +10 -10
- package/es/switch/Switch.vue.mjs +12 -1
- package/es/switch/style/index.css +1 -1
- package/es/tab-bar/TabBar.vue.mjs +2 -2
- package/es/tab-bar/style/index.css +2 -2
- package/es/tabs/style/index.css +1 -1
- package/es/tabs/use-tabs-configuration.mjs +2 -3
- package/es/themes/alps-light/index.mjs +10 -11
- package/es/themes/create-brand-dark.mjs +18 -0
- package/es/themes/dark/breadcrumb-item.mjs +1 -1
- package/es/themes/dark/cascader.mjs +1 -1
- package/es/themes/dark/index.mjs +2 -2
- package/es/themes/firefly-light/index.mjs +12 -13
- package/es/themes/index.mjs +2 -2
- package/es/themes/maple-light/index.mjs +2 -2
- package/es/time/presentation/TimeFieldPanel.vue.mjs +2 -2
- package/es/time/presentation/TimePanelContent2.vue.mjs +8 -9
- package/es/time/presentation/use-field-locale.mjs +5 -6
- package/es/time/props.mjs +1 -1
- package/es/time-range/presentation/TimePanelContent2.vue.mjs +6 -7
- package/es/time-range/props.mjs +1 -1
- package/es/trigger/popup-move-focus.mjs +6 -6
- package/es/trigger/position.mjs +49 -3
- package/es/trigger/positioner.mjs +34 -5
- package/es/trigger/trigger.mjs +1 -1
- package/es/upload/Upload.vue.mjs +18 -2
- package/es/upload/composables/use-upload-queue.mjs +10 -1
- package/es/upload/composables/use-uploader.mjs +45 -11
- package/es/upload/use-upload-locale.mjs +16 -12
- package/es/utils/modal-focus.mjs +9 -2
- package/es/utils/modal-surface.mjs +9 -3
- package/highlight/web-types.en-US.json +698 -176
- package/highlight/web-types.zh-CN.json +699 -177
- package/lib/_components/field-presentation/EditorPanel.vue.js +3 -3
- package/lib/_components/field-presentation/editor-pending.js +4 -0
- package/lib/_components/field-presentation/with-field-presentation.js +50 -7
- package/lib/_components/picker-field/PickerField.vue.js +3 -13
- package/lib/_components/picker-field/TemporalCurrent.vue.js +2 -3
- package/lib/_components/picker-field/range-labels.js +18 -0
- package/lib/_components/selected-options/style/index.css +33 -15
- package/lib/_components/selection-field/use-selection-session.js +1 -0
- package/lib/_components/virtual-list-v2/VirtualList2.vue.js +25 -3
- package/lib/action-sheet/ActionSheet2.vue.js +2 -3
- package/lib/auto-complete/auto-complete.js +2 -2
- package/lib/auto-complete/presentation.js +1 -0
- package/lib/auto-complete/props.js +2 -0
- package/lib/auto-complete/style/index.css +7 -2
- package/lib/back-top/style/index.css +1 -1
- package/lib/breadcrumb/style/index.css +1 -1
- package/lib/button/base.js +7 -0
- package/lib/button/index.js +4 -4
- package/lib/button/style/index.css +1 -1
- package/lib/card/Card.vue.js +55 -13
- package/lib/carousel/style/index.css +1 -1
- package/lib/carousel/use-carousel-locale.js +9 -2
- package/lib/cascader/CascaderMenu.vue.js +2 -2
- package/lib/cascader/cascader-option.js +15 -6
- package/lib/cascader/field-adapter.js +1 -0
- package/lib/cascader/props.js +2 -0
- package/lib/cascader/style/index.css +36 -9
- package/lib/cascader/style/index.js +1 -0
- package/lib/cascader/use-cascader-focus.js +9 -6
- package/lib/checkbox/base.js +7 -0
- package/lib/checkbox/index.js +4 -4
- package/lib/checkbox/presentation.js +2 -2
- package/lib/checkbox/style/index.css +1 -1
- package/lib/countdown/use-countdown.js +9 -2
- package/lib/date/DatePanelActions.vue.js +4 -4
- package/lib/date/DateRangeQuickPanel.vue.js +2 -2
- package/lib/date/DateShortcuts.vue.js +2 -2
- package/lib/date/field-adapter.js +2 -3
- package/lib/date/picker-panels/DayPickerPanel2.vue.js +6 -7
- package/lib/date/picker-panels/MonthPickerPanel2.vue.js +7 -8
- package/lib/date/picker-panels/PanelHeader2.vue.js +6 -7
- package/lib/date/picker-panels/YearPickerPanel2.vue.js +2 -2
- package/lib/date/presentation/CalendarContent2.vue.js +13 -14
- package/lib/date/presentation/CalendarViewport.vue.js +2 -3
- package/lib/date/presentation/use-date-locale.js +2 -3
- package/lib/date/presentation/use-field-locale.js +5 -6
- package/lib/date/presentation/use-panel-actions-locale.js +4 -5
- package/lib/date-range/presentation/RangeContent2.vue.js +4 -5
- package/lib/dialog/Dialog.vue.js +3 -3
- package/lib/ellipsis/style/index.css +1 -1
- package/lib/fab/Fab.js +4 -5
- package/lib/form/FormItemLabel.vue.js +3 -2
- package/lib/form/focus-explicit-label.js +52 -0
- package/lib/input/base.js +7 -0
- package/lib/input/index.js +5 -5
- package/lib/locale/date-text.js +38 -0
- package/lib/locale/misc-text.js +23 -0
- package/lib/locale/temporal-text.js +22 -0
- package/lib/locale/zh-CN.js +234 -130
- package/lib/maple-vue.js +1 -1
- package/lib/maple.cjs.js +3637 -2963
- package/lib/maple.css +273 -207
- package/lib/nav-menu/style/index.css +1 -1
- package/lib/notice-bar/NoticeBar2.vue.js +2 -3
- package/lib/number-keyboard/NumberKeyboard2.vue.js +5 -6
- package/lib/pagination/PageInput.vue.js +2 -2
- package/lib/pagination/style/index.css +2 -2
- package/lib/people-select/PeopleSelect.js +34 -53
- package/lib/people-select/Person.vue.js +3 -3
- package/lib/people-select/emits.js +1 -1
- package/lib/people-select/people-select.js +6 -8
- package/lib/people-select/presentation.js +3 -1
- package/lib/people-select/props.js +9 -3
- package/lib/people-select/selection.js +64 -0
- package/lib/people-select/style/index.css +6 -0
- package/lib/picker/Picker.vue.js +2 -2
- package/lib/picker/Picker2.vue.js +4 -5
- package/lib/picker/base.js +7 -0
- package/lib/picker/index.js +5 -5
- package/lib/progress/style/index.css +2 -2
- package/lib/radio/style/index.css +1 -1
- package/lib/rate/style/index.css +2 -2
- package/lib/ripple/index.js +78 -0
- package/lib/search/HistoryContent.vue.js +4 -4
- package/lib/search/Search.vue.js +4 -4
- package/lib/search/props.js +1 -2
- package/lib/select/props.js +2 -0
- package/lib/select/select.js +14 -4
- package/lib/select/style/index.css +22 -12
- package/lib/select/use-select-controller.js +22 -2
- package/lib/slider/Slider.vue.js +42 -20
- package/lib/slider/SliderInput.vue.js +14 -2
- package/lib/slider/style/index.css +2 -2
- package/lib/steps/style/index.css +10 -10
- package/lib/switch/Switch.vue.js +11 -0
- package/lib/switch/style/index.css +1 -1
- package/lib/tab-bar/TabBar.vue.js +2 -2
- package/lib/tab-bar/style/index.css +2 -2
- package/lib/tabs/style/index.css +1 -1
- package/lib/tabs/use-tabs-configuration.js +2 -3
- package/lib/themes/alps-light/index.js +10 -11
- package/lib/themes/create-brand-dark.js +18 -0
- package/lib/themes/dark/breadcrumb-item.js +1 -1
- package/lib/themes/dark/cascader.js +1 -1
- package/lib/themes/dark/index.js +2 -2
- package/lib/themes/firefly-light/index.js +12 -13
- package/lib/themes/index.js +2 -2
- package/lib/themes/maple-light/index.js +2 -2
- package/lib/time/presentation/TimeFieldPanel.vue.js +2 -2
- package/lib/time/presentation/TimePanelContent2.vue.js +8 -9
- package/lib/time/presentation/use-field-locale.js +5 -6
- package/lib/time/props.js +1 -1
- package/lib/time-range/presentation/TimePanelContent2.vue.js +6 -7
- package/lib/time-range/props.js +1 -1
- package/lib/trigger/popup-move-focus.js +6 -6
- package/lib/trigger/position.js +48 -2
- package/lib/trigger/positioner.js +33 -4
- package/lib/trigger/trigger.js +1 -1
- package/lib/upload/Upload.vue.js +17 -1
- package/lib/upload/composables/use-upload-queue.js +10 -1
- package/lib/upload/composables/use-uploader.js +45 -11
- package/lib/upload/use-upload-locale.js +15 -11
- package/lib/utils/modal-focus.js +9 -2
- package/lib/utils/modal-surface.js +9 -3
- package/package.json +6 -6
- package/types/styleVars.d.ts +3 -0
- package/types-generated/_components/field-presentation/editor-pending.d.ts +3 -0
- package/types-generated/_components/field-presentation/with-field-presentation.d.ts +2 -0
- package/types-generated/_components/picker-field/range-labels.d.ts +1 -0
- package/types-generated/action-sheet/ActionSheet.vue.d.ts +2 -1
- package/types-generated/action-sheet/index.d.ts +1 -1
- package/types-generated/auto-complete/auto-complete.d.ts +13 -4
- package/types-generated/auto-complete/index.d.ts +30 -0
- package/types-generated/auto-complete/presentation.d.ts +9 -0
- package/types-generated/auto-complete/props.d.ts +5 -1
- package/types-generated/breadcrumb/index.d.ts +72 -2
- package/types-generated/button/base.d.ts +266 -0
- package/types-generated/button/index.d.ts +3 -1
- package/types-generated/cascader/Cascader.vue.d.ts +10 -1
- package/types-generated/cascader/CascaderPanel.vue.d.ts +1 -1
- package/types-generated/cascader/index.d.ts +39 -9
- package/types-generated/cascader/presentation.d.ts +18 -3
- package/types-generated/cascader/props.d.ts +5 -0
- package/types-generated/cascader/style/index.d.ts +1 -0
- package/types-generated/cascader/use-cascader-controller.d.ts +4 -0
- package/types-generated/checkbox/base.d.ts +361 -0
- package/types-generated/checkbox/index.d.ts +362 -3
- package/types-generated/date/picker-panels/DayPickerPanel.vue.d.ts +6 -248
- package/types-generated/date/picker-panels/MonthPickerPanel.vue.d.ts +8 -249
- package/types-generated/date/picker-panels/PanelHeader.vue.d.ts +3 -124
- package/types-generated/date/picker-panels/YearPickerPanel.vue.d.ts +6 -248
- package/types-generated/date/presentation/CalendarContent.vue.d.ts +1169 -966
- package/types-generated/date-range/presentation/RangeContent.vue.d.ts +2561 -1430
- package/types-generated/form/focus-explicit-label.d.ts +2 -0
- package/types-generated/index.d.ts +1 -1
- package/types-generated/input/base.d.ts +481 -0
- package/types-generated/input/index.d.ts +2 -0
- package/types-generated/locale/date-text.d.ts +2 -0
- package/types-generated/locale/misc-text.d.ts +2 -0
- package/types-generated/locale/temporal-text.d.ts +2 -0
- package/types-generated/maple-vue.d.ts +1 -1
- package/types-generated/menu/index.d.ts +1022 -2
- package/types-generated/people-select/PeopleSelect.d.ts +38 -16
- package/types-generated/people-select/emits.d.ts +3 -2
- package/types-generated/people-select/index.d.ts +135 -63
- package/types-generated/people-select/people-select.d.ts +47 -16
- package/types-generated/people-select/presentation.d.ts +46 -16
- package/types-generated/people-select/props.d.ts +18 -7
- package/types-generated/people-select/selection.d.ts +11 -0
- package/types-generated/people-select/types.d.ts +5 -1
- package/types-generated/picker/Picker.vue.d.ts +5 -125
- package/types-generated/picker/base.d.ts +2043 -0
- package/types-generated/picker/index.d.ts +1134 -206
- package/types-generated/radio/index.d.ts +365 -2
- package/types-generated/search/Search.vue.d.ts +2 -2
- package/types-generated/search/props.d.ts +1 -1
- package/types-generated/select/index.d.ts +30 -0
- package/types-generated/select/native-editor-owner.d.ts +1 -0
- package/types-generated/select/props.d.ts +6 -1
- package/types-generated/select/select.d.ts +9 -0
- package/types-generated/select/use-select-controller.d.ts +5 -0
- package/types-generated/slider/SliderInput.vue.d.ts +4 -0
- package/types-generated/themes/dark/cascader.d.ts +1 -1
- package/types-generated/themes/index.d.ts +2 -2
- package/types-generated/time/presentation/TimePanelContent.vue.d.ts +1117 -309
- package/types-generated/time/props.d.ts +3 -2
- package/types-generated/time-range/picker-props.d.ts +1 -1
- package/types-generated/time-range/presentation/TimePanelContent.vue.d.ts +1125 -317
- package/types-generated/time-range/props.d.ts +6 -5
- package/types-generated/trigger/position.d.ts +1 -0
- package/types-generated/upload/Upload.vue.d.ts +11 -11
- package/types-generated/upload/composables/use-upload-queue.d.ts +1 -0
- package/types-generated/upload/composables/use-uploader.d.ts +2 -0
- package/types-generated/utils/modal-focus.d.ts +1 -0
- package/umd/_components/selected-options/style/index.css +33 -15
- package/umd/auto-complete/style/index.css +7 -2
- package/umd/back-top/style/index.css +1 -1
- package/umd/breadcrumb/style/index.css +1 -1
- package/umd/button/style/index.css +1 -1
- package/umd/carousel/style/index.css +1 -1
- package/umd/cascader/style/index.css +36 -9
- package/umd/checkbox/style/index.css +1 -1
- package/umd/ellipsis/style/index.css +1 -1
- package/umd/maple.css +273 -207
- package/umd/maple.js +3 -3
- package/umd/nav-menu/style/index.css +1 -1
- package/umd/pagination/style/index.css +2 -2
- package/umd/people-select/style/index.css +6 -0
- package/umd/progress/style/index.css +2 -2
- package/umd/radio/style/index.css +1 -1
- package/umd/rate/style/index.css +2 -2
- package/umd/select/style/index.css +22 -12
- package/umd/slider/style/index.css +2 -2
- package/umd/steps/style/index.css +10 -10
- package/umd/switch/style/index.css +1 -1
- package/umd/tab-bar/style/index.css +2 -2
- package/umd/tabs/style/index.css +1 -1
package/es/trigger/position.mjs
CHANGED
|
@@ -97,14 +97,29 @@ function getScrollElements(element) {
|
|
|
97
97
|
const visited = /* @__PURE__ */ new Set();
|
|
98
98
|
while (root && !visited.has(root.ownerDocument)) {
|
|
99
99
|
visited.add(root.ownerDocument);
|
|
100
|
-
|
|
100
|
+
const parent = (node) => {
|
|
101
|
+
if (node.assignedSlot) {
|
|
102
|
+
return node.assignedSlot;
|
|
103
|
+
}
|
|
104
|
+
if (node.parentElement) {
|
|
105
|
+
return node.parentElement;
|
|
106
|
+
}
|
|
107
|
+
const tree = node.getRootNode();
|
|
108
|
+
return tree.nodeType === 11 && "host" in tree ? tree.host : null;
|
|
109
|
+
};
|
|
110
|
+
let current = parent(root);
|
|
111
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
101
112
|
while (current && current !== current.ownerDocument.documentElement) {
|
|
113
|
+
if (ancestors.has(current)) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
ancestors.add(current);
|
|
102
117
|
const style = current.ownerDocument.defaultView?.getComputedStyle(current);
|
|
103
118
|
const overflow = `${style?.overflow ?? ""}${style?.overflowX ?? ""}${style?.overflowY ?? ""}`;
|
|
104
119
|
if (/(auto|scroll|overlay)/.test(overflow)) {
|
|
105
120
|
result.push(current);
|
|
106
121
|
}
|
|
107
|
-
current = current
|
|
122
|
+
current = parent(current);
|
|
108
123
|
}
|
|
109
124
|
try {
|
|
110
125
|
root = root.ownerDocument.defaultView?.frameElement ?? void 0;
|
|
@@ -114,6 +129,36 @@ function getScrollElements(element) {
|
|
|
114
129
|
}
|
|
115
130
|
return result;
|
|
116
131
|
}
|
|
132
|
+
function getSlotChangeRoots(element) {
|
|
133
|
+
const roots = [];
|
|
134
|
+
const visited = /* @__PURE__ */ new Set();
|
|
135
|
+
let current = element;
|
|
136
|
+
while (current && !visited.has(current)) {
|
|
137
|
+
visited.add(current);
|
|
138
|
+
const parentShadow = current.parentElement?.shadowRoot;
|
|
139
|
+
if (parentShadow) {
|
|
140
|
+
roots.push(parentShadow);
|
|
141
|
+
}
|
|
142
|
+
if (current.assignedSlot) {
|
|
143
|
+
current = current.assignedSlot;
|
|
144
|
+
} else if (current.parentElement) {
|
|
145
|
+
current = current.parentElement;
|
|
146
|
+
} else {
|
|
147
|
+
const tree = current.getRootNode();
|
|
148
|
+
if (tree.nodeType === 11 && "host" in tree) {
|
|
149
|
+
roots.push(tree);
|
|
150
|
+
current = tree.host;
|
|
151
|
+
} else {
|
|
152
|
+
try {
|
|
153
|
+
current = current.ownerDocument.defaultView?.frameElement;
|
|
154
|
+
} catch {
|
|
155
|
+
current = void 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return roots;
|
|
161
|
+
}
|
|
117
162
|
function getScrollViews(element) {
|
|
118
163
|
const result = [];
|
|
119
164
|
let document = element?.ownerDocument;
|
|
@@ -135,5 +180,6 @@ function getScrollViews(element) {
|
|
|
135
180
|
export {
|
|
136
181
|
calculatePopupPosition,
|
|
137
182
|
getScrollElements,
|
|
138
|
-
getScrollViews
|
|
183
|
+
getScrollViews,
|
|
184
|
+
getSlotChangeRoots
|
|
139
185
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { ref, watch, nextTick, onMounted, onActivated, onDeactivated, onBeforeUnmount } from "vue";
|
|
2
2
|
import { getArrowStyle } from "./arrow.mjs";
|
|
3
3
|
import { getPositioningSpace, translateRectBetweenDocuments, getRelativeRect, getTransformOrigin } from "./geometry.mjs";
|
|
4
|
-
import { getScrollElements, getScrollViews, calculatePopupPosition } from "./position.mjs";
|
|
4
|
+
import { getSlotChangeRoots, getScrollElements, getScrollViews, calculatePopupPosition } from "./position.mjs";
|
|
5
5
|
import { useElementResize } from "../utils/resize-observer.mjs";
|
|
6
6
|
function rafThrottle(callback, ownerView) {
|
|
7
7
|
let frame;
|
|
8
8
|
let frameView;
|
|
9
9
|
let latest;
|
|
10
|
+
let latestTarget;
|
|
10
11
|
let generation = 0;
|
|
11
12
|
const run = (event) => {
|
|
12
13
|
latest = event;
|
|
14
|
+
latestTarget = event?.currentTarget ?? event?.target;
|
|
13
15
|
if (frame !== void 0) {
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
@@ -27,8 +29,10 @@ function rafThrottle(callback, ownerView) {
|
|
|
27
29
|
frame = void 0;
|
|
28
30
|
frameView = void 0;
|
|
29
31
|
const currentEvent = latest;
|
|
32
|
+
const currentTarget = latestTarget;
|
|
30
33
|
latest = void 0;
|
|
31
|
-
|
|
34
|
+
latestTarget = void 0;
|
|
35
|
+
callback(currentEvent, currentTarget);
|
|
32
36
|
});
|
|
33
37
|
};
|
|
34
38
|
run.cancel = () => {
|
|
@@ -39,6 +43,7 @@ function rafThrottle(callback, ownerView) {
|
|
|
39
43
|
frame = void 0;
|
|
40
44
|
frameView = void 0;
|
|
41
45
|
latest = void 0;
|
|
46
|
+
latestTarget = void 0;
|
|
42
47
|
};
|
|
43
48
|
return run;
|
|
44
49
|
}
|
|
@@ -54,6 +59,7 @@ function useTriggerPositioner(options, context) {
|
|
|
54
59
|
let scrollPositions = /* @__PURE__ */ new WeakMap();
|
|
55
60
|
let windowPositions = /* @__PURE__ */ new WeakMap();
|
|
56
61
|
let scrollViews = [];
|
|
62
|
+
let slotRoots = [];
|
|
57
63
|
function update() {
|
|
58
64
|
const reference = context.reference.value;
|
|
59
65
|
const popup = context.popup.value;
|
|
@@ -139,10 +145,10 @@ function useTriggerPositioner(options, context) {
|
|
|
139
145
|
}
|
|
140
146
|
}
|
|
141
147
|
const scrolling = rafThrottle(
|
|
142
|
-
(
|
|
148
|
+
(_event, eventTarget) => {
|
|
143
149
|
const shouldClose = options.scrollToClose || context.globalScrollToClose.value;
|
|
144
|
-
if (shouldClose &&
|
|
145
|
-
const target =
|
|
150
|
+
if (shouldClose && eventTarget) {
|
|
151
|
+
const target = eventTarget;
|
|
146
152
|
const previous = scrollPositions.get(target) ?? [target.scrollTop, target.scrollLeft];
|
|
147
153
|
scrollPositions.set(target, previous);
|
|
148
154
|
if (Math.abs(target.scrollTop - previous[0]) >= options.scrollToCloseDistance || Math.abs(target.scrollLeft - previous[1]) >= options.scrollToCloseDistance) {
|
|
@@ -189,11 +195,30 @@ function useTriggerPositioner(options, context) {
|
|
|
189
195
|
for (const view of scrollViews) {
|
|
190
196
|
view.removeEventListener("scroll", onWindowScroll);
|
|
191
197
|
}
|
|
198
|
+
for (const slot of slotRoots) {
|
|
199
|
+
slot.removeEventListener("slotchange", onSlotChange);
|
|
200
|
+
}
|
|
201
|
+
slotRoots = [];
|
|
192
202
|
scrollViews = [];
|
|
193
203
|
scrollElements = [];
|
|
194
204
|
scrollPositions = /* @__PURE__ */ new WeakMap();
|
|
195
205
|
windowPositions = /* @__PURE__ */ new WeakMap();
|
|
196
206
|
}
|
|
207
|
+
function onSlotChange() {
|
|
208
|
+
positionGeneration++;
|
|
209
|
+
const reference = context.reference.value;
|
|
210
|
+
const popup = context.popup.value;
|
|
211
|
+
const nextElements = [.../* @__PURE__ */ new Set([...getScrollElements(reference), ...getScrollElements(popup)])];
|
|
212
|
+
const nextViews = [.../* @__PURE__ */ new Set([...getScrollViews(reference), ...getScrollViews(popup)])];
|
|
213
|
+
const nextRoots = [.../* @__PURE__ */ new Set([...getSlotChangeRoots(reference), ...getSlotChangeRoots(popup)])];
|
|
214
|
+
function changed(before, after) {
|
|
215
|
+
return before.length !== after.length || before.some((item, index) => item !== after[index]);
|
|
216
|
+
}
|
|
217
|
+
if (changed(scrollElements, nextElements) || changed(scrollViews, nextViews) || changed(slotRoots, nextRoots)) {
|
|
218
|
+
bindScroll();
|
|
219
|
+
}
|
|
220
|
+
nextTick(update);
|
|
221
|
+
}
|
|
197
222
|
function bindScroll() {
|
|
198
223
|
unbindScroll();
|
|
199
224
|
const reference = context.reference.value;
|
|
@@ -202,6 +227,10 @@ function useTriggerPositioner(options, context) {
|
|
|
202
227
|
if (!active || !reference || !popup || !context.visible.value || suspended) {
|
|
203
228
|
return;
|
|
204
229
|
}
|
|
230
|
+
slotRoots = [.../* @__PURE__ */ new Set([...getSlotChangeRoots(reference), ...getSlotChangeRoots(popup)])];
|
|
231
|
+
for (const slot of slotRoots) {
|
|
232
|
+
slot.addEventListener("slotchange", onSlotChange);
|
|
233
|
+
}
|
|
205
234
|
scrollElements = [.../* @__PURE__ */ new Set([...getScrollElements(reference), ...getScrollElements(popup)])];
|
|
206
235
|
for (const element of scrollElements) {
|
|
207
236
|
scrollPositions.set(element, [element.scrollTop, element.scrollLeft]);
|
package/es/trigger/trigger.mjs
CHANGED
|
@@ -162,7 +162,7 @@ const Trigger = /* @__PURE__ */ defineComponent({
|
|
|
162
162
|
});
|
|
163
163
|
return () => {
|
|
164
164
|
const referenceNodes = mergeFirstReferenceClass(slots.default?.() ?? [], visible.value ? props.openedClass : void 0);
|
|
165
|
-
const contentNodes = slots.content?.() ?? [];
|
|
165
|
+
const contentNodes = renderState.rendered.value ? slots.content?.() ?? [] : [];
|
|
166
166
|
const hiddenByEmpty = props.hideEmpty && isEmptyContent(contentNodes);
|
|
167
167
|
nodes.value = referenceNodes;
|
|
168
168
|
return createVNode(Fragment, null, [referenceNodes, createVNode(Teleport, {
|
package/es/upload/Upload.vue.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onBeforeUnmount, openBlock, createElementBlock, unref, normalizeClass, createElementVNode, createVNode, withDirectives, renderSlot, toDisplayString, createCommentVNode, Fragment, renderList, mergeProps, normalizeStyle } from "vue";
|
|
1
|
+
import { defineComponent, ref, inject, watch, onBeforeUnmount, openBlock, createElementBlock, unref, normalizeClass, createElementVNode, createVNode, withDirectives, renderSlot, toDisplayString, createCommentVNode, Fragment, renderList, mergeProps, normalizeStyle } from "vue";
|
|
2
2
|
import { IconEye, IconDownload, IconClose, IconRefresh } from "@maple-design/icons-vue";
|
|
3
|
+
import { fieldEditorControlPending } from "../_components/field-presentation/editor-pending.mjs";
|
|
3
4
|
import _sfc_main$1 from "../_components/pending-feedback/PendingFeedback.vue.mjs";
|
|
4
5
|
import { useFormErrorDescription } from "../form/error-description.mjs";
|
|
5
6
|
import { ImagePreviewFn as previewImage } from "../image/preview.mjs";
|
|
@@ -133,6 +134,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
});
|
|
137
|
+
const editorPending = inject(fieldEditorControlPending, void 0);
|
|
138
|
+
watch(
|
|
139
|
+
uploader.editorPending,
|
|
140
|
+
(value) => {
|
|
141
|
+
if (editorPending) {
|
|
142
|
+
editorPending.value = value;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{ flush: "sync" }
|
|
146
|
+
);
|
|
147
|
+
onBeforeUnmount(() => {
|
|
148
|
+
if (editorPending) {
|
|
149
|
+
editorPending.value = false;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
136
152
|
const {
|
|
137
153
|
fileList,
|
|
138
154
|
maxReached,
|
|
@@ -253,7 +269,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
253
269
|
class: normalizeClass(unref(n)("input")),
|
|
254
270
|
type: "file",
|
|
255
271
|
accept: _ctx.accept,
|
|
256
|
-
capture: _ctx.capture,
|
|
272
|
+
capture: _ctx.capture === false ? void 0 : _ctx.capture === true ? "" : _ctx.capture,
|
|
257
273
|
multiple: !unref(replacementTarget) && (_ctx.multiple || _ctx.directory),
|
|
258
274
|
disabled: unref(disabledState),
|
|
259
275
|
webkitdirectory: !unref(replacementTarget) && _ctx.directory || void 0,
|
|
@@ -2,10 +2,13 @@ import { ref, computed, nextTick } from "vue";
|
|
|
2
2
|
function useUploadQueue(options) {
|
|
3
3
|
const inner = ref((options.defaultValue?.() ?? []).map((file) => ({ ...file })));
|
|
4
4
|
const fileList = computed(() => options.modelValue?.() ?? inner.value);
|
|
5
|
+
let revision = 0;
|
|
5
6
|
let pending;
|
|
6
7
|
let pendingBase;
|
|
7
8
|
const mutationList = () => pending && fileList.value === pendingBase ? pending : fileList.value;
|
|
8
9
|
function commit(next, changed) {
|
|
10
|
+
const currentRevision = ++revision;
|
|
11
|
+
const startedActive = options.isActive?.() ?? true;
|
|
9
12
|
pendingBase = fileList.value;
|
|
10
13
|
pending = next;
|
|
11
14
|
if (options.modelValue?.() === void 0) {
|
|
@@ -18,7 +21,9 @@ function useUploadQueue(options) {
|
|
|
18
21
|
}
|
|
19
22
|
});
|
|
20
23
|
options.onUpdateModelValue?.(next);
|
|
21
|
-
options.
|
|
24
|
+
if (revision === currentRevision && (!startedActive || (options.isActive?.() ?? true))) {
|
|
25
|
+
options.onChange?.(next, changed);
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
function append(files) {
|
|
24
29
|
if (files.length) {
|
|
@@ -64,6 +69,10 @@ function useUploadQueue(options) {
|
|
|
64
69
|
function reset() {
|
|
65
70
|
if (fileList.value.length) {
|
|
66
71
|
commit([]);
|
|
72
|
+
} else {
|
|
73
|
+
revision++;
|
|
74
|
+
pending = void 0;
|
|
75
|
+
pendingBase = void 0;
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
return {
|
|
@@ -9,6 +9,7 @@ import { useFilePicker } from "./use-file-picker.mjs";
|
|
|
9
9
|
import { useUploadQueue } from "./use-upload-queue.mjs";
|
|
10
10
|
function useUploader(options) {
|
|
11
11
|
const feedback = usePendingFeedback();
|
|
12
|
+
const preparation = usePendingFeedback();
|
|
12
13
|
let active = true;
|
|
13
14
|
let inactive = false;
|
|
14
15
|
let generation = 0;
|
|
@@ -26,7 +27,8 @@ function useUploader(options) {
|
|
|
26
27
|
modelValue: options.modelValue,
|
|
27
28
|
defaultValue: options.defaultValue,
|
|
28
29
|
onChange: options.onChange,
|
|
29
|
-
onUpdateModelValue: options.onUpdateModelValue
|
|
30
|
+
onUpdateModelValue: options.onUpdateModelValue,
|
|
31
|
+
isActive: () => active && !inactive
|
|
30
32
|
});
|
|
31
33
|
const replacementTarget = ref();
|
|
32
34
|
const metadataVersion = ref(0);
|
|
@@ -202,8 +204,8 @@ function useUploader(options) {
|
|
|
202
204
|
}
|
|
203
205
|
function enqueue(files, rejected, previous) {
|
|
204
206
|
const epoch = generation;
|
|
205
|
-
adding = adding.then(() => prepareFiles(files, rejected, epoch, previous)).catch(() => {
|
|
206
|
-
});
|
|
207
|
+
adding = preparation.track(() => adding.then(() => prepareFiles(files, rejected, epoch, previous)).catch(() => {
|
|
208
|
+
}));
|
|
207
209
|
return adding;
|
|
208
210
|
}
|
|
209
211
|
async function prepareFiles(files, initialRejected, epoch, previous) {
|
|
@@ -221,7 +223,9 @@ function useUploader(options) {
|
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
} catch {
|
|
224
|
-
|
|
226
|
+
if (valid(epoch)) {
|
|
227
|
+
reject([...rejected, ...files.map((file) => ({ file, reason: "before-add" }))]);
|
|
228
|
+
}
|
|
225
229
|
return;
|
|
226
230
|
}
|
|
227
231
|
}
|
|
@@ -308,9 +312,17 @@ function useUploader(options) {
|
|
|
308
312
|
return;
|
|
309
313
|
}
|
|
310
314
|
reject(rejected);
|
|
315
|
+
if (!valid(epoch)) {
|
|
316
|
+
items.forEach((item) => release(item.uid));
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
311
319
|
if (rejected.some((file) => file.reason === "max-files")) {
|
|
312
320
|
options.onExceed?.(candidates, queue.fileList.value);
|
|
313
321
|
}
|
|
322
|
+
if (!valid(epoch)) {
|
|
323
|
+
items.forEach((item) => release(item.uid));
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
314
326
|
if (!items.length) {
|
|
315
327
|
return;
|
|
316
328
|
}
|
|
@@ -332,11 +344,19 @@ function useUploader(options) {
|
|
|
332
344
|
items.forEach((file) => pendingAuto.add(file.uid));
|
|
333
345
|
if (previous) {
|
|
334
346
|
queue.replace(previous, items[0]);
|
|
347
|
+
if (!valid(epoch)) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
335
350
|
options.onReplace?.(items[0], previous);
|
|
336
351
|
} else {
|
|
337
352
|
queue.append(items);
|
|
338
353
|
}
|
|
339
|
-
|
|
354
|
+
for (const file of items) {
|
|
355
|
+
if (!valid(epoch)) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
options.onRead?.(reactive(file));
|
|
359
|
+
}
|
|
340
360
|
await nextTick();
|
|
341
361
|
}
|
|
342
362
|
async function submit(file) {
|
|
@@ -350,6 +370,7 @@ function useUploader(options) {
|
|
|
350
370
|
if (attempts.has(file.uid)) {
|
|
351
371
|
return;
|
|
352
372
|
}
|
|
373
|
+
const epoch = generation;
|
|
353
374
|
const attempt = {};
|
|
354
375
|
attempts.set(file.uid, attempt);
|
|
355
376
|
const current = () => active && !inactive && attempts.get(file.uid) === attempt && queue.fileList.value.some(
|
|
@@ -394,7 +415,9 @@ function useUploader(options) {
|
|
|
394
415
|
}
|
|
395
416
|
const changed = { ...item, status: "uploading", percent: event.percent };
|
|
396
417
|
queue.patch(file.uid, { status: changed.status, percent: changed.percent });
|
|
397
|
-
|
|
418
|
+
if (valid(epoch) && current()) {
|
|
419
|
+
options.onProgress?.(changed, event);
|
|
420
|
+
}
|
|
398
421
|
};
|
|
399
422
|
const handleSuccess = (response) => {
|
|
400
423
|
if (!current()) {
|
|
@@ -403,7 +426,9 @@ function useUploader(options) {
|
|
|
403
426
|
attempts.delete(file.uid);
|
|
404
427
|
const changed = { ...item, status: "success", percent: 100, response };
|
|
405
428
|
queue.patch(file.uid, { status: changed.status, percent: changed.percent, response });
|
|
406
|
-
|
|
429
|
+
if (valid(epoch)) {
|
|
430
|
+
options.onSuccess?.(changed);
|
|
431
|
+
}
|
|
407
432
|
};
|
|
408
433
|
const handleError = (error) => {
|
|
409
434
|
if (!current()) {
|
|
@@ -412,7 +437,9 @@ function useUploader(options) {
|
|
|
412
437
|
attempts.delete(file.uid);
|
|
413
438
|
const changed = { ...item, status: "error", percent: 0, error };
|
|
414
439
|
queue.patch(file.uid, { status: changed.status, percent: changed.percent, error });
|
|
415
|
-
|
|
440
|
+
if (valid(epoch)) {
|
|
441
|
+
options.onError?.(changed);
|
|
442
|
+
}
|
|
416
443
|
};
|
|
417
444
|
const requestOptions = {
|
|
418
445
|
action: options.action?.(),
|
|
@@ -445,7 +472,9 @@ function useUploader(options) {
|
|
|
445
472
|
attempts.delete(file.uid);
|
|
446
473
|
const changed = { ...item, status: "error", percent: 0, error };
|
|
447
474
|
queue.patch(file.uid, changed);
|
|
448
|
-
|
|
475
|
+
if (valid(epoch)) {
|
|
476
|
+
options.onError?.(changed);
|
|
477
|
+
}
|
|
449
478
|
}
|
|
450
479
|
}
|
|
451
480
|
function abort(file) {
|
|
@@ -481,7 +510,9 @@ function useUploader(options) {
|
|
|
481
510
|
cancelAttempt(file.uid);
|
|
482
511
|
pendingAuto.delete(file.uid);
|
|
483
512
|
queue.remove(file);
|
|
484
|
-
|
|
513
|
+
if (valid(epoch)) {
|
|
514
|
+
options.onRemove?.(file);
|
|
515
|
+
}
|
|
485
516
|
} catch {
|
|
486
517
|
} finally {
|
|
487
518
|
if (removals.get(file.uid) === token) {
|
|
@@ -508,10 +539,11 @@ function useUploader(options) {
|
|
|
508
539
|
});
|
|
509
540
|
}
|
|
510
541
|
function reset() {
|
|
511
|
-
feedback.cancel();
|
|
512
542
|
if (disabled.value) {
|
|
513
543
|
return;
|
|
514
544
|
}
|
|
545
|
+
feedback.cancel();
|
|
546
|
+
preparation.cancel();
|
|
515
547
|
generation++;
|
|
516
548
|
replacementTarget.value = void 0;
|
|
517
549
|
adding = Promise.resolve();
|
|
@@ -562,6 +594,8 @@ function useUploader(options) {
|
|
|
562
594
|
});
|
|
563
595
|
return {
|
|
564
596
|
guardPending: feedback.pending,
|
|
597
|
+
/** @internal Coordinates deferred field confirmation with file preparation. */
|
|
598
|
+
editorPending: computed(() => feedback.pending.value || preparation.pending.value),
|
|
565
599
|
fileList: queue.fileList,
|
|
566
600
|
maxReached,
|
|
567
601
|
disabled,
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
-
import "../locale/
|
|
3
|
-
import {
|
|
2
|
+
import { t, defaultLocaleReady } from "../locale/state.mjs";
|
|
3
|
+
import { defaultUploadClose, defaultUploadDelete, defaultUploadRetry, defaultUploadCancel, defaultUploadDownload, defaultUploadPreview, defaultUploadDrag, defaultUploadButtonText, defaultUploadDuration, defaultUploadReplace } from "../locale/zh-CN.mjs";
|
|
4
|
+
function text(key, fallback) {
|
|
5
|
+
const value = t(key);
|
|
6
|
+
return String(defaultLocaleReady.value ? value : value ?? fallback);
|
|
7
|
+
}
|
|
4
8
|
function useUploadLocale() {
|
|
5
9
|
return computed(() => ({
|
|
6
|
-
replace:
|
|
7
|
-
duration:
|
|
8
|
-
upload:
|
|
9
|
-
dropFiles:
|
|
10
|
-
preview:
|
|
11
|
-
download:
|
|
12
|
-
cancel:
|
|
13
|
-
retry:
|
|
14
|
-
remove:
|
|
15
|
-
close:
|
|
10
|
+
replace: text("upload.replace", defaultUploadReplace),
|
|
11
|
+
duration: text("upload.duration", defaultUploadDuration),
|
|
12
|
+
upload: text("upload.buttonText", defaultUploadButtonText),
|
|
13
|
+
dropFiles: text("upload.drag", defaultUploadDrag),
|
|
14
|
+
preview: text("upload.preview", defaultUploadPreview),
|
|
15
|
+
download: text("upload.download", defaultUploadDownload),
|
|
16
|
+
cancel: text("upload.cancel", defaultUploadCancel),
|
|
17
|
+
retry: text("upload.retry", defaultUploadRetry),
|
|
18
|
+
remove: text("upload.delete", defaultUploadDelete),
|
|
19
|
+
close: text("upload.close", defaultUploadClose)
|
|
16
20
|
}));
|
|
17
21
|
}
|
|
18
22
|
export {
|
package/es/utils/modal-focus.mjs
CHANGED
|
@@ -70,6 +70,13 @@ function useModalFocus(root, active, isTop, lockScroll = () => true, ownerDocume
|
|
|
70
70
|
target.focus({ preventScroll: true });
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
function focusAfterEnter() {
|
|
74
|
+
const doc = root()?.ownerDocument;
|
|
75
|
+
const current = doc?.activeElement;
|
|
76
|
+
if (!current || current === doc?.body || current === doc?.documentElement || previous.includes(current)) {
|
|
77
|
+
focus();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
73
80
|
function restore() {
|
|
74
81
|
const focused = owner?.activeElement;
|
|
75
82
|
const target = previous.find(restorable);
|
|
@@ -174,7 +181,7 @@ function useModalFocus(root, active, isTop, lockScroll = () => true, ownerDocume
|
|
|
174
181
|
unbind();
|
|
175
182
|
bind();
|
|
176
183
|
}
|
|
177
|
-
if (value) {
|
|
184
|
+
if (value && (!captured || root() !== element)) {
|
|
178
185
|
capture();
|
|
179
186
|
}
|
|
180
187
|
},
|
|
@@ -205,7 +212,7 @@ function useModalFocus(root, active, isTop, lockScroll = () => true, ownerDocume
|
|
|
205
212
|
unbind();
|
|
206
213
|
restore();
|
|
207
214
|
});
|
|
208
|
-
return { focus, restore, trap };
|
|
215
|
+
return { focus, focusAfterEnter, restore, trap };
|
|
209
216
|
}
|
|
210
217
|
export {
|
|
211
218
|
useModalFocus
|
|
@@ -40,7 +40,7 @@ function useModalSurface(options) {
|
|
|
40
40
|
const { zIndex } = useZIndex(layerActive, 3);
|
|
41
41
|
const mergedZIndex = computed(() => options.zIndex() ?? zIndex.value);
|
|
42
42
|
const { onStackTop } = usePopupLayer(layerActive, mergedZIndex, modalDocument);
|
|
43
|
-
const { focus, restore } = useModalFocus(
|
|
43
|
+
const { focus, focusAfterEnter, restore } = useModalFocus(
|
|
44
44
|
() => options.root.value?.querySelector("[data-modal-focus-root]") ?? options.root.value,
|
|
45
45
|
() => mergedOpen.value,
|
|
46
46
|
onStackTop,
|
|
@@ -50,7 +50,13 @@ function useModalSurface(options) {
|
|
|
50
50
|
watch(
|
|
51
51
|
[popupContainerTarget, () => options.popupContainer() === false],
|
|
52
52
|
() => {
|
|
53
|
-
nextTick(
|
|
53
|
+
nextTick(() => {
|
|
54
|
+
const doc = modalDocument();
|
|
55
|
+
const current = doc?.activeElement;
|
|
56
|
+
if (!current || current === doc?.body || current === doc?.documentElement) {
|
|
57
|
+
focus();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
54
60
|
},
|
|
55
61
|
{ flush: "post" }
|
|
56
62
|
);
|
|
@@ -126,7 +132,7 @@ function useModalSurface(options) {
|
|
|
126
132
|
onBeforeUnmount(unbind);
|
|
127
133
|
function opened() {
|
|
128
134
|
if (mergedOpen.value) {
|
|
129
|
-
|
|
135
|
+
focusAfterEnter();
|
|
130
136
|
transition.opened();
|
|
131
137
|
}
|
|
132
138
|
}
|