orion-design 0.1.31 → 0.1.33
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -5
- package/dist/Throne/hooks/use-throne-context.d.ts +5 -0
- package/dist/Throne/hooks/use-throne-context.js +15 -0
- package/dist/Throne/hooks/use-throne-context.js.map +1 -0
- package/dist/Throne/index.d.ts +1 -1
- package/dist/Throne/index.js +14 -30
- package/dist/Throne/index.js.map +1 -1
- package/dist/components/Button/ButtonGroup/ButtonGroup.d.ts +2 -0
- package/dist/components/Button/index.js +36 -41
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +89 -122
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/FileInput/FileInput.vue.d.ts +4 -4
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.vue.d.ts +894 -0
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/MultiTableSelect/MultiTableSelect.d.ts +26 -0
- package/dist/components/Form/MultiTableSelect/MultiTableSelect.js +5 -0
- package/dist/components/Form/MultiTableSelect/MultiTableSelect.js.map +1 -0
- package/dist/components/Form/MultiTableSelect/MultiTableSelect.vue.d.ts +6249 -0
- package/dist/components/Form/MultiTableSelect/hooks/useMultiTableSelect.d.ts +1 -0
- package/dist/components/Form/MultiTableSelect/hooks/useMultiTableSelect.js +9 -0
- package/dist/components/Form/MultiTableSelect/hooks/useMultiTableSelect.js.map +1 -0
- package/dist/components/Form/MultiTableSelect/index.d.ts +2 -0
- package/dist/components/Form/MultiTableSelect/index.js +7 -0
- package/dist/components/Form/MultiTableSelect/index.js.map +1 -0
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +69 -127
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.d.ts +3 -0
- package/dist/components/Form/index.js +790 -829
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +18 -30
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +510 -6
- package/dist/components/LovTable/LovQuerytable.vue.d.ts +468 -4
- package/dist/components/LovTable/index.d.ts +489 -5
- package/dist/components/LovTable/index.js +104 -179
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/index.js +56 -111
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.d.ts +1 -1
- package/dist/components/Modal/types.js +3 -4
- package/dist/components/Modal/types.js.map +1 -1
- package/dist/components/Modal/useModal.js +5 -5
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/MultiTableSelectPagetable/MultiTableSelectPagetable.vue.d.ts +880 -0
- package/dist/components/MultiTableSelectPagetable/index.d.ts +462 -0
- package/dist/components/MultiTableSelectPagetable/index.js +164 -0
- package/dist/components/MultiTableSelectPagetable/index.js.map +1 -0
- package/dist/components/Pagetable/Pagetable.d.ts +96 -3
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +14 -1
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +14 -1
- package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +1 -1
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +14 -1
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +14 -1
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +14 -1
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +14 -1
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +14 -1
- package/dist/components/Pagetable/hooks/useCode.d.ts +2 -0
- package/dist/components/Pagetable/hooks/useCode.js +24 -0
- package/dist/components/Pagetable/hooks/useCode.js.map +1 -0
- package/dist/components/Pagetable/hooks/useColumns.js +85 -88
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +159 -2
- package/dist/components/Pagetable/index.js +601 -684
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +54 -92
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/Querytable.d.ts +80 -2
- package/dist/components/Querytable/columns/QuerytableColumnButtongroup.d.ts +14 -1
- package/dist/components/Querytable/columns/QuerytableColumnDate.d.ts +14 -1
- package/dist/components/Querytable/columns/QuerytableColumnDiy.d.ts +1 -1
- package/dist/components/Querytable/columns/QuerytableColumnLink.d.ts +14 -1
- package/dist/components/Querytable/columns/QuerytableColumnMultiselect.d.ts +14 -1
- package/dist/components/Querytable/columns/QuerytableColumnNumber.d.ts +14 -1
- package/dist/components/Querytable/columns/QuerytableColumnSingleselect.d.ts +14 -1
- package/dist/components/Querytable/columns/QuerytableColumnString.d.ts +14 -1
- package/dist/components/Querytable/hooks/useColumns.js +79 -82
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.d.ts +147 -1
- package/dist/components/Querytable/index.js +526 -579
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +54 -92
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +74 -100
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +358 -603
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/Throne/ThroneContextProvider.d.ts +25 -0
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +4 -6
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +39 -74
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +19 -29
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +5 -9
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +17 -22
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +39 -74
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +8 -9
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +7 -14
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +25 -49
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +61 -103
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +50 -65
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +4 -8
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +11 -12
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +2 -4
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +14 -18
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +20 -46
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +10 -18
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +4 -5
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +3 -4
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +8 -9
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +10 -16
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +38 -41
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +22 -41
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +43 -85
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +15 -27
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +25 -29
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +18 -35
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +30 -46
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +6 -12
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +3 -5
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +4 -5
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +54 -100
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +220 -231
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.d.ts +2 -0
- package/dist/components/components.js +24 -20
- package/dist/components/components.js.map +1 -1
- package/dist/components/index.js +43 -38
- package/dist/components/index.js.map +1 -1
- package/dist/components-DP9bnDLm.js +48 -0
- package/dist/components-DP9bnDLm.js.map +1 -0
- package/dist/error/OrionError.js +4 -8
- package/dist/error/OrionError.js.map +1 -1
- package/dist/{index-C6P_0wAy.js → index-ChkLOmNK.js} +76 -46
- package/dist/{index-C6P_0wAy.js.map → index-ChkLOmNK.js.map} +1 -1
- package/dist/index.css +1 -797
- package/dist/index.d.ts +1 -0
- package/dist/index.js +46 -36
- package/dist/index.js.map +1 -1
- package/dist/print/LodopFuncs.js +43 -101
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +108 -200
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +14 -17
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +13 -16
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +14 -17
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +22 -47
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +25 -40
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +10 -16
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +201 -305
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +5 -11
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +5 -11
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +4 -9
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +5 -11
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +33 -48
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +93 -191
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +25 -35
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
- package/dist/components-8oZ2kpUC.js +0 -27
- package/dist/components-8oZ2kpUC.js.map +0 -1
- package/dist/components-B3d9m_tn.js +0 -27
- package/dist/components-B3d9m_tn.js.map +0 -1
- package/dist/functions-BeMkokbY.js +0 -63
- package/dist/functions-BeMkokbY.js.map +0 -1
- package/dist/index-BOKLZnqH.js +0 -54
- package/dist/index-BOKLZnqH.js.map +0 -1
- package/dist/index-D1m0KTpK.js +0 -69
- package/dist/index-D1m0KTpK.js.map +0 -1
- package/dist/index-DR5ZP7mD.js +0 -160
- package/dist/index-DR5ZP7mD.js.map +0 -1
- package/dist/index-DkwIULcN.js +0 -200
- package/dist/index-DkwIULcN.js.map +0 -1
@@ -1,81 +1,46 @@
|
|
1
|
-
const
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
|
14
|
-
return true;
|
15
|
-
}
|
16
|
-
if (element.disabled) {
|
17
|
-
return false;
|
18
|
-
}
|
19
|
-
switch (element.nodeName) {
|
20
|
-
case "A": {
|
21
|
-
return !!element.href && element.rel !== "ignore";
|
22
|
-
}
|
23
|
-
case "INPUT": {
|
24
|
-
return !(element.type === "hidden" || element.type === "file");
|
25
|
-
}
|
1
|
+
const u = 'a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])', c = (t) => process.env.NODE_ENV === "test" ? !0 : getComputedStyle(t).position === "fixed" ? !1 : t.offsetParent !== null, d = (t) => Array.from(
|
2
|
+
t.querySelectorAll(u)
|
3
|
+
).filter((e) => o(e) && c(e)), o = (t) => {
|
4
|
+
if (t.tabIndex > 0 || t.tabIndex === 0 && t.getAttribute("tabIndex") !== null)
|
5
|
+
return !0;
|
6
|
+
if (t.disabled)
|
7
|
+
return !1;
|
8
|
+
switch (t.nodeName) {
|
9
|
+
case "A":
|
10
|
+
return !!t.href && t.rel !== "ignore";
|
11
|
+
case "INPUT":
|
12
|
+
return !(t.type === "hidden" || t.type === "file");
|
26
13
|
case "BUTTON":
|
27
14
|
case "SELECT":
|
28
|
-
case "TEXTAREA":
|
29
|
-
return
|
30
|
-
|
31
|
-
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
};
|
36
|
-
const attemptFocus = (element) => {
|
37
|
-
var _a;
|
38
|
-
if (!isFocusable(element)) {
|
39
|
-
return false;
|
40
|
-
}
|
41
|
-
(_a = element.focus) == null ? void 0 : _a.call(element);
|
42
|
-
return document.activeElement === element;
|
43
|
-
};
|
44
|
-
const triggerEvent = function(elm, name, ...opts) {
|
45
|
-
let eventName;
|
46
|
-
if (name.includes("mouse") || name.includes("click")) {
|
47
|
-
eventName = "MouseEvents";
|
48
|
-
} else if (name.includes("key")) {
|
49
|
-
eventName = "KeyboardEvent";
|
50
|
-
} else {
|
51
|
-
eventName = "HTMLEvents";
|
15
|
+
case "TEXTAREA":
|
16
|
+
return !0;
|
17
|
+
default:
|
18
|
+
return !1;
|
52
19
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
const
|
60
|
-
|
61
|
-
|
62
|
-
const
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
el.focus();
|
69
|
-
!isLeaf(el) && el.click();
|
20
|
+
}, l = (t) => {
|
21
|
+
var e;
|
22
|
+
return o(t) ? ((e = t.focus) == null || e.call(t), document.activeElement === t) : !1;
|
23
|
+
}, f = function(t, e, ...s) {
|
24
|
+
let n;
|
25
|
+
e.includes("mouse") || e.includes("click") ? n = "MouseEvents" : e.includes("key") ? n = "KeyboardEvent" : n = "HTMLEvents";
|
26
|
+
const r = document.createEvent(n);
|
27
|
+
return r.initEvent(e, ...s), t.dispatchEvent(r), t;
|
28
|
+
}, a = (t) => !t.getAttribute("aria-owns"), E = (t, e, s) => {
|
29
|
+
const { parentNode: n } = t;
|
30
|
+
if (!n) return null;
|
31
|
+
const r = n.querySelectorAll(s), i = Array.prototype.indexOf.call(r, t);
|
32
|
+
return r[i + e] || null;
|
33
|
+
}, b = (t) => {
|
34
|
+
t && (t.focus(), !a(t) && t.click());
|
70
35
|
};
|
71
36
|
export {
|
72
|
-
attemptFocus,
|
73
|
-
focusNode,
|
74
|
-
getSibling,
|
75
|
-
isFocusable,
|
76
|
-
isLeaf,
|
77
|
-
isVisible,
|
78
|
-
obtainAllFocusableElements,
|
79
|
-
triggerEvent
|
37
|
+
l as attemptFocus,
|
38
|
+
b as focusNode,
|
39
|
+
E as getSibling,
|
40
|
+
o as isFocusable,
|
41
|
+
a as isLeaf,
|
42
|
+
c as isVisible,
|
43
|
+
d as obtainAllFocusableElements,
|
44
|
+
f as triggerEvent
|
80
45
|
};
|
81
46
|
//# sourceMappingURL=aria.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"aria.js","sources":["../../../../src/components/_util/dom/aria.ts"],"sourcesContent":["const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex=\"-1\"]),input:not([disabled]),input:not([type=\"hidden\"]),select:not([disabled]),textarea:not([disabled])`\r\n\r\n/**\r\n * Determine if the testing element is visible on screen no matter if its on the viewport or not\r\n */\r\nexport const isVisible = (element: HTMLElement) => {\r\n if (process.env.NODE_ENV === 'test') return true\r\n const computed = getComputedStyle(element)\r\n // element.offsetParent won't work on fix positioned\r\n // WARNING: potential issue here, going to need some expert advices on this issue\r\n return computed.position === 'fixed' ? false : element.offsetParent !== null\r\n}\r\n\r\nexport const obtainAllFocusableElements = (\r\n element: HTMLElement\r\n): HTMLElement[] => {\r\n return Array.from(\r\n element.querySelectorAll<HTMLElement>(FOCUSABLE_ELEMENT_SELECTORS)\r\n ).filter((item: HTMLElement) => isFocusable(item) && isVisible(item))\r\n}\r\n\r\n/**\r\n * @desc Determine if target element is focusable\r\n * @param element {HTMLElement}\r\n * @returns {Boolean} true if it is focusable\r\n */\r\nexport const isFocusable = (element: HTMLElement): boolean => {\r\n if (\r\n element.tabIndex > 0 ||\r\n (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)\r\n ) {\r\n return true\r\n }\r\n // HTMLButtonElement has disabled\r\n if ((element as HTMLButtonElement).disabled) {\r\n return false\r\n }\r\n\r\n switch (element.nodeName) {\r\n case 'A': {\r\n // casting current element to Specific HTMLElement in order to be more type precise\r\n return (\r\n !!(element as HTMLAnchorElement).href &&\r\n (element as HTMLAnchorElement).rel !== 'ignore'\r\n )\r\n }\r\n case 'INPUT': {\r\n return !(\r\n (element as HTMLInputElement).type === 'hidden' ||\r\n (element as HTMLInputElement).type === 'file'\r\n )\r\n }\r\n case 'BUTTON':\r\n case 'SELECT':\r\n case 'TEXTAREA': {\r\n return true\r\n }\r\n default: {\r\n return false\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @desc Set Attempt to set focus on the current node.\r\n * @param element\r\n * The node to attempt to focus on.\r\n * @returns\r\n * true if element is focused.\r\n */\r\nexport const attemptFocus = (element: HTMLElement): boolean => {\r\n if (!isFocusable(element)) {\r\n return false\r\n }\r\n // Remove the old try catch block since there will be no error to be thrown\r\n element.focus?.()\r\n return document.activeElement === element\r\n}\r\n\r\n/**\r\n * Trigger an event\r\n * mouseenter, mouseleave, mouseover, keyup, change, click, etc.\r\n * @param {HTMLElement} elm\r\n * @param {String} name\r\n * @param {*} opts\r\n */\r\nexport const triggerEvent = function (\r\n elm: HTMLElement,\r\n name: string,\r\n ...opts: Array<boolean>\r\n): HTMLElement {\r\n let eventName: string\r\n\r\n if (name.includes('mouse') || name.includes('click')) {\r\n eventName = 'MouseEvents'\r\n } else if (name.includes('key')) {\r\n eventName = 'KeyboardEvent'\r\n } else {\r\n eventName = 'HTMLEvents'\r\n }\r\n const evt = document.createEvent(eventName)\r\n\r\n evt.initEvent(name, ...opts)\r\n elm.dispatchEvent(evt)\r\n return elm\r\n}\r\n\r\nexport const isLeaf = (el: HTMLElement) => !el.getAttribute('aria-owns')\r\n\r\nexport const getSibling = (\r\n el: HTMLElement,\r\n distance: number,\r\n elClass: string\r\n) => {\r\n const { parentNode } = el\r\n if (!parentNode) return null\r\n const siblings = parentNode.querySelectorAll(elClass)\r\n const index = Array.prototype.indexOf.call(siblings, el)\r\n return siblings[index + distance] || null\r\n}\r\n\r\nexport const focusNode = (el: HTMLElement) => {\r\n if (!el) return\r\n el.focus()\r\n !isLeaf(el) && el.click()\r\n}\r\n"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"aria.js","sources":["../../../../src/components/_util/dom/aria.ts"],"sourcesContent":["const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex=\"-1\"]),input:not([disabled]),input:not([type=\"hidden\"]),select:not([disabled]),textarea:not([disabled])`\r\n\r\n/**\r\n * Determine if the testing element is visible on screen no matter if its on the viewport or not\r\n */\r\nexport const isVisible = (element: HTMLElement) => {\r\n if (process.env.NODE_ENV === 'test') return true\r\n const computed = getComputedStyle(element)\r\n // element.offsetParent won't work on fix positioned\r\n // WARNING: potential issue here, going to need some expert advices on this issue\r\n return computed.position === 'fixed' ? false : element.offsetParent !== null\r\n}\r\n\r\nexport const obtainAllFocusableElements = (\r\n element: HTMLElement\r\n): HTMLElement[] => {\r\n return Array.from(\r\n element.querySelectorAll<HTMLElement>(FOCUSABLE_ELEMENT_SELECTORS)\r\n ).filter((item: HTMLElement) => isFocusable(item) && isVisible(item))\r\n}\r\n\r\n/**\r\n * @desc Determine if target element is focusable\r\n * @param element {HTMLElement}\r\n * @returns {Boolean} true if it is focusable\r\n */\r\nexport const isFocusable = (element: HTMLElement): boolean => {\r\n if (\r\n element.tabIndex > 0 ||\r\n (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)\r\n ) {\r\n return true\r\n }\r\n // HTMLButtonElement has disabled\r\n if ((element as HTMLButtonElement).disabled) {\r\n return false\r\n }\r\n\r\n switch (element.nodeName) {\r\n case 'A': {\r\n // casting current element to Specific HTMLElement in order to be more type precise\r\n return (\r\n !!(element as HTMLAnchorElement).href &&\r\n (element as HTMLAnchorElement).rel !== 'ignore'\r\n )\r\n }\r\n case 'INPUT': {\r\n return !(\r\n (element as HTMLInputElement).type === 'hidden' ||\r\n (element as HTMLInputElement).type === 'file'\r\n )\r\n }\r\n case 'BUTTON':\r\n case 'SELECT':\r\n case 'TEXTAREA': {\r\n return true\r\n }\r\n default: {\r\n return false\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * @desc Set Attempt to set focus on the current node.\r\n * @param element\r\n * The node to attempt to focus on.\r\n * @returns\r\n * true if element is focused.\r\n */\r\nexport const attemptFocus = (element: HTMLElement): boolean => {\r\n if (!isFocusable(element)) {\r\n return false\r\n }\r\n // Remove the old try catch block since there will be no error to be thrown\r\n element.focus?.()\r\n return document.activeElement === element\r\n}\r\n\r\n/**\r\n * Trigger an event\r\n * mouseenter, mouseleave, mouseover, keyup, change, click, etc.\r\n * @param {HTMLElement} elm\r\n * @param {String} name\r\n * @param {*} opts\r\n */\r\nexport const triggerEvent = function (\r\n elm: HTMLElement,\r\n name: string,\r\n ...opts: Array<boolean>\r\n): HTMLElement {\r\n let eventName: string\r\n\r\n if (name.includes('mouse') || name.includes('click')) {\r\n eventName = 'MouseEvents'\r\n } else if (name.includes('key')) {\r\n eventName = 'KeyboardEvent'\r\n } else {\r\n eventName = 'HTMLEvents'\r\n }\r\n const evt = document.createEvent(eventName)\r\n\r\n evt.initEvent(name, ...opts)\r\n elm.dispatchEvent(evt)\r\n return elm\r\n}\r\n\r\nexport const isLeaf = (el: HTMLElement) => !el.getAttribute('aria-owns')\r\n\r\nexport const getSibling = (\r\n el: HTMLElement,\r\n distance: number,\r\n elClass: string\r\n) => {\r\n const { parentNode } = el\r\n if (!parentNode) return null\r\n const siblings = parentNode.querySelectorAll(elClass)\r\n const index = Array.prototype.indexOf.call(siblings, el)\r\n return siblings[index + distance] || null\r\n}\r\n\r\nexport const focusNode = (el: HTMLElement) => {\r\n if (!el) return\r\n el.focus()\r\n !isLeaf(el) && el.click()\r\n}\r\n"],"names":["FOCUSABLE_ELEMENT_SELECTORS","isVisible","element","obtainAllFocusableElements","item","isFocusable","attemptFocus","_a","triggerEvent","elm","name","opts","eventName","evt","isLeaf","el","getSibling","distance","elClass","parentNode","siblings","index","focusNode"],"mappings":"AAAA,MAAMA,IAA8B,8KAKvBC,IAAY,CAACC,MACpB,QAAQ,IAAI,aAAa,SAAe,KAC3B,iBAAiBA,CAAO,EAGzB,aAAa,UAAU,KAAQA,EAAQ,iBAAiB,MAG7DC,IAA6B,CACxCD,MAEO,MAAM;AAAA,EACXA,EAAQ,iBAA8BF,CAA2B;AAAA,EACjE,OAAO,CAACI,MAAsBC,EAAYD,CAAI,KAAKH,EAAUG,CAAI,CAAC,GAQzDC,IAAc,CAACH,MAAkC;AAE1D,MAAAA,EAAQ,WAAW,KAClBA,EAAQ,aAAa,KAAKA,EAAQ,aAAa,UAAU,MAAM;AAEzD,WAAA;AAGT,MAAKA,EAA8B;AAC1B,WAAA;AAGT,UAAQA,EAAQ,UAAU;AAAA,IACxB,KAAK;AAEH,aACE,CAAC,CAAEA,EAA8B,QAChCA,EAA8B,QAAQ;AAAA,IAG3C,KAAK;AACH,aAAO,EACJA,EAA6B,SAAS,YACtCA,EAA6B,SAAS;AAAA,IAG3C,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACI,aAAA;AAAA,IAET;AACS,aAAA;AAAA,EAEX;AACF,GASaI,IAAe,CAACJ,MAAkC;AAtE/D,MAAAK;AAuEM,SAACF,EAAYH,CAAO,MAIxBK,IAAAL,EAAQ,UAAR,QAAAK,EAAA,KAAAL,IACO,SAAS,kBAAkBA,KAJzB;AAKX,GASaM,IAAe,SAC1BC,GACAC,MACGC,GACU;AACT,MAAAC;AAEJ,EAAIF,EAAK,SAAS,OAAO,KAAKA,EAAK,SAAS,OAAO,IACrCE,IAAA,gBACHF,EAAK,SAAS,KAAK,IAChBE,IAAA,kBAEAA,IAAA;AAER,QAAAC,IAAM,SAAS,YAAYD,CAAS;AAEtC,SAAAC,EAAA,UAAUH,GAAM,GAAGC,CAAI,GAC3BF,EAAI,cAAcI,CAAG,GACdJ;AACT,GAEaK,IAAS,CAACC,MAAoB,CAACA,EAAG,aAAa,WAAW,GAE1DC,IAAa,CACxBD,GACAE,GACAC,MACG;AACG,QAAA,EAAE,YAAAC,EAAe,IAAAJ;AACnB,MAAA,CAACI,EAAmB,QAAA;AAClB,QAAAC,IAAWD,EAAW,iBAAiBD,CAAO,GAC9CG,IAAQ,MAAM,UAAU,QAAQ,KAAKD,GAAUL,CAAE;AAChD,SAAAK,EAASC,IAAQJ,CAAQ,KAAK;AACvC,GAEaK,IAAY,CAACP,MAAoB;AAC5C,EAAKA,MACLA,EAAG,MAAM,GACT,CAACD,EAAOC,CAAE,KAAKA,EAAG,MAAM;AAC1B;"}
|
@@ -1,19 +1,18 @@
|
|
1
|
-
import { e as
|
1
|
+
import { e as t } from "../../../functions-DzLqXvGt.js";
|
2
2
|
import "lodash-es";
|
3
3
|
import "vue";
|
4
|
-
import { i as
|
5
|
-
const
|
6
|
-
if (!
|
7
|
-
if (
|
4
|
+
import { i as e } from "../../../index-C9tCD90X.js";
|
5
|
+
const u = (r) => {
|
6
|
+
if (!e || r === "") return null;
|
7
|
+
if (t(r))
|
8
8
|
try {
|
9
|
-
return document.querySelector(
|
9
|
+
return document.querySelector(r);
|
10
10
|
} catch {
|
11
11
|
return null;
|
12
12
|
}
|
13
|
-
|
14
|
-
return target;
|
13
|
+
return r;
|
15
14
|
};
|
16
15
|
export {
|
17
|
-
getElement
|
16
|
+
u as getElement
|
18
17
|
};
|
19
18
|
//# sourceMappingURL=element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"element.js","sources":["../../../../src/components/_util/dom/element.ts"],"sourcesContent":["import { isString } from '../types'\r\nimport { isClient } from '../browser'\r\n\r\ntype GetElement = <T extends string | HTMLElement | Window | null | undefined>(\r\n target: T\r\n) => T extends string ? HTMLElement | null : T\r\n\r\nexport const getElement = ((\r\n target: string | HTMLElement | Window | null | undefined\r\n) => {\r\n if (!isClient || target === '') return null\r\n if (isString(target)) {\r\n try {\r\n return document.querySelector<HTMLElement>(target)\r\n } catch {\r\n return null\r\n }\r\n }\r\n return target\r\n}) as GetElement\r\n"],"names":[],"mappings":";;;;AAOa,
|
1
|
+
{"version":3,"file":"element.js","sources":["../../../../src/components/_util/dom/element.ts"],"sourcesContent":["import { isString } from '../types'\r\nimport { isClient } from '../browser'\r\n\r\ntype GetElement = <T extends string | HTMLElement | Window | null | undefined>(\r\n target: T\r\n) => T extends string ? HTMLElement | null : T\r\n\r\nexport const getElement = ((\r\n target: string | HTMLElement | Window | null | undefined\r\n) => {\r\n if (!isClient || target === '') return null\r\n if (isString(target)) {\r\n try {\r\n return document.querySelector<HTMLElement>(target)\r\n } catch {\r\n return null\r\n }\r\n }\r\n return target\r\n}) as GetElement\r\n"],"names":["getElement","target","isClient","isString"],"mappings":";;;;AAOa,MAAAA,IAAc,CACzBC,MACG;AACH,MAAI,CAACC,KAAYD,MAAW,GAAW,QAAA;AACnC,MAAAE,EAASF,CAAM;AACb,QAAA;AACK,aAAA,SAAS,cAA2BA,CAAM;AAAA,IAAA,QAC3C;AACC,aAAA;AAAA,IACT;AAEK,SAAAA;AACT;"}
|
@@ -1,17 +1,10 @@
|
|
1
|
-
const
|
2
|
-
const
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
}
|
7
|
-
};
|
8
|
-
return handleEvent;
|
9
|
-
};
|
10
|
-
const whenMouse = (handler) => {
|
11
|
-
return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
|
12
|
-
};
|
1
|
+
const v = (o, t, { checkForDefaultPrevented: c = !0 } = {}) => (n) => {
|
2
|
+
const e = o == null ? void 0 : o(n);
|
3
|
+
if (c === !1 || !e)
|
4
|
+
return t == null ? void 0 : t(n);
|
5
|
+
}, u = (o) => (t) => t.pointerType === "mouse" ? o(t) : void 0;
|
13
6
|
export {
|
14
|
-
composeEventHandlers,
|
15
|
-
whenMouse
|
7
|
+
v as composeEventHandlers,
|
8
|
+
u as whenMouse
|
16
9
|
};
|
17
10
|
//# sourceMappingURL=event.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"event.js","sources":["../../../../src/components/_util/dom/event.ts"],"sourcesContent":["export const composeEventHandlers = <E>(\r\n theirsHandler?: (event: E) => boolean | void,\r\n oursHandler?: (event: E) => void,\r\n { checkForDefaultPrevented = true } = {}\r\n) => {\r\n const handleEvent = (event: E) => {\r\n const shouldPrevent = theirsHandler?.(event)\r\n\r\n if (checkForDefaultPrevented === false || !shouldPrevent) {\r\n return oursHandler?.(event)\r\n }\r\n }\r\n return handleEvent\r\n}\r\n\r\ntype WhenMouseHandler = (e: PointerEvent) => any\r\nexport const whenMouse = (handler: WhenMouseHandler): WhenMouseHandler => {\r\n return (e: PointerEvent) =>\r\n e.pointerType === 'mouse' ? handler(e) : undefined\r\n}\r\n"],"names":[],"mappings":"AAAa,
|
1
|
+
{"version":3,"file":"event.js","sources":["../../../../src/components/_util/dom/event.ts"],"sourcesContent":["export const composeEventHandlers = <E>(\r\n theirsHandler?: (event: E) => boolean | void,\r\n oursHandler?: (event: E) => void,\r\n { checkForDefaultPrevented = true } = {}\r\n) => {\r\n const handleEvent = (event: E) => {\r\n const shouldPrevent = theirsHandler?.(event)\r\n\r\n if (checkForDefaultPrevented === false || !shouldPrevent) {\r\n return oursHandler?.(event)\r\n }\r\n }\r\n return handleEvent\r\n}\r\n\r\ntype WhenMouseHandler = (e: PointerEvent) => any\r\nexport const whenMouse = (handler: WhenMouseHandler): WhenMouseHandler => {\r\n return (e: PointerEvent) =>\r\n e.pointerType === 'mouse' ? handler(e) : undefined\r\n}\r\n"],"names":["composeEventHandlers","theirsHandler","oursHandler","checkForDefaultPrevented","event","shouldPrevent","whenMouse","handler","e"],"mappings":"AAAa,MAAAA,IAAuB,CAClCC,GACAC,GACA,EAAE,0BAAAC,IAA2B,GAAS,IAAA,OAElB,CAACC,MAAa;AAC1B,QAAAC,IAAgBJ,KAAA,gBAAAA,EAAgBG;AAElC,MAAAD,MAA6B,MAAS,CAACE;AACzC,WAAOH,KAAA,gBAAAA,EAAcE;AACvB,GAMSE,IAAY,CAACC,MACjB,CAACC,MACNA,EAAE,gBAAgB,UAAUD,EAAQC,CAAC,IAAI;"}
|
@@ -1,39 +1,39 @@
|
|
1
|
-
import { attemptFocus, focusNode, getSibling, isFocusable, isLeaf, isVisible, obtainAllFocusableElements, triggerEvent } from "./aria.js";
|
2
|
-
import { composeEventHandlers, whenMouse } from "./event.js";
|
3
|
-
import { getClientXY, getOffsetTop, getOffsetTopDistance, isInContainer } from "./position.js";
|
4
|
-
import { animateScrollTo, getScrollBarWidth, getScrollContainer, getScrollElement, getScrollTop, isScroll, scrollIntoView } from "./scroll.js";
|
5
|
-
import { addClass, addUnit, classNameToArray, getStyle, hasClass, removeClass, removeStyle, setStyle } from "./style.js";
|
6
|
-
import { getElement } from "./element.js";
|
1
|
+
import { attemptFocus as o, focusNode as l, getSibling as r, isFocusable as s, isLeaf as a, isVisible as i, obtainAllFocusableElements as n, triggerEvent as m } from "./aria.js";
|
2
|
+
import { composeEventHandlers as g, whenMouse as f } from "./event.js";
|
3
|
+
import { getClientXY as S, getOffsetTop as d, getOffsetTopDistance as x, isInContainer as C } from "./position.js";
|
4
|
+
import { animateScrollTo as u, getScrollBarWidth as E, getScrollContainer as T, getScrollElement as v, getScrollTop as y, isScroll as h, scrollIntoView as F } from "./scroll.js";
|
5
|
+
import { addClass as A, addUnit as I, classNameToArray as N, getStyle as O, hasClass as V, removeClass as B, removeStyle as D, setStyle as H } from "./style.js";
|
6
|
+
import { getElement as M } from "./element.js";
|
7
7
|
export {
|
8
|
-
addClass,
|
9
|
-
addUnit,
|
10
|
-
animateScrollTo,
|
11
|
-
attemptFocus,
|
12
|
-
classNameToArray,
|
13
|
-
composeEventHandlers,
|
14
|
-
focusNode,
|
15
|
-
getClientXY,
|
16
|
-
getElement,
|
17
|
-
getOffsetTop,
|
18
|
-
getOffsetTopDistance,
|
19
|
-
getScrollBarWidth,
|
20
|
-
getScrollContainer,
|
21
|
-
getScrollElement,
|
22
|
-
getScrollTop,
|
23
|
-
getSibling,
|
24
|
-
getStyle,
|
25
|
-
hasClass,
|
26
|
-
isFocusable,
|
27
|
-
isInContainer,
|
28
|
-
isLeaf,
|
29
|
-
isScroll,
|
30
|
-
isVisible,
|
31
|
-
obtainAllFocusableElements,
|
32
|
-
removeClass,
|
33
|
-
removeStyle,
|
34
|
-
scrollIntoView,
|
35
|
-
setStyle,
|
36
|
-
triggerEvent,
|
37
|
-
whenMouse
|
8
|
+
A as addClass,
|
9
|
+
I as addUnit,
|
10
|
+
u as animateScrollTo,
|
11
|
+
o as attemptFocus,
|
12
|
+
N as classNameToArray,
|
13
|
+
g as composeEventHandlers,
|
14
|
+
l as focusNode,
|
15
|
+
S as getClientXY,
|
16
|
+
M as getElement,
|
17
|
+
d as getOffsetTop,
|
18
|
+
x as getOffsetTopDistance,
|
19
|
+
E as getScrollBarWidth,
|
20
|
+
T as getScrollContainer,
|
21
|
+
v as getScrollElement,
|
22
|
+
y as getScrollTop,
|
23
|
+
r as getSibling,
|
24
|
+
O as getStyle,
|
25
|
+
V as hasClass,
|
26
|
+
s as isFocusable,
|
27
|
+
C as isInContainer,
|
28
|
+
a as isLeaf,
|
29
|
+
h as isScroll,
|
30
|
+
i as isVisible,
|
31
|
+
n as obtainAllFocusableElements,
|
32
|
+
B as removeClass,
|
33
|
+
D as removeStyle,
|
34
|
+
F as scrollIntoView,
|
35
|
+
H as setStyle,
|
36
|
+
m as triggerEvent,
|
37
|
+
f as whenMouse
|
38
38
|
};
|
39
39
|
//# sourceMappingURL=index.js.map
|
@@ -1,54 +1,30 @@
|
|
1
|
-
import { i as
|
2
|
-
const
|
3
|
-
if (!
|
4
|
-
const
|
5
|
-
let
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
return
|
17
|
-
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
offset += parent.offsetTop;
|
23
|
-
parent = parent.offsetParent;
|
24
|
-
}
|
25
|
-
return offset;
|
26
|
-
};
|
27
|
-
const getOffsetTopDistance = (el, containerEl) => {
|
28
|
-
return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
|
29
|
-
};
|
30
|
-
const getClientXY = (event) => {
|
31
|
-
let clientX;
|
32
|
-
let clientY;
|
33
|
-
if (event.type === "touchend") {
|
34
|
-
clientY = event.changedTouches[0].clientY;
|
35
|
-
clientX = event.changedTouches[0].clientX;
|
36
|
-
} else if (event.type.startsWith("touch")) {
|
37
|
-
clientY = event.touches[0].clientY;
|
38
|
-
clientX = event.touches[0].clientX;
|
39
|
-
} else {
|
40
|
-
clientY = event.clientY;
|
41
|
-
clientX = event.clientX;
|
42
|
-
}
|
43
|
-
return {
|
44
|
-
clientX,
|
45
|
-
clientY
|
1
|
+
import { i as c } from "../../../index-C9tCD90X.js";
|
2
|
+
const s = (t, i) => {
|
3
|
+
if (!c || !t || !i) return !1;
|
4
|
+
const e = t.getBoundingClientRect();
|
5
|
+
let n;
|
6
|
+
return i instanceof Element ? n = i.getBoundingClientRect() : n = {
|
7
|
+
top: 0,
|
8
|
+
right: window.innerWidth,
|
9
|
+
bottom: window.innerHeight,
|
10
|
+
left: 0
|
11
|
+
}, e.top < n.bottom && e.bottom > n.top && e.right > n.left && e.left < n.right;
|
12
|
+
}, o = (t) => {
|
13
|
+
let i = 0, e = t;
|
14
|
+
for (; e; )
|
15
|
+
i += e.offsetTop, e = e.offsetParent;
|
16
|
+
return i;
|
17
|
+
}, r = (t, i) => Math.abs(o(t) - o(i)), f = (t) => {
|
18
|
+
let i, e;
|
19
|
+
return t.type === "touchend" ? (e = t.changedTouches[0].clientY, i = t.changedTouches[0].clientX) : t.type.startsWith("touch") ? (e = t.touches[0].clientY, i = t.touches[0].clientX) : (e = t.clientY, i = t.clientX), {
|
20
|
+
clientX: i,
|
21
|
+
clientY: e
|
46
22
|
};
|
47
23
|
};
|
48
24
|
export {
|
49
|
-
getClientXY,
|
50
|
-
getOffsetTop,
|
51
|
-
getOffsetTopDistance,
|
52
|
-
isInContainer
|
25
|
+
f as getClientXY,
|
26
|
+
o as getOffsetTop,
|
27
|
+
r as getOffsetTopDistance,
|
28
|
+
s as isInContainer
|
53
29
|
};
|
54
30
|
//# sourceMappingURL=position.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"position.js","sources":["../../../../src/components/_util/dom/position.ts"],"sourcesContent":["import { isClient } from '../browser'\r\n\r\nexport const isInContainer = (\r\n el?: Element,\r\n container?: Element | Window\r\n): boolean => {\r\n if (!isClient || !el || !container) return false\r\n\r\n const elRect = el.getBoundingClientRect()\r\n\r\n let containerRect: Pick<DOMRect, 'top' | 'bottom' | 'left' | 'right'>\r\n if (container instanceof Element) {\r\n containerRect = container.getBoundingClientRect()\r\n } else {\r\n containerRect = {\r\n top: 0,\r\n right: window.innerWidth,\r\n bottom: window.innerHeight,\r\n left: 0,\r\n }\r\n }\r\n return (\r\n elRect.top < containerRect.bottom &&\r\n elRect.bottom > containerRect.top &&\r\n elRect.right > containerRect.left &&\r\n elRect.left < containerRect.right\r\n )\r\n}\r\n\r\nexport const getOffsetTop = (el: HTMLElement) => {\r\n let offset = 0\r\n let parent = el\r\n\r\n while (parent) {\r\n offset += parent.offsetTop\r\n parent = parent.offsetParent as HTMLElement\r\n }\r\n\r\n return offset\r\n}\r\n\r\nexport const getOffsetTopDistance = (\r\n el: HTMLElement,\r\n containerEl: HTMLElement\r\n) => {\r\n return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl))\r\n}\r\n\r\nexport const getClientXY = (event: MouseEvent | TouchEvent) => {\r\n let clientX: number\r\n let clientY: number\r\n if (event.type === 'touchend') {\r\n clientY = (event as TouchEvent).changedTouches[0].clientY\r\n clientX = (event as TouchEvent).changedTouches[0].clientX\r\n } else if (event.type.startsWith('touch')) {\r\n clientY = (event as TouchEvent).touches[0].clientY\r\n clientX = (event as TouchEvent).touches[0].clientX\r\n } else {\r\n clientY = (event as MouseEvent).clientY\r\n clientX = (event as MouseEvent).clientX\r\n }\r\n return {\r\n clientX,\r\n clientY,\r\n }\r\n}\r\n"],"names":[],"mappings":";AAEa,
|
1
|
+
{"version":3,"file":"position.js","sources":["../../../../src/components/_util/dom/position.ts"],"sourcesContent":["import { isClient } from '../browser'\r\n\r\nexport const isInContainer = (\r\n el?: Element,\r\n container?: Element | Window\r\n): boolean => {\r\n if (!isClient || !el || !container) return false\r\n\r\n const elRect = el.getBoundingClientRect()\r\n\r\n let containerRect: Pick<DOMRect, 'top' | 'bottom' | 'left' | 'right'>\r\n if (container instanceof Element) {\r\n containerRect = container.getBoundingClientRect()\r\n } else {\r\n containerRect = {\r\n top: 0,\r\n right: window.innerWidth,\r\n bottom: window.innerHeight,\r\n left: 0,\r\n }\r\n }\r\n return (\r\n elRect.top < containerRect.bottom &&\r\n elRect.bottom > containerRect.top &&\r\n elRect.right > containerRect.left &&\r\n elRect.left < containerRect.right\r\n )\r\n}\r\n\r\nexport const getOffsetTop = (el: HTMLElement) => {\r\n let offset = 0\r\n let parent = el\r\n\r\n while (parent) {\r\n offset += parent.offsetTop\r\n parent = parent.offsetParent as HTMLElement\r\n }\r\n\r\n return offset\r\n}\r\n\r\nexport const getOffsetTopDistance = (\r\n el: HTMLElement,\r\n containerEl: HTMLElement\r\n) => {\r\n return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl))\r\n}\r\n\r\nexport const getClientXY = (event: MouseEvent | TouchEvent) => {\r\n let clientX: number\r\n let clientY: number\r\n if (event.type === 'touchend') {\r\n clientY = (event as TouchEvent).changedTouches[0].clientY\r\n clientX = (event as TouchEvent).changedTouches[0].clientX\r\n } else if (event.type.startsWith('touch')) {\r\n clientY = (event as TouchEvent).touches[0].clientY\r\n clientX = (event as TouchEvent).touches[0].clientX\r\n } else {\r\n clientY = (event as MouseEvent).clientY\r\n clientX = (event as MouseEvent).clientX\r\n }\r\n return {\r\n clientX,\r\n clientY,\r\n }\r\n}\r\n"],"names":["isInContainer","el","container","isClient","elRect","containerRect","getOffsetTop","offset","parent","getOffsetTopDistance","containerEl","getClientXY","event","clientX","clientY"],"mappings":";AAEa,MAAAA,IAAgB,CAC3BC,GACAC,MACY;AACZ,MAAI,CAACC,KAAY,CAACF,KAAM,CAACC,EAAkB,QAAA;AAErC,QAAAE,IAASH,EAAG;AAEd,MAAAI;AACJ,SAAIH,aAAqB,UACvBG,IAAgBH,EAAU,0BAEVG,IAAA;AAAA,IACd,KAAK;AAAA,IACL,OAAO,OAAO;AAAA,IACd,QAAQ,OAAO;AAAA,IACf,MAAM;AAAA,EAAA,GAIRD,EAAO,MAAMC,EAAc,UAC3BD,EAAO,SAASC,EAAc,OAC9BD,EAAO,QAAQC,EAAc,QAC7BD,EAAO,OAAOC,EAAc;AAEhC,GAEaC,IAAe,CAACL,MAAoB;AAC/C,MAAIM,IAAS,GACTC,IAASP;AAEb,SAAOO;AACL,IAAAD,KAAUC,EAAO,WACjBA,IAASA,EAAO;AAGX,SAAAD;AACT,GAEaE,IAAuB,CAClCR,GACAS,MAEO,KAAK,IAAIJ,EAAaL,CAAE,IAAIK,EAAaI,CAAW,CAAC,GAGjDC,IAAc,CAACC,MAAmC;AACzD,MAAAC,GACAC;AACA,SAAAF,EAAM,SAAS,cACNE,IAAAF,EAAqB,eAAe,CAAC,EAAE,SACvCC,IAAAD,EAAqB,eAAe,CAAC,EAAE,WACzCA,EAAM,KAAK,WAAW,OAAO,KAC3BE,IAAAF,EAAqB,QAAQ,CAAC,EAAE,SAChCC,IAAAD,EAAqB,QAAQ,CAAC,EAAE,YAE3CE,IAAWF,EAAqB,SAChCC,IAAWD,EAAqB,UAE3B;AAAA,IACL,SAAAC;AAAA,IACA,SAAAC;AAAA,EAAA;AAEJ;"}
|
@@ -1,120 +1,78 @@
|
|
1
|
-
import { easeInOutCubic } from "../easings.js";
|
2
|
-
import { isWindow } from "../types.js";
|
3
|
-
import { rAF, cAF } from "../raf.js";
|
4
|
-
import { getStyle } from "./style.js";
|
5
|
-
import { i as
|
6
|
-
const
|
7
|
-
if (!
|
8
|
-
const
|
1
|
+
import { easeInOutCubic as w } from "../easings.js";
|
2
|
+
import { isWindow as u } from "../types.js";
|
3
|
+
import { rAF as h, cAF as a } from "../raf.js";
|
4
|
+
import { getStyle as T } from "./style.js";
|
5
|
+
import { i as p } from "../../../index-C9tCD90X.js";
|
6
|
+
const v = (o, t) => {
|
7
|
+
if (!p) return !1;
|
8
|
+
const l = {
|
9
9
|
undefined: "overflow",
|
10
10
|
true: "overflow-y",
|
11
11
|
false: "overflow-x"
|
12
|
-
}[String(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
while (parent) {
|
20
|
-
if ([window, document, document.documentElement].includes(parent))
|
12
|
+
}[String(t)], e = T(o, l);
|
13
|
+
return ["scroll", "auto", "overlay"].some((r) => e.includes(r));
|
14
|
+
}, b = (o, t) => {
|
15
|
+
if (!p) return;
|
16
|
+
let l = o;
|
17
|
+
for (; l; ) {
|
18
|
+
if ([window, document, document.documentElement].includes(l))
|
21
19
|
return window;
|
22
|
-
if (
|
23
|
-
|
20
|
+
if (v(l, t)) return l;
|
21
|
+
l = l.parentNode;
|
24
22
|
}
|
25
|
-
return
|
23
|
+
return l;
|
26
24
|
};
|
27
|
-
let
|
28
|
-
const
|
29
|
-
var
|
30
|
-
if (!
|
31
|
-
if (
|
32
|
-
const
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
outer.style.overflow = "scroll";
|
41
|
-
const inner = document.createElement("div");
|
42
|
-
inner.style.width = "100%";
|
43
|
-
outer.appendChild(inner);
|
44
|
-
const widthWithScroll = inner.offsetWidth;
|
45
|
-
(_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
|
46
|
-
scrollBarWidth = widthNoScroll - widthWithScroll;
|
47
|
-
return scrollBarWidth;
|
25
|
+
let f;
|
26
|
+
const x = (o) => {
|
27
|
+
var s;
|
28
|
+
if (!p) return 0;
|
29
|
+
if (f !== void 0) return f;
|
30
|
+
const t = document.createElement("div");
|
31
|
+
t.className = `${o}-scrollbar__wrap`, t.style.visibility = "hidden", t.style.width = "100px", t.style.position = "absolute", t.style.top = "-9999px", document.body.appendChild(t);
|
32
|
+
const l = t.offsetWidth;
|
33
|
+
t.style.overflow = "scroll";
|
34
|
+
const e = document.createElement("div");
|
35
|
+
e.style.width = "100%", t.appendChild(e);
|
36
|
+
const r = e.offsetWidth;
|
37
|
+
return (s = t.parentNode) == null || s.removeChild(t), f = l - r, f;
|
48
38
|
};
|
49
|
-
function
|
50
|
-
if (!
|
51
|
-
if (!
|
52
|
-
|
39
|
+
function E(o, t) {
|
40
|
+
if (!p) return;
|
41
|
+
if (!t) {
|
42
|
+
o.scrollTop = 0;
|
53
43
|
return;
|
54
44
|
}
|
55
|
-
const
|
56
|
-
let
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
|
62
|
-
const bottom = top + selected.offsetHeight;
|
63
|
-
const viewRectTop = container.scrollTop;
|
64
|
-
const viewRectBottom = viewRectTop + container.clientHeight;
|
65
|
-
if (top < viewRectTop) {
|
66
|
-
container.scrollTop = top;
|
67
|
-
} else if (bottom > viewRectBottom) {
|
68
|
-
container.scrollTop = bottom - container.clientHeight;
|
69
|
-
}
|
45
|
+
const l = [];
|
46
|
+
let e = t.offsetParent;
|
47
|
+
for (; e !== null && o !== e && o.contains(e); )
|
48
|
+
l.push(e), e = e.offsetParent;
|
49
|
+
const r = t.offsetTop + l.reduce((m, i) => m + i.offsetTop, 0), s = r + t.offsetHeight, n = o.scrollTop, c = n + o.clientHeight;
|
50
|
+
r < n ? o.scrollTop = r : s > c && (o.scrollTop = s - o.clientHeight);
|
70
51
|
}
|
71
|
-
function
|
72
|
-
const
|
73
|
-
let
|
74
|
-
const
|
75
|
-
const
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
to,
|
81
|
-
duration
|
52
|
+
function N(o, t, l, e, r) {
|
53
|
+
const s = Date.now();
|
54
|
+
let n;
|
55
|
+
const c = () => {
|
56
|
+
const i = Date.now() - s, d = w(
|
57
|
+
i > e ? e : i,
|
58
|
+
t,
|
59
|
+
l,
|
60
|
+
e
|
82
61
|
);
|
83
|
-
|
84
|
-
container.scrollTo(window.pageXOffset, nextScrollTop);
|
85
|
-
} else {
|
86
|
-
container.scrollTop = nextScrollTop;
|
87
|
-
}
|
88
|
-
if (time < duration) {
|
89
|
-
handle = rAF(scroll);
|
90
|
-
} else if (typeof callback === "function") {
|
91
|
-
callback();
|
92
|
-
}
|
62
|
+
u(o) ? o.scrollTo(window.pageXOffset, d) : o.scrollTop = d, i < e ? n = h(c) : typeof r == "function" && r();
|
93
63
|
};
|
94
|
-
|
95
|
-
|
96
|
-
handle && cAF(handle);
|
64
|
+
return c(), () => {
|
65
|
+
n && a(n);
|
97
66
|
};
|
98
67
|
}
|
99
|
-
const
|
100
|
-
if (isWindow(container)) {
|
101
|
-
return target.ownerDocument.documentElement;
|
102
|
-
}
|
103
|
-
return container;
|
104
|
-
};
|
105
|
-
const getScrollTop = (container) => {
|
106
|
-
if (isWindow(container)) {
|
107
|
-
return window.scrollY;
|
108
|
-
}
|
109
|
-
return container.scrollTop;
|
110
|
-
};
|
68
|
+
const B = (o, t) => u(t) ? o.ownerDocument.documentElement : t, D = (o) => u(o) ? window.scrollY : o.scrollTop;
|
111
69
|
export {
|
112
|
-
animateScrollTo,
|
113
|
-
getScrollBarWidth,
|
114
|
-
getScrollContainer,
|
115
|
-
getScrollElement,
|
116
|
-
getScrollTop,
|
117
|
-
isScroll,
|
118
|
-
scrollIntoView
|
70
|
+
N as animateScrollTo,
|
71
|
+
x as getScrollBarWidth,
|
72
|
+
b as getScrollContainer,
|
73
|
+
B as getScrollElement,
|
74
|
+
D as getScrollTop,
|
75
|
+
v as isScroll,
|
76
|
+
E as scrollIntoView
|
119
77
|
};
|
120
78
|
//# sourceMappingURL=scroll.js.map
|