@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.
Files changed (83) hide show
  1. package/es/index.mjs +158 -152
  2. package/es/src/business/ap-table-modal/table-modal.vue2.mjs +8 -4
  3. package/es/src/config-provider/hooks/use-namespace.d.ts +1 -1
  4. package/es/src/config-provider/hooks/use-namespace.mjs +3 -3
  5. package/es/src/hooks/index.d.ts +2 -0
  6. package/es/src/hooks/index.mjs +7 -3
  7. package/es/src/hooks/useManualRef.d.ts +6 -0
  8. package/es/src/hooks/useManualRef.mjs +27 -0
  9. package/es/src/hooks/useThrottleRef.d.ts +2 -0
  10. package/es/src/hooks/useThrottleRef.mjs +31 -0
  11. package/es/src/index.d.ts +1 -1
  12. package/es/src/index.mjs +231 -228
  13. package/es/src/path-map.mjs +1 -1
  14. package/es/src/scroll-bar/hooks/use-track.d.ts +30 -0
  15. package/es/src/scroll-bar/hooks/use-track.mjs +76 -0
  16. package/es/src/scroll-bar/index.d.ts +4 -0
  17. package/es/src/scroll-bar/index.mjs +3 -0
  18. package/es/src/scroll-bar/index.vue.d.ts +52 -0
  19. package/es/src/scroll-bar/index.vue.mjs +77 -0
  20. package/es/src/scroll-bar/index.vue2.mjs +4 -0
  21. package/es/src/scroll-bar/interface.d.ts +66 -0
  22. package/es/src/scroll-bar/internal.vue.d.ts +22 -0
  23. package/es/src/scroll-bar/internal.vue.mjs +132 -0
  24. package/es/src/scroll-bar/internal.vue2.mjs +4 -0
  25. package/es/src/scroll-bar/style/css.js +1 -0
  26. package/es/src/scroll-bar/style/index.js +1 -0
  27. package/es/src/scroll-bar/utils/index.d.ts +22 -0
  28. package/es/src/scroll-bar/utils/index.mjs +17 -0
  29. package/lib/index.js +1 -1
  30. package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
  31. package/lib/src/config-provider/hooks/use-namespace.d.ts +1 -1
  32. package/lib/src/config-provider/hooks/use-namespace.js +1 -1
  33. package/lib/src/hooks/index.d.ts +2 -0
  34. package/lib/src/hooks/index.js +1 -1
  35. package/lib/src/hooks/useManualRef.d.ts +6 -0
  36. package/lib/src/hooks/useManualRef.js +1 -0
  37. package/lib/src/hooks/useThrottleRef.d.ts +2 -0
  38. package/lib/src/hooks/useThrottleRef.js +1 -0
  39. package/lib/src/index.d.ts +1 -1
  40. package/lib/src/index.js +1 -1
  41. package/lib/src/path-map.js +1 -1
  42. package/lib/src/scroll-bar/hooks/use-track.d.ts +30 -0
  43. package/lib/src/scroll-bar/hooks/use-track.js +1 -0
  44. package/lib/src/scroll-bar/index.d.ts +4 -0
  45. package/lib/src/scroll-bar/index.js +1 -0
  46. package/lib/src/scroll-bar/index.vue.d.ts +52 -0
  47. package/lib/src/scroll-bar/index.vue.js +1 -0
  48. package/lib/src/scroll-bar/index.vue2.js +1 -0
  49. package/lib/src/scroll-bar/interface.d.ts +66 -0
  50. package/lib/src/scroll-bar/internal.vue.d.ts +22 -0
  51. package/lib/src/scroll-bar/internal.vue.js +1 -0
  52. package/lib/src/scroll-bar/internal.vue2.js +1 -0
  53. package/lib/src/scroll-bar/style/css.cjs +1 -0
  54. package/lib/src/scroll-bar/style/index.cjs +1 -0
  55. package/lib/src/scroll-bar/utils/index.d.ts +22 -0
  56. package/lib/src/scroll-bar/utils/index.js +1 -0
  57. package/package.json +1 -1
  58. package/theme/index.css +36 -21
  59. package/theme/index.less +1 -1
  60. package/theme/scroll-bar/index.css +46 -0
  61. package/theme/scroll-bar/index.less +62 -0
  62. package/es/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +0 -8
  63. package/es/src/ap-scroll-bar/ap-scroll-bar.vue.mjs +0 -4
  64. package/es/src/ap-scroll-bar/ap-scroll-bar.vue2.mjs +0 -116
  65. package/es/src/ap-scroll-bar/index.d.ts +0 -29
  66. package/es/src/ap-scroll-bar/index.mjs +0 -8
  67. package/es/src/ap-scroll-bar/interface.d.ts +0 -4
  68. package/es/src/ap-scroll-bar/style/css.js +0 -1
  69. package/es/src/ap-scroll-bar/style/index.js +0 -1
  70. package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.d.ts +0 -8
  71. package/lib/src/ap-scroll-bar/ap-scroll-bar.vue.js +0 -1
  72. package/lib/src/ap-scroll-bar/ap-scroll-bar.vue2.js +0 -1
  73. package/lib/src/ap-scroll-bar/index.d.ts +0 -29
  74. package/lib/src/ap-scroll-bar/index.js +0 -1
  75. package/lib/src/ap-scroll-bar/interface.d.ts +0 -4
  76. package/lib/src/ap-scroll-bar/style/css.cjs +0 -1
  77. package/lib/src/ap-scroll-bar/style/index.cjs +0 -1
  78. /package/es/src/{ap-scroll-bar → scroll-bar}/interface.mjs +0 -0
  79. /package/es/src/{ap-scroll-bar → scroll-bar}/style/css.d.ts +0 -0
  80. /package/es/src/{ap-scroll-bar → scroll-bar}/style/index.d.ts +0 -0
  81. /package/lib/src/{ap-scroll-bar → scroll-bar}/interface.js +0 -0
  82. /package/lib/src/{ap-scroll-bar → scroll-bar}/style/css.d.ts +0 -0
  83. /package/lib/src/{ap-scroll-bar → scroll-bar}/style/index.d.ts +0 -0
