@gct-paas/word 1.0.2 → 1.0.3-beta.0
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/README.md +20 -11
- package/dist/browser.js +1 -1
- package/dist/chunks/{ModelEditor-CXoezurC.js → ModelEditor-DqavEAJg.js} +113 -4
- package/dist/chunks/ModelEditor-DqavEAJg.js.map +1 -0
- package/dist/chunks/NodeFactory-DzFnWaWf.js +500 -0
- package/dist/chunks/NodeFactory-DzFnWaWf.js.map +1 -0
- package/dist/chunks/{browser-DY0wE3Uz.js → browser-OAJIVM8O.js} +412 -185
- package/dist/chunks/browser-OAJIVM8O.js.map +1 -0
- package/dist/chunks/legacy-template-converter-DFsd-elN.js +125 -0
- package/dist/chunks/legacy-template-converter-DFsd-elN.js.map +1 -0
- package/dist/chunks/migrate-YJTylIpz.js +5193 -0
- package/dist/chunks/migrate-YJTylIpz.js.map +1 -0
- package/dist/chunks/{sdk-Dz96Ca_-.js → sdk-BmwE5mZn.js} +1069 -615
- package/dist/chunks/sdk-BmwE5mZn.js.map +1 -0
- package/dist/chunks/src-BFXPGLus.js +3338 -0
- package/dist/chunks/src-BFXPGLus.js.map +1 -0
- package/dist/chunks/{table-borders-Dwuj7lFp.js → table-borders-B9bZMj5o.js} +2 -2
- package/dist/chunks/{table-borders-Dwuj7lFp.js.map → table-borders-B9bZMj5o.js.map} +1 -1
- package/dist/chunks/templates-Djcl21k4.js.map +1 -1
- package/dist/chunks/{types-Bq4hbWKT.js → types-CMkQ6Lvg.js} +122 -6
- package/dist/chunks/types-CMkQ6Lvg.js.map +1 -0
- package/dist/chunks/{NodeFactory-D9gVGSok.js → validation-DkCy8wHI.js} +10 -495
- package/dist/chunks/validation-DkCy8wHI.js.map +1 -0
- package/dist/docx.js +3 -2
- package/dist/docx.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/legacy.js +1 -0
- package/dist/platform.js +2 -2
- package/dist/style.css +760 -480
- package/dist/types/adapters/browser/canvas/CanvasPages.d.ts +1 -1
- package/dist/types/adapters/browser/canvas/paint-context.d.ts +4 -0
- package/dist/types/adapters/browser/canvas/paint-signature.d.ts +4 -0
- package/dist/types/adapters/browser/input/SignatureFieldInput.d.ts +10 -1
- package/dist/types/adapters/browser/input/signature-panel.d.ts +6 -0
- package/dist/types/adapters/browser/input/validation/CanvasValidationPanel.d.ts +1 -1
- package/dist/types/adapters/browser/input/word-error-text.d.ts +8 -2
- package/dist/types/adapters/platform/index.d.ts +1 -0
- package/dist/types/adapters/platform/templates.d.ts +11 -1
- package/dist/types/adapters/vue/GctWordPrintRenderer.vue.d.ts +1 -1
- package/dist/types/adapters/vue/GctWordTemplateDesigner.vue.d.ts +3 -0
- package/dist/types/adapters/vue/SignatureCardReader.vue.d.ts +1 -0
- package/dist/types/adapters/vue/SignatureVisual.vue.d.ts +10 -0
- package/dist/types/adapters/vue/WordFeedback.vue.d.ts +11 -0
- package/dist/types/adapters/vue/WordLayoutNotices.vue.d.ts +8 -0
- package/dist/types/adapters/vue/WordOperationError.vue.d.ts +11 -0
- package/dist/types/adapters/vue/field-properties/dependency-strategies.d.ts +7 -0
- package/dist/types/adapters/vue/index.d.ts +1 -0
- package/dist/types/adapters/vue/layout-notices.d.ts +15 -0
- package/dist/types/adapters/vue/legacy-template-converter.d.ts +14 -0
- package/dist/types/adapters/vue/region-properties/WordBusinessRegion.vue.d.ts +3 -0
- package/dist/types/adapters/vue/region-properties/WordDataLockConfig.vue.d.ts +16 -0
- package/dist/types/adapters/vue/useWordWorkspace.d.ts +6 -3
- package/dist/types/adapters/vue/word-feedback.d.ts +21 -0
- package/dist/types/data/DataManager.d.ts +2 -2
- package/dist/types/data/rows/copy-row.d.ts +5 -0
- package/dist/types/data/services/DataDependencies.d.ts +2 -2
- package/dist/types/data/types/manager.d.ts +2 -0
- package/dist/types/data/types/rules.d.ts +8 -1
- package/dist/types/import/legacy/autofill.d.ts +3 -0
- package/dist/types/import/legacy/bindings.d.ts +9 -0
- package/dist/types/import/legacy/boundary.d.ts +10 -0
- package/dist/types/import/legacy/business-fields.d.ts +25 -0
- package/dist/types/import/legacy/context.d.ts +61 -0
- package/dist/types/import/legacy/data-sources.d.ts +29 -0
- package/dist/types/import/legacy/document-rules.d.ts +38 -0
- package/dist/types/import/legacy/document-signature.d.ts +16 -0
- package/dist/types/import/legacy/fields.d.ts +34 -0
- package/dist/types/import/legacy/index.d.ts +3 -0
- package/dist/types/import/legacy/initialization.d.ts +34 -0
- package/dist/types/import/legacy/json-data.d.ts +25 -0
- package/dist/types/import/legacy/materials.d.ts +40 -0
- package/dist/types/import/legacy/media.d.ts +18 -0
- package/dist/types/import/legacy/metadata.d.ts +23 -0
- package/dist/types/import/legacy/migrate.d.ts +9 -0
- package/dist/types/import/legacy/page-widgets.d.ts +30 -0
- package/dist/types/import/legacy/relations.d.ts +25 -0
- package/dist/types/import/legacy/scalar-fields.d.ts +7 -0
- package/dist/types/import/legacy/styles.d.ts +52 -0
- package/dist/types/import/legacy/table-variants.d.ts +18 -0
- package/dist/types/import/legacy/tables.d.ts +27 -0
- package/dist/types/import/legacy/trace-fields.d.ts +21 -0
- package/dist/types/import/legacy/types.d.ts +141 -0
- package/dist/types/import/legacy/widget-presentation.d.ts +10 -0
- package/dist/types/layout/engine/atoms/control-text.d.ts +16 -0
- package/dist/types/layout/engine/atoms/field-control.d.ts +0 -13
- package/dist/types/layout/engine/atoms/signatures.d.ts +2 -2
- package/dist/types/layout/engine/blocks/placement-types.d.ts +7 -0
- package/dist/types/layout/engine/pagination/content-flow.d.ts +8 -0
- package/dist/types/layout/engine/tables/place-table-window.d.ts +3 -2
- package/dist/types/layout/engine/tables/row-flow.d.ts +3 -2
- package/dist/types/layout/engine/tables/table-flow.d.ts +3 -1
- package/dist/types/layout/geometry/control-brackets.d.ts +4 -0
- package/dist/types/layout/types/presentation/controls.d.ts +13 -0
- package/dist/types/layout/types/presentation/images.d.ts +8 -0
- package/dist/types/layout/types/presentation/signatures.d.ts +6 -0
- package/dist/types/model/business/business-types.d.ts +9 -1
- package/dist/types/model/business/data-lock-config.d.ts +27 -0
- package/dist/types/runtime/form/business/signatures/NativeSignatures.d.ts +3 -1
- package/dist/types/runtime/form/business/signatures/device-signature-lock.d.ts +2 -0
- package/dist/types/runtime/form/business/tables/row-fields.d.ts +1 -1
- package/dist/types/runtime/form/copy-field-paths.d.ts +3 -0
- package/dist/types/runtime/form/fields/core/rules/CommonFieldRules.d.ts +5 -1
- package/dist/types/runtime/form/validation/NativeFieldValidation.d.ts +14 -2
- package/dist/types/runtime/form/validation/targets.d.ts +1 -1
- package/dist/types/runtime/form/validation/types.d.ts +2 -0
- package/dist/types/runtime/interaction/EditorController.d.ts +2 -0
- package/dist/types/runtime/interaction/browse/types.d.ts +5 -0
- package/dist/types/runtime/interaction/design/format/EditorFormat.d.ts +2 -2
- package/dist/types/runtime/interaction/design/format/summary.d.ts +1 -2
- package/dist/types/runtime/interaction/design/format/targets.d.ts +11 -0
- package/dist/types/runtime/interaction/design/format/types.d.ts +3 -3
- package/dist/types/runtime/interaction/design/tables/regions/definitions.d.ts +7 -0
- package/dist/types/runtime/interaction/field-signature.d.ts +3 -0
- package/dist/types/runtime/presentation/fields/signatures.d.ts +5 -2
- package/dist/types/shared/platform-gct/form-credentials.d.ts +0 -1
- package/dist/types/shared/platform-gct/templates.d.ts +2 -0
- package/dist/types/shared/signature-graphic.d.ts +27 -0
- package/dist/types/shared/text/shading.d.ts +12 -0
- package/dist/types/shared/ui/select/src/select.types.d.ts +2 -0
- package/dist/types/shared/ui/tree-select/src/unified-tree-select.vue.d.ts +1 -1
- package/dist/vue.js +2101 -4470
- package/dist/vue.js.map +1 -1
- package/package.json +9 -3
- package/dist/chunks/ModelEditor-CXoezurC.js.map +0 -1
- package/dist/chunks/NodeFactory-D9gVGSok.js.map +0 -1
- package/dist/chunks/browser-DY0wE3Uz.js.map +0 -1
- package/dist/chunks/sdk-Dz96Ca_-.js.map +0 -1
- package/dist/chunks/types-Bq4hbWKT.js.map +0 -1
|
@@ -0,0 +1,3338 @@
|
|
|
1
|
+
import { Teleport, Transition, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, reactive, ref, render, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, useSlots, withCtx, withModifiers } from "vue";
|
|
2
|
+
// ../ui/src/button/src/button.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var _hoisted_1$4 = ["disabled"];
|
|
4
|
+
var _hoisted_2$3 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "button-icon"
|
|
7
|
+
};
|
|
8
|
+
var button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
9
|
+
name: "GctButton",
|
|
10
|
+
__name: "button",
|
|
11
|
+
props: {
|
|
12
|
+
size: { default: "medium" },
|
|
13
|
+
type: { default: "default" },
|
|
14
|
+
plain: { type: Boolean },
|
|
15
|
+
full: { type: Boolean },
|
|
16
|
+
disabled: { type: Boolean },
|
|
17
|
+
loading: { type: Boolean },
|
|
18
|
+
class: {}
|
|
19
|
+
},
|
|
20
|
+
emits: ["click"],
|
|
21
|
+
setup(__props, { emit: __emit }) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const emit = __emit;
|
|
24
|
+
const slots = useSlots();
|
|
25
|
+
const buttonClass = computed(() => {
|
|
26
|
+
return [
|
|
27
|
+
"gct-button",
|
|
28
|
+
`button--${props.size}`,
|
|
29
|
+
`button--${props.type}`,
|
|
30
|
+
props.full ? "button--full" : "",
|
|
31
|
+
props.plain ? "button--plain" : "",
|
|
32
|
+
props.disabled ? "button--disabled" : "",
|
|
33
|
+
props.loading ? "button--loading" : "",
|
|
34
|
+
props.class
|
|
35
|
+
].filter(Boolean);
|
|
36
|
+
});
|
|
37
|
+
const handleClick = () => {
|
|
38
|
+
if (props.disabled || props.loading) return;
|
|
39
|
+
emit("click");
|
|
40
|
+
};
|
|
41
|
+
return (_ctx, _cache) => {
|
|
42
|
+
return openBlock(), createElementBlock("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
class: normalizeClass(buttonClass.value),
|
|
45
|
+
disabled: __props.disabled || __props.loading,
|
|
46
|
+
onClick: handleClick
|
|
47
|
+
}, [unref(slots).icon ? (openBlock(), createElementBlock("span", _hoisted_2$3, [renderSlot(_ctx.$slots, "icon", {}, void 0, true)])) : createCommentVNode("", true), createElementVNode("span", null, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 10, _hoisted_1$4);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
// \0plugin-vue:export-helper
|
|
52
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
53
|
+
const target = sfc.__vccOpts || sfc;
|
|
54
|
+
for (const [key, val] of props) target[key] = val;
|
|
55
|
+
return target;
|
|
56
|
+
};
|
|
57
|
+
// ../ui/src/button/src/button.vue
|
|
58
|
+
var button_default = /*#__PURE__*/ _plugin_vue_export_helper_default(button_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-05f5e056"]]);
|
|
59
|
+
// ../ui/src/icon/src/icon.vue?vue&type=script&setup=true&lang.ts
|
|
60
|
+
/** 平台静态包提供的字形必须和对应的字体类一起使用。 */
|
|
61
|
+
var platformIconFonts = /* @__PURE__ */ new Map([
|
|
62
|
+
["icon-a-Leftarrow", "iconfont"],
|
|
63
|
+
["icon-a-Rightarrow", "iconfont"],
|
|
64
|
+
["icon-arrow_zhankai", "gct-iconfont"],
|
|
65
|
+
["icon-cuowu2", "iconfont"],
|
|
66
|
+
["icon-drag", "iconfont"],
|
|
67
|
+
["icon-duigou-da", "gct-iconfont"],
|
|
68
|
+
["icon-guanbi", "iconfont"],
|
|
69
|
+
["icon-guanbi-Paddanchuang", "gct-iconfont"],
|
|
70
|
+
["icon-liangduanduiqi2", "iconfont"],
|
|
71
|
+
["icon-pad_arrow_down", "iconfont"],
|
|
72
|
+
["icon-pad_arrow_up", "iconfont"],
|
|
73
|
+
["icon-search", "gct-iconfont"],
|
|
74
|
+
["icon-sheji-2", "iconfont"],
|
|
75
|
+
["icon-sousuo", "iconfont"],
|
|
76
|
+
["icon-toast_guanbi", "gct-iconfont"],
|
|
77
|
+
["icon-you1_right-two1", "iconfont"],
|
|
78
|
+
["icon-zhuyi", "iconfont"]
|
|
79
|
+
]);
|
|
80
|
+
// ../ui/src/icon/src/icon.vue
|
|
81
|
+
var icon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
82
|
+
name: "GctIcon",
|
|
83
|
+
__name: "icon",
|
|
84
|
+
props: {
|
|
85
|
+
size: { default: 16 },
|
|
86
|
+
color: { default: "#333" },
|
|
87
|
+
icon: {},
|
|
88
|
+
font: { default: void 0 }
|
|
89
|
+
},
|
|
90
|
+
emits: ["click", "mousedown"],
|
|
91
|
+
setup(__props, { emit: __emit }) {
|
|
92
|
+
const emit = __emit;
|
|
93
|
+
return (_ctx, _cache) => {
|
|
94
|
+
return openBlock(), createElementBlock("span", {
|
|
95
|
+
class: "gct-icon",
|
|
96
|
+
style: normalizeStyle({
|
|
97
|
+
"--color": __props.color,
|
|
98
|
+
"--size": __props.size + "px"
|
|
99
|
+
}),
|
|
100
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event)),
|
|
101
|
+
onMousedown: _cache[1] || (_cache[1] = ($event) => emit("mousedown", $event))
|
|
102
|
+
}, [createElementVNode("i", {
|
|
103
|
+
class: normalizeClass([__props.font ?? unref(platformIconFonts).get(__props.icon) ?? "bd-iconfont", __props.icon]),
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}, null, 2)], 36);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}), [["__scopeId", "data-v-d8dd0a46"]]);
|
|
109
|
+
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
110
|
+
/**
|
|
111
|
+
* Custom positioning reference element.
|
|
112
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
113
|
+
*/
|
|
114
|
+
var sides = [
|
|
115
|
+
"top",
|
|
116
|
+
"right",
|
|
117
|
+
"bottom",
|
|
118
|
+
"left"
|
|
119
|
+
];
|
|
120
|
+
var alignments = ["start", "end"];
|
|
121
|
+
var placements$1 = /*#__PURE__*/ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
122
|
+
var min = Math.min;
|
|
123
|
+
var max = Math.max;
|
|
124
|
+
var round = Math.round;
|
|
125
|
+
var createCoords = (v) => ({
|
|
126
|
+
x: v,
|
|
127
|
+
y: v
|
|
128
|
+
});
|
|
129
|
+
var oppositeSideMap = {
|
|
130
|
+
left: "right",
|
|
131
|
+
right: "left",
|
|
132
|
+
bottom: "top",
|
|
133
|
+
top: "bottom"
|
|
134
|
+
};
|
|
135
|
+
function clamp(start, value, end) {
|
|
136
|
+
return max(start, min(value, end));
|
|
137
|
+
}
|
|
138
|
+
function evaluate(value, param) {
|
|
139
|
+
return typeof value === "function" ? value(param) : value;
|
|
140
|
+
}
|
|
141
|
+
function getSide(placement) {
|
|
142
|
+
return placement.split("-")[0];
|
|
143
|
+
}
|
|
144
|
+
function getAlignment(placement) {
|
|
145
|
+
return placement.split("-")[1];
|
|
146
|
+
}
|
|
147
|
+
function getOppositeAxis(axis) {
|
|
148
|
+
return axis === "x" ? "y" : "x";
|
|
149
|
+
}
|
|
150
|
+
function getAxisLength(axis) {
|
|
151
|
+
return axis === "y" ? "height" : "width";
|
|
152
|
+
}
|
|
153
|
+
function getSideAxis(placement) {
|
|
154
|
+
const firstChar = placement[0];
|
|
155
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
156
|
+
}
|
|
157
|
+
function getAlignmentAxis(placement) {
|
|
158
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
159
|
+
}
|
|
160
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
161
|
+
if (rtl === void 0) rtl = false;
|
|
162
|
+
const alignment = getAlignment(placement);
|
|
163
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
164
|
+
const length = getAxisLength(alignmentAxis);
|
|
165
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
166
|
+
if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
167
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
168
|
+
}
|
|
169
|
+
function getExpandedPlacements(placement) {
|
|
170
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
171
|
+
return [
|
|
172
|
+
getOppositeAlignmentPlacement(placement),
|
|
173
|
+
oppositePlacement,
|
|
174
|
+
getOppositeAlignmentPlacement(oppositePlacement)
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
178
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
179
|
+
}
|
|
180
|
+
var lrPlacement = ["left", "right"];
|
|
181
|
+
var rlPlacement = ["right", "left"];
|
|
182
|
+
var tbPlacement = ["top", "bottom"];
|
|
183
|
+
var btPlacement = ["bottom", "top"];
|
|
184
|
+
function getSideList(side, isStart, rtl) {
|
|
185
|
+
switch (side) {
|
|
186
|
+
case "top":
|
|
187
|
+
case "bottom":
|
|
188
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
189
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
190
|
+
case "left":
|
|
191
|
+
case "right": return isStart ? tbPlacement : btPlacement;
|
|
192
|
+
default: return [];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
196
|
+
const alignment = getAlignment(placement);
|
|
197
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
198
|
+
if (alignment) {
|
|
199
|
+
list = list.map((side) => side + "-" + alignment);
|
|
200
|
+
if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
201
|
+
}
|
|
202
|
+
return list;
|
|
203
|
+
}
|
|
204
|
+
function getOppositePlacement(placement) {
|
|
205
|
+
const side = getSide(placement);
|
|
206
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
207
|
+
}
|
|
208
|
+
function expandPaddingObject(padding) {
|
|
209
|
+
var _padding$top, _padding$right, _padding$bottom, _padding$left;
|
|
210
|
+
return {
|
|
211
|
+
top: (_padding$top = padding.top) != null ? _padding$top : 0,
|
|
212
|
+
right: (_padding$right = padding.right) != null ? _padding$right : 0,
|
|
213
|
+
bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
|
|
214
|
+
left: (_padding$left = padding.left) != null ? _padding$left : 0
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function getPaddingObject(padding) {
|
|
218
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
219
|
+
top: padding,
|
|
220
|
+
right: padding,
|
|
221
|
+
bottom: padding,
|
|
222
|
+
left: padding
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function rectToClientRect(rect) {
|
|
226
|
+
const { x, y, width, height } = rect;
|
|
227
|
+
return {
|
|
228
|
+
width,
|
|
229
|
+
height,
|
|
230
|
+
top: y,
|
|
231
|
+
left: x,
|
|
232
|
+
right: x + width,
|
|
233
|
+
bottom: y + height,
|
|
234
|
+
x,
|
|
235
|
+
y
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
// ../../node_modules/.pnpm/@floating-ui+core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
239
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
240
|
+
let { reference, floating } = _ref;
|
|
241
|
+
const sideAxis = getSideAxis(placement);
|
|
242
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
243
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
244
|
+
const side = getSide(placement);
|
|
245
|
+
const isVertical = sideAxis === "y";
|
|
246
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
247
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
248
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
249
|
+
let coords;
|
|
250
|
+
switch (side) {
|
|
251
|
+
case "top":
|
|
252
|
+
coords = {
|
|
253
|
+
x: commonX,
|
|
254
|
+
y: reference.y - floating.height
|
|
255
|
+
};
|
|
256
|
+
break;
|
|
257
|
+
case "bottom":
|
|
258
|
+
coords = {
|
|
259
|
+
x: commonX,
|
|
260
|
+
y: reference.y + reference.height
|
|
261
|
+
};
|
|
262
|
+
break;
|
|
263
|
+
case "right":
|
|
264
|
+
coords = {
|
|
265
|
+
x: reference.x + reference.width,
|
|
266
|
+
y: commonY
|
|
267
|
+
};
|
|
268
|
+
break;
|
|
269
|
+
case "left":
|
|
270
|
+
coords = {
|
|
271
|
+
x: reference.x - floating.width,
|
|
272
|
+
y: commonY
|
|
273
|
+
};
|
|
274
|
+
break;
|
|
275
|
+
default: coords = {
|
|
276
|
+
x: reference.x,
|
|
277
|
+
y: reference.y
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
const alignment = getAlignment(placement);
|
|
281
|
+
if (alignment) coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
|
|
282
|
+
return coords;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
286
|
+
* element is overflowing a given clipping boundary on each side.
|
|
287
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
288
|
+
* - negative = how many pixels left before it will overflow
|
|
289
|
+
* - 0 = lies flush with the boundary
|
|
290
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
291
|
+
*/
|
|
292
|
+
async function detectOverflow(state, options) {
|
|
293
|
+
var _await$platform$isEle;
|
|
294
|
+
if (options === void 0) options = {};
|
|
295
|
+
const { x, y, platform, rects, elements, strategy } = state;
|
|
296
|
+
const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
|
|
297
|
+
const paddingObject = getPaddingObject(padding);
|
|
298
|
+
const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
|
|
299
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
300
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
|
301
|
+
boundary,
|
|
302
|
+
rootBoundary,
|
|
303
|
+
strategy
|
|
304
|
+
}));
|
|
305
|
+
const rect = elementContext === "floating" ? {
|
|
306
|
+
x,
|
|
307
|
+
y,
|
|
308
|
+
width: rects.floating.width,
|
|
309
|
+
height: rects.floating.height
|
|
310
|
+
} : rects.reference;
|
|
311
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
312
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) && await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
|
313
|
+
x: 1,
|
|
314
|
+
y: 1
|
|
315
|
+
};
|
|
316
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
317
|
+
elements,
|
|
318
|
+
rect,
|
|
319
|
+
offsetParent,
|
|
320
|
+
strategy
|
|
321
|
+
}) : rect);
|
|
322
|
+
return {
|
|
323
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
324
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
325
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
326
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
var MAX_RESET_COUNT = 50;
|
|
330
|
+
/**
|
|
331
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
332
|
+
* next to a given reference element.
|
|
333
|
+
*
|
|
334
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
335
|
+
* write one for the platform you are using Floating UI with.
|
|
336
|
+
*/
|
|
337
|
+
var computePosition$1 = async (reference, floating, config) => {
|
|
338
|
+
const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
|
|
339
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
340
|
+
...platform,
|
|
341
|
+
detectOverflow
|
|
342
|
+
};
|
|
343
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
344
|
+
let rects = await platform.getElementRects({
|
|
345
|
+
reference,
|
|
346
|
+
floating,
|
|
347
|
+
strategy
|
|
348
|
+
});
|
|
349
|
+
let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
|
|
350
|
+
let statefulPlacement = placement;
|
|
351
|
+
let resetCount = 0;
|
|
352
|
+
const middlewareData = {};
|
|
353
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
354
|
+
const currentMiddleware = middleware[i];
|
|
355
|
+
if (!currentMiddleware) continue;
|
|
356
|
+
const { name, fn } = currentMiddleware;
|
|
357
|
+
const { x: nextX, y: nextY, data, reset } = await fn({
|
|
358
|
+
x,
|
|
359
|
+
y,
|
|
360
|
+
initialPlacement: placement,
|
|
361
|
+
placement: statefulPlacement,
|
|
362
|
+
strategy,
|
|
363
|
+
middlewareData,
|
|
364
|
+
rects,
|
|
365
|
+
platform: platformWithDetectOverflow,
|
|
366
|
+
elements: {
|
|
367
|
+
reference,
|
|
368
|
+
floating
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
x = nextX != null ? nextX : x;
|
|
372
|
+
y = nextY != null ? nextY : y;
|
|
373
|
+
middlewareData[name] = {
|
|
374
|
+
...middlewareData[name],
|
|
375
|
+
...data
|
|
376
|
+
};
|
|
377
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
378
|
+
resetCount++;
|
|
379
|
+
if (typeof reset === "object") {
|
|
380
|
+
if (reset.placement) statefulPlacement = reset.placement;
|
|
381
|
+
if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
|
|
382
|
+
reference,
|
|
383
|
+
floating,
|
|
384
|
+
strategy
|
|
385
|
+
}) : reset.rects;
|
|
386
|
+
({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
387
|
+
}
|
|
388
|
+
i = -1;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
x,
|
|
393
|
+
y,
|
|
394
|
+
placement: statefulPlacement,
|
|
395
|
+
strategy,
|
|
396
|
+
middlewareData
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Provides data to position an inner element of the floating element so that it
|
|
401
|
+
* appears centered to the reference element.
|
|
402
|
+
* @see https://floating-ui.com/docs/arrow
|
|
403
|
+
*/
|
|
404
|
+
var arrow$1 = (options) => ({
|
|
405
|
+
name: "arrow",
|
|
406
|
+
options,
|
|
407
|
+
async fn(state) {
|
|
408
|
+
const { x, y, placement, rects, platform, elements, middlewareData } = state;
|
|
409
|
+
const { element, padding = 0 } = evaluate(options, state) || {};
|
|
410
|
+
if (element == null) return {};
|
|
411
|
+
const paddingObject = getPaddingObject(padding);
|
|
412
|
+
const coords = {
|
|
413
|
+
x,
|
|
414
|
+
y
|
|
415
|
+
};
|
|
416
|
+
const axis = getAlignmentAxis(placement);
|
|
417
|
+
const length = getAxisLength(axis);
|
|
418
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
419
|
+
const isYAxis = axis === "y";
|
|
420
|
+
const minProp = isYAxis ? "top" : "left";
|
|
421
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
422
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
423
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
424
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
425
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
426
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
427
|
+
if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
428
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
429
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
430
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
431
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
432
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
433
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
434
|
+
const offset = clamp(minPadding, center, max);
|
|
435
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
436
|
+
const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;
|
|
437
|
+
return {
|
|
438
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
439
|
+
data: {
|
|
440
|
+
[axis]: offset,
|
|
441
|
+
centerOffset: center - offset - alignmentOffset,
|
|
442
|
+
...shouldAddOffset && { alignmentOffset }
|
|
443
|
+
},
|
|
444
|
+
reset: shouldAddOffset
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
449
|
+
return (alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement)).filter((placement) => {
|
|
450
|
+
if (alignment) return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
451
|
+
return true;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
456
|
+
* that has the most space available automatically, without needing to specify a
|
|
457
|
+
* preferred placement. Alternative to `flip`.
|
|
458
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
459
|
+
*/
|
|
460
|
+
var autoPlacement$1 = function(options) {
|
|
461
|
+
if (options === void 0) options = {};
|
|
462
|
+
return {
|
|
463
|
+
name: "autoPlacement",
|
|
464
|
+
options,
|
|
465
|
+
async fn(state) {
|
|
466
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
467
|
+
const { rects, middlewareData, placement, platform, elements } = state;
|
|
468
|
+
const { crossAxis = false, alignment, allowedPlacements = placements$1, autoAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
|
|
469
|
+
const placements$1$1 = alignment !== void 0 || allowedPlacements === placements$1 ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
470
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
471
|
+
const currentPlacement = placements$1$1[currentIndex];
|
|
472
|
+
if (currentPlacement == null) return {};
|
|
473
|
+
if (placement !== currentPlacement) return { reset: { placement: placements$1$1[0] } };
|
|
474
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
475
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
476
|
+
const currentOverflows = [
|
|
477
|
+
overflow[getSide(currentPlacement)],
|
|
478
|
+
overflow[alignmentSides[0]],
|
|
479
|
+
overflow[alignmentSides[1]]
|
|
480
|
+
];
|
|
481
|
+
const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
|
|
482
|
+
placement: currentPlacement,
|
|
483
|
+
overflows: currentOverflows
|
|
484
|
+
}];
|
|
485
|
+
const nextPlacement = placements$1$1[currentIndex + 1];
|
|
486
|
+
if (nextPlacement) return {
|
|
487
|
+
data: {
|
|
488
|
+
index: currentIndex + 1,
|
|
489
|
+
overflows: allOverflows
|
|
490
|
+
},
|
|
491
|
+
reset: { placement: nextPlacement }
|
|
492
|
+
};
|
|
493
|
+
const placementsSortedByMostSpace = allOverflows.map((d) => {
|
|
494
|
+
const alignment = getAlignment(d.placement);
|
|
495
|
+
return [
|
|
496
|
+
d.placement,
|
|
497
|
+
alignment && crossAxis ? d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : d.overflows[0],
|
|
498
|
+
d.overflows
|
|
499
|
+
];
|
|
500
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
501
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsSortedByMostSpace.filter((d) => d[2].slice(0, getAlignment(d[0]) ? 2 : 3).every((v) => v <= 0))[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
502
|
+
if (resetPlacement !== placement) return {
|
|
503
|
+
data: {
|
|
504
|
+
index: currentIndex + 1,
|
|
505
|
+
overflows: allOverflows
|
|
506
|
+
},
|
|
507
|
+
reset: { placement: resetPlacement }
|
|
508
|
+
};
|
|
509
|
+
return {};
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
515
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
516
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
517
|
+
* @see https://floating-ui.com/docs/flip
|
|
518
|
+
*/
|
|
519
|
+
var flip$1 = function(options) {
|
|
520
|
+
if (options === void 0) options = {};
|
|
521
|
+
return {
|
|
522
|
+
name: "flip",
|
|
523
|
+
options,
|
|
524
|
+
async fn(state) {
|
|
525
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
526
|
+
const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
|
|
527
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
|
|
528
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
529
|
+
const side = getSide(placement);
|
|
530
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
531
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
532
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
533
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
534
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
535
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
536
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
537
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
538
|
+
const overflows = [];
|
|
539
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
540
|
+
if (checkMainAxis) overflows.push(overflow[side]);
|
|
541
|
+
if (checkCrossAxis) {
|
|
542
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
543
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
544
|
+
}
|
|
545
|
+
overflowsData = [...overflowsData, {
|
|
546
|
+
placement,
|
|
547
|
+
overflows
|
|
548
|
+
}];
|
|
549
|
+
if (!overflows.every((side) => side <= 0)) {
|
|
550
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
551
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
552
|
+
const nextPlacement = placements[nextIndex];
|
|
553
|
+
if (nextPlacement) {
|
|
554
|
+
if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return {
|
|
555
|
+
data: {
|
|
556
|
+
index: nextIndex,
|
|
557
|
+
overflows: overflowsData
|
|
558
|
+
},
|
|
559
|
+
reset: { placement: nextPlacement }
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
563
|
+
if (!resetPlacement) switch (fallbackStrategy) {
|
|
564
|
+
case "bestFit": {
|
|
565
|
+
var _overflowsData$filter2;
|
|
566
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
567
|
+
if (hasFallbackAxisSideDirection) {
|
|
568
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
569
|
+
return currentSideAxis === initialSideAxis || currentSideAxis === "y";
|
|
570
|
+
}
|
|
571
|
+
return true;
|
|
572
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
573
|
+
if (placement) resetPlacement = placement;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
case "initialPlacement": resetPlacement = initialPlacement;
|
|
577
|
+
}
|
|
578
|
+
if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
|
|
579
|
+
}
|
|
580
|
+
return {};
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
var originSides = /*#__PURE__*/ new Set(["left", "top"]);
|
|
585
|
+
async function convertValueToCoords(state, options) {
|
|
586
|
+
const { placement, platform, elements } = state;
|
|
587
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
588
|
+
const side = getSide(placement);
|
|
589
|
+
const alignment = getAlignment(placement);
|
|
590
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
591
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
592
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
593
|
+
const rawValue = evaluate(options, state);
|
|
594
|
+
let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
|
|
595
|
+
mainAxis: rawValue,
|
|
596
|
+
crossAxis: 0,
|
|
597
|
+
alignmentAxis: null
|
|
598
|
+
} : {
|
|
599
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
600
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
601
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
602
|
+
};
|
|
603
|
+
if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
604
|
+
return isVertical ? {
|
|
605
|
+
x: crossAxis * crossAxisMulti,
|
|
606
|
+
y: mainAxis * mainAxisMulti
|
|
607
|
+
} : {
|
|
608
|
+
x: mainAxis * mainAxisMulti,
|
|
609
|
+
y: crossAxis * crossAxisMulti
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Modifies the placement by translating the floating element along the
|
|
614
|
+
* specified axes.
|
|
615
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
616
|
+
* object may be passed.
|
|
617
|
+
* @see https://floating-ui.com/docs/offset
|
|
618
|
+
*/
|
|
619
|
+
var offset$1 = function(options) {
|
|
620
|
+
if (options === void 0) options = 0;
|
|
621
|
+
return {
|
|
622
|
+
name: "offset",
|
|
623
|
+
options,
|
|
624
|
+
async fn(state) {
|
|
625
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
626
|
+
const { x, y, placement, middlewareData } = state;
|
|
627
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
628
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
629
|
+
return {
|
|
630
|
+
x: x + diffCoords.x,
|
|
631
|
+
y: y + diffCoords.y,
|
|
632
|
+
data: {
|
|
633
|
+
...diffCoords,
|
|
634
|
+
placement
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
642
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
643
|
+
* @see https://floating-ui.com/docs/shift
|
|
644
|
+
*/
|
|
645
|
+
var shift$1 = function(options) {
|
|
646
|
+
if (options === void 0) options = {};
|
|
647
|
+
return {
|
|
648
|
+
name: "shift",
|
|
649
|
+
options,
|
|
650
|
+
async fn(state) {
|
|
651
|
+
const { x, y, placement, platform } = state;
|
|
652
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
|
|
653
|
+
let { x, y } = _ref;
|
|
654
|
+
return {
|
|
655
|
+
x,
|
|
656
|
+
y
|
|
657
|
+
};
|
|
658
|
+
} }, ...detectOverflowOptions } = evaluate(options, state);
|
|
659
|
+
const coords = {
|
|
660
|
+
x,
|
|
661
|
+
y
|
|
662
|
+
};
|
|
663
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
664
|
+
const crossAxis = getSideAxis(placement);
|
|
665
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
666
|
+
let mainAxisCoord = coords[mainAxis];
|
|
667
|
+
let crossAxisCoord = coords[crossAxis];
|
|
668
|
+
const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
|
|
669
|
+
if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
|
|
670
|
+
if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
|
|
671
|
+
const limitedCoords = limiter.fn({
|
|
672
|
+
...state,
|
|
673
|
+
[mainAxis]: mainAxisCoord,
|
|
674
|
+
[crossAxis]: crossAxisCoord
|
|
675
|
+
});
|
|
676
|
+
return {
|
|
677
|
+
...limitedCoords,
|
|
678
|
+
data: {
|
|
679
|
+
x: limitedCoords.x - x,
|
|
680
|
+
y: limitedCoords.y - y,
|
|
681
|
+
enabled: {
|
|
682
|
+
[mainAxis]: checkMainAxis,
|
|
683
|
+
[crossAxis]: checkCrossAxis
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Provides data that allows you to change the size of the floating element —
|
|
692
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
693
|
+
* width of the reference element.
|
|
694
|
+
* @see https://floating-ui.com/docs/size
|
|
695
|
+
*/
|
|
696
|
+
var size$1 = function(options) {
|
|
697
|
+
if (options === void 0) options = {};
|
|
698
|
+
return {
|
|
699
|
+
name: "size",
|
|
700
|
+
options,
|
|
701
|
+
async fn(state) {
|
|
702
|
+
const { placement, rects, platform, elements } = state;
|
|
703
|
+
const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
|
|
704
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
705
|
+
const side = getSide(placement);
|
|
706
|
+
const alignment = getAlignment(placement);
|
|
707
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
708
|
+
const { width, height } = rects.floating;
|
|
709
|
+
let heightSide;
|
|
710
|
+
let widthSide;
|
|
711
|
+
if (side === "top" || side === "bottom") {
|
|
712
|
+
heightSide = side;
|
|
713
|
+
widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
714
|
+
} else {
|
|
715
|
+
widthSide = side;
|
|
716
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
717
|
+
}
|
|
718
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
719
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
720
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
721
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
722
|
+
const shiftData = state.middlewareData.shift;
|
|
723
|
+
const noShift = !shiftData;
|
|
724
|
+
let availableHeight = overflowAvailableHeight;
|
|
725
|
+
let availableWidth = overflowAvailableWidth;
|
|
726
|
+
if (shiftData != null && shiftData.enabled.x) availableWidth = maximumClippingWidth;
|
|
727
|
+
if (shiftData != null && shiftData.enabled.y) availableHeight = maximumClippingHeight;
|
|
728
|
+
if (noShift && !alignment) {
|
|
729
|
+
if (isYAxis) availableWidth = width - 2 * max(overflow.left, overflow.right);
|
|
730
|
+
else availableHeight = height - 2 * max(overflow.top, overflow.bottom);
|
|
731
|
+
}
|
|
732
|
+
await apply({
|
|
733
|
+
...state,
|
|
734
|
+
availableWidth,
|
|
735
|
+
availableHeight
|
|
736
|
+
});
|
|
737
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
738
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) return { reset: { rects: true } };
|
|
739
|
+
return {};
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
// ../../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
744
|
+
function hasWindow() {
|
|
745
|
+
return typeof window !== "undefined";
|
|
746
|
+
}
|
|
747
|
+
function getNodeName(node) {
|
|
748
|
+
if (isNode(node)) return (node.nodeName || "").toLowerCase();
|
|
749
|
+
return "#document";
|
|
750
|
+
}
|
|
751
|
+
function getWindow(node) {
|
|
752
|
+
var _node$ownerDocument;
|
|
753
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
754
|
+
}
|
|
755
|
+
function getDocumentElement(node) {
|
|
756
|
+
var _ref;
|
|
757
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
758
|
+
}
|
|
759
|
+
function isNode(value) {
|
|
760
|
+
if (!hasWindow()) return false;
|
|
761
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
762
|
+
}
|
|
763
|
+
function isElement(value) {
|
|
764
|
+
if (!hasWindow()) return false;
|
|
765
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
766
|
+
}
|
|
767
|
+
function isHTMLElement(value) {
|
|
768
|
+
if (!hasWindow()) return false;
|
|
769
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
770
|
+
}
|
|
771
|
+
function isShadowRoot(value) {
|
|
772
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") return false;
|
|
773
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
774
|
+
}
|
|
775
|
+
function isOverflowElement(element) {
|
|
776
|
+
const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element);
|
|
777
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
778
|
+
}
|
|
779
|
+
function isTableElement(element) {
|
|
780
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
781
|
+
}
|
|
782
|
+
function isTopLayer(element) {
|
|
783
|
+
try {
|
|
784
|
+
if (element.matches(":popover-open")) return true;
|
|
785
|
+
} catch (_e) {}
|
|
786
|
+
try {
|
|
787
|
+
return element.matches(":modal");
|
|
788
|
+
} catch (_e) {
|
|
789
|
+
return false;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
793
|
+
var containRe = /paint|layout|strict|content/;
|
|
794
|
+
var isNotNone = (value) => !!value && value !== "none";
|
|
795
|
+
var isWebKitValue;
|
|
796
|
+
function isContainingBlock(elementOrCss) {
|
|
797
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
798
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
799
|
+
}
|
|
800
|
+
function getContainingBlock(element) {
|
|
801
|
+
let currentNode = getParentNode(element);
|
|
802
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
803
|
+
if (isContainingBlock(currentNode)) return currentNode;
|
|
804
|
+
else if (isTopLayer(currentNode)) return null;
|
|
805
|
+
currentNode = getParentNode(currentNode);
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
809
|
+
function isWebKit() {
|
|
810
|
+
if (isWebKitValue == null) isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
811
|
+
return isWebKitValue;
|
|
812
|
+
}
|
|
813
|
+
function isLastTraversableNode(node) {
|
|
814
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
815
|
+
}
|
|
816
|
+
function getComputedStyle$1(element) {
|
|
817
|
+
return getWindow(element).getComputedStyle(element);
|
|
818
|
+
}
|
|
819
|
+
function getNodeScroll(element) {
|
|
820
|
+
if (isElement(element)) return {
|
|
821
|
+
scrollLeft: element.scrollLeft,
|
|
822
|
+
scrollTop: element.scrollTop
|
|
823
|
+
};
|
|
824
|
+
return {
|
|
825
|
+
scrollLeft: element.scrollX,
|
|
826
|
+
scrollTop: element.scrollY
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
function getParentNode(node) {
|
|
830
|
+
if (getNodeName(node) === "html") return node;
|
|
831
|
+
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
|
832
|
+
return isShadowRoot(result) ? result.host : result;
|
|
833
|
+
}
|
|
834
|
+
function getNearestOverflowAncestor(node) {
|
|
835
|
+
const parentNode = getParentNode(node);
|
|
836
|
+
if (isLastTraversableNode(parentNode)) return (node.ownerDocument || node).body;
|
|
837
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
|
|
838
|
+
return getNearestOverflowAncestor(parentNode);
|
|
839
|
+
}
|
|
840
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
841
|
+
var _node$ownerDocument2;
|
|
842
|
+
if (list === void 0) list = [];
|
|
843
|
+
if (traverseIframes === void 0) traverseIframes = true;
|
|
844
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
845
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
846
|
+
const win = getWindow(scrollableAncestor);
|
|
847
|
+
if (isBody) {
|
|
848
|
+
const frameElement = getFrameElement(win);
|
|
849
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
850
|
+
} else return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
851
|
+
}
|
|
852
|
+
function getFrameElement(win) {
|
|
853
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
854
|
+
}
|
|
855
|
+
// ../../node_modules/.pnpm/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
856
|
+
function getCssDimensions(element) {
|
|
857
|
+
const css = getComputedStyle$1(element);
|
|
858
|
+
let width = parseFloat(css.width) || 0;
|
|
859
|
+
let height = parseFloat(css.height) || 0;
|
|
860
|
+
const hasOffset = isHTMLElement(element);
|
|
861
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
862
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
863
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
864
|
+
if (shouldFallback) {
|
|
865
|
+
width = offsetWidth;
|
|
866
|
+
height = offsetHeight;
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
width,
|
|
870
|
+
height,
|
|
871
|
+
$: shouldFallback
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
function unwrapElement(element) {
|
|
875
|
+
return !isElement(element) ? element.contextElement : element;
|
|
876
|
+
}
|
|
877
|
+
function getScale(element) {
|
|
878
|
+
const domElement = unwrapElement(element);
|
|
879
|
+
if (!isHTMLElement(domElement)) return createCoords(1);
|
|
880
|
+
const rect = domElement.getBoundingClientRect();
|
|
881
|
+
const { width, height, $ } = getCssDimensions(domElement);
|
|
882
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
883
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
884
|
+
if (!x || !Number.isFinite(x)) x = 1;
|
|
885
|
+
if (!y || !Number.isFinite(y)) y = 1;
|
|
886
|
+
return {
|
|
887
|
+
x,
|
|
888
|
+
y
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
var noOffsets = /*#__PURE__*/ createCoords(0);
|
|
892
|
+
function getVisualOffsets(element) {
|
|
893
|
+
const win = getWindow(element);
|
|
894
|
+
if (!isWebKit() || !win.visualViewport) return noOffsets;
|
|
895
|
+
return {
|
|
896
|
+
x: win.visualViewport.offsetLeft,
|
|
897
|
+
y: win.visualViewport.offsetTop
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
901
|
+
if (isFixed === void 0) isFixed = false;
|
|
902
|
+
return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
|
|
903
|
+
}
|
|
904
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
905
|
+
if (includeScale === void 0) includeScale = false;
|
|
906
|
+
if (isFixedStrategy === void 0) isFixedStrategy = false;
|
|
907
|
+
const clientRect = element.getBoundingClientRect();
|
|
908
|
+
const domElement = unwrapElement(element);
|
|
909
|
+
let scale = createCoords(1);
|
|
910
|
+
if (includeScale) {
|
|
911
|
+
if (offsetParent) {
|
|
912
|
+
if (isElement(offsetParent)) scale = getScale(offsetParent);
|
|
913
|
+
} else scale = getScale(element);
|
|
914
|
+
}
|
|
915
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
916
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
917
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
918
|
+
let width = clientRect.width / scale.x;
|
|
919
|
+
let height = clientRect.height / scale.y;
|
|
920
|
+
if (domElement && offsetParent) {
|
|
921
|
+
const win = getWindow(domElement);
|
|
922
|
+
const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
923
|
+
let currentWin = win;
|
|
924
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
925
|
+
while (currentIFrame && offsetWin !== currentWin) {
|
|
926
|
+
const iframeScale = getScale(currentIFrame);
|
|
927
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
928
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
929
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
930
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
931
|
+
x *= iframeScale.x;
|
|
932
|
+
y *= iframeScale.y;
|
|
933
|
+
width *= iframeScale.x;
|
|
934
|
+
height *= iframeScale.y;
|
|
935
|
+
x += left;
|
|
936
|
+
y += top;
|
|
937
|
+
currentWin = getWindow(currentIFrame);
|
|
938
|
+
currentIFrame = getFrameElement(currentWin);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return rectToClientRect({
|
|
942
|
+
width,
|
|
943
|
+
height,
|
|
944
|
+
x,
|
|
945
|
+
y
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
function getWindowScrollBarX(element, rect) {
|
|
949
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
950
|
+
if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
951
|
+
return rect.left + leftScroll;
|
|
952
|
+
}
|
|
953
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
954
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
955
|
+
return {
|
|
956
|
+
x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect),
|
|
957
|
+
y: htmlRect.top + scroll.scrollTop
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
961
|
+
let { elements, rect, offsetParent, strategy } = _ref;
|
|
962
|
+
const isFixed = strategy === "fixed";
|
|
963
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
964
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
965
|
+
if (offsetParent === documentElement || topLayer && isFixed) return rect;
|
|
966
|
+
let scroll = {
|
|
967
|
+
scrollLeft: 0,
|
|
968
|
+
scrollTop: 0
|
|
969
|
+
};
|
|
970
|
+
let scale = createCoords(1);
|
|
971
|
+
const offsets = createCoords(0);
|
|
972
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
973
|
+
if (isOffsetParentAnElement || !isFixed) {
|
|
974
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
975
|
+
if (isOffsetParentAnElement) {
|
|
976
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
977
|
+
scale = getScale(offsetParent);
|
|
978
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
979
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
983
|
+
return {
|
|
984
|
+
width: rect.width * scale.x,
|
|
985
|
+
height: rect.height * scale.y,
|
|
986
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
987
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
function getClientRects(element) {
|
|
991
|
+
return element.getClientRects ? Array.from(element.getClientRects()) : [];
|
|
992
|
+
}
|
|
993
|
+
function getDocumentRect(html) {
|
|
994
|
+
const scroll = getNodeScroll(html);
|
|
995
|
+
const body = html.ownerDocument.body;
|
|
996
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
997
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
998
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(html);
|
|
999
|
+
const y = -scroll.scrollTop;
|
|
1000
|
+
if (getComputedStyle$1(body).direction === "rtl") x += max(html.clientWidth, body.clientWidth) - width;
|
|
1001
|
+
return {
|
|
1002
|
+
width,
|
|
1003
|
+
height,
|
|
1004
|
+
x,
|
|
1005
|
+
y
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
var SCROLLBAR_MAX = 25;
|
|
1009
|
+
function getViewportRect(element, strategy, rootBoundary) {
|
|
1010
|
+
if (rootBoundary === void 0) rootBoundary = "viewport";
|
|
1011
|
+
const isLayoutViewport = rootBoundary === "layoutViewport";
|
|
1012
|
+
const win = getWindow(element);
|
|
1013
|
+
const html = getDocumentElement(element);
|
|
1014
|
+
const visualViewport = win.visualViewport;
|
|
1015
|
+
let width = html.clientWidth;
|
|
1016
|
+
let height = html.clientHeight;
|
|
1017
|
+
let x = 0;
|
|
1018
|
+
let y = 0;
|
|
1019
|
+
if (visualViewport) {
|
|
1020
|
+
const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
|
|
1021
|
+
if (isLayoutViewport) {
|
|
1022
|
+
if (!layoutRelativeClientCoords) {
|
|
1023
|
+
x = -visualViewport.offsetLeft;
|
|
1024
|
+
y = -visualViewport.offsetTop;
|
|
1025
|
+
}
|
|
1026
|
+
} else {
|
|
1027
|
+
width = visualViewport.width;
|
|
1028
|
+
height = visualViewport.height;
|
|
1029
|
+
if (layoutRelativeClientCoords) {
|
|
1030
|
+
x = visualViewport.offsetLeft;
|
|
1031
|
+
y = visualViewport.offsetTop;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if (getWindowScrollBarX(html) <= 0) {
|
|
1036
|
+
const doc = html.ownerDocument;
|
|
1037
|
+
const body = doc.body;
|
|
1038
|
+
const bodyStyles = getComputedStyle(body);
|
|
1039
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
1040
|
+
const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
1041
|
+
const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
|
|
1042
|
+
if (gutter <= SCROLLBAR_MAX) width -= gutter;
|
|
1043
|
+
}
|
|
1044
|
+
return {
|
|
1045
|
+
width,
|
|
1046
|
+
height,
|
|
1047
|
+
x,
|
|
1048
|
+
y
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1052
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1053
|
+
const top = clientRect.top + element.clientTop;
|
|
1054
|
+
const left = clientRect.left + element.clientLeft;
|
|
1055
|
+
const scale = getScale(element);
|
|
1056
|
+
return {
|
|
1057
|
+
width: element.clientWidth * scale.x,
|
|
1058
|
+
height: element.clientHeight * scale.y,
|
|
1059
|
+
x: left * scale.x,
|
|
1060
|
+
y: top * scale.y
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1064
|
+
let rect;
|
|
1065
|
+
if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") rect = getViewportRect(element, strategy, clippingAncestor);
|
|
1066
|
+
else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
|
|
1067
|
+
else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1068
|
+
else {
|
|
1069
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1070
|
+
rect = {
|
|
1071
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1072
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1073
|
+
width: clippingAncestor.width,
|
|
1074
|
+
height: clippingAncestor.height
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
return rectToClientRect(rect);
|
|
1078
|
+
}
|
|
1079
|
+
function getClippingElementAncestors(element, cache) {
|
|
1080
|
+
const cachedResult = cache.get(element);
|
|
1081
|
+
if (cachedResult) return cachedResult;
|
|
1082
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1083
|
+
let lastKeptComputedStyle = null;
|
|
1084
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
1085
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1086
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1087
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1088
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1089
|
+
const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
|
|
1090
|
+
if (!currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static")) result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1091
|
+
else lastKeptComputedStyle = computedStyle;
|
|
1092
|
+
currentNode = getParentNode(currentNode);
|
|
1093
|
+
}
|
|
1094
|
+
cache.set(element, result);
|
|
1095
|
+
return result;
|
|
1096
|
+
}
|
|
1097
|
+
function getClippingRect(_ref) {
|
|
1098
|
+
let { element, boundary, rootBoundary, strategy } = _ref;
|
|
1099
|
+
const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary];
|
|
1100
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
1101
|
+
let top = firstRect.top;
|
|
1102
|
+
let right = firstRect.right;
|
|
1103
|
+
let bottom = firstRect.bottom;
|
|
1104
|
+
let left = firstRect.left;
|
|
1105
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
1106
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
1107
|
+
top = max(rect.top, top);
|
|
1108
|
+
right = min(rect.right, right);
|
|
1109
|
+
bottom = min(rect.bottom, bottom);
|
|
1110
|
+
left = max(rect.left, left);
|
|
1111
|
+
}
|
|
1112
|
+
return {
|
|
1113
|
+
width: right - left,
|
|
1114
|
+
height: bottom - top,
|
|
1115
|
+
x: left,
|
|
1116
|
+
y: top
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
function getDimensions(element) {
|
|
1120
|
+
const { width, height } = getCssDimensions(element);
|
|
1121
|
+
return {
|
|
1122
|
+
width,
|
|
1123
|
+
height
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1127
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1128
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1129
|
+
const isFixed = strategy === "fixed";
|
|
1130
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1131
|
+
let scroll = {
|
|
1132
|
+
scrollLeft: 0,
|
|
1133
|
+
scrollTop: 0
|
|
1134
|
+
};
|
|
1135
|
+
const offsets = createCoords(0);
|
|
1136
|
+
if (isOffsetParentAnElement || !isFixed) {
|
|
1137
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
1138
|
+
if (isOffsetParentAnElement) {
|
|
1139
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1140
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1141
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
if (!isOffsetParentAnElement && documentElement) offsets.x = getWindowScrollBarX(documentElement);
|
|
1145
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1146
|
+
return {
|
|
1147
|
+
x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
|
|
1148
|
+
y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y,
|
|
1149
|
+
width: rect.width,
|
|
1150
|
+
height: rect.height
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
function isStaticPositioned(element) {
|
|
1154
|
+
return getComputedStyle$1(element).position === "static";
|
|
1155
|
+
}
|
|
1156
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1157
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null;
|
|
1158
|
+
if (polyfill) return polyfill(element);
|
|
1159
|
+
let rawOffsetParent = element.offsetParent;
|
|
1160
|
+
if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1161
|
+
return rawOffsetParent;
|
|
1162
|
+
}
|
|
1163
|
+
function getOffsetParent(element, polyfill) {
|
|
1164
|
+
const win = getWindow(element);
|
|
1165
|
+
if (isTopLayer(element)) return win;
|
|
1166
|
+
if (!isHTMLElement(element)) {
|
|
1167
|
+
let svgOffsetParent = getParentNode(element);
|
|
1168
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1169
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent;
|
|
1170
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1171
|
+
}
|
|
1172
|
+
return win;
|
|
1173
|
+
}
|
|
1174
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1175
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1176
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win;
|
|
1177
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1178
|
+
}
|
|
1179
|
+
var getElementRects = async function(data) {
|
|
1180
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1181
|
+
const getDimensionsFn = this.getDimensions;
|
|
1182
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1183
|
+
return {
|
|
1184
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1185
|
+
floating: {
|
|
1186
|
+
x: 0,
|
|
1187
|
+
y: 0,
|
|
1188
|
+
width: floatingDimensions.width,
|
|
1189
|
+
height: floatingDimensions.height
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
};
|
|
1193
|
+
function isRTL(element) {
|
|
1194
|
+
return getComputedStyle$1(element).direction === "rtl";
|
|
1195
|
+
}
|
|
1196
|
+
var platform = {
|
|
1197
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1198
|
+
getDocumentElement,
|
|
1199
|
+
getClippingRect,
|
|
1200
|
+
getOffsetParent,
|
|
1201
|
+
getElementRects,
|
|
1202
|
+
getClientRects,
|
|
1203
|
+
getDimensions,
|
|
1204
|
+
getScale,
|
|
1205
|
+
isElement,
|
|
1206
|
+
isRTL
|
|
1207
|
+
};
|
|
1208
|
+
/**
|
|
1209
|
+
* Modifies the placement by translating the floating element along the
|
|
1210
|
+
* specified axes.
|
|
1211
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1212
|
+
* object may be passed.
|
|
1213
|
+
* @see https://floating-ui.com/docs/offset
|
|
1214
|
+
*/
|
|
1215
|
+
var offset$2 = offset$1;
|
|
1216
|
+
/**
|
|
1217
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
1218
|
+
* that has the most space available automatically, without needing to specify a
|
|
1219
|
+
* preferred placement. Alternative to `flip`.
|
|
1220
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
1221
|
+
*/
|
|
1222
|
+
var autoPlacement = autoPlacement$1;
|
|
1223
|
+
/**
|
|
1224
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
1225
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
1226
|
+
* @see https://floating-ui.com/docs/shift
|
|
1227
|
+
*/
|
|
1228
|
+
var shift = shift$1;
|
|
1229
|
+
/**
|
|
1230
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1231
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1232
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
1233
|
+
* @see https://floating-ui.com/docs/flip
|
|
1234
|
+
*/
|
|
1235
|
+
var flip = flip$1;
|
|
1236
|
+
/**
|
|
1237
|
+
* Provides data that allows you to change the size of the floating element —
|
|
1238
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
1239
|
+
* width of the reference element.
|
|
1240
|
+
* @see https://floating-ui.com/docs/size
|
|
1241
|
+
*/
|
|
1242
|
+
var size = size$1;
|
|
1243
|
+
/**
|
|
1244
|
+
* Provides data to position an inner element of the floating element so that it
|
|
1245
|
+
* appears centered to the reference element.
|
|
1246
|
+
* @see https://floating-ui.com/docs/arrow
|
|
1247
|
+
*/
|
|
1248
|
+
var arrow = arrow$1;
|
|
1249
|
+
/**
|
|
1250
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1251
|
+
* next to a given reference element.
|
|
1252
|
+
*/
|
|
1253
|
+
var computePosition = (reference, floating, options) => {
|
|
1254
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1255
|
+
const mergedOptions = options != null ? options : {};
|
|
1256
|
+
const platformWithCache = {
|
|
1257
|
+
...platform,
|
|
1258
|
+
...mergedOptions.platform,
|
|
1259
|
+
_c: cache
|
|
1260
|
+
};
|
|
1261
|
+
return computePosition$1(reference, floating, {
|
|
1262
|
+
...mergedOptions,
|
|
1263
|
+
platform: platformWithCache
|
|
1264
|
+
});
|
|
1265
|
+
};
|
|
1266
|
+
// ../../node_modules/.pnpm/floating-vue@5.4.0_vue@3.5.44_typescript@5.9.3_/node_modules/floating-vue/dist/floating-vue.mjs
|
|
1267
|
+
var config = {
|
|
1268
|
+
disabled: false,
|
|
1269
|
+
distance: 5,
|
|
1270
|
+
skidding: 0,
|
|
1271
|
+
container: "body",
|
|
1272
|
+
boundary: void 0,
|
|
1273
|
+
instantMove: false,
|
|
1274
|
+
disposeTimeout: 150,
|
|
1275
|
+
popperTriggers: [],
|
|
1276
|
+
strategy: "absolute",
|
|
1277
|
+
preventOverflow: true,
|
|
1278
|
+
flip: true,
|
|
1279
|
+
shift: true,
|
|
1280
|
+
overflowPadding: 0,
|
|
1281
|
+
arrowPadding: 0,
|
|
1282
|
+
arrowOverflow: true,
|
|
1283
|
+
/**
|
|
1284
|
+
* By default, compute autohide on 'click'.
|
|
1285
|
+
*/
|
|
1286
|
+
autoHideOnMousedown: false,
|
|
1287
|
+
themes: {
|
|
1288
|
+
tooltip: {
|
|
1289
|
+
placement: "top",
|
|
1290
|
+
triggers: [
|
|
1291
|
+
"hover",
|
|
1292
|
+
"focus",
|
|
1293
|
+
"touch"
|
|
1294
|
+
],
|
|
1295
|
+
hideTriggers: (events) => [...events, "click"],
|
|
1296
|
+
delay: {
|
|
1297
|
+
show: 200,
|
|
1298
|
+
hide: 0
|
|
1299
|
+
},
|
|
1300
|
+
handleResize: false,
|
|
1301
|
+
html: false,
|
|
1302
|
+
loadingContent: "..."
|
|
1303
|
+
},
|
|
1304
|
+
dropdown: {
|
|
1305
|
+
placement: "bottom",
|
|
1306
|
+
triggers: ["click"],
|
|
1307
|
+
delay: 0,
|
|
1308
|
+
handleResize: true,
|
|
1309
|
+
autoHide: true
|
|
1310
|
+
},
|
|
1311
|
+
menu: {
|
|
1312
|
+
$extend: "dropdown",
|
|
1313
|
+
triggers: ["hover", "focus"],
|
|
1314
|
+
popperTriggers: ["hover"],
|
|
1315
|
+
delay: {
|
|
1316
|
+
show: 0,
|
|
1317
|
+
hide: 400
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
/**
|
|
1323
|
+
* Get default config value depending on theme
|
|
1324
|
+
*/
|
|
1325
|
+
function getDefaultConfig(theme, key) {
|
|
1326
|
+
let themeConfig = config.themes[theme] || {};
|
|
1327
|
+
let value;
|
|
1328
|
+
do {
|
|
1329
|
+
value = themeConfig[key];
|
|
1330
|
+
if (typeof value === "undefined") {
|
|
1331
|
+
if (themeConfig.$extend) themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1332
|
+
else {
|
|
1333
|
+
themeConfig = null;
|
|
1334
|
+
value = config[key];
|
|
1335
|
+
}
|
|
1336
|
+
} else themeConfig = null;
|
|
1337
|
+
} while (themeConfig);
|
|
1338
|
+
return value;
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Theme CSS inheritance
|
|
1342
|
+
*/
|
|
1343
|
+
function getThemeClasses(theme) {
|
|
1344
|
+
const result = [theme];
|
|
1345
|
+
let themeConfig = config.themes[theme] || {};
|
|
1346
|
+
do
|
|
1347
|
+
if (themeConfig.$extend && !themeConfig.$resetCss) {
|
|
1348
|
+
result.push(themeConfig.$extend);
|
|
1349
|
+
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1350
|
+
} else themeConfig = null;
|
|
1351
|
+
while (themeConfig);
|
|
1352
|
+
return result.map((c) => `v-popper--theme-${c}`);
|
|
1353
|
+
}
|
|
1354
|
+
function getAllParentThemes(theme) {
|
|
1355
|
+
const result = [theme];
|
|
1356
|
+
let themeConfig = config.themes[theme] || {};
|
|
1357
|
+
do
|
|
1358
|
+
if (themeConfig.$extend) {
|
|
1359
|
+
result.push(themeConfig.$extend);
|
|
1360
|
+
themeConfig = config.themes[themeConfig.$extend] || {};
|
|
1361
|
+
} else themeConfig = null;
|
|
1362
|
+
while (themeConfig);
|
|
1363
|
+
return result;
|
|
1364
|
+
}
|
|
1365
|
+
var supportsPassive = (() => {
|
|
1366
|
+
if (typeof window === "undefined") return false;
|
|
1367
|
+
let supported = false;
|
|
1368
|
+
try {
|
|
1369
|
+
const opts = Object.defineProperty({}, "passive", { get() {
|
|
1370
|
+
supported = true;
|
|
1371
|
+
} });
|
|
1372
|
+
window.addEventListener("test", null, opts);
|
|
1373
|
+
} catch (_unused) {}
|
|
1374
|
+
return supported;
|
|
1375
|
+
})();
|
|
1376
|
+
var isIOS = typeof window !== "undefined" && typeof navigator !== "undefined" && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
1377
|
+
var placements = [
|
|
1378
|
+
"auto",
|
|
1379
|
+
"top",
|
|
1380
|
+
"bottom",
|
|
1381
|
+
"left",
|
|
1382
|
+
"right"
|
|
1383
|
+
].reduce((acc, base) => acc.concat([
|
|
1384
|
+
base,
|
|
1385
|
+
`${base}-start`,
|
|
1386
|
+
`${base}-end`
|
|
1387
|
+
]), []);
|
|
1388
|
+
var SHOW_EVENT_MAP = {
|
|
1389
|
+
hover: "mouseenter",
|
|
1390
|
+
focus: "focus",
|
|
1391
|
+
click: "click",
|
|
1392
|
+
touch: "touchstart",
|
|
1393
|
+
pointer: "pointerdown"
|
|
1394
|
+
};
|
|
1395
|
+
var HIDE_EVENT_MAP = {
|
|
1396
|
+
hover: "mouseleave",
|
|
1397
|
+
focus: "blur",
|
|
1398
|
+
click: "click",
|
|
1399
|
+
touch: "touchend",
|
|
1400
|
+
pointer: "pointerup"
|
|
1401
|
+
};
|
|
1402
|
+
function removeFromArray(array, item) {
|
|
1403
|
+
const index = array.indexOf(item);
|
|
1404
|
+
if (index !== -1) array.splice(index, 1);
|
|
1405
|
+
}
|
|
1406
|
+
function nextFrame() {
|
|
1407
|
+
return new Promise((resolve) => requestAnimationFrame(() => {
|
|
1408
|
+
requestAnimationFrame(resolve);
|
|
1409
|
+
}));
|
|
1410
|
+
}
|
|
1411
|
+
var shownPoppers = [];
|
|
1412
|
+
var hidingPopper = null;
|
|
1413
|
+
var shownPoppersByTheme = {};
|
|
1414
|
+
function getShownPoppersByTheme(theme) {
|
|
1415
|
+
let list = shownPoppersByTheme[theme];
|
|
1416
|
+
if (!list) list = shownPoppersByTheme[theme] = [];
|
|
1417
|
+
return list;
|
|
1418
|
+
}
|
|
1419
|
+
var Element$1 = function() {};
|
|
1420
|
+
if (typeof window !== "undefined") Element$1 = window.Element;
|
|
1421
|
+
function defaultPropFactory(prop) {
|
|
1422
|
+
return function(props) {
|
|
1423
|
+
return getDefaultConfig(props.theme, prop);
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
var PROVIDE_KEY = "__floating-vue__popper";
|
|
1427
|
+
var createPopper = () => defineComponent({
|
|
1428
|
+
name: "VPopper",
|
|
1429
|
+
provide() {
|
|
1430
|
+
return { [PROVIDE_KEY]: { parentPopper: this } };
|
|
1431
|
+
},
|
|
1432
|
+
inject: { [PROVIDE_KEY]: { default: null } },
|
|
1433
|
+
props: {
|
|
1434
|
+
theme: {
|
|
1435
|
+
type: String,
|
|
1436
|
+
required: true
|
|
1437
|
+
},
|
|
1438
|
+
targetNodes: {
|
|
1439
|
+
type: Function,
|
|
1440
|
+
required: true
|
|
1441
|
+
},
|
|
1442
|
+
referenceNode: {
|
|
1443
|
+
type: Function,
|
|
1444
|
+
default: null
|
|
1445
|
+
},
|
|
1446
|
+
popperNode: {
|
|
1447
|
+
type: Function,
|
|
1448
|
+
required: true
|
|
1449
|
+
},
|
|
1450
|
+
shown: {
|
|
1451
|
+
type: Boolean,
|
|
1452
|
+
default: false
|
|
1453
|
+
},
|
|
1454
|
+
showGroup: {
|
|
1455
|
+
type: String,
|
|
1456
|
+
default: null
|
|
1457
|
+
},
|
|
1458
|
+
ariaId: { default: null },
|
|
1459
|
+
disabled: {
|
|
1460
|
+
type: Boolean,
|
|
1461
|
+
default: defaultPropFactory("disabled")
|
|
1462
|
+
},
|
|
1463
|
+
positioningDisabled: {
|
|
1464
|
+
type: Boolean,
|
|
1465
|
+
default: defaultPropFactory("positioningDisabled")
|
|
1466
|
+
},
|
|
1467
|
+
placement: {
|
|
1468
|
+
type: String,
|
|
1469
|
+
default: defaultPropFactory("placement"),
|
|
1470
|
+
validator: (value) => placements.includes(value)
|
|
1471
|
+
},
|
|
1472
|
+
delay: {
|
|
1473
|
+
type: [
|
|
1474
|
+
String,
|
|
1475
|
+
Number,
|
|
1476
|
+
Object
|
|
1477
|
+
],
|
|
1478
|
+
default: defaultPropFactory("delay")
|
|
1479
|
+
},
|
|
1480
|
+
distance: {
|
|
1481
|
+
type: [Number, String],
|
|
1482
|
+
default: defaultPropFactory("distance")
|
|
1483
|
+
},
|
|
1484
|
+
skidding: {
|
|
1485
|
+
type: [Number, String],
|
|
1486
|
+
default: defaultPropFactory("skidding")
|
|
1487
|
+
},
|
|
1488
|
+
triggers: {
|
|
1489
|
+
type: Array,
|
|
1490
|
+
default: defaultPropFactory("triggers")
|
|
1491
|
+
},
|
|
1492
|
+
showTriggers: {
|
|
1493
|
+
type: [Array, Function],
|
|
1494
|
+
default: defaultPropFactory("showTriggers")
|
|
1495
|
+
},
|
|
1496
|
+
hideTriggers: {
|
|
1497
|
+
type: [Array, Function],
|
|
1498
|
+
default: defaultPropFactory("hideTriggers")
|
|
1499
|
+
},
|
|
1500
|
+
popperTriggers: {
|
|
1501
|
+
type: Array,
|
|
1502
|
+
default: defaultPropFactory("popperTriggers")
|
|
1503
|
+
},
|
|
1504
|
+
popperShowTriggers: {
|
|
1505
|
+
type: [Array, Function],
|
|
1506
|
+
default: defaultPropFactory("popperShowTriggers")
|
|
1507
|
+
},
|
|
1508
|
+
popperHideTriggers: {
|
|
1509
|
+
type: [Array, Function],
|
|
1510
|
+
default: defaultPropFactory("popperHideTriggers")
|
|
1511
|
+
},
|
|
1512
|
+
container: {
|
|
1513
|
+
type: [
|
|
1514
|
+
String,
|
|
1515
|
+
Object,
|
|
1516
|
+
Element$1,
|
|
1517
|
+
Boolean
|
|
1518
|
+
],
|
|
1519
|
+
default: defaultPropFactory("container")
|
|
1520
|
+
},
|
|
1521
|
+
boundary: {
|
|
1522
|
+
type: [String, Element$1],
|
|
1523
|
+
default: defaultPropFactory("boundary")
|
|
1524
|
+
},
|
|
1525
|
+
strategy: {
|
|
1526
|
+
type: String,
|
|
1527
|
+
validator: (value) => ["absolute", "fixed"].includes(value),
|
|
1528
|
+
default: defaultPropFactory("strategy")
|
|
1529
|
+
},
|
|
1530
|
+
autoHide: {
|
|
1531
|
+
type: [Boolean, Function],
|
|
1532
|
+
default: defaultPropFactory("autoHide")
|
|
1533
|
+
},
|
|
1534
|
+
handleResize: {
|
|
1535
|
+
type: Boolean,
|
|
1536
|
+
default: defaultPropFactory("handleResize")
|
|
1537
|
+
},
|
|
1538
|
+
instantMove: {
|
|
1539
|
+
type: Boolean,
|
|
1540
|
+
default: defaultPropFactory("instantMove")
|
|
1541
|
+
},
|
|
1542
|
+
eagerMount: {
|
|
1543
|
+
type: Boolean,
|
|
1544
|
+
default: defaultPropFactory("eagerMount")
|
|
1545
|
+
},
|
|
1546
|
+
popperClass: {
|
|
1547
|
+
type: [
|
|
1548
|
+
String,
|
|
1549
|
+
Array,
|
|
1550
|
+
Object
|
|
1551
|
+
],
|
|
1552
|
+
default: defaultPropFactory("popperClass")
|
|
1553
|
+
},
|
|
1554
|
+
computeTransformOrigin: {
|
|
1555
|
+
type: Boolean,
|
|
1556
|
+
default: defaultPropFactory("computeTransformOrigin")
|
|
1557
|
+
},
|
|
1558
|
+
/**
|
|
1559
|
+
* @deprecated
|
|
1560
|
+
*/
|
|
1561
|
+
autoMinSize: {
|
|
1562
|
+
type: Boolean,
|
|
1563
|
+
default: defaultPropFactory("autoMinSize")
|
|
1564
|
+
},
|
|
1565
|
+
autoSize: {
|
|
1566
|
+
type: [Boolean, String],
|
|
1567
|
+
default: defaultPropFactory("autoSize")
|
|
1568
|
+
},
|
|
1569
|
+
/**
|
|
1570
|
+
* @deprecated
|
|
1571
|
+
*/
|
|
1572
|
+
autoMaxSize: {
|
|
1573
|
+
type: Boolean,
|
|
1574
|
+
default: defaultPropFactory("autoMaxSize")
|
|
1575
|
+
},
|
|
1576
|
+
autoBoundaryMaxSize: {
|
|
1577
|
+
type: Boolean,
|
|
1578
|
+
default: defaultPropFactory("autoBoundaryMaxSize")
|
|
1579
|
+
},
|
|
1580
|
+
preventOverflow: {
|
|
1581
|
+
type: Boolean,
|
|
1582
|
+
default: defaultPropFactory("preventOverflow")
|
|
1583
|
+
},
|
|
1584
|
+
overflowPadding: {
|
|
1585
|
+
type: [Number, String],
|
|
1586
|
+
default: defaultPropFactory("overflowPadding")
|
|
1587
|
+
},
|
|
1588
|
+
arrowPadding: {
|
|
1589
|
+
type: [Number, String],
|
|
1590
|
+
default: defaultPropFactory("arrowPadding")
|
|
1591
|
+
},
|
|
1592
|
+
arrowOverflow: {
|
|
1593
|
+
type: Boolean,
|
|
1594
|
+
default: defaultPropFactory("arrowOverflow")
|
|
1595
|
+
},
|
|
1596
|
+
flip: {
|
|
1597
|
+
type: Boolean,
|
|
1598
|
+
default: defaultPropFactory("flip")
|
|
1599
|
+
},
|
|
1600
|
+
shift: {
|
|
1601
|
+
type: Boolean,
|
|
1602
|
+
default: defaultPropFactory("shift")
|
|
1603
|
+
},
|
|
1604
|
+
shiftCrossAxis: {
|
|
1605
|
+
type: Boolean,
|
|
1606
|
+
default: defaultPropFactory("shiftCrossAxis")
|
|
1607
|
+
},
|
|
1608
|
+
noAutoFocus: {
|
|
1609
|
+
type: Boolean,
|
|
1610
|
+
default: defaultPropFactory("noAutoFocus")
|
|
1611
|
+
},
|
|
1612
|
+
disposeTimeout: {
|
|
1613
|
+
type: Number,
|
|
1614
|
+
default: defaultPropFactory("disposeTimeout")
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
emits: {
|
|
1618
|
+
show: () => true,
|
|
1619
|
+
hide: () => true,
|
|
1620
|
+
"update:shown": (_shown) => true,
|
|
1621
|
+
"apply-show": () => true,
|
|
1622
|
+
"apply-hide": () => true,
|
|
1623
|
+
"close-group": () => true,
|
|
1624
|
+
"close-directive": () => true,
|
|
1625
|
+
"auto-hide": () => true,
|
|
1626
|
+
resize: () => true
|
|
1627
|
+
},
|
|
1628
|
+
data() {
|
|
1629
|
+
return {
|
|
1630
|
+
isShown: false,
|
|
1631
|
+
isMounted: false,
|
|
1632
|
+
skipTransition: false,
|
|
1633
|
+
classes: {
|
|
1634
|
+
showFrom: false,
|
|
1635
|
+
showTo: false,
|
|
1636
|
+
hideFrom: false,
|
|
1637
|
+
hideTo: true
|
|
1638
|
+
},
|
|
1639
|
+
result: {
|
|
1640
|
+
x: 0,
|
|
1641
|
+
y: 0,
|
|
1642
|
+
placement: "",
|
|
1643
|
+
strategy: this.strategy,
|
|
1644
|
+
arrow: {
|
|
1645
|
+
x: 0,
|
|
1646
|
+
y: 0,
|
|
1647
|
+
centerOffset: 0
|
|
1648
|
+
},
|
|
1649
|
+
transformOrigin: null
|
|
1650
|
+
},
|
|
1651
|
+
randomId: `popper_${[Math.random(), Date.now()].map((n) => n.toString(36).substring(2, 10)).join("_")}`,
|
|
1652
|
+
shownChildren: /* @__PURE__ */ new Set(),
|
|
1653
|
+
lastAutoHide: true,
|
|
1654
|
+
pendingHide: false,
|
|
1655
|
+
containsGlobalTarget: false,
|
|
1656
|
+
isDisposed: true,
|
|
1657
|
+
mouseDownContains: false
|
|
1658
|
+
};
|
|
1659
|
+
},
|
|
1660
|
+
computed: {
|
|
1661
|
+
popperId() {
|
|
1662
|
+
var _this$ariaId;
|
|
1663
|
+
return (_this$ariaId = this.ariaId) !== null && _this$ariaId !== void 0 ? _this$ariaId : this.randomId;
|
|
1664
|
+
},
|
|
1665
|
+
shouldMountContent() {
|
|
1666
|
+
return this.eagerMount || this.isMounted;
|
|
1667
|
+
},
|
|
1668
|
+
slotData() {
|
|
1669
|
+
return {
|
|
1670
|
+
popperId: this.popperId,
|
|
1671
|
+
isShown: this.isShown,
|
|
1672
|
+
shouldMountContent: this.shouldMountContent,
|
|
1673
|
+
skipTransition: this.skipTransition,
|
|
1674
|
+
autoHide: typeof this.autoHide === "function" ? this.lastAutoHide : this.autoHide,
|
|
1675
|
+
show: this.show,
|
|
1676
|
+
hide: this.hide,
|
|
1677
|
+
handleResize: this.handleResize,
|
|
1678
|
+
onResize: this.onResize,
|
|
1679
|
+
classes: {
|
|
1680
|
+
...this.classes,
|
|
1681
|
+
popperClass: this.popperClass
|
|
1682
|
+
},
|
|
1683
|
+
result: this.positioningDisabled ? null : this.result,
|
|
1684
|
+
attrs: this.$attrs
|
|
1685
|
+
};
|
|
1686
|
+
},
|
|
1687
|
+
parentPopper() {
|
|
1688
|
+
var _this$PROVIDE_KEY;
|
|
1689
|
+
return (_this$PROVIDE_KEY = this[PROVIDE_KEY]) === null || _this$PROVIDE_KEY === void 0 ? void 0 : _this$PROVIDE_KEY.parentPopper;
|
|
1690
|
+
},
|
|
1691
|
+
hasPopperShowTriggerHover() {
|
|
1692
|
+
var _this$popperTriggers, _this$popperShowTrigg;
|
|
1693
|
+
return ((_this$popperTriggers = this.popperTriggers) === null || _this$popperTriggers === void 0 ? void 0 : _this$popperTriggers.includes("hover")) || ((_this$popperShowTrigg = this.popperShowTriggers) === null || _this$popperShowTrigg === void 0 ? void 0 : _this$popperShowTrigg.includes("hover"));
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
watch: {
|
|
1697
|
+
shown: "$_autoShowHide",
|
|
1698
|
+
disabled(value) {
|
|
1699
|
+
if (value) this.dispose();
|
|
1700
|
+
else this.init();
|
|
1701
|
+
},
|
|
1702
|
+
async container() {
|
|
1703
|
+
if (this.isShown) {
|
|
1704
|
+
this.$_ensureTeleport();
|
|
1705
|
+
await this.$_computePosition();
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
triggers: {
|
|
1709
|
+
handler: "$_refreshListeners",
|
|
1710
|
+
deep: true
|
|
1711
|
+
},
|
|
1712
|
+
positioningDisabled: "$_refreshListeners",
|
|
1713
|
+
...[
|
|
1714
|
+
"placement",
|
|
1715
|
+
"distance",
|
|
1716
|
+
"skidding",
|
|
1717
|
+
"boundary",
|
|
1718
|
+
"strategy",
|
|
1719
|
+
"overflowPadding",
|
|
1720
|
+
"arrowPadding",
|
|
1721
|
+
"preventOverflow",
|
|
1722
|
+
"shift",
|
|
1723
|
+
"shiftCrossAxis",
|
|
1724
|
+
"flip"
|
|
1725
|
+
].reduce((acc, prop) => {
|
|
1726
|
+
acc[prop] = "$_computePosition";
|
|
1727
|
+
return acc;
|
|
1728
|
+
}, {})
|
|
1729
|
+
},
|
|
1730
|
+
created() {
|
|
1731
|
+
if (this.autoMinSize) console.warn("[floating-vue] `autoMinSize` option is deprecated. Use `autoSize=\"min\"` instead.");
|
|
1732
|
+
if (this.autoMaxSize) console.warn("[floating-vue] `autoMaxSize` option is deprecated. Use `autoBoundaryMaxSize` instead.");
|
|
1733
|
+
},
|
|
1734
|
+
mounted() {
|
|
1735
|
+
this.init();
|
|
1736
|
+
this.$_detachPopperNode();
|
|
1737
|
+
},
|
|
1738
|
+
activated() {
|
|
1739
|
+
this.$_autoShowHide();
|
|
1740
|
+
},
|
|
1741
|
+
deactivated() {
|
|
1742
|
+
this.hide();
|
|
1743
|
+
},
|
|
1744
|
+
beforeUnmount() {
|
|
1745
|
+
this.dispose();
|
|
1746
|
+
},
|
|
1747
|
+
methods: {
|
|
1748
|
+
show({ event = null, skipDelay = false, force = false } = {}) {
|
|
1749
|
+
var _this$parentPopper;
|
|
1750
|
+
if (((_this$parentPopper = this.parentPopper) === null || _this$parentPopper === void 0 ? void 0 : _this$parentPopper.lockedChild) && this.parentPopper.lockedChild !== this) return;
|
|
1751
|
+
this.pendingHide = false;
|
|
1752
|
+
if (force || !this.disabled) {
|
|
1753
|
+
var _this$parentPopper2;
|
|
1754
|
+
if (((_this$parentPopper2 = this.parentPopper) === null || _this$parentPopper2 === void 0 ? void 0 : _this$parentPopper2.lockedChild) === this) this.parentPopper.lockedChild = null;
|
|
1755
|
+
this.$_scheduleShow(event, skipDelay);
|
|
1756
|
+
this.$emit("show");
|
|
1757
|
+
this.$_showFrameLocked = true;
|
|
1758
|
+
requestAnimationFrame(() => {
|
|
1759
|
+
this.$_showFrameLocked = false;
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
this.$emit("update:shown", true);
|
|
1763
|
+
},
|
|
1764
|
+
hide({ event = null, skipDelay = false } = {}) {
|
|
1765
|
+
var _this$parentPopper3;
|
|
1766
|
+
if (this.$_hideInProgress) return;
|
|
1767
|
+
if (this.shownChildren.size > 0) {
|
|
1768
|
+
this.pendingHide = true;
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
if (this.hasPopperShowTriggerHover && this.$_isAimingPopper()) {
|
|
1772
|
+
if (this.parentPopper) {
|
|
1773
|
+
this.parentPopper.lockedChild = this;
|
|
1774
|
+
if (this.parentPopper.lockedChildTimer) clearTimeout(this.parentPopper.lockedChildTimer);
|
|
1775
|
+
this.parentPopper.lockedChildTimer = setTimeout(() => {
|
|
1776
|
+
if (this.parentPopper.lockedChild === this) {
|
|
1777
|
+
this.parentPopper.lockedChild.hide({ skipDelay });
|
|
1778
|
+
this.parentPopper.lockedChild = null;
|
|
1779
|
+
}
|
|
1780
|
+
}, 1e3);
|
|
1781
|
+
}
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
if (((_this$parentPopper3 = this.parentPopper) === null || _this$parentPopper3 === void 0 ? void 0 : _this$parentPopper3.lockedChild) === this) this.parentPopper.lockedChild = null;
|
|
1785
|
+
this.pendingHide = false;
|
|
1786
|
+
this.$_scheduleHide(event, skipDelay);
|
|
1787
|
+
this.$emit("hide");
|
|
1788
|
+
this.$emit("update:shown", false);
|
|
1789
|
+
},
|
|
1790
|
+
init() {
|
|
1791
|
+
var _this$referenceNode, _this$referenceNode2;
|
|
1792
|
+
if (!this.isDisposed) return;
|
|
1793
|
+
this.isDisposed = false;
|
|
1794
|
+
this.isMounted = false;
|
|
1795
|
+
this.$_events = [];
|
|
1796
|
+
this.$_preventShow = false;
|
|
1797
|
+
this.$_referenceNode = (_this$referenceNode = (_this$referenceNode2 = this.referenceNode) === null || _this$referenceNode2 === void 0 ? void 0 : _this$referenceNode2.call(this)) !== null && _this$referenceNode !== void 0 ? _this$referenceNode : this.$el;
|
|
1798
|
+
this.$_targetNodes = this.targetNodes().filter((e) => e.nodeType === e.ELEMENT_NODE);
|
|
1799
|
+
this.$_popperNode = this.popperNode();
|
|
1800
|
+
this.$_innerNode = this.$_popperNode.querySelector(".v-popper__inner");
|
|
1801
|
+
this.$_arrowNode = this.$_popperNode.querySelector(".v-popper__arrow-container");
|
|
1802
|
+
this.$_swapTargetAttrs("title", "data-original-title");
|
|
1803
|
+
this.$_detachPopperNode();
|
|
1804
|
+
if (this.triggers.length) this.$_addEventListeners();
|
|
1805
|
+
if (this.shown) this.show();
|
|
1806
|
+
},
|
|
1807
|
+
dispose() {
|
|
1808
|
+
if (this.isDisposed) return;
|
|
1809
|
+
this.isDisposed = true;
|
|
1810
|
+
this.$_removeEventListeners();
|
|
1811
|
+
this.hide({ skipDelay: true });
|
|
1812
|
+
this.$_detachPopperNode();
|
|
1813
|
+
this.isMounted = false;
|
|
1814
|
+
this.isShown = false;
|
|
1815
|
+
this.$_updateParentShownChildren(false);
|
|
1816
|
+
this.$_swapTargetAttrs("data-original-title", "title");
|
|
1817
|
+
},
|
|
1818
|
+
async onResize() {
|
|
1819
|
+
if (this.isShown) {
|
|
1820
|
+
await this.$_computePosition();
|
|
1821
|
+
this.$emit("resize");
|
|
1822
|
+
}
|
|
1823
|
+
},
|
|
1824
|
+
async $_computePosition() {
|
|
1825
|
+
if (this.isDisposed || this.positioningDisabled) return;
|
|
1826
|
+
const options = {
|
|
1827
|
+
strategy: this.strategy,
|
|
1828
|
+
middleware: []
|
|
1829
|
+
};
|
|
1830
|
+
if (this.distance || this.skidding) options.middleware.push(offset$2({
|
|
1831
|
+
mainAxis: this.distance,
|
|
1832
|
+
crossAxis: this.skidding
|
|
1833
|
+
}));
|
|
1834
|
+
const isPlacementAuto = this.placement.startsWith("auto");
|
|
1835
|
+
if (isPlacementAuto) {
|
|
1836
|
+
var _this$placement$split;
|
|
1837
|
+
options.middleware.push(autoPlacement({ alignment: (_this$placement$split = this.placement.split("-")[1]) !== null && _this$placement$split !== void 0 ? _this$placement$split : "" }));
|
|
1838
|
+
} else options.placement = this.placement;
|
|
1839
|
+
if (this.preventOverflow) {
|
|
1840
|
+
if (this.shift) options.middleware.push(shift({
|
|
1841
|
+
padding: this.overflowPadding,
|
|
1842
|
+
boundary: this.boundary,
|
|
1843
|
+
crossAxis: this.shiftCrossAxis
|
|
1844
|
+
}));
|
|
1845
|
+
if (!isPlacementAuto && this.flip) options.middleware.push(flip({
|
|
1846
|
+
padding: this.overflowPadding,
|
|
1847
|
+
boundary: this.boundary
|
|
1848
|
+
}));
|
|
1849
|
+
}
|
|
1850
|
+
options.middleware.push(arrow({
|
|
1851
|
+
element: this.$_arrowNode,
|
|
1852
|
+
padding: this.arrowPadding
|
|
1853
|
+
}));
|
|
1854
|
+
if (this.arrowOverflow) options.middleware.push({
|
|
1855
|
+
name: "arrowOverflow",
|
|
1856
|
+
fn: ({ placement, rects, middlewareData }) => {
|
|
1857
|
+
let overflow;
|
|
1858
|
+
const { centerOffset } = middlewareData.arrow;
|
|
1859
|
+
if (placement.startsWith("top") || placement.startsWith("bottom")) overflow = Math.abs(centerOffset) > rects.reference.width / 2;
|
|
1860
|
+
else overflow = Math.abs(centerOffset) > rects.reference.height / 2;
|
|
1861
|
+
return { data: { overflow } };
|
|
1862
|
+
}
|
|
1863
|
+
});
|
|
1864
|
+
if (this.autoMinSize || this.autoSize) {
|
|
1865
|
+
const autoSize = this.autoSize ? this.autoSize : this.autoMinSize ? "min" : null;
|
|
1866
|
+
options.middleware.push({
|
|
1867
|
+
name: "autoSize",
|
|
1868
|
+
fn: ({ rects, placement, middlewareData }) => {
|
|
1869
|
+
var _middlewareData$autoS;
|
|
1870
|
+
if ((_middlewareData$autoS = middlewareData.autoSize) === null || _middlewareData$autoS === void 0 ? void 0 : _middlewareData$autoS.skip) return {};
|
|
1871
|
+
let width;
|
|
1872
|
+
let height;
|
|
1873
|
+
if (placement.startsWith("top") || placement.startsWith("bottom")) width = rects.reference.width;
|
|
1874
|
+
else height = rects.reference.height;
|
|
1875
|
+
this.$_innerNode.style[autoSize === "min" ? "minWidth" : autoSize === "max" ? "maxWidth" : "width"] = width != null ? `${width}px` : null;
|
|
1876
|
+
this.$_innerNode.style[autoSize === "min" ? "minHeight" : autoSize === "max" ? "maxHeight" : "height"] = height != null ? `${height}px` : null;
|
|
1877
|
+
return {
|
|
1878
|
+
data: { skip: true },
|
|
1879
|
+
reset: { rects: true }
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
if (this.autoMaxSize || this.autoBoundaryMaxSize) {
|
|
1885
|
+
this.$_innerNode.style.maxWidth = null;
|
|
1886
|
+
this.$_innerNode.style.maxHeight = null;
|
|
1887
|
+
options.middleware.push(size({
|
|
1888
|
+
boundary: this.boundary,
|
|
1889
|
+
padding: this.overflowPadding,
|
|
1890
|
+
apply: ({ availableWidth, availableHeight }) => {
|
|
1891
|
+
this.$_innerNode.style.maxWidth = availableWidth != null ? `${availableWidth}px` : null;
|
|
1892
|
+
this.$_innerNode.style.maxHeight = availableHeight != null ? `${availableHeight}px` : null;
|
|
1893
|
+
}
|
|
1894
|
+
}));
|
|
1895
|
+
}
|
|
1896
|
+
const data = await computePosition(this.$_referenceNode, this.$_popperNode, options);
|
|
1897
|
+
Object.assign(this.result, {
|
|
1898
|
+
x: data.x,
|
|
1899
|
+
y: data.y,
|
|
1900
|
+
placement: data.placement,
|
|
1901
|
+
strategy: data.strategy,
|
|
1902
|
+
arrow: {
|
|
1903
|
+
...data.middlewareData.arrow,
|
|
1904
|
+
...data.middlewareData.arrowOverflow
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
},
|
|
1908
|
+
$_scheduleShow(_event, skipDelay = false) {
|
|
1909
|
+
this.$_updateParentShownChildren(true);
|
|
1910
|
+
this.$_hideInProgress = false;
|
|
1911
|
+
clearTimeout(this.$_scheduleTimer);
|
|
1912
|
+
if (hidingPopper && this.instantMove && hidingPopper.instantMove && hidingPopper !== this.parentPopper) {
|
|
1913
|
+
hidingPopper.$_applyHide(true);
|
|
1914
|
+
this.$_applyShow(true);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
if (skipDelay) this.$_applyShow();
|
|
1918
|
+
else this.$_scheduleTimer = setTimeout(this.$_applyShow.bind(this), this.$_computeDelay("show"));
|
|
1919
|
+
},
|
|
1920
|
+
$_scheduleHide(_event, skipDelay = false) {
|
|
1921
|
+
if (this.shownChildren.size > 0) {
|
|
1922
|
+
this.pendingHide = true;
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
this.$_updateParentShownChildren(false);
|
|
1926
|
+
this.$_hideInProgress = true;
|
|
1927
|
+
if (this.$_scheduleTimer) clearTimeout(this.$_scheduleTimer);
|
|
1928
|
+
if (this.isShown) hidingPopper = this;
|
|
1929
|
+
if (skipDelay) this.$_applyHide();
|
|
1930
|
+
else this.$_scheduleTimer = setTimeout(this.$_applyHide.bind(this), this.$_computeDelay("hide"));
|
|
1931
|
+
},
|
|
1932
|
+
$_computeDelay(type) {
|
|
1933
|
+
const delay = this.delay;
|
|
1934
|
+
return parseInt(delay && delay[type] || delay || 0);
|
|
1935
|
+
},
|
|
1936
|
+
async $_applyShow(skipTransition = false) {
|
|
1937
|
+
if (this.$_disposeTimer) clearTimeout(this.$_disposeTimer);
|
|
1938
|
+
if (this.$_scheduleTimer) clearTimeout(this.$_scheduleTimer);
|
|
1939
|
+
this.skipTransition = skipTransition;
|
|
1940
|
+
if (this.isShown) return;
|
|
1941
|
+
this.$_ensureTeleport();
|
|
1942
|
+
await nextFrame();
|
|
1943
|
+
await this.$_computePosition();
|
|
1944
|
+
await this.$_applyShowEffect();
|
|
1945
|
+
if (!this.positioningDisabled) this.$_registerEventListeners([...getOverflowAncestors(this.$_referenceNode), ...getOverflowAncestors(this.$_popperNode)], "scroll", () => {
|
|
1946
|
+
this.$_computePosition();
|
|
1947
|
+
});
|
|
1948
|
+
},
|
|
1949
|
+
async $_applyShowEffect() {
|
|
1950
|
+
if (this.$_hideInProgress) return;
|
|
1951
|
+
if (this.computeTransformOrigin) {
|
|
1952
|
+
const bounds = this.$_referenceNode.getBoundingClientRect();
|
|
1953
|
+
const popperWrapper = this.$_popperNode.querySelector(".v-popper__wrapper");
|
|
1954
|
+
const parentBounds = popperWrapper.parentNode.getBoundingClientRect();
|
|
1955
|
+
const x = bounds.x + bounds.width / 2 - (parentBounds.left + popperWrapper.offsetLeft);
|
|
1956
|
+
const y = bounds.y + bounds.height / 2 - (parentBounds.top + popperWrapper.offsetTop);
|
|
1957
|
+
this.result.transformOrigin = `${x}px ${y}px`;
|
|
1958
|
+
}
|
|
1959
|
+
this.isShown = true;
|
|
1960
|
+
this.$_applyAttrsToTarget({
|
|
1961
|
+
"aria-describedby": this.popperId,
|
|
1962
|
+
"data-popper-shown": ""
|
|
1963
|
+
});
|
|
1964
|
+
const showGroup = this.showGroup;
|
|
1965
|
+
if (showGroup) {
|
|
1966
|
+
let popover;
|
|
1967
|
+
for (let i = 0; i < shownPoppers.length; i++) {
|
|
1968
|
+
popover = shownPoppers[i];
|
|
1969
|
+
if (popover.showGroup !== showGroup) {
|
|
1970
|
+
popover.hide();
|
|
1971
|
+
popover.$emit("close-group");
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
shownPoppers.push(this);
|
|
1976
|
+
document.body.classList.add("v-popper--some-open");
|
|
1977
|
+
for (const theme of getAllParentThemes(this.theme)) {
|
|
1978
|
+
getShownPoppersByTheme(theme).push(this);
|
|
1979
|
+
document.body.classList.add(`v-popper--some-open--${theme}`);
|
|
1980
|
+
}
|
|
1981
|
+
this.$emit("apply-show");
|
|
1982
|
+
this.classes.showFrom = true;
|
|
1983
|
+
this.classes.showTo = false;
|
|
1984
|
+
this.classes.hideFrom = false;
|
|
1985
|
+
this.classes.hideTo = false;
|
|
1986
|
+
await nextFrame();
|
|
1987
|
+
this.classes.showFrom = false;
|
|
1988
|
+
this.classes.showTo = true;
|
|
1989
|
+
if (!this.noAutoFocus) this.$_popperNode.focus();
|
|
1990
|
+
},
|
|
1991
|
+
async $_applyHide(skipTransition = false) {
|
|
1992
|
+
if (this.shownChildren.size > 0) {
|
|
1993
|
+
this.pendingHide = true;
|
|
1994
|
+
this.$_hideInProgress = false;
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
if (this.$_scheduleTimer) clearTimeout(this.$_scheduleTimer);
|
|
1998
|
+
if (!this.isShown) return;
|
|
1999
|
+
this.skipTransition = skipTransition;
|
|
2000
|
+
removeFromArray(shownPoppers, this);
|
|
2001
|
+
if (shownPoppers.length === 0) document.body.classList.remove("v-popper--some-open");
|
|
2002
|
+
for (const theme of getAllParentThemes(this.theme)) {
|
|
2003
|
+
const list = getShownPoppersByTheme(theme);
|
|
2004
|
+
removeFromArray(list, this);
|
|
2005
|
+
if (list.length === 0) document.body.classList.remove(`v-popper--some-open--${theme}`);
|
|
2006
|
+
}
|
|
2007
|
+
if (hidingPopper === this) hidingPopper = null;
|
|
2008
|
+
this.isShown = false;
|
|
2009
|
+
this.$_applyAttrsToTarget({
|
|
2010
|
+
"aria-describedby": void 0,
|
|
2011
|
+
"data-popper-shown": void 0
|
|
2012
|
+
});
|
|
2013
|
+
if (this.$_disposeTimer) clearTimeout(this.$_disposeTimer);
|
|
2014
|
+
const disposeTime = this.disposeTimeout;
|
|
2015
|
+
if (disposeTime !== null) this.$_disposeTimer = setTimeout(() => {
|
|
2016
|
+
if (this.$_popperNode) {
|
|
2017
|
+
this.$_detachPopperNode();
|
|
2018
|
+
this.isMounted = false;
|
|
2019
|
+
}
|
|
2020
|
+
}, disposeTime);
|
|
2021
|
+
this.$_removeEventListeners("scroll");
|
|
2022
|
+
this.$emit("apply-hide");
|
|
2023
|
+
this.classes.showFrom = false;
|
|
2024
|
+
this.classes.showTo = false;
|
|
2025
|
+
this.classes.hideFrom = true;
|
|
2026
|
+
this.classes.hideTo = false;
|
|
2027
|
+
await nextFrame();
|
|
2028
|
+
this.classes.hideFrom = false;
|
|
2029
|
+
this.classes.hideTo = true;
|
|
2030
|
+
},
|
|
2031
|
+
$_autoShowHide() {
|
|
2032
|
+
if (this.shown) this.show();
|
|
2033
|
+
else this.hide();
|
|
2034
|
+
},
|
|
2035
|
+
$_ensureTeleport() {
|
|
2036
|
+
if (this.isDisposed) return;
|
|
2037
|
+
let container = this.container;
|
|
2038
|
+
if (typeof container === "string") container = window.document.querySelector(container);
|
|
2039
|
+
else if (container === false) container = this.$_targetNodes[0].parentNode;
|
|
2040
|
+
if (!container) throw new Error(`No container for popover: ${this.container}`);
|
|
2041
|
+
container.appendChild(this.$_popperNode);
|
|
2042
|
+
this.isMounted = true;
|
|
2043
|
+
},
|
|
2044
|
+
$_addEventListeners() {
|
|
2045
|
+
const handleShow = (event) => {
|
|
2046
|
+
if (this.isShown && !this.$_hideInProgress) return;
|
|
2047
|
+
event.usedByTooltip = true;
|
|
2048
|
+
!this.$_preventShow && this.show({ event });
|
|
2049
|
+
};
|
|
2050
|
+
this.$_registerTriggerListeners(this.$_targetNodes, SHOW_EVENT_MAP, this.triggers, this.showTriggers, handleShow);
|
|
2051
|
+
this.$_registerTriggerListeners([this.$_popperNode], SHOW_EVENT_MAP, this.popperTriggers, this.popperShowTriggers, handleShow);
|
|
2052
|
+
const handleHide = (event) => {
|
|
2053
|
+
if (event.usedByTooltip) return;
|
|
2054
|
+
this.hide({ event });
|
|
2055
|
+
};
|
|
2056
|
+
this.$_registerTriggerListeners(this.$_targetNodes, HIDE_EVENT_MAP, this.triggers, this.hideTriggers, handleHide);
|
|
2057
|
+
this.$_registerTriggerListeners([this.$_popperNode], HIDE_EVENT_MAP, this.popperTriggers, this.popperHideTriggers, handleHide);
|
|
2058
|
+
},
|
|
2059
|
+
$_registerEventListeners(targetNodes, eventType, handler) {
|
|
2060
|
+
this.$_events.push({
|
|
2061
|
+
targetNodes,
|
|
2062
|
+
eventType,
|
|
2063
|
+
handler
|
|
2064
|
+
});
|
|
2065
|
+
targetNodes.forEach((node) => node.addEventListener(eventType, handler, supportsPassive ? { passive: true } : void 0));
|
|
2066
|
+
},
|
|
2067
|
+
$_registerTriggerListeners(targetNodes, eventMap, commonTriggers, customTrigger, handler) {
|
|
2068
|
+
let triggers = commonTriggers;
|
|
2069
|
+
if (customTrigger != null) triggers = typeof customTrigger === "function" ? customTrigger(triggers) : customTrigger;
|
|
2070
|
+
triggers.forEach((trigger) => {
|
|
2071
|
+
const eventType = eventMap[trigger];
|
|
2072
|
+
if (eventType) this.$_registerEventListeners(targetNodes, eventType, handler);
|
|
2073
|
+
});
|
|
2074
|
+
},
|
|
2075
|
+
$_removeEventListeners(filterEventType) {
|
|
2076
|
+
const newList = [];
|
|
2077
|
+
this.$_events.forEach((listener) => {
|
|
2078
|
+
const { targetNodes, eventType, handler } = listener;
|
|
2079
|
+
if (!filterEventType || filterEventType === eventType) targetNodes.forEach((node) => node.removeEventListener(eventType, handler));
|
|
2080
|
+
else newList.push(listener);
|
|
2081
|
+
});
|
|
2082
|
+
this.$_events = newList;
|
|
2083
|
+
},
|
|
2084
|
+
$_refreshListeners() {
|
|
2085
|
+
if (!this.isDisposed) {
|
|
2086
|
+
this.$_removeEventListeners();
|
|
2087
|
+
this.$_addEventListeners();
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
$_handleGlobalClose(event, touch = false) {
|
|
2091
|
+
if (this.$_showFrameLocked) return;
|
|
2092
|
+
this.hide({ event });
|
|
2093
|
+
if (event.closePopover) this.$emit("close-directive");
|
|
2094
|
+
else this.$emit("auto-hide");
|
|
2095
|
+
if (touch) {
|
|
2096
|
+
this.$_preventShow = true;
|
|
2097
|
+
setTimeout(() => {
|
|
2098
|
+
this.$_preventShow = false;
|
|
2099
|
+
}, 300);
|
|
2100
|
+
}
|
|
2101
|
+
},
|
|
2102
|
+
$_detachPopperNode() {
|
|
2103
|
+
this.$_popperNode.parentNode && this.$_popperNode.parentNode.removeChild(this.$_popperNode);
|
|
2104
|
+
},
|
|
2105
|
+
$_swapTargetAttrs(attrFrom, attrTo) {
|
|
2106
|
+
for (const el of this.$_targetNodes) {
|
|
2107
|
+
const value = el.getAttribute(attrFrom);
|
|
2108
|
+
if (value) {
|
|
2109
|
+
el.removeAttribute(attrFrom);
|
|
2110
|
+
el.setAttribute(attrTo, value);
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
},
|
|
2114
|
+
$_applyAttrsToTarget(attrs) {
|
|
2115
|
+
for (const el of this.$_targetNodes) for (const n in attrs) {
|
|
2116
|
+
const value = attrs[n];
|
|
2117
|
+
if (value == null) el.removeAttribute(n);
|
|
2118
|
+
else el.setAttribute(n, value);
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
$_updateParentShownChildren(value) {
|
|
2122
|
+
let parent = this.parentPopper;
|
|
2123
|
+
while (parent) {
|
|
2124
|
+
if (value) parent.shownChildren.add(this.randomId);
|
|
2125
|
+
else {
|
|
2126
|
+
parent.shownChildren.delete(this.randomId);
|
|
2127
|
+
if (parent.pendingHide) parent.hide();
|
|
2128
|
+
}
|
|
2129
|
+
parent = parent.parentPopper;
|
|
2130
|
+
}
|
|
2131
|
+
},
|
|
2132
|
+
$_isAimingPopper() {
|
|
2133
|
+
const referenceBounds = this.$_referenceNode.getBoundingClientRect();
|
|
2134
|
+
if (mouseX >= referenceBounds.left && mouseX <= referenceBounds.right && mouseY >= referenceBounds.top && mouseY <= referenceBounds.bottom) {
|
|
2135
|
+
const popperBounds = this.$_popperNode.getBoundingClientRect();
|
|
2136
|
+
const vectorX = mouseX - mousePreviousX;
|
|
2137
|
+
const vectorY = mouseY - mousePreviousY;
|
|
2138
|
+
const newVectorLength = popperBounds.left + popperBounds.width / 2 - mousePreviousX + (popperBounds.top + popperBounds.height / 2) - mousePreviousY + popperBounds.width + popperBounds.height;
|
|
2139
|
+
const edgeX = mousePreviousX + vectorX * newVectorLength;
|
|
2140
|
+
const edgeY = mousePreviousY + vectorY * newVectorLength;
|
|
2141
|
+
return lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.top, popperBounds.left, popperBounds.bottom) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.top, popperBounds.right, popperBounds.top) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.right, popperBounds.top, popperBounds.right, popperBounds.bottom) || lineIntersectsLine(mousePreviousX, mousePreviousY, edgeX, edgeY, popperBounds.left, popperBounds.bottom, popperBounds.right, popperBounds.bottom);
|
|
2142
|
+
}
|
|
2143
|
+
return false;
|
|
2144
|
+
}
|
|
2145
|
+
},
|
|
2146
|
+
render() {
|
|
2147
|
+
return this.$slots.default(this.slotData);
|
|
2148
|
+
}
|
|
2149
|
+
});
|
|
2150
|
+
if (typeof document !== "undefined" && typeof window !== "undefined") {
|
|
2151
|
+
if (isIOS) {
|
|
2152
|
+
const options = supportsPassive ? {
|
|
2153
|
+
passive: true,
|
|
2154
|
+
capture: true
|
|
2155
|
+
} : true;
|
|
2156
|
+
document.addEventListener("touchstart", (event) => handleGlobalPointerDown(event, true), options);
|
|
2157
|
+
document.addEventListener("touchend", (event) => handleGlobalPointerUp(event, true), options);
|
|
2158
|
+
} else {
|
|
2159
|
+
window.addEventListener("mousedown", (event) => handleGlobalPointerDown(event, false), true);
|
|
2160
|
+
window.addEventListener("click", (event) => handleGlobalPointerUp(event, false), true);
|
|
2161
|
+
}
|
|
2162
|
+
window.addEventListener("resize", recomputeAllPoppers);
|
|
2163
|
+
}
|
|
2164
|
+
function handleGlobalPointerDown(event, touch) {
|
|
2165
|
+
if (config.autoHideOnMousedown) handleGlobalClose(event, touch);
|
|
2166
|
+
else for (let i = 0; i < shownPoppers.length; i++) {
|
|
2167
|
+
const popper = shownPoppers[i];
|
|
2168
|
+
try {
|
|
2169
|
+
popper.mouseDownContains = popper.popperNode().contains(event.target);
|
|
2170
|
+
} catch (_unused) {}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
function handleGlobalPointerUp(event, touch) {
|
|
2174
|
+
if (!config.autoHideOnMousedown) handleGlobalClose(event, touch);
|
|
2175
|
+
}
|
|
2176
|
+
function handleGlobalClose(event, touch) {
|
|
2177
|
+
const preventClose = {};
|
|
2178
|
+
for (let i = shownPoppers.length - 1; i >= 0; i--) {
|
|
2179
|
+
const popper = shownPoppers[i];
|
|
2180
|
+
try {
|
|
2181
|
+
const childrenContains = Array.from(popper.shownChildren).some((id) => {
|
|
2182
|
+
const child = shownPoppers.find((p) => p.randomId === id);
|
|
2183
|
+
return child && child.popperNode().contains(event.target);
|
|
2184
|
+
});
|
|
2185
|
+
const contains = popper.containsGlobalTarget = popper.mouseDownContains || popper.popperNode().contains(event.target) || childrenContains;
|
|
2186
|
+
popper.pendingHide = false;
|
|
2187
|
+
requestAnimationFrame(() => {
|
|
2188
|
+
popper.pendingHide = false;
|
|
2189
|
+
if (preventClose[popper.randomId]) return;
|
|
2190
|
+
if (shouldAutoHide(popper, contains, event)) {
|
|
2191
|
+
popper.$_handleGlobalClose(event, touch);
|
|
2192
|
+
if (!event.closeAllPopover && event.closePopover && contains) {
|
|
2193
|
+
let parent = popper.parentPopper;
|
|
2194
|
+
while (parent) {
|
|
2195
|
+
preventClose[parent.randomId] = true;
|
|
2196
|
+
parent = parent.parentPopper;
|
|
2197
|
+
}
|
|
2198
|
+
return;
|
|
2199
|
+
}
|
|
2200
|
+
let parent = popper.parentPopper;
|
|
2201
|
+
while (parent) {
|
|
2202
|
+
if (shouldAutoHide(parent, parent.containsGlobalTarget, event)) parent.$_handleGlobalClose(event, touch);
|
|
2203
|
+
else break;
|
|
2204
|
+
parent = parent.parentPopper;
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
});
|
|
2208
|
+
} catch (_unused2) {}
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
function shouldAutoHide(popper, contains, event) {
|
|
2212
|
+
return event.closeAllPopover || event.closePopover && contains || getAutoHideResult(popper, event) && !contains;
|
|
2213
|
+
}
|
|
2214
|
+
function getAutoHideResult(popper, event) {
|
|
2215
|
+
if (typeof popper.autoHide === "function") {
|
|
2216
|
+
const result = popper.autoHide(event);
|
|
2217
|
+
popper.lastAutoHide = result;
|
|
2218
|
+
return result;
|
|
2219
|
+
}
|
|
2220
|
+
return popper.autoHide;
|
|
2221
|
+
}
|
|
2222
|
+
function recomputeAllPoppers() {
|
|
2223
|
+
for (let i = 0; i < shownPoppers.length; i++) shownPoppers[i].$_computePosition();
|
|
2224
|
+
}
|
|
2225
|
+
var mousePreviousX = 0;
|
|
2226
|
+
var mousePreviousY = 0;
|
|
2227
|
+
var mouseX = 0;
|
|
2228
|
+
var mouseY = 0;
|
|
2229
|
+
if (typeof window !== "undefined") window.addEventListener("mousemove", (event) => {
|
|
2230
|
+
mousePreviousX = mouseX;
|
|
2231
|
+
mousePreviousY = mouseY;
|
|
2232
|
+
mouseX = event.clientX;
|
|
2233
|
+
mouseY = event.clientY;
|
|
2234
|
+
}, supportsPassive ? { passive: true } : void 0);
|
|
2235
|
+
function lineIntersectsLine(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
2236
|
+
const uA = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
|
|
2237
|
+
const uB = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1));
|
|
2238
|
+
return uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1;
|
|
2239
|
+
}
|
|
2240
|
+
var PopperRoot = defineComponent({
|
|
2241
|
+
extends: createPopper(),
|
|
2242
|
+
render() {
|
|
2243
|
+
var _this$$slots$default, _this$$slots;
|
|
2244
|
+
return h("div", {
|
|
2245
|
+
ref: "reference",
|
|
2246
|
+
class: ["v-popper", { "v-popper--shown": this.slotData.isShown }]
|
|
2247
|
+
}, (_this$$slots$default = (_this$$slots = this.$slots).default) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots, this.slotData));
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
var ThemeClass = (prop = "theme") => ({ computed: { themeClass() {
|
|
2251
|
+
return getThemeClasses(this[prop]);
|
|
2252
|
+
} } });
|
|
2253
|
+
var PopperContent = defineComponent({
|
|
2254
|
+
name: "VPopperContent",
|
|
2255
|
+
mixins: [ThemeClass()],
|
|
2256
|
+
props: {
|
|
2257
|
+
popperId: String,
|
|
2258
|
+
theme: String,
|
|
2259
|
+
shown: Boolean,
|
|
2260
|
+
mounted: Boolean,
|
|
2261
|
+
skipTransition: Boolean,
|
|
2262
|
+
autoHide: Boolean,
|
|
2263
|
+
handleResize: Boolean,
|
|
2264
|
+
classes: Object,
|
|
2265
|
+
result: Object
|
|
2266
|
+
},
|
|
2267
|
+
emits: ["hide", "resize"],
|
|
2268
|
+
mounted() {
|
|
2269
|
+
if (this.handleResize) {
|
|
2270
|
+
this.$_resizeObserver = new ResizeObserver(() => this.$emit("resize"));
|
|
2271
|
+
this.$_resizeObserver.observe(this.$refs.inner);
|
|
2272
|
+
}
|
|
2273
|
+
},
|
|
2274
|
+
beforeUnmount() {
|
|
2275
|
+
var _this$$_resizeObserve;
|
|
2276
|
+
(_this$$_resizeObserve = this.$_resizeObserver) === null || _this$$_resizeObserve === void 0 || _this$$_resizeObserve.disconnect();
|
|
2277
|
+
},
|
|
2278
|
+
methods: { toPx(value) {
|
|
2279
|
+
if (value != null && !Number.isNaN(value)) return `${value}px`;
|
|
2280
|
+
return null;
|
|
2281
|
+
} },
|
|
2282
|
+
render() {
|
|
2283
|
+
var _this$$slots$default, _this$$slots;
|
|
2284
|
+
const { autoHide, classes, result, shown } = this;
|
|
2285
|
+
return h("div", {
|
|
2286
|
+
id: this.popperId,
|
|
2287
|
+
ref: "popover",
|
|
2288
|
+
"data-allow-mismatch": "",
|
|
2289
|
+
class: [
|
|
2290
|
+
"v-popper__popper",
|
|
2291
|
+
this.themeClass,
|
|
2292
|
+
classes.popperClass,
|
|
2293
|
+
{
|
|
2294
|
+
"v-popper__popper--shown": shown,
|
|
2295
|
+
"v-popper__popper--hidden": !shown,
|
|
2296
|
+
"v-popper__popper--show-from": classes.showFrom,
|
|
2297
|
+
"v-popper__popper--show-to": classes.showTo,
|
|
2298
|
+
"v-popper__popper--hide-from": classes.hideFrom,
|
|
2299
|
+
"v-popper__popper--hide-to": classes.hideTo,
|
|
2300
|
+
"v-popper__popper--skip-transition": this.skipTransition,
|
|
2301
|
+
"v-popper__popper--arrow-overflow": result && result.arrow.overflow,
|
|
2302
|
+
"v-popper__popper--no-positioning": !result
|
|
2303
|
+
}
|
|
2304
|
+
],
|
|
2305
|
+
style: result ? {
|
|
2306
|
+
position: result.strategy,
|
|
2307
|
+
transform: `translate3d(${Math.round(result.x)}px,${Math.round(result.y)}px,0)`
|
|
2308
|
+
} : void 0,
|
|
2309
|
+
"aria-hidden": shown || autoHide ? "false" : "true",
|
|
2310
|
+
tabindex: autoHide ? 0 : void 0,
|
|
2311
|
+
"data-popper-placement": result ? result.placement : void 0,
|
|
2312
|
+
onKeyup: (event) => {
|
|
2313
|
+
if (event.key === "Escape" && autoHide) this.$emit("hide");
|
|
2314
|
+
}
|
|
2315
|
+
}, [h("div", {
|
|
2316
|
+
class: "v-popper__backdrop",
|
|
2317
|
+
onClick: () => autoHide && this.$emit("hide")
|
|
2318
|
+
}), h("div", {
|
|
2319
|
+
class: "v-popper__wrapper",
|
|
2320
|
+
style: result ? { transformOrigin: result.transformOrigin } : void 0
|
|
2321
|
+
}, [h("div", {
|
|
2322
|
+
ref: "inner",
|
|
2323
|
+
class: "v-popper__inner"
|
|
2324
|
+
}, this.mounted ? [h("div", (_this$$slots$default = (_this$$slots = this.$slots).default) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots))] : void 0), h("div", {
|
|
2325
|
+
ref: "arrow",
|
|
2326
|
+
class: "v-popper__arrow-container",
|
|
2327
|
+
style: result ? {
|
|
2328
|
+
left: this.toPx(result.arrow.x),
|
|
2329
|
+
top: this.toPx(result.arrow.y)
|
|
2330
|
+
} : void 0
|
|
2331
|
+
}, [h("div", { class: "v-popper__arrow-outer" }), h("div", { class: "v-popper__arrow-inner" })])])]);
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
var PopperMethods = { methods: {
|
|
2335
|
+
show(...args) {
|
|
2336
|
+
return this.$refs.popper.show(...args);
|
|
2337
|
+
},
|
|
2338
|
+
hide(...args) {
|
|
2339
|
+
return this.$refs.popper.hide(...args);
|
|
2340
|
+
},
|
|
2341
|
+
dispose(...args) {
|
|
2342
|
+
return this.$refs.popper.dispose(...args);
|
|
2343
|
+
},
|
|
2344
|
+
onResize(...args) {
|
|
2345
|
+
return this.$refs.popper.onResize(...args);
|
|
2346
|
+
}
|
|
2347
|
+
} };
|
|
2348
|
+
var Element$2 = function() {};
|
|
2349
|
+
if (typeof window !== "undefined") Element$2 = window.Element;
|
|
2350
|
+
var PopperWrapper = defineComponent({
|
|
2351
|
+
name: "VPopperWrapper",
|
|
2352
|
+
mixins: [PopperMethods, ThemeClass("finalTheme")],
|
|
2353
|
+
props: {
|
|
2354
|
+
theme: {
|
|
2355
|
+
type: String,
|
|
2356
|
+
default: null
|
|
2357
|
+
},
|
|
2358
|
+
referenceNode: {
|
|
2359
|
+
type: Function,
|
|
2360
|
+
default: null
|
|
2361
|
+
},
|
|
2362
|
+
shown: {
|
|
2363
|
+
type: Boolean,
|
|
2364
|
+
default: false
|
|
2365
|
+
},
|
|
2366
|
+
showGroup: {
|
|
2367
|
+
type: String,
|
|
2368
|
+
default: null
|
|
2369
|
+
},
|
|
2370
|
+
ariaId: { default: null },
|
|
2371
|
+
disabled: {
|
|
2372
|
+
type: Boolean,
|
|
2373
|
+
default: void 0
|
|
2374
|
+
},
|
|
2375
|
+
positioningDisabled: {
|
|
2376
|
+
type: Boolean,
|
|
2377
|
+
default: void 0
|
|
2378
|
+
},
|
|
2379
|
+
placement: {
|
|
2380
|
+
type: String,
|
|
2381
|
+
default: void 0
|
|
2382
|
+
},
|
|
2383
|
+
delay: {
|
|
2384
|
+
type: [
|
|
2385
|
+
String,
|
|
2386
|
+
Number,
|
|
2387
|
+
Object
|
|
2388
|
+
],
|
|
2389
|
+
default: void 0
|
|
2390
|
+
},
|
|
2391
|
+
distance: {
|
|
2392
|
+
type: [Number, String],
|
|
2393
|
+
default: void 0
|
|
2394
|
+
},
|
|
2395
|
+
skidding: {
|
|
2396
|
+
type: [Number, String],
|
|
2397
|
+
default: void 0
|
|
2398
|
+
},
|
|
2399
|
+
triggers: {
|
|
2400
|
+
type: Array,
|
|
2401
|
+
default: void 0
|
|
2402
|
+
},
|
|
2403
|
+
showTriggers: {
|
|
2404
|
+
type: [Array, Function],
|
|
2405
|
+
default: void 0
|
|
2406
|
+
},
|
|
2407
|
+
hideTriggers: {
|
|
2408
|
+
type: [Array, Function],
|
|
2409
|
+
default: void 0
|
|
2410
|
+
},
|
|
2411
|
+
popperTriggers: {
|
|
2412
|
+
type: Array,
|
|
2413
|
+
default: void 0
|
|
2414
|
+
},
|
|
2415
|
+
popperShowTriggers: {
|
|
2416
|
+
type: [Array, Function],
|
|
2417
|
+
default: void 0
|
|
2418
|
+
},
|
|
2419
|
+
popperHideTriggers: {
|
|
2420
|
+
type: [Array, Function],
|
|
2421
|
+
default: void 0
|
|
2422
|
+
},
|
|
2423
|
+
container: {
|
|
2424
|
+
type: [
|
|
2425
|
+
String,
|
|
2426
|
+
Object,
|
|
2427
|
+
Element$2,
|
|
2428
|
+
Boolean
|
|
2429
|
+
],
|
|
2430
|
+
default: void 0
|
|
2431
|
+
},
|
|
2432
|
+
boundary: {
|
|
2433
|
+
type: [String, Element$2],
|
|
2434
|
+
default: void 0
|
|
2435
|
+
},
|
|
2436
|
+
strategy: {
|
|
2437
|
+
type: String,
|
|
2438
|
+
default: void 0
|
|
2439
|
+
},
|
|
2440
|
+
autoHide: {
|
|
2441
|
+
type: [Boolean, Function],
|
|
2442
|
+
default: void 0
|
|
2443
|
+
},
|
|
2444
|
+
handleResize: {
|
|
2445
|
+
type: Boolean,
|
|
2446
|
+
default: void 0
|
|
2447
|
+
},
|
|
2448
|
+
instantMove: {
|
|
2449
|
+
type: Boolean,
|
|
2450
|
+
default: void 0
|
|
2451
|
+
},
|
|
2452
|
+
eagerMount: {
|
|
2453
|
+
type: Boolean,
|
|
2454
|
+
default: void 0
|
|
2455
|
+
},
|
|
2456
|
+
popperClass: {
|
|
2457
|
+
type: [
|
|
2458
|
+
String,
|
|
2459
|
+
Array,
|
|
2460
|
+
Object
|
|
2461
|
+
],
|
|
2462
|
+
default: void 0
|
|
2463
|
+
},
|
|
2464
|
+
computeTransformOrigin: {
|
|
2465
|
+
type: Boolean,
|
|
2466
|
+
default: void 0
|
|
2467
|
+
},
|
|
2468
|
+
/**
|
|
2469
|
+
* @deprecated
|
|
2470
|
+
*/
|
|
2471
|
+
autoMinSize: {
|
|
2472
|
+
type: Boolean,
|
|
2473
|
+
default: void 0
|
|
2474
|
+
},
|
|
2475
|
+
autoSize: {
|
|
2476
|
+
type: [Boolean, String],
|
|
2477
|
+
default: void 0
|
|
2478
|
+
},
|
|
2479
|
+
/**
|
|
2480
|
+
* @deprecated
|
|
2481
|
+
*/
|
|
2482
|
+
autoMaxSize: {
|
|
2483
|
+
type: Boolean,
|
|
2484
|
+
default: void 0
|
|
2485
|
+
},
|
|
2486
|
+
autoBoundaryMaxSize: {
|
|
2487
|
+
type: Boolean,
|
|
2488
|
+
default: void 0
|
|
2489
|
+
},
|
|
2490
|
+
preventOverflow: {
|
|
2491
|
+
type: Boolean,
|
|
2492
|
+
default: void 0
|
|
2493
|
+
},
|
|
2494
|
+
overflowPadding: {
|
|
2495
|
+
type: [Number, String],
|
|
2496
|
+
default: void 0
|
|
2497
|
+
},
|
|
2498
|
+
arrowPadding: {
|
|
2499
|
+
type: [Number, String],
|
|
2500
|
+
default: void 0
|
|
2501
|
+
},
|
|
2502
|
+
arrowOverflow: {
|
|
2503
|
+
type: Boolean,
|
|
2504
|
+
default: void 0
|
|
2505
|
+
},
|
|
2506
|
+
flip: {
|
|
2507
|
+
type: Boolean,
|
|
2508
|
+
default: void 0
|
|
2509
|
+
},
|
|
2510
|
+
shift: {
|
|
2511
|
+
type: Boolean,
|
|
2512
|
+
default: void 0
|
|
2513
|
+
},
|
|
2514
|
+
shiftCrossAxis: {
|
|
2515
|
+
type: Boolean,
|
|
2516
|
+
default: void 0
|
|
2517
|
+
},
|
|
2518
|
+
noAutoFocus: {
|
|
2519
|
+
type: Boolean,
|
|
2520
|
+
default: void 0
|
|
2521
|
+
},
|
|
2522
|
+
disposeTimeout: {
|
|
2523
|
+
type: Number,
|
|
2524
|
+
default: void 0
|
|
2525
|
+
}
|
|
2526
|
+
},
|
|
2527
|
+
emits: {
|
|
2528
|
+
show: () => true,
|
|
2529
|
+
hide: () => true,
|
|
2530
|
+
"update:shown": (_shown) => true,
|
|
2531
|
+
"apply-show": () => true,
|
|
2532
|
+
"apply-hide": () => true,
|
|
2533
|
+
"close-group": () => true,
|
|
2534
|
+
"close-directive": () => true,
|
|
2535
|
+
"auto-hide": () => true,
|
|
2536
|
+
resize: () => true
|
|
2537
|
+
},
|
|
2538
|
+
computed: { finalTheme() {
|
|
2539
|
+
var _this$theme;
|
|
2540
|
+
return (_this$theme = this.theme) !== null && _this$theme !== void 0 ? _this$theme : this.$options.vPopperTheme;
|
|
2541
|
+
} },
|
|
2542
|
+
methods: { getTargetNodes() {
|
|
2543
|
+
return Array.from(this.$el.children).filter((node) => node !== this.$refs.popperContent.$el);
|
|
2544
|
+
} },
|
|
2545
|
+
render() {
|
|
2546
|
+
return h(PopperRoot, {
|
|
2547
|
+
ref: "popper",
|
|
2548
|
+
...this.$props,
|
|
2549
|
+
theme: this.finalTheme,
|
|
2550
|
+
targetNodes: this.getTargetNodes,
|
|
2551
|
+
popperNode: () => this.$refs.popperContent.$el,
|
|
2552
|
+
class: [this.themeClass],
|
|
2553
|
+
onShow: () => this.$emit("show"),
|
|
2554
|
+
onHide: () => this.$emit("hide"),
|
|
2555
|
+
"onUpdate:shown": (shown) => this.$emit("update:shown", shown),
|
|
2556
|
+
onApplyShow: () => this.$emit("apply-show"),
|
|
2557
|
+
onApplyHide: () => this.$emit("apply-hide"),
|
|
2558
|
+
onCloseGroup: () => this.$emit("close-group"),
|
|
2559
|
+
onCloseDirective: () => this.$emit("close-directive"),
|
|
2560
|
+
onAutoHide: () => this.$emit("auto-hide"),
|
|
2561
|
+
onResize: () => this.$emit("resize")
|
|
2562
|
+
}, { default: ({ popperId, isShown, shouldMountContent, skipTransition, autoHide, show, hide, handleResize, onResize, classes, result }) => {
|
|
2563
|
+
var _this$$slots$default, _this$$slots;
|
|
2564
|
+
return [(_this$$slots$default = (_this$$slots = this.$slots).default) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots, {
|
|
2565
|
+
shown: isShown,
|
|
2566
|
+
show,
|
|
2567
|
+
hide
|
|
2568
|
+
}), h(PopperContent, {
|
|
2569
|
+
ref: "popperContent",
|
|
2570
|
+
popperId,
|
|
2571
|
+
theme: this.finalTheme,
|
|
2572
|
+
shown: isShown,
|
|
2573
|
+
mounted: shouldMountContent,
|
|
2574
|
+
skipTransition,
|
|
2575
|
+
autoHide,
|
|
2576
|
+
handleResize,
|
|
2577
|
+
classes,
|
|
2578
|
+
result,
|
|
2579
|
+
onHide: hide,
|
|
2580
|
+
onResize
|
|
2581
|
+
}, { default: () => {
|
|
2582
|
+
var _this$$slots$popper, _this$$slots2;
|
|
2583
|
+
return (_this$$slots$popper = (_this$$slots2 = this.$slots).popper) === null || _this$$slots$popper === void 0 ? void 0 : _this$$slots$popper.call(_this$$slots2, {
|
|
2584
|
+
shown: isShown,
|
|
2585
|
+
hide
|
|
2586
|
+
});
|
|
2587
|
+
} })];
|
|
2588
|
+
} });
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2591
|
+
/**
|
|
2592
|
+
* A `PopperWrapper` variant with its own name and default theme — same recipe
|
|
2593
|
+
* as the themed-component guide in the docs.
|
|
2594
|
+
*/
|
|
2595
|
+
function createThemedPopperWrapper(name, vPopperTheme) {
|
|
2596
|
+
return {
|
|
2597
|
+
...PopperWrapper,
|
|
2598
|
+
name,
|
|
2599
|
+
vPopperTheme
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
createThemedPopperWrapper("VDropdown", "dropdown");
|
|
2603
|
+
createThemedPopperWrapper("VMenu", "menu");
|
|
2604
|
+
createThemedPopperWrapper("VTooltip", "tooltip");
|
|
2605
|
+
var Popper = createPopper();
|
|
2606
|
+
defineComponent({
|
|
2607
|
+
name: "VTooltipDirective",
|
|
2608
|
+
mixins: [PopperMethods],
|
|
2609
|
+
inheritAttrs: false,
|
|
2610
|
+
props: {
|
|
2611
|
+
theme: {
|
|
2612
|
+
type: String,
|
|
2613
|
+
default: "tooltip"
|
|
2614
|
+
},
|
|
2615
|
+
html: {
|
|
2616
|
+
type: Boolean,
|
|
2617
|
+
default: (props) => getDefaultConfig(props.theme, "html")
|
|
2618
|
+
},
|
|
2619
|
+
content: {
|
|
2620
|
+
type: [
|
|
2621
|
+
String,
|
|
2622
|
+
Number,
|
|
2623
|
+
Function
|
|
2624
|
+
],
|
|
2625
|
+
default: null
|
|
2626
|
+
},
|
|
2627
|
+
loadingContent: {
|
|
2628
|
+
type: String,
|
|
2629
|
+
default: (props) => getDefaultConfig(props.theme, "loadingContent")
|
|
2630
|
+
},
|
|
2631
|
+
targetNodes: {
|
|
2632
|
+
type: Function,
|
|
2633
|
+
required: true
|
|
2634
|
+
}
|
|
2635
|
+
},
|
|
2636
|
+
data() {
|
|
2637
|
+
return { asyncContent: null };
|
|
2638
|
+
},
|
|
2639
|
+
computed: {
|
|
2640
|
+
isContentAsync() {
|
|
2641
|
+
return typeof this.content === "function";
|
|
2642
|
+
},
|
|
2643
|
+
loading() {
|
|
2644
|
+
return this.isContentAsync && this.asyncContent == null;
|
|
2645
|
+
},
|
|
2646
|
+
finalContent() {
|
|
2647
|
+
if (this.isContentAsync) return this.loading ? this.loadingContent : this.asyncContent;
|
|
2648
|
+
return this.content;
|
|
2649
|
+
}
|
|
2650
|
+
},
|
|
2651
|
+
watch: {
|
|
2652
|
+
content: {
|
|
2653
|
+
handler() {
|
|
2654
|
+
this.fetchContent(true);
|
|
2655
|
+
},
|
|
2656
|
+
immediate: true
|
|
2657
|
+
},
|
|
2658
|
+
async finalContent() {
|
|
2659
|
+
await this.$nextTick();
|
|
2660
|
+
this.$refs.popper.onResize();
|
|
2661
|
+
}
|
|
2662
|
+
},
|
|
2663
|
+
created() {
|
|
2664
|
+
this.$_fetchId = 0;
|
|
2665
|
+
},
|
|
2666
|
+
methods: {
|
|
2667
|
+
fetchContent(force) {
|
|
2668
|
+
if (typeof this.content === "function" && this.$_isShown && (force || !this.$_loading && this.asyncContent == null)) {
|
|
2669
|
+
this.asyncContent = null;
|
|
2670
|
+
this.$_loading = true;
|
|
2671
|
+
const fetchId = ++this.$_fetchId;
|
|
2672
|
+
const result = this.content(this);
|
|
2673
|
+
if (result.then) result.then((res) => this.onResult(fetchId, res));
|
|
2674
|
+
else this.onResult(fetchId, result);
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
onResult(fetchId, result) {
|
|
2678
|
+
if (fetchId !== this.$_fetchId) return;
|
|
2679
|
+
this.$_loading = false;
|
|
2680
|
+
this.asyncContent = result;
|
|
2681
|
+
},
|
|
2682
|
+
onShow() {
|
|
2683
|
+
this.$_isShown = true;
|
|
2684
|
+
this.fetchContent();
|
|
2685
|
+
},
|
|
2686
|
+
onHide() {
|
|
2687
|
+
this.$_isShown = false;
|
|
2688
|
+
}
|
|
2689
|
+
},
|
|
2690
|
+
render() {
|
|
2691
|
+
return h(Popper, {
|
|
2692
|
+
ref: "popper",
|
|
2693
|
+
...this.$attrs,
|
|
2694
|
+
theme: this.theme,
|
|
2695
|
+
targetNodes: this.targetNodes,
|
|
2696
|
+
popperNode: () => this.$refs.popperContent.$el,
|
|
2697
|
+
onApplyShow: this.onShow,
|
|
2698
|
+
onApplyHide: this.onHide
|
|
2699
|
+
}, { default: ({ popperId, isShown, shouldMountContent, skipTransition, autoHide, hide, handleResize, onResize, classes, result }) => h(PopperContent, {
|
|
2700
|
+
ref: "popperContent",
|
|
2701
|
+
class: { "v-popper--tooltip-loading": this.loading },
|
|
2702
|
+
popperId,
|
|
2703
|
+
theme: this.theme,
|
|
2704
|
+
shown: isShown,
|
|
2705
|
+
mounted: shouldMountContent,
|
|
2706
|
+
skipTransition,
|
|
2707
|
+
autoHide,
|
|
2708
|
+
handleResize,
|
|
2709
|
+
classes,
|
|
2710
|
+
result,
|
|
2711
|
+
onHide: hide,
|
|
2712
|
+
onResize
|
|
2713
|
+
}, { default: () => this.html ? h("div", { innerHTML: this.finalContent }) : h("div", { textContent: this.finalContent }) }) });
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2716
|
+
// ../ui/src/utils/popper-themes.ts
|
|
2717
|
+
/** 各宿主可同时加载旧组件库,eform 只注册自己的弹层主题。 */
|
|
2718
|
+
Object.assign(config.themes, {
|
|
2719
|
+
"eform-tooltip": {
|
|
2720
|
+
$extend: "tooltip",
|
|
2721
|
+
$resetCss: true
|
|
2722
|
+
},
|
|
2723
|
+
"eform-tooltip-dark": {
|
|
2724
|
+
$extend: "tooltip",
|
|
2725
|
+
$resetCss: true
|
|
2726
|
+
},
|
|
2727
|
+
"eform-dropdown": {
|
|
2728
|
+
$extend: "dropdown",
|
|
2729
|
+
$resetCss: true
|
|
2730
|
+
},
|
|
2731
|
+
"eform-popconfirm": {
|
|
2732
|
+
$extend: "dropdown",
|
|
2733
|
+
$resetCss: true
|
|
2734
|
+
}
|
|
2735
|
+
});
|
|
2736
|
+
// ../ui/src/tooltip/src/tooltip.vue
|
|
2737
|
+
var tooltip_default = {
|
|
2738
|
+
...PopperWrapper,
|
|
2739
|
+
name: "GctTooltip",
|
|
2740
|
+
vPopperTheme: "eform-tooltip"
|
|
2741
|
+
};
|
|
2742
|
+
// ../ui/src/modal/src/ConfirmTip.vue?vue&type=script&setup=true&lang.ts
|
|
2743
|
+
var _hoisted_1$3 = { class: "modal-confirm-tip" };
|
|
2744
|
+
var _hoisted_2$2 = { class: "tip-icon" };
|
|
2745
|
+
var _hoisted_3$1 = { class: "tip-content" };
|
|
2746
|
+
// ../ui/src/modal/src/ConfirmTip.vue
|
|
2747
|
+
var ConfirmTip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2748
|
+
__name: "ConfirmTip",
|
|
2749
|
+
props: { tip: {} },
|
|
2750
|
+
setup(__props) {
|
|
2751
|
+
return (_ctx, _cache) => {
|
|
2752
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [createElementVNode("div", _hoisted_2$2, [createVNode(unref(icon_default), {
|
|
2753
|
+
icon: "icon-jinggao",
|
|
2754
|
+
color: "#FF8C4B",
|
|
2755
|
+
size: "18"
|
|
2756
|
+
})]), createElementVNode("div", _hoisted_3$1, toDisplayString(__props.tip), 1)]);
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2759
|
+
}), [["__scopeId", "data-v-16d6437a"]]);
|
|
2760
|
+
// ../ui/src/modal/src/DialogActionIcon.vue?vue&type=script&setup=true&lang.ts
|
|
2761
|
+
var _hoisted_1$2 = {
|
|
2762
|
+
width: "16",
|
|
2763
|
+
height: "16",
|
|
2764
|
+
viewBox: "64 64 896 896",
|
|
2765
|
+
fill: "currentColor",
|
|
2766
|
+
"aria-hidden": "true"
|
|
2767
|
+
};
|
|
2768
|
+
var _hoisted_2$1 = ["d"];
|
|
2769
|
+
// ../ui/src/modal/src/DialogActionIcon.vue
|
|
2770
|
+
var DialogActionIcon_default = /* @__PURE__ */ defineComponent({
|
|
2771
|
+
__name: "DialogActionIcon",
|
|
2772
|
+
props: { name: {} },
|
|
2773
|
+
setup(__props) {
|
|
2774
|
+
const paths = {
|
|
2775
|
+
minimize: "M160 472h704v80H160z",
|
|
2776
|
+
close: "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z",
|
|
2777
|
+
fullscreen: "M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z",
|
|
2778
|
+
"fullscreen-exit": "M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 000 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 00391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 00-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"
|
|
2779
|
+
};
|
|
2780
|
+
return (_ctx, _cache) => {
|
|
2781
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$2, [createElementVNode("path", { d: paths[__props.name] }, null, 8, _hoisted_2$1)]);
|
|
2782
|
+
};
|
|
2783
|
+
}
|
|
2784
|
+
});
|
|
2785
|
+
// ../ui/src/modal/src/DialogActionButton.vue?vue&type=script&setup=true&lang.ts
|
|
2786
|
+
var _hoisted_1$1 = ["aria-label", "disabled"];
|
|
2787
|
+
// ../ui/src/modal/src/DialogActionButton.vue
|
|
2788
|
+
var DialogActionButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2789
|
+
inheritAttrs: false,
|
|
2790
|
+
__name: "DialogActionButton",
|
|
2791
|
+
props: {
|
|
2792
|
+
label: {},
|
|
2793
|
+
icon: {},
|
|
2794
|
+
tooltip: {},
|
|
2795
|
+
disabled: { type: Boolean }
|
|
2796
|
+
},
|
|
2797
|
+
emits: [
|
|
2798
|
+
"click",
|
|
2799
|
+
"pointerdown",
|
|
2800
|
+
"keydown"
|
|
2801
|
+
],
|
|
2802
|
+
setup(__props, { emit: __emit }) {
|
|
2803
|
+
const emit = __emit;
|
|
2804
|
+
return (_ctx, _cache) => {
|
|
2805
|
+
return openBlock(), createBlock(unref(tooltip_default), {
|
|
2806
|
+
theme: "eform-tooltip-dark",
|
|
2807
|
+
placement: "top",
|
|
2808
|
+
distance: 6,
|
|
2809
|
+
disabled: __props.disabled,
|
|
2810
|
+
triggers: ["hover"],
|
|
2811
|
+
"no-auto-focus": ""
|
|
2812
|
+
}, {
|
|
2813
|
+
popper: withCtx(() => [createTextVNode(toDisplayString(__props.tooltip ?? __props.label), 1)]),
|
|
2814
|
+
default: withCtx(() => [createElementVNode("button", mergeProps({
|
|
2815
|
+
type: "button",
|
|
2816
|
+
class: ["gct-dialog-action", { "is-close": __props.icon === "close" }]
|
|
2817
|
+
}, _ctx.$attrs, {
|
|
2818
|
+
"aria-label": __props.label,
|
|
2819
|
+
disabled: __props.disabled,
|
|
2820
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event)),
|
|
2821
|
+
onPointerdown: _cache[1] || (_cache[1] = ($event) => emit("pointerdown", $event)),
|
|
2822
|
+
onKeydown: _cache[2] || (_cache[2] = ($event) => emit("keydown", $event))
|
|
2823
|
+
}), [__props.icon ? (openBlock(), createBlock(DialogActionIcon_default, {
|
|
2824
|
+
key: 0,
|
|
2825
|
+
name: __props.icon
|
|
2826
|
+
}, null, 8, ["name"])) : renderSlot(_ctx.$slots, "default", {}, void 0, true, 1)], 16, _hoisted_1$1)]),
|
|
2827
|
+
_: 3
|
|
2828
|
+
}, 8, ["disabled"]);
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
}), [["__scopeId", "data-v-8fea9fa1"]]);
|
|
2832
|
+
// ../ui/src/modal/src/ModalRoot.vue?vue&type=script&setup=true&lang.ts
|
|
2833
|
+
var _hoisted_1 = [
|
|
2834
|
+
"role",
|
|
2835
|
+
"aria-label",
|
|
2836
|
+
"aria-modal"
|
|
2837
|
+
];
|
|
2838
|
+
var _hoisted_2 = {
|
|
2839
|
+
key: 0,
|
|
2840
|
+
class: "header-title-wrap"
|
|
2841
|
+
};
|
|
2842
|
+
var _hoisted_3 = { class: "header-title" };
|
|
2843
|
+
var _hoisted_4 = {
|
|
2844
|
+
key: 1,
|
|
2845
|
+
class: "header-title"
|
|
2846
|
+
};
|
|
2847
|
+
// ../ui/src/modal/src/ModalRoot.vue
|
|
2848
|
+
var ModalRoot_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2849
|
+
__name: "ModalRoot",
|
|
2850
|
+
props: {
|
|
2851
|
+
__onRegisterIns: {},
|
|
2852
|
+
__onDestroyed: {},
|
|
2853
|
+
title: { default: "提示" },
|
|
2854
|
+
body: { default: null },
|
|
2855
|
+
bodyProps: {},
|
|
2856
|
+
bodyPadding: {},
|
|
2857
|
+
width: { default: 640 },
|
|
2858
|
+
height: {},
|
|
2859
|
+
maxHeight: {},
|
|
2860
|
+
zIndex: { default: 1999 },
|
|
2861
|
+
className: { default: "" },
|
|
2862
|
+
fullscreen: {
|
|
2863
|
+
type: Boolean,
|
|
2864
|
+
default: true
|
|
2865
|
+
},
|
|
2866
|
+
minimizable: { type: Boolean },
|
|
2867
|
+
closable: {
|
|
2868
|
+
type: Boolean,
|
|
2869
|
+
default: true
|
|
2870
|
+
},
|
|
2871
|
+
closeOnEsc: {
|
|
2872
|
+
type: Boolean,
|
|
2873
|
+
default: true
|
|
2874
|
+
},
|
|
2875
|
+
closeOnMaskClick: {
|
|
2876
|
+
type: Boolean,
|
|
2877
|
+
default: true
|
|
2878
|
+
},
|
|
2879
|
+
showHeader: {
|
|
2880
|
+
type: Boolean,
|
|
2881
|
+
default: true
|
|
2882
|
+
},
|
|
2883
|
+
showFooter: {
|
|
2884
|
+
type: Boolean,
|
|
2885
|
+
default: true
|
|
2886
|
+
},
|
|
2887
|
+
showCancel: {
|
|
2888
|
+
type: Boolean,
|
|
2889
|
+
default: true
|
|
2890
|
+
},
|
|
2891
|
+
showConfirmContinue: {
|
|
2892
|
+
type: Boolean,
|
|
2893
|
+
default: false
|
|
2894
|
+
},
|
|
2895
|
+
plainFooter: {
|
|
2896
|
+
type: Boolean,
|
|
2897
|
+
default: false
|
|
2898
|
+
},
|
|
2899
|
+
confirmText: { default: "确认" },
|
|
2900
|
+
confirmContinueText: { default: "确认并继续" },
|
|
2901
|
+
cancelText: { default: "取消" },
|
|
2902
|
+
draggable: {
|
|
2903
|
+
type: Boolean,
|
|
2904
|
+
default: false
|
|
2905
|
+
},
|
|
2906
|
+
showMask: {
|
|
2907
|
+
type: Boolean,
|
|
2908
|
+
default: void 0
|
|
2909
|
+
},
|
|
2910
|
+
readonly: {
|
|
2911
|
+
type: Boolean,
|
|
2912
|
+
default: false
|
|
2913
|
+
},
|
|
2914
|
+
onConfirm: {},
|
|
2915
|
+
onConfirmContinue: {},
|
|
2916
|
+
onCancel: {},
|
|
2917
|
+
onClose: {}
|
|
2918
|
+
},
|
|
2919
|
+
setup(__props) {
|
|
2920
|
+
const props = __props;
|
|
2921
|
+
const visible = ref(false);
|
|
2922
|
+
const loading = ref(false);
|
|
2923
|
+
const continueLoading = ref(false);
|
|
2924
|
+
const bodyRef = ref(null);
|
|
2925
|
+
const panel = ref();
|
|
2926
|
+
const maximized = ref(false);
|
|
2927
|
+
const minimized = ref(false);
|
|
2928
|
+
const fullscreenLabel = computed(() => maximized.value ? "还原" : "最大化");
|
|
2929
|
+
const minimizeLabel = computed(() => minimized.value ? "还原完整面板" : "缩小为悬浮窗");
|
|
2930
|
+
const positions = reactive({});
|
|
2931
|
+
const positionKey = computed(() => minimized.value ? "compact" : "expanded");
|
|
2932
|
+
let drag;
|
|
2933
|
+
let resizeObserver;
|
|
2934
|
+
let contextConfirmFn = null;
|
|
2935
|
+
const mergedBodyProps = computed(() => ({
|
|
2936
|
+
...props.bodyProps || {},
|
|
2937
|
+
readonly: props.readonly || props.bodyProps?.readonly
|
|
2938
|
+
}));
|
|
2939
|
+
const showMaskLayer = computed(() => {
|
|
2940
|
+
return !minimized.value && (props.showMask ?? !props.draggable);
|
|
2941
|
+
});
|
|
2942
|
+
const wrapperStyle = computed(() => ({ zIndex: props.zIndex + 1 }));
|
|
2943
|
+
const modalStyle = computed(() => {
|
|
2944
|
+
if (maximized.value) return {
|
|
2945
|
+
width: "100vw",
|
|
2946
|
+
height: "100dvh",
|
|
2947
|
+
maxWidth: "none",
|
|
2948
|
+
maxHeight: "none",
|
|
2949
|
+
borderRadius: 0
|
|
2950
|
+
};
|
|
2951
|
+
const maxHeight = typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "80vh";
|
|
2952
|
+
const base = {
|
|
2953
|
+
width: minimized.value ? "350px" : `${props.width}px`,
|
|
2954
|
+
maxHeight: minimized.value ? "min(308px, calc(100dvh - 32px))" : maxHeight
|
|
2955
|
+
};
|
|
2956
|
+
const position = positions[positionKey.value];
|
|
2957
|
+
if (position) return {
|
|
2958
|
+
...base,
|
|
2959
|
+
position: "absolute",
|
|
2960
|
+
left: `${position.x}px`,
|
|
2961
|
+
top: `${position.y}px`
|
|
2962
|
+
};
|
|
2963
|
+
if (minimized.value) return {
|
|
2964
|
+
...base,
|
|
2965
|
+
position: "absolute",
|
|
2966
|
+
right: "16px",
|
|
2967
|
+
bottom: "16px"
|
|
2968
|
+
};
|
|
2969
|
+
return base;
|
|
2970
|
+
});
|
|
2971
|
+
const close = () => {
|
|
2972
|
+
if (!visible.value) return;
|
|
2973
|
+
visible.value = false;
|
|
2974
|
+
props.__onDestroyed();
|
|
2975
|
+
props.onClose?.();
|
|
2976
|
+
};
|
|
2977
|
+
function restore() {
|
|
2978
|
+
if (!visible.value) return;
|
|
2979
|
+
minimized.value = false;
|
|
2980
|
+
maximized.value = false;
|
|
2981
|
+
nextTick(() => panel.value?.focus({ preventScroll: true }));
|
|
2982
|
+
}
|
|
2983
|
+
function toggleMinimized() {
|
|
2984
|
+
minimized.value = !minimized.value;
|
|
2985
|
+
maximized.value = false;
|
|
2986
|
+
nextTick(keepPanelInViewport);
|
|
2987
|
+
}
|
|
2988
|
+
const setLoading = (v) => {
|
|
2989
|
+
loading.value = v;
|
|
2990
|
+
};
|
|
2991
|
+
const setOnConfirm = (fn) => {
|
|
2992
|
+
contextConfirmFn = fn;
|
|
2993
|
+
};
|
|
2994
|
+
const modalInstance = {
|
|
2995
|
+
bodyRef,
|
|
2996
|
+
close,
|
|
2997
|
+
restore,
|
|
2998
|
+
setLoading
|
|
2999
|
+
};
|
|
3000
|
+
const modalContext = {
|
|
3001
|
+
...modalInstance,
|
|
3002
|
+
setOnConfirm
|
|
3003
|
+
};
|
|
3004
|
+
const bodyStyle = computed(() => ({
|
|
3005
|
+
height: props.height && !maximized.value ? `${props.height}px` : void 0,
|
|
3006
|
+
padding: props.bodyPadding === void 0 ? void 0 : `${props.bodyPadding}px`
|
|
3007
|
+
}));
|
|
3008
|
+
function placePanel(position) {
|
|
3009
|
+
const element = panel.value;
|
|
3010
|
+
if (!element || maximized.value) return;
|
|
3011
|
+
const margin = 8;
|
|
3012
|
+
const next = {
|
|
3013
|
+
x: Math.max(margin, Math.min(position.x, window.innerWidth - element.offsetWidth - margin)),
|
|
3014
|
+
y: Math.max(margin, Math.min(position.y, window.innerHeight - element.offsetHeight - margin))
|
|
3015
|
+
};
|
|
3016
|
+
const previous = positions[positionKey.value];
|
|
3017
|
+
if (next.x !== previous?.x || next.y !== previous?.y) positions[positionKey.value] = next;
|
|
3018
|
+
}
|
|
3019
|
+
function keepPanelInViewport() {
|
|
3020
|
+
const position = positions[positionKey.value];
|
|
3021
|
+
if (position) placePanel(position);
|
|
3022
|
+
}
|
|
3023
|
+
function handleDragStart(event) {
|
|
3024
|
+
if (!props.draggable || maximized.value || event.button !== 0 || drag || !panel.value) return;
|
|
3025
|
+
const { left, top } = panel.value.getBoundingClientRect();
|
|
3026
|
+
drag = {
|
|
3027
|
+
pointerId: event.pointerId,
|
|
3028
|
+
offset: {
|
|
3029
|
+
x: event.clientX - left,
|
|
3030
|
+
y: event.clientY - top
|
|
3031
|
+
}
|
|
3032
|
+
};
|
|
3033
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
3034
|
+
}
|
|
3035
|
+
function handleDragMove(event) {
|
|
3036
|
+
if (drag?.pointerId !== event.pointerId) return;
|
|
3037
|
+
placePanel({
|
|
3038
|
+
x: event.clientX - drag.offset.x,
|
|
3039
|
+
y: event.clientY - drag.offset.y
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
function handleDragEnd(event) {
|
|
3043
|
+
if (drag?.pointerId === event.pointerId) drag = void 0;
|
|
3044
|
+
}
|
|
3045
|
+
function handleDragKeydown(event) {
|
|
3046
|
+
const offset = (/* @__PURE__ */ new Map([
|
|
3047
|
+
["ArrowLeft", [-16, 0]],
|
|
3048
|
+
["ArrowRight", [16, 0]],
|
|
3049
|
+
["ArrowUp", [0, -16]],
|
|
3050
|
+
["ArrowDown", [0, 16]]
|
|
3051
|
+
])).get(event.key);
|
|
3052
|
+
if (!offset || !panel.value) return;
|
|
3053
|
+
event.preventDefault();
|
|
3054
|
+
const { left, top } = panel.value.getBoundingClientRect();
|
|
3055
|
+
placePanel({
|
|
3056
|
+
x: left + offset[0],
|
|
3057
|
+
y: top + offset[1]
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
const handleMaskClick = () => {
|
|
3061
|
+
if (!props.closeOnMaskClick) return;
|
|
3062
|
+
close();
|
|
3063
|
+
};
|
|
3064
|
+
const handleEscClick = (e) => {
|
|
3065
|
+
if (visible.value && e.key === "Escape" && props.closeOnEsc) handleDismiss();
|
|
3066
|
+
};
|
|
3067
|
+
function handlePanelKeydown(event) {
|
|
3068
|
+
if (!props.minimizable || event.defaultPrevented || event.isComposing) return;
|
|
3069
|
+
if (event.key === "Escape" && props.closeOnEsc) {
|
|
3070
|
+
event.preventDefault();
|
|
3071
|
+
event.stopPropagation();
|
|
3072
|
+
handleDismiss();
|
|
3073
|
+
return;
|
|
3074
|
+
}
|
|
3075
|
+
const element = panel.value;
|
|
3076
|
+
if (event.key !== "Tab" || !showMaskLayer.value || !element) return;
|
|
3077
|
+
const controls = [...element.querySelectorAll("button, a[href], input, select, textarea, [tabindex]")].filter((control) => control.tabIndex >= 0 && !control.matches(":disabled") && !control.closest("[hidden], [inert]"));
|
|
3078
|
+
const active = element.ownerDocument.activeElement;
|
|
3079
|
+
const boundary = event.shiftKey ? controls.at(0) : controls.at(-1);
|
|
3080
|
+
if (active !== element && active !== boundary && controls.length) return;
|
|
3081
|
+
event.preventDefault();
|
|
3082
|
+
(event.shiftKey ? controls.at(-1) : controls.at(0))?.focus();
|
|
3083
|
+
}
|
|
3084
|
+
const handleConfirmContinueClick = async () => {
|
|
3085
|
+
if (!props.onConfirmContinue) return;
|
|
3086
|
+
try {
|
|
3087
|
+
continueLoading.value = true;
|
|
3088
|
+
await props.onConfirmContinue(modalInstance);
|
|
3089
|
+
} finally {
|
|
3090
|
+
continueLoading.value = false;
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
const handleConfirmClick = async () => {
|
|
3094
|
+
if (props.readonly) {
|
|
3095
|
+
close();
|
|
3096
|
+
return;
|
|
3097
|
+
}
|
|
3098
|
+
const confirmFn = contextConfirmFn || props.onConfirm;
|
|
3099
|
+
if (!confirmFn) {
|
|
3100
|
+
close();
|
|
3101
|
+
return;
|
|
3102
|
+
}
|
|
3103
|
+
await confirmFn(modalInstance);
|
|
3104
|
+
};
|
|
3105
|
+
const handleDismiss = async () => {
|
|
3106
|
+
if (props.onCancel) await props.onCancel(modalInstance);
|
|
3107
|
+
else close();
|
|
3108
|
+
};
|
|
3109
|
+
const handleCancelClick = handleDismiss;
|
|
3110
|
+
onMounted(() => {
|
|
3111
|
+
visible.value = true;
|
|
3112
|
+
props.__onRegisterIns(modalInstance);
|
|
3113
|
+
if (!props.minimizable) window.addEventListener("keydown", handleEscClick);
|
|
3114
|
+
if (props.draggable) window.addEventListener("resize", keepPanelInViewport);
|
|
3115
|
+
nextTick(() => {
|
|
3116
|
+
const element = panel.value;
|
|
3117
|
+
if (!element) return;
|
|
3118
|
+
if (props.minimizable) element.focus({ preventScroll: true });
|
|
3119
|
+
if (props.draggable && typeof ResizeObserver !== "undefined") {
|
|
3120
|
+
resizeObserver = new ResizeObserver(keepPanelInViewport);
|
|
3121
|
+
resizeObserver.observe(element);
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
});
|
|
3125
|
+
onBeforeUnmount(() => {
|
|
3126
|
+
window.removeEventListener("keydown", handleEscClick);
|
|
3127
|
+
window.removeEventListener("resize", keepPanelInViewport);
|
|
3128
|
+
resizeObserver?.disconnect();
|
|
3129
|
+
});
|
|
3130
|
+
return (_ctx, _cache) => {
|
|
3131
|
+
return openBlock(), createBlock(Teleport, { to: "body" }, [showMaskLayer.value ? (openBlock(), createBlock(Transition, {
|
|
3132
|
+
key: 0,
|
|
3133
|
+
name: "gct-modal-mask"
|
|
3134
|
+
}, {
|
|
3135
|
+
default: withCtx(() => [visible.value ? (openBlock(), createElementBlock("div", {
|
|
3136
|
+
key: 0,
|
|
3137
|
+
class: "gct-modal-mask",
|
|
3138
|
+
style: normalizeStyle({ zIndex: __props.zIndex }),
|
|
3139
|
+
onClick: handleMaskClick
|
|
3140
|
+
}, null, 4)) : createCommentVNode("", true)]),
|
|
3141
|
+
_: 1
|
|
3142
|
+
})) : createCommentVNode("", true), createVNode(Transition, { name: __props.draggable ? "gct-modal-draggable" : "gct-modal-wrapper" }, {
|
|
3143
|
+
default: withCtx(() => [visible.value ? (openBlock(), createElementBlock("div", {
|
|
3144
|
+
key: 0,
|
|
3145
|
+
class: normalizeClass(["gct-modal-wrapper", { "allows-background-pointer": __props.draggable || minimized.value }]),
|
|
3146
|
+
style: normalizeStyle(wrapperStyle.value),
|
|
3147
|
+
onClick: withModifiers(handleMaskClick, ["self"])
|
|
3148
|
+
}, [createElementVNode("div", {
|
|
3149
|
+
ref_key: "panel",
|
|
3150
|
+
ref: panel,
|
|
3151
|
+
class: normalizeClass(["gct-modal", [__props.className, { "is-minimized": minimized.value }]]),
|
|
3152
|
+
style: normalizeStyle(modalStyle.value),
|
|
3153
|
+
role: __props.showHeader ? "dialog" : void 0,
|
|
3154
|
+
"aria-label": __props.showHeader ? __props.title : void 0,
|
|
3155
|
+
"aria-modal": __props.showHeader && showMaskLayer.value ? true : void 0,
|
|
3156
|
+
tabindex: "-1",
|
|
3157
|
+
onKeydown: handlePanelKeydown
|
|
3158
|
+
}, [
|
|
3159
|
+
__props.showHeader ? (openBlock(), createElementBlock("header", {
|
|
3160
|
+
key: 0,
|
|
3161
|
+
class: normalizeClass(["modal-header", { "is-draggable": __props.draggable && !maximized.value }]),
|
|
3162
|
+
onPointerdown: handleDragStart,
|
|
3163
|
+
onPointermove: handleDragMove,
|
|
3164
|
+
onLostpointercapture: handleDragEnd,
|
|
3165
|
+
onPointerup: handleDragEnd,
|
|
3166
|
+
onPointercancel: handleDragEnd
|
|
3167
|
+
}, [
|
|
3168
|
+
__props.draggable ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(DialogActionButton_default, {
|
|
3169
|
+
class: "header-drag-button",
|
|
3170
|
+
label: "移动弹框",
|
|
3171
|
+
tooltip: "拖动标题栏移动,也可用方向键",
|
|
3172
|
+
disabled: maximized.value,
|
|
3173
|
+
onKeydown: handleDragKeydown
|
|
3174
|
+
}, {
|
|
3175
|
+
default: withCtx(() => [createVNode(unref(icon_default), {
|
|
3176
|
+
icon: "icon-drag",
|
|
3177
|
+
color: "currentColor",
|
|
3178
|
+
size: 16
|
|
3179
|
+
})]),
|
|
3180
|
+
_: 1
|
|
3181
|
+
}, 8, ["disabled"]), createElementVNode("span", _hoisted_3, toDisplayString(__props.title), 1)])) : (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.title), 1)),
|
|
3182
|
+
__props.fullscreen && !minimized.value ? (openBlock(), createBlock(DialogActionButton_default, {
|
|
3183
|
+
key: 2,
|
|
3184
|
+
label: fullscreenLabel.value,
|
|
3185
|
+
icon: maximized.value ? "fullscreen-exit" : "fullscreen",
|
|
3186
|
+
onPointerdown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
|
|
3187
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => maximized.value = !maximized.value, ["stop"]))
|
|
3188
|
+
}, null, 8, ["label", "icon"])) : createCommentVNode("", true),
|
|
3189
|
+
__props.minimizable ? (openBlock(), createBlock(DialogActionButton_default, {
|
|
3190
|
+
key: 3,
|
|
3191
|
+
label: minimizeLabel.value,
|
|
3192
|
+
icon: minimized.value ? "fullscreen" : "minimize",
|
|
3193
|
+
onPointerdown: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"])),
|
|
3194
|
+
onClick: withModifiers(toggleMinimized, ["stop"])
|
|
3195
|
+
}, null, 8, ["label", "icon"])) : createCommentVNode("", true),
|
|
3196
|
+
__props.closable ? (openBlock(), createBlock(DialogActionButton_default, {
|
|
3197
|
+
key: 4,
|
|
3198
|
+
label: "关闭",
|
|
3199
|
+
icon: "close",
|
|
3200
|
+
onPointerdown: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"])),
|
|
3201
|
+
onClick: withModifiers(handleDismiss, ["stop"])
|
|
3202
|
+
})) : createCommentVNode("", true)
|
|
3203
|
+
], 34)) : createCommentVNode("", true),
|
|
3204
|
+
createElementVNode("section", {
|
|
3205
|
+
class: normalizeClass(["modal-body", { "is-readonly": __props.readonly }]),
|
|
3206
|
+
style: normalizeStyle(bodyStyle.value)
|
|
3207
|
+
}, [(openBlock(), createBlock(resolveDynamicComponent(__props.body), mergeProps({
|
|
3208
|
+
ref_key: "bodyRef",
|
|
3209
|
+
ref: bodyRef,
|
|
3210
|
+
"modal-context": modalContext
|
|
3211
|
+
}, mergedBodyProps.value), null, 16))], 6),
|
|
3212
|
+
__props.showFooter ? (openBlock(), createElementBlock("footer", {
|
|
3213
|
+
key: 1,
|
|
3214
|
+
class: normalizeClass(["modal-footer", __props.plainFooter ? "--plain" : void 0])
|
|
3215
|
+
}, [
|
|
3216
|
+
__props.showCancel && !__props.readonly ? (openBlock(), createBlock(unref(button_default), {
|
|
3217
|
+
key: 0,
|
|
3218
|
+
disabled: loading.value,
|
|
3219
|
+
size: __props.plainFooter ? "small" : "medium",
|
|
3220
|
+
onClick: unref(handleCancelClick)
|
|
3221
|
+
}, {
|
|
3222
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.cancelText), 1)]),
|
|
3223
|
+
_: 1
|
|
3224
|
+
}, 8, [
|
|
3225
|
+
"disabled",
|
|
3226
|
+
"size",
|
|
3227
|
+
"onClick"
|
|
3228
|
+
])) : createCommentVNode("", true),
|
|
3229
|
+
props.showConfirmContinue && !__props.readonly ? (openBlock(), createBlock(unref(button_default), {
|
|
3230
|
+
key: 1,
|
|
3231
|
+
type: "primary",
|
|
3232
|
+
disabled: loading.value,
|
|
3233
|
+
size: __props.plainFooter ? "small" : "medium",
|
|
3234
|
+
loading: loading.value && continueLoading.value,
|
|
3235
|
+
onClick: handleConfirmContinueClick
|
|
3236
|
+
}, {
|
|
3237
|
+
default: withCtx(() => [createTextVNode(toDisplayString(props.confirmContinueText), 1)]),
|
|
3238
|
+
_: 1
|
|
3239
|
+
}, 8, [
|
|
3240
|
+
"disabled",
|
|
3241
|
+
"size",
|
|
3242
|
+
"loading"
|
|
3243
|
+
])) : createCommentVNode("", true),
|
|
3244
|
+
createVNode(unref(button_default), {
|
|
3245
|
+
type: __props.readonly ? "default" : "primary",
|
|
3246
|
+
disabled: loading.value,
|
|
3247
|
+
loading: loading.value,
|
|
3248
|
+
size: __props.plainFooter ? "small" : "medium",
|
|
3249
|
+
onClick: handleConfirmClick
|
|
3250
|
+
}, {
|
|
3251
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.readonly ? "关闭" : __props.confirmText), 1)]),
|
|
3252
|
+
_: 1
|
|
3253
|
+
}, 8, [
|
|
3254
|
+
"type",
|
|
3255
|
+
"disabled",
|
|
3256
|
+
"loading",
|
|
3257
|
+
"size"
|
|
3258
|
+
])
|
|
3259
|
+
], 2)) : createCommentVNode("", true)
|
|
3260
|
+
], 46, _hoisted_1)], 6)) : createCommentVNode("", true)]),
|
|
3261
|
+
_: 1
|
|
3262
|
+
}, 8, ["name"])]);
|
|
3263
|
+
};
|
|
3264
|
+
}
|
|
3265
|
+
}), [["__scopeId", "data-v-4b0a83ed"]]);
|
|
3266
|
+
// ../ui/src/modal/src/index.ts
|
|
3267
|
+
var BASE_Z_INDEX = 1999;
|
|
3268
|
+
var offset = 0;
|
|
3269
|
+
var GctModal = {
|
|
3270
|
+
/** 有宿主组件的弹框沿用同一 Vue 应用的组件、指令和注入。 */
|
|
3271
|
+
open(options, appContext) {
|
|
3272
|
+
const container = document.createElement("div");
|
|
3273
|
+
document.body.appendChild(container);
|
|
3274
|
+
const currentZIndex = options.zIndex ?? BASE_Z_INDEX + offset * 2;
|
|
3275
|
+
offset++;
|
|
3276
|
+
const bodyRefRef = shallowRef();
|
|
3277
|
+
let unmount;
|
|
3278
|
+
let closeFn;
|
|
3279
|
+
let restoreFn;
|
|
3280
|
+
let setLoadingFn;
|
|
3281
|
+
const instance = {
|
|
3282
|
+
bodyRef: bodyRefRef,
|
|
3283
|
+
close() {
|
|
3284
|
+
closeFn();
|
|
3285
|
+
},
|
|
3286
|
+
restore() {
|
|
3287
|
+
restoreFn();
|
|
3288
|
+
},
|
|
3289
|
+
setLoading(v) {
|
|
3290
|
+
setLoadingFn(v);
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3293
|
+
const props = reactive({
|
|
3294
|
+
...options,
|
|
3295
|
+
zIndex: currentZIndex,
|
|
3296
|
+
__onRegisterIns(ins) {
|
|
3297
|
+
instance.bodyRef = ins.bodyRef;
|
|
3298
|
+
closeFn = ins.close;
|
|
3299
|
+
restoreFn = ins.restore;
|
|
3300
|
+
setLoadingFn = ins.setLoading;
|
|
3301
|
+
},
|
|
3302
|
+
__onDestroyed() {
|
|
3303
|
+
setTimeout(() => {
|
|
3304
|
+
offset--;
|
|
3305
|
+
unmount();
|
|
3306
|
+
container.remove();
|
|
3307
|
+
}, 200);
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
if (appContext) {
|
|
3311
|
+
const root = h(ModalRoot_default, props);
|
|
3312
|
+
root.appContext = appContext;
|
|
3313
|
+
unmount = () => render(null, container);
|
|
3314
|
+
render(root, container);
|
|
3315
|
+
} else {
|
|
3316
|
+
const modalApp = createApp({ render: () => h(ModalRoot_default, props) });
|
|
3317
|
+
unmount = () => modalApp.unmount();
|
|
3318
|
+
modalApp.mount(container);
|
|
3319
|
+
}
|
|
3320
|
+
return instance;
|
|
3321
|
+
},
|
|
3322
|
+
confirm(tip, cb) {
|
|
3323
|
+
this.open({
|
|
3324
|
+
showHeader: false,
|
|
3325
|
+
plainFooter: true,
|
|
3326
|
+
width: 316,
|
|
3327
|
+
body: ConfirmTip_default,
|
|
3328
|
+
bodyProps: { tip },
|
|
3329
|
+
onConfirm({ close }) {
|
|
3330
|
+
cb();
|
|
3331
|
+
close();
|
|
3332
|
+
}
|
|
3333
|
+
});
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
export { icon_default as a, PopperWrapper as i, DialogActionButton_default as n, button_default as o, tooltip_default as r, _plugin_vue_export_helper_default as s, GctModal as t };
|
|
3337
|
+
|
|
3338
|
+
//# sourceMappingURL=src-BFXPGLus.js.map
|