@aplus-frontend/ui 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +158 -152
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +8 -4
- package/es/src/config-provider/hooks/use-namespace.d.ts +1 -1
- package/es/src/config-provider/hooks/use-namespace.mjs +3 -3
- package/es/src/hooks/index.d.ts +2 -0
- package/es/src/hooks/index.mjs +7 -3
- package/es/src/hooks/useManualRef.d.ts +6 -0
- package/es/src/hooks/useManualRef.mjs +27 -0
- package/es/src/hooks/useThrottleRef.d.ts +2 -0
- package/es/src/hooks/useThrottleRef.mjs +31 -0
- package/es/src/index.d.ts +1 -1
- package/es/src/index.mjs +231 -228
- package/es/src/path-map.mjs +1 -1
- package/es/src/scroll-bar/hooks/use-track.d.ts +30 -0
- package/es/src/scroll-bar/hooks/use-track.mjs +76 -0
- package/es/src/scroll-bar/index.d.ts +4 -0
- package/es/src/scroll-bar/index.mjs +3 -0
- package/es/src/scroll-bar/index.vue.d.ts +52 -0
- package/es/src/scroll-bar/index.vue.mjs +77 -0
- package/es/src/scroll-bar/index.vue2.mjs +4 -0
- package/es/src/scroll-bar/interface.d.ts +66 -0
- package/es/src/scroll-bar/internal.vue.d.ts +22 -0
- package/es/src/scroll-bar/internal.vue.mjs +132 -0
- package/es/src/scroll-bar/internal.vue2.mjs +4 -0
- package/es/src/scroll-bar/style/css.js +1 -0
- package/es/src/scroll-bar/style/index.js +1 -0
- package/es/src/scroll-bar/utils/index.d.ts +22 -0
- package/es/src/scroll-bar/utils/index.mjs +17 -0
- package/lib/index.js +1 -1
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/config-provider/hooks/use-namespace.d.ts +1 -1
- package/lib/src/config-provider/hooks/use-namespace.js +1 -1
- package/lib/src/hooks/index.d.ts +2 -0
- package/lib/src/hooks/index.js +1 -1
- package/lib/src/hooks/useManualRef.d.ts +6 -0
- package/lib/src/hooks/useManualRef.js +1 -0
- package/lib/src/hooks/useThrottleRef.d.ts +2 -0
- package/lib/src/hooks/useThrottleRef.js +1 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/lib/src/scroll-bar/hooks/use-track.d.ts +30 -0
- package/lib/src/scroll-bar/hooks/use-track.js +1 -0
- package/lib/src/scroll-bar/index.d.ts +4 -0
- package/lib/src/scroll-bar/index.js +1 -0
- package/lib/src/scroll-bar/index.vue.d.ts +52 -0
- package/lib/src/scroll-bar/index.vue.js +1 -0
- package/lib/src/scroll-bar/index.vue2.js +1 -0
- package/lib/src/scroll-bar/interface.d.ts +66 -0
- package/lib/src/scroll-bar/internal.vue.d.ts +22 -0
- package/lib/src/scroll-bar/internal.vue.js +1 -0
- package/lib/src/scroll-bar/internal.vue2.js +1 -0
- package/lib/src/scroll-bar/style/css.cjs +1 -0
- package/lib/src/scroll-bar/style/index.cjs +1 -0
- package/lib/src/scroll-bar/utils/index.d.ts +22 -0
- package/lib/src/scroll-bar/utils/index.js +1 -0
- package/package.json +1 -1
- package/theme/index.css +36 -21
- package/theme/index.less +1 -1
- package/theme/scroll-bar/index.css +46 -0
- package/theme/scroll-bar/index.less +62 -0
- package/es/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +0 -8
- package/es/src/ap-scroll-bar/ap-scroll-bar.vue.mjs +0 -4
- package/es/src/ap-scroll-bar/ap-scroll-bar.vue2.mjs +0 -116
- package/es/src/ap-scroll-bar/index.d.ts +0 -29
- package/es/src/ap-scroll-bar/index.mjs +0 -8
- package/es/src/ap-scroll-bar/interface.d.ts +0 -4
- package/es/src/ap-scroll-bar/style/css.js +0 -1
- package/es/src/ap-scroll-bar/style/index.js +0 -1
- package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +0 -8
- package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.js +0 -1
- package/lib/src/ap-scroll-bar/ap-scroll-bar.vue2.js +0 -1
- package/lib/src/ap-scroll-bar/index.d.ts +0 -29
- package/lib/src/ap-scroll-bar/index.js +0 -1
- package/lib/src/ap-scroll-bar/interface.d.ts +0 -4
- package/lib/src/ap-scroll-bar/style/css.cjs +0 -1
- package/lib/src/ap-scroll-bar/style/index.cjs +0 -1
- /package/es/src/{ap-scroll-bar → scroll-bar}/interface.mjs +0 -0
- /package/es/src/{ap-scroll-bar → scroll-bar}/style/css.d.ts +0 -0
- /package/es/src/{ap-scroll-bar → scroll-bar}/style/index.d.ts +0 -0
- /package/lib/src/{ap-scroll-bar → scroll-bar}/interface.js +0 -0
- /package/lib/src/{ap-scroll-bar → scroll-bar}/style/css.d.ts +0 -0
- /package/lib/src/{ap-scroll-bar → scroll-bar}/style/index.d.ts +0 -0
package/lib/src/path-map.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={ApActionItem:["ap-action","item"],ApActionItemModal:["ap-action","item-modal"],ApActionItemPopconfirm:["ap-action","item-popconfirm"],ApActionItemDropdown:["ap-action","item-dropdown"],ApActionGroup:["ap-action","group"],ApButton:["ap-button"],ApActionButton:["ap-action-button"],ApDescriptions:["ap-descriptions"],ApDownload:["ap-download"],ApField:["ap-field"],ApFieldText:["ap-field","text"],ApFieldCheckbox:["ap-field","checkbox"],ApFieldDate:["ap-field","date"],ApFieldNumber:["ap-field","number"],ApFieldRadio:["ap-field","radio"],ApFieldSwitch:["ap-field","switch"],ApFieldTextArea:["ap-field","text-area"],ApFieldDateRange:["ap-field","date-range"],ApFieldSelect:["ap-field","select"],ApFieldPassword:["ap-field","password"],ApFieldSlider:["ap-field","slider"],ApFieldSegmented:["ap-field","segmented"],ApFieldDateRate:["ap-field","rate"],ApForm:["ap-form"],ApFormItem:["ap-form","item"],ApFormItemGroup:["ap-form","item-group"],ApFormList:["ap-form","list"],ApFormSearchForm:["ap-form","search-form"],ApFormModalForm:["ap-form","modal-form"],ApFormDependency:["ap-form","dependency"],ApFormSet:["ap-form","set"],ApFormDrawerForm:["ap-form","drawer-form"],ApFormItemText:["ap-form","item-text"],ApFormItemTextArea:["ap-form","item-text-area"],ApFormItemNumber:["ap-form","item-number"],ApFormItemDate:["ap-form","item-date"],ApFormItemDateRange:["ap-form","item-date-range"],ApFormItemRadio:["ap-form","item-radio"],ApFormItemSelect:["ap-form","item-select"],ApFormItemSwitch:["ap-form","item-switch"],ApFormItemCheckbox:["ap-form","item-checkbox"],ApFormItemTextPassword:["ap-form","item-text-password"],ApFormItemTextGroup:["ap-form","item-text-group"],ApInfoLayout:["ap-info-layout"],ApList:["ap-list"],ApModal:["ap-modal"],ApDrawer:["ap-drawer"],ApTable:["ap-table"],ApTag:["ap-tag"],ApTagGroup:["ap-tag","group"],ApUpload:["ap-upload"],CheckCard:["check-card"],CheckCardGroup:["check-card","group"],ConfigProvider:["config-provider"],EditableTable:["editable-table"],EditableTableFormItem:["editable-table","form-item"],WorkOrderModal:["work-order-modal"],ApAttachment:["business","ap-attachment"],ApBatchAction:["business","ap-batch-action"],ApBatchActionGroup:["business","ap-batch-action-group"],ApButtonGroup:["business","ap-button-group"],ApCard:["business","ap-card"],ApExpandAlert:["business","ap-expand-alert"],ApExportGroup:["business","ap-export-group"],ApImage:["business","ap-image"],ApInputRadio:["business","ap-input-radio"],ApSizeInput:["business","ap-size-input"],ApLabel:["business","ap-label"],ApLabelGroup:["business","ap-label","group"],ApLadder:["business","ap-ladder"],ApSelectLayout:["business","ap-select-layout"],ApStatus:["business","ap-status"],ApStatusGroup:["business","ap-status","group"],ApTableModal:["business","ap-table-modal"],useTableModal:["business","ap-table-modal"],useTableSelectModal:["business","ap-table-modal"],ApTitle:["business","ap-title"],ApSummary:["business","ap-summary"],
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={ApActionItem:["ap-action","item"],ApActionItemModal:["ap-action","item-modal"],ApActionItemPopconfirm:["ap-action","item-popconfirm"],ApActionItemDropdown:["ap-action","item-dropdown"],ApActionGroup:["ap-action","group"],ApButton:["ap-button"],ApActionButton:["ap-action-button"],ApDescriptions:["ap-descriptions"],ApDownload:["ap-download"],ApField:["ap-field"],ApFieldText:["ap-field","text"],ApFieldCheckbox:["ap-field","checkbox"],ApFieldDate:["ap-field","date"],ApFieldNumber:["ap-field","number"],ApFieldRadio:["ap-field","radio"],ApFieldSwitch:["ap-field","switch"],ApFieldTextArea:["ap-field","text-area"],ApFieldDateRange:["ap-field","date-range"],ApFieldSelect:["ap-field","select"],ApFieldPassword:["ap-field","password"],ApFieldSlider:["ap-field","slider"],ApFieldSegmented:["ap-field","segmented"],ApFieldDateRate:["ap-field","rate"],ApForm:["ap-form"],ApFormItem:["ap-form","item"],ApFormItemGroup:["ap-form","item-group"],ApFormList:["ap-form","list"],ApFormSearchForm:["ap-form","search-form"],ApFormModalForm:["ap-form","modal-form"],ApFormDependency:["ap-form","dependency"],ApFormSet:["ap-form","set"],ApFormDrawerForm:["ap-form","drawer-form"],ApFormItemText:["ap-form","item-text"],ApFormItemTextArea:["ap-form","item-text-area"],ApFormItemNumber:["ap-form","item-number"],ApFormItemDate:["ap-form","item-date"],ApFormItemDateRange:["ap-form","item-date-range"],ApFormItemRadio:["ap-form","item-radio"],ApFormItemSelect:["ap-form","item-select"],ApFormItemSwitch:["ap-form","item-switch"],ApFormItemCheckbox:["ap-form","item-checkbox"],ApFormItemTextPassword:["ap-form","item-text-password"],ApFormItemTextGroup:["ap-form","item-text-group"],ApInfoLayout:["ap-info-layout"],ApList:["ap-list"],ApModal:["ap-modal"],ApDrawer:["ap-drawer"],ApTable:["ap-table"],ApTag:["ap-tag"],ApTagGroup:["ap-tag","group"],ApUpload:["ap-upload"],CheckCard:["check-card"],CheckCardGroup:["check-card","group"],ConfigProvider:["config-provider"],EditableTable:["editable-table"],EditableTableFormItem:["editable-table","form-item"],WorkOrderModal:["work-order-modal"],ApAttachment:["business","ap-attachment"],ApBatchAction:["business","ap-batch-action"],ApBatchActionGroup:["business","ap-batch-action-group"],ApButtonGroup:["business","ap-button-group"],ApCard:["business","ap-card"],ApExpandAlert:["business","ap-expand-alert"],ApExportGroup:["business","ap-export-group"],ApImage:["business","ap-image"],ApInputRadio:["business","ap-input-radio"],ApSizeInput:["business","ap-size-input"],ApLabel:["business","ap-label"],ApLabelGroup:["business","ap-label","group"],ApLadder:["business","ap-ladder"],ApSelectLayout:["business","ap-select-layout"],ApStatus:["business","ap-status"],ApStatusGroup:["business","ap-status","group"],ApTableModal:["business","ap-table-modal"],useTableModal:["business","ap-table-modal"],useTableSelectModal:["business","ap-table-modal"],ApTitle:["business","ap-title"],ApSummary:["business","ap-summary"],ScrollBar:["scroll-bar"],ApAppendix:["business","ap-appendix"],ApGroupSearch:["business","ap-group-search"],ApPopoverSelect:["business","ap-group-search","popover-select"],ApExtensionSelect:["business","ap-group-search","extension-select"],ApUploadSingle:["business","ap-upload-file","ap-upload-single"],BatchInputGroup:["business","batch-input-group"],ApFormControlRender:["ap-form","render"],ApFormItemRender:["ap-form","render"]};exports.default=e;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 处理点击滑轨滚动
|
|
4
|
+
* @param param0
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function useTrack({ currentScroll, trackSpeed, track, bar, tracking, type, barLength, disabled, onDown, onMove, onUp, onScroll }: {
|
|
8
|
+
currentScroll: Ref<number>;
|
|
9
|
+
type: Ref<'vertical' | 'horizontal'>;
|
|
10
|
+
trackSpeed?: Ref<number>;
|
|
11
|
+
track?: Ref<HTMLElement | null | undefined>;
|
|
12
|
+
bar?: Ref<HTMLElement | null | undefined>;
|
|
13
|
+
tracking?: Ref<boolean>;
|
|
14
|
+
barLength?: Ref<number>;
|
|
15
|
+
disabled?: Ref<boolean>;
|
|
16
|
+
onDown?: (scroll: number) => void;
|
|
17
|
+
onMove?: (scroll: number) => void;
|
|
18
|
+
onUp?: (scroll: number) => void;
|
|
19
|
+
onScroll?: (scroll: number) => void;
|
|
20
|
+
}): {
|
|
21
|
+
currentScroll: Ref<number, number>;
|
|
22
|
+
trackSpeed: Ref<number, number>;
|
|
23
|
+
track: Ref<HTMLElement | null | undefined, HTMLElement | null | undefined>;
|
|
24
|
+
bar: Ref<HTMLElement | null | undefined, HTMLElement | null | undefined>;
|
|
25
|
+
tracking: Ref<boolean, boolean>;
|
|
26
|
+
type: Ref<"horizontal" | "vertical", "horizontal" | "vertical">;
|
|
27
|
+
barLength: Ref<number, number>;
|
|
28
|
+
disabled: Ref<boolean, boolean>;
|
|
29
|
+
handleMouseDown: (event: PointerEvent) => false | undefined;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),q=require("../utils/index.js"),M=()=>{};function V({currentScroll:e=i.ref(0),trackSpeed:v=i.ref(2),track:p=i.ref(null),bar:n=i.ref(null),tracking:d=i.ref(!1),type:R=i.ref("vertical"),barLength:o=i.ref(35),disabled:x=i.ref(!1),onDown:w=M,onMove:A=M,onUp:B=M,onScroll:P=M}){let r,s,f,l,m=!0,g=!1;function h(){if(!d.value)return;g=!0;const t=X(l,e.value);let a=!1;if(m){if(e.value<l){const u=e.value+t*v.value;e.value=Math.min(u,l),a=!0}}else if(e.value>l){const u=e.value-t*v.value;e.value=Math.max(u,l),a=!0}a&&P(e.value),(d.value&&m?e.value<l:e.value>l)?requestAnimationFrame(h):g=!1}function T(t){if(x.value||t.button!==0||(t.stopPropagation(),t.preventDefault(),!p.value||!n.value))return!1;document.addEventListener("pointermove",D),document.addEventListener("pointerup",E);const a=p.value.getBoundingClientRect(),u=n.value.getBoundingClientRect();let c;R.value==="vertical"?(r=a.height,s=u.top-a.top,f=u.top,c=s+t.clientY-f):(r=a.width,s=u.left-a.left,f=u.left,c=s+t.clientX-f),m=c/r*100>o.value;const C=(c/r*100-(m?o.value:0))/(100-o.value);l=q.ensureRangeValue(C*100),d.value=!0,w(e.value),h()}function D(t){t.stopPropagation(),t.preventDefault(),A(e.value);let a;R.value==="vertical"?a=s+t.clientY-f:a=s+t.clientX-f;const u=(a/r*100-(m?o.value:0))/(100-o.value);l=q.ensureRangeValue(u*100),!g&&h()}function E(t){t.preventDefault(),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",E),d.value=!1,B(e.value)}return{currentScroll:e,trackSpeed:v,track:p,bar:n,tracking:d,type:R,barLength:o,disabled:x,handleMouseDown:T}}function X(e,v){const p=Math.abs(e-v);for(let n=0;n<5;++n)if(p<(n+1)*20)return 1+.25*n;return 2}exports.useTrack=V;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("./index.vue2.js");require("./internal.vue2.js");require("./interface.js");
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ScrollBarProps, ScrollBarDirection, InternalScrollBarProps } from './interface';
|
|
2
|
+
import { DefineComponent, ComputedRef, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, CreateComponentPublicInstanceWithMixins, Ref, GlobalComponents, GlobalDirectives } from 'vue';
|
|
3
|
+
declare const _default: DefineComponent<ScrollBarProps, {
|
|
4
|
+
currentScroll: ComputedRef<number | undefined>;
|
|
5
|
+
scroll: ((percent: number) => void) | undefined;
|
|
6
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ScrollBarProps> & Readonly<{}>, {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
direction: ScrollBarDirection;
|
|
9
|
+
showTrack: boolean;
|
|
10
|
+
trackSpeed: number;
|
|
11
|
+
extraSize: number;
|
|
12
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
13
|
+
barRef: CreateComponentPublicInstanceWithMixins<Readonly< InternalScrollBarProps> & Readonly<{}>, {
|
|
14
|
+
currentScroll: Ref<number, number>;
|
|
15
|
+
container: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
16
|
+
bar: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
17
|
+
track: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
18
|
+
scroll: (percent: number) => void;
|
|
19
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
20
|
+
scroll: number;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
direction: ScrollBarDirection;
|
|
23
|
+
barLength: number;
|
|
24
|
+
showTrack: boolean;
|
|
25
|
+
trackSpeed: number;
|
|
26
|
+
}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {
|
|
27
|
+
container: HTMLDivElement;
|
|
28
|
+
track: HTMLDivElement;
|
|
29
|
+
bar: HTMLDivElement;
|
|
30
|
+
}, HTMLDivElement, ComponentProvideOptions, {
|
|
31
|
+
P: {};
|
|
32
|
+
B: {};
|
|
33
|
+
D: {};
|
|
34
|
+
C: {};
|
|
35
|
+
M: {};
|
|
36
|
+
Defaults: {};
|
|
37
|
+
}, Readonly< InternalScrollBarProps> & Readonly<{}>, {
|
|
38
|
+
currentScroll: Ref<number, number>;
|
|
39
|
+
container: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
40
|
+
bar: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
41
|
+
track: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
42
|
+
scroll: (percent: number) => void;
|
|
43
|
+
}, {}, {}, {}, {
|
|
44
|
+
scroll: number;
|
|
45
|
+
disabled: boolean;
|
|
46
|
+
direction: ScrollBarDirection;
|
|
47
|
+
barLength: number;
|
|
48
|
+
showTrack: boolean;
|
|
49
|
+
trackSpeed: number;
|
|
50
|
+
}> | null;
|
|
51
|
+
}, HTMLDivElement>;
|
|
52
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("./internal.vue2.js");const b=require("lodash-unified"),i=require("./utils/index.js"),h=require("./internal.vue.js"),g=e.defineComponent({name:"ScrollBar",__name:"index",props:{scrollContainer:{},extraSize:{default:0},direction:{default:"vertical"},scroll:{},width:{},barColor:{},trackColor:{},trackWidth:{},disabled:{type:Boolean,default:!1},showTrack:{type:Boolean,default:!0},trackSpeed:{default:2},onScrollStart:{},onScroll:{},onScrollEnd:{}},setup(f,{expose:d}){var s;const t=f,a=e.toRef(t,"scrollContainer"),n=e.ref(),u=e.ref(30);function S(){if(!a.value||!n.value)return;const{totalSize:r,visibleSize:l,distance:o}=i.getScrollable(a.value,t.direction),c=o/(r+t.extraSize-l||1)*100;n.value.scroll(c)}e.watchEffect(()=>{const r=e.unref(a.value);if(!r)return;const{visibleSize:l,totalSize:o}=i.getScrollable(r,t.direction);u.value=i.ensureRangeValue(Math.min(l/(o+t.extraSize||1)*100)),r.addEventListener("scroll",S)},{flush:"post"});function p(r){const l=e.unref(a);if(!l)return;const{totalSize:o,visibleSize:c,topOrLeft:v}=i.getScrollable(l,t.direction);if(o<=c)return;const _=`scroll${v}`;l[_]=r*(o+t.extraSize-c)/100}return d({currentScroll:e.computed(()=>{var r;return e.unref((r=n.value)==null?void 0:r.currentScroll)}),scroll:(s=n.value)==null?void 0:s.scroll}),(r,l)=>(e.openBlock(),e.createBlock(h.default,e.mergeProps({ref_key:"barRef",ref:n,"bar-length":u.value},e.unref(b.omit)(t,["onScroll","extraSize","scrollContainer"]),{onScroll:p}),null,16,["bar-length"]))}});exports.default=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index.vue.js");exports.default=e.default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CSSProperties, Ref } from 'vue';
|
|
2
|
+
export type ScrollBarDirection = 'vertical' | 'horizontal';
|
|
3
|
+
export type ColorType = CSSProperties['background-color'];
|
|
4
|
+
export interface InternalScrollBarProps {
|
|
5
|
+
/**
|
|
6
|
+
* 滚动条的方向
|
|
7
|
+
*/
|
|
8
|
+
direction?: ScrollBarDirection;
|
|
9
|
+
/**
|
|
10
|
+
* 滚动条当前的位置(百分比值)
|
|
11
|
+
*/
|
|
12
|
+
scroll?: number;
|
|
13
|
+
/**
|
|
14
|
+
* 滚动条的长(高)度
|
|
15
|
+
*/
|
|
16
|
+
barLength?: number;
|
|
17
|
+
/**
|
|
18
|
+
* 滚动条的高(宽)度
|
|
19
|
+
*/
|
|
20
|
+
width?: number;
|
|
21
|
+
/**
|
|
22
|
+
* 滚动条的颜色
|
|
23
|
+
*/
|
|
24
|
+
barColor?: ColorType;
|
|
25
|
+
/**
|
|
26
|
+
* 滑轨的颜色
|
|
27
|
+
*/
|
|
28
|
+
trackColor?: ColorType;
|
|
29
|
+
/**
|
|
30
|
+
* 滑动滚到的长度
|
|
31
|
+
*/
|
|
32
|
+
trackWidth?: number;
|
|
33
|
+
/**
|
|
34
|
+
* 是否禁用
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 是否显示滑轨
|
|
39
|
+
*/
|
|
40
|
+
showTrack?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 点击滑轨滚动的速度
|
|
43
|
+
*/
|
|
44
|
+
trackSpeed?: number;
|
|
45
|
+
onScrollStart?: (percent: number) => void;
|
|
46
|
+
onScroll?: (percent: number) => void;
|
|
47
|
+
onScrollEnd?: (percent: number) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface ScrollBarProps extends Omit<InternalScrollBarProps, 'barLength'> {
|
|
50
|
+
/**
|
|
51
|
+
* 可滚动容器
|
|
52
|
+
*/
|
|
53
|
+
scrollContainer?: HTMLElement;
|
|
54
|
+
/**
|
|
55
|
+
* 额外的尺寸(宽/高)
|
|
56
|
+
*/
|
|
57
|
+
extraSize?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface InternalScrollBarExpose {
|
|
60
|
+
currentScroll: Ref<number>;
|
|
61
|
+
container: Ref<HTMLElement>;
|
|
62
|
+
track: Ref<HTMLElement>;
|
|
63
|
+
bar: Ref<HTMLElement>;
|
|
64
|
+
scroll: (percent: number) => void;
|
|
65
|
+
}
|
|
66
|
+
export type ScrollBarExpose = Pick<InternalScrollBarExpose, 'scroll' | 'currentScroll'>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InternalScrollBarProps, ScrollBarDirection } from './interface';
|
|
2
|
+
import { DefineComponent, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
declare function scroll(percent: number): void;
|
|
4
|
+
declare const _default: DefineComponent<InternalScrollBarProps, {
|
|
5
|
+
currentScroll: Ref<number, number>;
|
|
6
|
+
container: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
7
|
+
bar: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
8
|
+
track: Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
9
|
+
scroll: typeof scroll;
|
|
10
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<InternalScrollBarProps> & Readonly<{}>, {
|
|
11
|
+
scroll: number;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
direction: ScrollBarDirection;
|
|
14
|
+
barLength: number;
|
|
15
|
+
showTrack: boolean;
|
|
16
|
+
trackSpeed: number;
|
|
17
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
18
|
+
container: HTMLDivElement;
|
|
19
|
+
track: HTMLDivElement;
|
|
20
|
+
bar: HTMLDivElement;
|
|
21
|
+
}, HTMLDivElement>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue");require("../config-provider/index.js");const T=require("./hooks/use-track.js"),p=require("./utils/index.js"),P=require("../config-provider/hooks/use-namespace.js"),B=t.defineComponent({__name:"internal",props:{direction:{default:"vertical"},scroll:{default:0},barLength:{default:35},width:{},barColor:{},trackColor:{},trackWidth:{},disabled:{type:Boolean,default:!1},showTrack:{type:Boolean,default:!0},trackSpeed:{default:2},onScrollStart:{},onScroll:{},onScrollEnd:{}},setup(y,{expose:E}){const n=y,h=t.ref(),c=t.ref(),l=t.ref(),{b:L,e:b,m:C,em:u,cssVar:R}=P.useNamespace("scroll-bar"),o=t.ref(n.scroll),{handleMouseDown:k}=T.useTrack({currentScroll:o,track:c,bar:l,type:t.toRef(n,"direction"),trackSpeed:t.toRef(n,"trackSpeed"),barLength:t.toRef(n,"barLength"),disabled:t.toRef(n,"disabled"),onDown:e=>{var r;(r=n.onScrollStart)==null||r.call(n,e)},onUp:e=>{var r;(r=n.onScrollEnd)==null||r.call(n,e)},onScroll:e=>{var r;(r=n.onScroll)==null||r.call(n,e)}});t.watch(()=>n.scroll,e=>{o.value=e}),t.watchEffect(()=>{if(!t.unref(l))return;const e=`${(100-n.barLength)*o.value/n.barLength}%`,r=`${n.barLength}%`;n.direction==="vertical"?(l.value.style.height=r,l.value.style.transform=`translate3d(0, ${e}, 0)`):(l.value.style.width=r,l.value.style.transform=`translate3d(${e}, 0, 0)`)});let f,s,d;function M(e){var w;if(n.disabled||e.button!==0)return;e.preventDefault(),e.stopPropagation();const r=t.unref(c),i=t.unref(l);if(!r||!i)return;document.addEventListener("pointermove",v),document.addEventListener("pointerup",m);const a=r.getBoundingClientRect(),S=i.getBoundingClientRect();n.direction==="vertical"?(f=a.height,s=S.top-a.top,d=e.clientY):(f=a.width,s=S.left-a.left,d=e.clientX),(w=n.onScrollStart)==null||w.call(n,t.unref(o))}function v(e){var a;e.stopPropagation(),e.preventDefault();let r;n.direction==="vertical"?r=s+e.clientY-d:r=s+e.clientX-d;const i=r/f/(100-n.barLength)*1e4;o.value=p.ensureRangeValue(i),(a=n.onScroll)==null||a.call(n,t.unref(o))}function m(e){var r;e.preventDefault(),document.removeEventListener("pointermove",v),document.removeEventListener("pointerup",m),(r=n.onScrollEnd)==null||r.call(n,t.unref(o))}function g(e){e.cancelable&&(e.stopPropagation(),e.preventDefault())}function D(e){Math.abs(t.unref(o)-e)<=.001||(o.value=p.ensureRangeValue(e))}return E({currentScroll:o,container:h,bar:l,track:c,scroll:D}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:h,class:t.normalizeClass([t.unref(L)(),t.unref(C)(e.direction)]),style:t.normalizeStyle(t.unref(R)({"bar-color":e.barColor,"track-color":e.trackColor,"bar-width":e.width?`${e.width}px`:void 0,"track-width":e.trackWidth?`${e.trackWidth}px`:void 0}))},[t.createElementVNode("div",{ref_key:"track",ref:c,class:t.normalizeClass([t.unref(b)("track"),e.disabled?t.unref(u)("track","disabled"):null,e.showTrack?null:t.unref(u)("track","hidden")]),onPointerdown:r[0]||(r[0]=(...i)=>t.unref(k)&&t.unref(k)(...i)),onTouchstart:g},null,34),t.createElementVNode("div",{ref_key:"bar",ref:l,class:t.normalizeClass([t.unref(b)("bar"),t.unref(u)("bar",e.direction),e.disabled?t.unref(u)("bar","disabled"):null]),onPointerdown:M,onTouchstart:g},null,34)],6))}});exports.default=B;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal.vue.js");exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui/theme/scroll-bar/index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui/theme/scroll-bar/index.less';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ScrollBarDirection } from '../interface';
|
|
2
|
+
/**
|
|
3
|
+
* 保证返回的值在[start,end]范围内
|
|
4
|
+
* @param target
|
|
5
|
+
* @param start
|
|
6
|
+
* @param end
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureRangeValue(target: number, start?: number, end?: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* 获得某个可滚动元素的一些关键数据
|
|
12
|
+
* @param dom 可滚动元素
|
|
13
|
+
* @param direction 滚动方向
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function getScrollable(dom: HTMLElement, direction: ScrollBarDirection): {
|
|
17
|
+
totalSize: number;
|
|
18
|
+
visibleSize: number;
|
|
19
|
+
distance: number;
|
|
20
|
+
topOrLeft: string;
|
|
21
|
+
widthOrHeight: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(e,t=0,l=100){return Math.max(t,Math.min(e,l))}function r(e,t){const l=t==="horizontal"?"Left":"Top",n=t==="horizontal"?"Width":"Height";return{totalSize:e[`scroll${n}`],visibleSize:e[`offset${n}`],distance:e[`scroll${l}`],topOrLeft:l,widthOrHeight:n}}exports.ensureRangeValue=o;exports.getScrollable=r;
|
package/package.json
CHANGED
package/theme/index.css
CHANGED
|
@@ -1720,36 +1720,51 @@ div.aplus-ap-info-layout-admin__header-shadow.aplus-ap-info-layout-admin__sticky
|
|
|
1720
1720
|
left: 0px;
|
|
1721
1721
|
top: -20px;
|
|
1722
1722
|
}
|
|
1723
|
-
.aplus-
|
|
1723
|
+
.aplus-scroll-bar {
|
|
1724
1724
|
position: relative;
|
|
1725
|
-
background-color: var(--ap-scroll-bar-background, rgba(0, 0, 0, 0.05));
|
|
1726
1725
|
}
|
|
1727
|
-
.aplus-
|
|
1728
|
-
|
|
1726
|
+
.aplus-scroll-bar--horizontal {
|
|
1727
|
+
width: 100%;
|
|
1728
|
+
height: var(--aplus-scroll-bar-track-width, 10px);
|
|
1729
1729
|
}
|
|
1730
|
-
.aplus-
|
|
1731
|
-
width: 10px;
|
|
1730
|
+
.aplus-scroll-bar--vertical {
|
|
1731
|
+
width: var(--aplus-scroll-bar-track-width, 10px);
|
|
1732
1732
|
height: 100%;
|
|
1733
1733
|
}
|
|
1734
|
-
.aplus-
|
|
1734
|
+
.aplus-scroll-bar__track {
|
|
1735
1735
|
position: absolute;
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1736
|
+
width: 100%;
|
|
1737
|
+
height: 100%;
|
|
1738
|
+
top: 0;
|
|
1739
|
+
inset-inline-start: 0;
|
|
1740
|
+
cursor: pointer;
|
|
1741
|
+
background-color: var(--aplus-scroll-bar-track-color, rgba(0, 0, 0, 0.05));
|
|
1740
1742
|
}
|
|
1741
|
-
.aplus-
|
|
1742
|
-
|
|
1743
|
-
|
|
1743
|
+
.aplus-scroll-bar__track--disabled {
|
|
1744
|
+
pointer-events: none;
|
|
1745
|
+
background-color: rgba(0, 0, 0, 0.02);
|
|
1744
1746
|
}
|
|
1745
|
-
.aplus-
|
|
1746
|
-
|
|
1747
|
-
|
|
1747
|
+
.aplus-scroll-bar__track--hidden {
|
|
1748
|
+
pointer-events: none;
|
|
1749
|
+
background-color: transparent;
|
|
1750
|
+
}
|
|
1751
|
+
.aplus-scroll-bar__bar {
|
|
1752
|
+
position: absolute;
|
|
1753
|
+
border-radius: var(--aplus-scroll-bar-bar-width, 8px);
|
|
1754
|
+
background-color: var(--aplus-scroll-bar-bar-color, #c7c8cc);
|
|
1755
|
+
cursor: pointer;
|
|
1756
|
+
}
|
|
1757
|
+
.aplus-scroll-bar__bar--disabled {
|
|
1758
|
+
pointer-events: none;
|
|
1759
|
+
box-shadow: none;
|
|
1760
|
+
}
|
|
1761
|
+
.aplus-scroll-bar__bar--horizontal {
|
|
1762
|
+
height: var(--aplus-scroll-bar-bar-width, 8px);
|
|
1763
|
+
top: calc(var(--aplus-scroll-bar-track-width, 10px) - var(--aplus-scroll-bar-bar-width, 8px));
|
|
1748
1764
|
}
|
|
1749
|
-
.aplus-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
background-color: var(--ap-scroll-bar-bar-active, rgba(144, 147, 153, 0.5));
|
|
1765
|
+
.aplus-scroll-bar__bar--vertical {
|
|
1766
|
+
width: var(--aplus-scroll-bar-bar-width, 8px);
|
|
1767
|
+
left: calc(var(--aplus-scroll-bar-track-width, 10px) / 2 - var(--aplus-scroll-bar-bar-width, 8px) / 2);
|
|
1753
1768
|
}
|
|
1754
1769
|
.aplus-ap-appendix__suffix {
|
|
1755
1770
|
width: 100%;
|
package/theme/index.less
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
@import './work-order-modal/index.less';
|
|
27
27
|
@import './ap-summary/index.less';
|
|
28
28
|
@import './ap-table-modal/index.less';
|
|
29
|
-
@import './
|
|
29
|
+
@import './scroll-bar/index.less';
|
|
30
30
|
@import './ap-appendix/ap-appendix.less';
|
|
31
31
|
@import './ap-group-search/ap-group-search.less';
|
|
32
32
|
@import './ap-group-search/ap-popover-select.less';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.aplus-scroll-bar {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.aplus-scroll-bar--horizontal {
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: var(--aplus-scroll-bar-track-width, 10px);
|
|
7
|
+
}
|
|
8
|
+
.aplus-scroll-bar--vertical {
|
|
9
|
+
width: var(--aplus-scroll-bar-track-width, 10px);
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
.aplus-scroll-bar__track {
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
top: 0;
|
|
17
|
+
inset-inline-start: 0;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
background-color: var(--aplus-scroll-bar-track-color, rgba(0, 0, 0, 0.05));
|
|
20
|
+
}
|
|
21
|
+
.aplus-scroll-bar__track--disabled {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
background-color: rgba(0, 0, 0, 0.02);
|
|
24
|
+
}
|
|
25
|
+
.aplus-scroll-bar__track--hidden {
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
background-color: transparent;
|
|
28
|
+
}
|
|
29
|
+
.aplus-scroll-bar__bar {
|
|
30
|
+
position: absolute;
|
|
31
|
+
border-radius: var(--aplus-scroll-bar-bar-width, 8px);
|
|
32
|
+
background-color: var(--aplus-scroll-bar-bar-color, #c7c8cc);
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
.aplus-scroll-bar__bar--disabled {
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
box-shadow: none;
|
|
38
|
+
}
|
|
39
|
+
.aplus-scroll-bar__bar--horizontal {
|
|
40
|
+
height: var(--aplus-scroll-bar-bar-width, 8px);
|
|
41
|
+
top: calc(var(--aplus-scroll-bar-track-width, 10px) - var(--aplus-scroll-bar-bar-width, 8px));
|
|
42
|
+
}
|
|
43
|
+
.aplus-scroll-bar__bar--vertical {
|
|
44
|
+
width: var(--aplus-scroll-bar-bar-width, 8px);
|
|
45
|
+
left: calc(var(--aplus-scroll-bar-track-width, 10px) / 2 - var(--aplus-scroll-bar-bar-width, 8px) / 2);
|
|
46
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import '../mixins/mixins.less';
|
|
2
|
+
@import '../mixins/config.less';
|
|
3
|
+
|
|
4
|
+
@bar: ~'@{ns}-scroll-bar__bar--disabled';
|
|
5
|
+
@bc: ~'--@{ns}-scroll-bar-bar-color';
|
|
6
|
+
@tc: ~'--@{ns}-scroll-bar-track-color';
|
|
7
|
+
@bw: ~'--@{ns}-scroll-bar-bar-width';
|
|
8
|
+
@tw: ~'--@{ns}-scroll-bar-track-width';
|
|
9
|
+
|
|
10
|
+
.b('scroll-bar', {
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
&--horizontal {
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: var(@tw, 10px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--vertical {
|
|
19
|
+
width: var(@tw, 10px);
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__track {
|
|
24
|
+
position: absolute;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
top: 0;
|
|
28
|
+
inset-inline-start: 0;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
background-color: var(@tc, rgb(0 0 0 / 5%));
|
|
31
|
+
&--disabled {
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
background-color: rgb(0 0 0 / 2%);
|
|
34
|
+
}
|
|
35
|
+
&--hidden {
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__bar {
|
|
42
|
+
position: absolute;
|
|
43
|
+
border-radius: var(@bw, 8px);
|
|
44
|
+
background-color: var(@bc, #c7c8cc);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
|
|
47
|
+
&--disabled {
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
box-shadow: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&--horizontal {
|
|
53
|
+
height: var(@bw, 8px);
|
|
54
|
+
top: calc(var(@tw, 10px) - var(@bw, 8px));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--vertical {
|
|
58
|
+
width: var(@bw, 8px);
|
|
59
|
+
left: calc(var(@tw, 10px) / 2 - var(@bw, 8px) / 2);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ApScrollBarProps } from './interface';
|
|
2
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
-
declare const _default: DefineComponent<ApScrollBarProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApScrollBarProps> & Readonly<{}>, {
|
|
4
|
-
type: "horizontal" | "vertical";
|
|
5
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
6
|
-
containerRef: HTMLDivElement;
|
|
7
|
-
}, HTMLDivElement>;
|
|
8
|
-
export default _default;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { defineComponent as O, ref as a, nextTick as $, onMounted as Q, watch as Z, onUnmounted as ee, openBlock as te, createElementBlock as le, normalizeClass as N, unref as u, normalizeStyle as U, createElementVNode as oe } from "vue";
|
|
2
|
-
import "../config-provider/index.mjs";
|
|
3
|
-
import { Subject as ae, fromEvent as v, map as _, takeUntil as h, throttleTime as X, concatAll as Y, withLatestFrom as ne } from "rxjs";
|
|
4
|
-
import { useNamespace as ce } from "../config-provider/hooks/use-namespace.mjs";
|
|
5
|
-
const ve = /* @__PURE__ */ O({
|
|
6
|
-
__name: "ap-scroll-bar",
|
|
7
|
-
props: {
|
|
8
|
-
target: {},
|
|
9
|
-
type: {
|
|
10
|
-
default: "horizontal"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
setup(j) {
|
|
14
|
-
const o = j, r = a(), H = a(0), T = a(0), p = a(0), d = a(0), g = a(), y = a(), b = a(), W = a(), t = a(), w = a(!1), f = new ae(), z = a();
|
|
15
|
-
let k = 0, B = 0;
|
|
16
|
-
const E = (e) => e / y.value, S = (e) => e * y.value, R = () => {
|
|
17
|
-
if (t.value)
|
|
18
|
-
if (o.type === "horizontal") {
|
|
19
|
-
const e = t.value.scrollWidth, l = t.value.clientWidth;
|
|
20
|
-
w.value = l >= e;
|
|
21
|
-
} else {
|
|
22
|
-
const e = t.value.scrollHeight, l = t.value.clientHeight;
|
|
23
|
-
w.value = l >= e;
|
|
24
|
-
}
|
|
25
|
-
}, L = () => {
|
|
26
|
-
if (t.value && r.value)
|
|
27
|
-
if (o.type === "horizontal") {
|
|
28
|
-
const e = t.value.scrollWidth, l = t.value.clientWidth, n = t.value.scrollLeft, s = r.value.clientWidth;
|
|
29
|
-
g.value = l / e, y.value = s / e, H.value = Math.round(s * g.value), p.value = S(n);
|
|
30
|
-
} else {
|
|
31
|
-
const e = t.value.scrollHeight, l = t.value.clientHeight, n = t.value.scrollTop, s = r.value.clientHeight;
|
|
32
|
-
g.value = l / e, y.value = s / e, T.value = Math.floor(s * g.value), d.value = E(n);
|
|
33
|
-
}
|
|
34
|
-
}, P = () => {
|
|
35
|
-
const e = v(W.value, "mousedown"), l = v(b.value, "mousemove"), n = v(b.value, "mouseup"), s = v(b.value, "selectstart");
|
|
36
|
-
e.pipe(_(() => s.pipe(h(n), h(f), X(16))), Y()).subscribe((c) => c.preventDefault()), e.pipe(_(() => l.pipe(h(n), h(f), X(16))), Y(), ne(e), _(([c, x]) => {
|
|
37
|
-
console.log("move!!!", c);
|
|
38
|
-
const m = c, i = x, C = m.pageX - z.value.left - i.offsetX, M = m.pageY - z.value.top - i.offsetY, J = r.value.clientWidth, K = r.value.clientHeight;
|
|
39
|
-
return {
|
|
40
|
-
x: C > 0 ? Math.min(C, J - H.value) : Math.max(C, 0),
|
|
41
|
-
y: M > 0 ? Math.min(M, K - T.value) : Math.max(M, 0)
|
|
42
|
-
};
|
|
43
|
-
})).subscribe((c) => {
|
|
44
|
-
var x, m;
|
|
45
|
-
if (o.type === "horizontal") {
|
|
46
|
-
const i = E(c.x);
|
|
47
|
-
c.x !== p.value && t.value && ((x = t.value) == null || x.scrollTo({
|
|
48
|
-
left: i
|
|
49
|
-
})), p.value = c.x;
|
|
50
|
-
} else {
|
|
51
|
-
const i = E(c.y);
|
|
52
|
-
c.y !== d.value && t.value && ((m = t.value) == null || m.scrollTo({
|
|
53
|
-
top: i
|
|
54
|
-
})), d.value = c.y;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}, q = () => {
|
|
58
|
-
t.value && v(t.value, "scroll").pipe(h(f)).subscribe((l) => {
|
|
59
|
-
var s;
|
|
60
|
-
const n = l.target;
|
|
61
|
-
n && o.type === "horizontal" && (k = n.scrollLeft, p.value = S(k)), n && o.type === "vertical" && B !== ((s = t == null ? void 0 : t.value) == null ? void 0 : s.scrollTop) && (B = n.scrollTop, d.value = S(B));
|
|
62
|
-
});
|
|
63
|
-
}, A = () => {
|
|
64
|
-
v(window, "resize").pipe(h(f)).subscribe(() => {
|
|
65
|
-
R(), $(() => {
|
|
66
|
-
var l;
|
|
67
|
-
z.value = (l = r.value) == null ? void 0 : l.getBoundingClientRect(), L();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}, F = () => {
|
|
71
|
-
console.log("targetEle.value", t.value), t.value && W.value && (R(), $(() => {
|
|
72
|
-
var e;
|
|
73
|
-
z.value = (e = r.value) == null ? void 0 : e.getBoundingClientRect(), L(), P(), q(), A();
|
|
74
|
-
}));
|
|
75
|
-
};
|
|
76
|
-
Q(() => {
|
|
77
|
-
Z(() => o.target, () => {
|
|
78
|
-
$(() => {
|
|
79
|
-
var e, l;
|
|
80
|
-
typeof o.target == "string" ? t.value = document.querySelector(o.target) : t.value = (e = o.target) == null ? void 0 : e.call(o), b.value = (l = document.getElementsByTagName("body")) == null ? void 0 : l[0], W.value = document.getElementById("bar"), F();
|
|
81
|
-
});
|
|
82
|
-
}, {
|
|
83
|
-
immediate: !0
|
|
84
|
-
});
|
|
85
|
-
}), ee(() => {
|
|
86
|
-
f.next(0);
|
|
87
|
-
});
|
|
88
|
-
const {
|
|
89
|
-
b: V,
|
|
90
|
-
e: G,
|
|
91
|
-
m: D,
|
|
92
|
-
em: I
|
|
93
|
-
} = ce("ap-scroll-bar");
|
|
94
|
-
return (e, l) => (te(), le("div", {
|
|
95
|
-
ref_key: "containerRef",
|
|
96
|
-
ref: r,
|
|
97
|
-
class: N(`${u(V)()} ${o.type === "horizontal" ? u(D)("horizontal") : u(D)("vertical")}`),
|
|
98
|
-
style: U({
|
|
99
|
-
display: w.value ? "none" : "block"
|
|
100
|
-
})
|
|
101
|
-
}, [oe("div", {
|
|
102
|
-
id: "bar",
|
|
103
|
-
class: N(`${u(G)("bar")} ${o.type === "horizontal" ? u(I)("bar", "horizontal") : u(I)("bar", "vertical")}`),
|
|
104
|
-
style: U(o.type === "horizontal" ? {
|
|
105
|
-
width: `${H.value}px`,
|
|
106
|
-
left: `${p.value}px`
|
|
107
|
-
} : {
|
|
108
|
-
height: `${T.value}px`,
|
|
109
|
-
top: `${d.value}px`
|
|
110
|
-
})
|
|
111
|
-
}, null, 6)], 6));
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
export {
|
|
115
|
-
ve as default
|
|
116
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CreateComponentPublicInstanceWithMixins, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps, Plugin } from 'vue';
|
|
2
|
-
import { ApScrollBarProps } from './interface';
|
|
3
|
-
export * from './interface';
|
|
4
|
-
declare const ApScrollBar: {
|
|
5
|
-
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
6
|
-
type: "horizontal" | "vertical";
|
|
7
|
-
}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {
|
|
8
|
-
containerRef: HTMLDivElement;
|
|
9
|
-
}, HTMLDivElement, ComponentProvideOptions, {
|
|
10
|
-
P: {};
|
|
11
|
-
B: {};
|
|
12
|
-
D: {};
|
|
13
|
-
C: {};
|
|
14
|
-
M: {};
|
|
15
|
-
Defaults: {};
|
|
16
|
-
}, Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, {
|
|
17
|
-
type: "horizontal" | "vertical";
|
|
18
|
-
}>;
|
|
19
|
-
__isFragment?: never;
|
|
20
|
-
__isTeleport?: never;
|
|
21
|
-
__isSuspense?: never;
|
|
22
|
-
} & ComponentOptionsBase<Readonly< ApScrollBarProps> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
23
|
-
type: "horizontal" | "vertical";
|
|
24
|
-
}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
25
|
-
$props: {
|
|
26
|
-
onClick?: () => void;
|
|
27
|
-
};
|
|
28
|
-
}));
|
|
29
|
-
export { ApScrollBar };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@aplus-frontend/ui/theme/ap-scroll-bar/index.css';
|