@@ -1 +0,0 @@
1
- import '@aplus-frontend/ui/theme/ap-scroll-bar/index.less';
@@ -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 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ap-scroll-bar.vue2.js");exports.default=e.default;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../config-provider/index.js");const o=require("rxjs"),X=require("../config-provider/hooks/use-namespace.js"),Y=e.defineComponent({__name:"ap-scroll-bar",props:{target:{},type:{default:"horizontal"}},setup($){const a=$,i=e.ref(),z=e.ref(0),T=e.ref(0),v=e.ref(0),f=e.ref(0),d=e.ref(),p=e.ref(),g=e.ref(),x=e.ref(),l=e.ref(),E=e.ref(!1),h=new o.Subject,y=e.ref();let w=0,H=0;const W=t=>t/p.value,k=t=>t*p.value,B=()=>{if(l.value)if(a.type==="horizontal"){const t=l.value.scrollWidth,n=l.value.clientWidth;E.value=n>=t}else{const t=l.value.scrollHeight,n=l.value.clientHeight;E.value=n>=t}},C=()=>{if(l.value&&i.value)if(a.type==="horizontal"){const t=l.value.scrollWidth,n=l.value.clientWidth,r=l.value.scrollLeft,s=i.value.clientWidth;d.value=n/t,p.value=s/t,z.value=Math.round(s*d.value),v.value=k(r)}else{const t=l.value.scrollHeight,n=l.value.clientHeight,r=l.value.scrollTop,s=i.value.clientHeight;d.value=n/t,p.value=s/t,T.value=Math.floor(s*d.value),f.value=W(r)}},R=()=>{const t=o.fromEvent(x.value,"mousedown"),n=o.fromEvent(g.value,"mousemove"),r=o.fromEvent(g.value,"mouseup"),s=o.fromEvent(g.value,"selectstart");t.pipe(o.map(()=>s.pipe(o.takeUntil(r),o.takeUntil(h),o.throttleTime(16))),o.concatAll()).subscribe(c=>c.preventDefault()),t.pipe(o.map(()=>n.pipe(o.takeUntil(r),o.takeUntil(h),o.throttleTime(16))),o.concatAll(),o.withLatestFrom(t),o.map(([c,b])=>{console.log("move!!!",c);const m=c,u=b,S=m.pageX-y.value.left-u.offsetX,M=m.pageY-y.value.top-u.offsetY,I=i.value.clientWidth,P=i.value.clientHeight;return{x:S>0?Math.min(S,I-z.value):Math.max(S,0),y:M>0?Math.min(M,P-T.value):Math.max(M,0)}})).subscribe(c=>{var b,m;if(a.type==="horizontal"){const u=W(c.x);c.x!==v.value&&l.value&&((b=l.value)==null||b.scrollTo({left:u})),v.value=c.x}else{const u=W(c.y);c.y!==f.value&&l.value&&((m=l.value)==null||m.scrollTo({top:u})),f.value=c.y}})},q=()=>{l.value&&o.fromEvent(l.value,"scroll").pipe(o.takeUntil(h)).subscribe(n=>{var s;const r=n.target;r&&a.type==="horizontal"&&(w=r.scrollLeft,v.value=k(w)),r&&a.type==="vertical"&&H!==((s=l==null?void 0:l.value)==null?void 0:s.scrollTop)&&(H=r.scrollTop,f.value=k(H))})},L=()=>{o.fromEvent(window,"resize").pipe(o.takeUntil(h)).subscribe(()=>{B(),e.nextTick(()=>{var n;y.value=(n=i.value)==null?void 0:n.getBoundingClientRect(),C()})})},j=()=>{console.log("targetEle.value",l.value),l.value&&x.value&&(B(),e.nextTick(()=>{var t;y.value=(t=i.value)==null?void 0:t.getBoundingClientRect(),C(),R(),q(),L()}))};e.onMounted(()=>{e.watch(()=>a.target,()=>{e.nextTick(()=>{var t,n;typeof a.target=="string"?l.value=document.querySelector(a.target):l.value=(t=a.target)==null?void 0:t.call(a),g.value=(n=document.getElementsByTagName("body"))==null?void 0:n[0],x.value=document.getElementById("bar"),j()})},{immediate:!0})}),e.onUnmounted(()=>{h.next(0)});const{b:N,e:D,m:_,em:U}=X.useNamespace("ap-scroll-bar");return(t,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:i,class:e.normalizeClass(`${e.unref(N)()} ${a.type==="horizontal"?e.unref(_)("horizontal"):e.unref(_)("vertical")}`),style:e.normalizeStyle({display:E.value?"none":"block"})},[e.createElementVNode("div",{id:"bar",class:e.normalizeClass(`${e.unref(D)("bar")} ${a.type==="horizontal"?e.unref(U)("bar","horizontal"):e.unref(U)("bar","vertical")}`),style:e.normalizeStyle(a.type==="horizontal"?{width:`${z.value}px`,left:`${v.value}px`}:{height:`${T.value}px`,top:`${f.value}px`})},null,6)],6))}});exports.default=Y;
@@ -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
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./interface.js");const e=require("@aplus-frontend/utils");require("./ap-scroll-bar.vue.js");const r=require("./ap-scroll-bar.vue2.js"),t=e.withInstall(r.default);exports.ApScrollBar=t;
@@ -1,4 +0,0 @@
1
- export interface ApScrollBarProps {
2
- target: string | (() => Element);
3
- type?: 'horizontal' | 'vertical';
4
- }
@@ -1 +0,0 @@
1
- import '@aplus-frontend/ui/theme/ap-scroll-bar/index.css';
@@ -1 +0,0 @@
1
- import '@aplus-frontend/ui/theme/ap-scroll-bar/index.less';