hzzt-plus 2.0.1 → 2.0.2
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +351 -236
- package/dist/index.full.min.js +12 -12
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +15 -15
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +349 -237
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/es/component.mjs +3 -1
- package/es/component.mjs.map +1 -1
- package/es/components/index.d.ts +1 -0
- package/es/components/index.mjs +2 -0
- package/es/components/index.mjs.map +1 -1
- package/es/components/lazy-list/index.d.ts +5 -0
- package/es/components/lazy-list/index.mjs +9 -0
- package/es/components/lazy-list/index.mjs.map +1 -0
- package/es/components/lazy-list/src/lazy-list.d.ts +14 -0
- package/es/components/lazy-list/src/lazy-list.mjs +27 -0
- package/es/components/lazy-list/src/lazy-list.mjs.map +1 -0
- package/es/components/lazy-list/src/lazy-list.vue.d.ts +57 -0
- package/es/components/lazy-list/src/lazy-list2.mjs +85 -0
- package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -0
- package/es/components/lazy-list/style/css.d.ts +2 -0
- package/es/components/lazy-list/style/css.mjs +3 -0
- package/es/components/lazy-list/style/css.mjs.map +1 -0
- package/es/components/lazy-list/style/index.d.ts +2 -0
- package/es/components/lazy-list/style/index.mjs +3 -0
- package/es/components/lazy-list/style/index.mjs.map +1 -0
- package/es/components/scroll/index.mjs +2 -2
- package/es/components/scroll/src/scroll.mjs +0 -86
- package/es/components/scroll/src/scroll.mjs.map +1 -1
- package/es/components/scroll/src/scroll2.mjs +86 -0
- package/es/components/scroll/src/scroll2.mjs.map +1 -1
- package/es/components/select/src/select.vue.d.ts +1 -0
- package/es/components/select/src/select2.mjs +11 -1
- package/es/components/select/src/select2.mjs.map +1 -1
- package/es/index.mjs +2 -0
- package/es/index.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/global.d.ts +1 -0
- package/lib/component.js +3 -1
- package/lib/component.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +5 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/lazy-list/index.d.ts +5 -0
- package/lib/components/lazy-list/index.js +16 -0
- package/lib/components/lazy-list/index.js.map +1 -0
- package/lib/components/lazy-list/src/lazy-list.d.ts +14 -0
- package/lib/components/lazy-list/src/lazy-list.js +32 -0
- package/lib/components/lazy-list/src/lazy-list.js.map +1 -0
- package/lib/components/lazy-list/src/lazy-list.vue.d.ts +57 -0
- package/lib/components/lazy-list/src/lazy-list2.js +89 -0
- package/lib/components/lazy-list/src/lazy-list2.js.map +1 -0
- package/lib/components/lazy-list/style/css.d.ts +2 -0
- package/lib/components/lazy-list/style/css.js +6 -0
- package/lib/components/lazy-list/style/css.js.map +1 -0
- package/lib/components/lazy-list/style/index.d.ts +2 -0
- package/lib/components/lazy-list/style/index.js +6 -0
- package/lib/components/lazy-list/style/index.js.map +1 -0
- package/lib/components/scroll/index.js +2 -2
- package/lib/components/scroll/src/scroll.js +0 -89
- package/lib/components/scroll/src/scroll.js.map +1 -1
- package/lib/components/scroll/src/scroll2.js +89 -0
- package/lib/components/scroll/src/scroll2.js.map +1 -1
- package/lib/components/select/src/select.vue.d.ts +1 -0
- package/lib/components/select/src/select2.js +11 -1
- package/lib/components/select/src/select2.js.map +1 -1
- package/lib/index.js +35 -30
- package/lib/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/tags.json +1 -1
- package/theme/hzzt-lazy-list.css +1 -0
- package/theme/index.css +1 -1
- package/theme/src/index.scss +1 -0
- package/theme/src/lazy-list.scss +21 -0
- package/web-types.json +1 -1
package/dist/locale/en.js
CHANGED
package/dist/locale/en.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.2 */(function(e,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis!="undefined"?globalThis:e||self,e.HzztPlusLocaleEn=r())})(this,function(){"use strict";var e={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};return e});
|
|
2
2
|
//# sourceMappingURL=en.min.js.map
|
package/dist/locale/en.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.2 */var r={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};export{r as default};
|
|
2
2
|
//# sourceMappingURL=en.min.mjs.map
|
package/dist/locale/en.mjs
CHANGED
package/dist/locale/zh-cn.js
CHANGED
package/dist/locale/zh-cn.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.2 */(function(u,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e():typeof define=="function"&&define.amd?define(e):(u=typeof globalThis!="undefined"?globalThis:u||self,u.HzztPlusLocaleZhCn=e())})(this,function(){"use strict";var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};return u});
|
|
2
2
|
//# sourceMappingURL=zh-cn.min.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.2 */var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};export{u as default};
|
|
2
2
|
//# sourceMappingURL=zh-cn.min.mjs.map
|
package/dist/locale/zh-cn.mjs
CHANGED
package/es/component.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { HzztCascader } from './components/cascader/index.mjs';
|
|
|
18
18
|
import { HzztSelect } from './components/select/index.mjs';
|
|
19
19
|
import { HzztClickInput } from './components/click-input/index.mjs';
|
|
20
20
|
import { HzztScroll } from './components/scroll/index.mjs';
|
|
21
|
+
import { HzztLazyList } from './components/lazy-list/index.mjs';
|
|
21
22
|
|
|
22
23
|
var Components = [
|
|
23
24
|
HzztConfigProvider,
|
|
@@ -39,7 +40,8 @@ var Components = [
|
|
|
39
40
|
HzztCascader,
|
|
40
41
|
HzztSelect,
|
|
41
42
|
HzztClickInput,
|
|
42
|
-
HzztScroll
|
|
43
|
+
HzztScroll,
|
|
44
|
+
HzztLazyList
|
|
43
45
|
];
|
|
44
46
|
|
|
45
47
|
export { Components as default };
|
package/es/component.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.mjs","sources":["../../../packages/hzzt-plus/component.ts"],"sourcesContent":["import { HzztTitle } from '@hzzt-plus/components/title'\nimport { HzztDropdown } from '@hzzt-plus/components/dropdown'\nimport { HzztCollapse } from '@hzzt-plus/components/collapse'\nimport { HzztConfigProvider } from '@hzzt-plus/components/config-provider'\nimport { HzztTab } from '@hzzt-plus/components/tab'\nimport { HzztIcon } from '@hzzt-plus/components/icon'\nimport { HzztPagination } from '@hzzt-plus/components/pagination'\nimport { HzztTooltip } from '@hzzt-plus/components/tooltip'\nimport { HzztPageSize } from '@hzzt-plus/components/page-size'\nimport { HzztConfirmPassword } from '@hzzt-plus/components/confirm-password'\nimport { HzztCheckButton } from '@hzzt-plus/components/check-button'\nimport { HzztQuarterPicker } from '@hzzt-plus/components/quarter-picker'\nimport { HzztScan } from '@hzzt-plus/components/scan'\nimport { HzztSelectInput } from '@hzzt-plus/components/select-input'\nimport { HzztSelectTextarea } from '@hzzt-plus/components/select-textarea'\nimport { HzztInputRange } from '@hzzt-plus/components/input-range'\nimport { HzztCascader } from '@hzzt-plus/components/cascader'\nimport { HzztSelect } from '@hzzt-plus/components/select'\nimport { HzztClickInput } from '@hzzt-plus/components/click-input'\nimport { HzztScroll } from '@hzzt-plus/components/scroll'\n\nimport type { Plugin } from 'vue'\n\nexport default [\n HzztConfigProvider,\n HzztTitle,\n HzztDropdown,\n HzztCollapse,\n HzztTab,\n HzztIcon,\n HzztPagination,\n HzztTooltip,\n HzztPageSize,\n HzztConfirmPassword,\n HzztCheckButton,\n HzztQuarterPicker,\n HzztScan,\n HzztSelectInput,\n HzztSelectTextarea,\n HzztInputRange,\n HzztCascader,\n HzztSelect,\n HzztClickInput,\n HzztScroll,\n] as Plugin[]\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.mjs","sources":["../../../packages/hzzt-plus/component.ts"],"sourcesContent":["import { HzztTitle } from '@hzzt-plus/components/title'\nimport { HzztDropdown } from '@hzzt-plus/components/dropdown'\nimport { HzztCollapse } from '@hzzt-plus/components/collapse'\nimport { HzztConfigProvider } from '@hzzt-plus/components/config-provider'\nimport { HzztTab } from '@hzzt-plus/components/tab'\nimport { HzztIcon } from '@hzzt-plus/components/icon'\nimport { HzztPagination } from '@hzzt-plus/components/pagination'\nimport { HzztTooltip } from '@hzzt-plus/components/tooltip'\nimport { HzztPageSize } from '@hzzt-plus/components/page-size'\nimport { HzztConfirmPassword } from '@hzzt-plus/components/confirm-password'\nimport { HzztCheckButton } from '@hzzt-plus/components/check-button'\nimport { HzztQuarterPicker } from '@hzzt-plus/components/quarter-picker'\nimport { HzztScan } from '@hzzt-plus/components/scan'\nimport { HzztSelectInput } from '@hzzt-plus/components/select-input'\nimport { HzztSelectTextarea } from '@hzzt-plus/components/select-textarea'\nimport { HzztInputRange } from '@hzzt-plus/components/input-range'\nimport { HzztCascader } from '@hzzt-plus/components/cascader'\nimport { HzztSelect } from '@hzzt-plus/components/select'\nimport { HzztClickInput } from '@hzzt-plus/components/click-input'\nimport { HzztScroll } from '@hzzt-plus/components/scroll'\nimport { HzztLazyList } from '@hzzt-plus/components/lazy-list'\n\nimport type { Plugin } from 'vue'\n\nexport default [\n HzztConfigProvider,\n HzztTitle,\n HzztDropdown,\n HzztCollapse,\n HzztTab,\n HzztIcon,\n HzztPagination,\n HzztTooltip,\n HzztPageSize,\n HzztConfirmPassword,\n HzztCheckButton,\n HzztQuarterPicker,\n HzztScan,\n HzztSelectInput,\n HzztSelectTextarea,\n HzztInputRange,\n HzztCascader,\n HzztSelect,\n HzztClickInput,\n HzztScroll,\n HzztLazyList,\n] as Plugin[]\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,iBAAe;AACf,EAAE,kBAAkB;AACpB,EAAE,SAAS;AACX,EAAE,YAAY;AACd,EAAE,YAAY;AACd,EAAE,OAAO;AACT,EAAE,QAAQ;AACV,EAAE,cAAc;AAChB,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,mBAAmB;AACrB,EAAE,eAAe;AACjB,EAAE,iBAAiB;AACnB,EAAE,QAAQ;AACV,EAAE,eAAe;AACjB,EAAE,kBAAkB;AACpB,EAAE,cAAc;AAChB,EAAE,YAAY;AACd,EAAE,UAAU;AACZ,EAAE,cAAc;AAChB,EAAE,UAAU;AACZ,EAAE,YAAY;AACd,CAAC;;;;"}
|
package/es/components/index.d.ts
CHANGED
package/es/components/index.mjs
CHANGED
|
@@ -18,6 +18,7 @@ export { HzztCascader } from './cascader/index.mjs';
|
|
|
18
18
|
export { HzztSelect } from './select/index.mjs';
|
|
19
19
|
export { HzztClickInput } from './click-input/index.mjs';
|
|
20
20
|
export { HzztScroll } from './scroll/index.mjs';
|
|
21
|
+
export { HzztLazyList } from './lazy-list/index.mjs';
|
|
21
22
|
export { titleProps } from './title/src/title.mjs';
|
|
22
23
|
export { configProviderProps } from './config-provider/src/config-provider-props.mjs';
|
|
23
24
|
export { configProviderContextKey } from './config-provider/src/constants.mjs';
|
|
@@ -29,4 +30,5 @@ export { inputRangeEmits, inputRangeProps } from './input-range/src/input-range2
|
|
|
29
30
|
export { cascaderEmits, cascaderProps } from './cascader/src/cascader.mjs';
|
|
30
31
|
export { selectEmits, selectProps } from './select/src/select.mjs';
|
|
31
32
|
export { clickInputEmits, clickInputProps } from './click-input/src/click-input.mjs';
|
|
33
|
+
export { lazyListEmits, lazyListProps } from './lazy-list/src/lazy-list.mjs';
|
|
32
34
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import '../../utils/index.mjs';
|
|
2
|
+
import LazyList from './src/lazy-list2.mjs';
|
|
3
|
+
export { lazyListEmits, lazyListProps } from './src/lazy-list.mjs';
|
|
4
|
+
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
|
+
|
|
6
|
+
const HzztLazyList = withInstall(LazyList);
|
|
7
|
+
|
|
8
|
+
export { HzztLazyList, HzztLazyList as default };
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/lazy-list/index.ts"],"sourcesContent":["import {withInstall} from '@hzzt-plus/utils'\nimport LazyList from './src/lazy-list.vue'\nimport type {SFCWithInstall} from '@hzzt-plus/utils'\n\nexport const HzztLazyList: SFCWithInstall<typeof LazyList> = withInstall(LazyList)\nexport default HzztLazyList\n\nexport * from './src/lazy-list'\n"],"names":[],"mappings":";;;;;AAEY,MAAC,YAAY,GAAG,WAAW,CAAC,QAAQ;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue';
|
|
2
|
+
import type LazyList from './lazy-list.vue';
|
|
3
|
+
export declare const lazyListProps: {
|
|
4
|
+
size: import("hzzt-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
5
|
+
height: import("hzzt-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
6
|
+
data: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]) | ((new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]))[], unknown, unknown, () => never[], boolean>;
|
|
7
|
+
rowKey: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
8
|
+
};
|
|
9
|
+
export declare type LazyListProps = ExtractPropTypes<typeof lazyListProps>;
|
|
10
|
+
export declare const lazyListEmits: {
|
|
11
|
+
'row-click': (row: any) => any;
|
|
12
|
+
};
|
|
13
|
+
export declare type LazyListEmits = typeof lazyListEmits;
|
|
14
|
+
export declare type LazyListInstance = InstanceType<typeof LazyList>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '../../../utils/index.mjs';
|
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
3
|
+
|
|
4
|
+
const lazyListProps = buildProps({
|
|
5
|
+
size: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 20
|
|
8
|
+
},
|
|
9
|
+
height: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 30
|
|
12
|
+
},
|
|
13
|
+
data: {
|
|
14
|
+
type: definePropType(Array),
|
|
15
|
+
default: () => []
|
|
16
|
+
},
|
|
17
|
+
rowKey: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "id"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const lazyListEmits = {
|
|
23
|
+
"row-click": (row) => row
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { lazyListEmits, lazyListProps };
|
|
27
|
+
//# sourceMappingURL=lazy-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-list.mjs","sources":["../../../../../../packages/components/lazy-list/src/lazy-list.ts"],"sourcesContent":["import {buildProps, definePropType} from '@hzzt-plus/utils'\nimport type {ExtractPropTypes} from 'vue'\nimport type LazyList from './lazy-list.vue'\n\nexport const lazyListProps = buildProps({\n size: {\n type: Number,\n default: 20,\n },\n height: {\n type: Number,\n default: 30,\n },\n data: {\n type: definePropType<Record<string, any>[]>(Array),\n default: () => [],\n },\n rowKey: {\n type: String,\n default: 'id',\n },\n})\n\nexport type LazyListProps = ExtractPropTypes<typeof lazyListProps>\n\nexport const lazyListEmits = {\n 'row-click': (row: any) => row\n}\n\nexport type LazyListEmits = typeof lazyListEmits\n\n\nexport type LazyListInstance = InstanceType<typeof LazyList>\n"],"names":[],"mappings":";;;AACY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG;AAC3B;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
size: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
3
|
+
height: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
4
|
+
data: import("../../../utils").EpPropFinalized<(new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]) | ((new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]))[], unknown, unknown, () => never[], boolean>;
|
|
5
|
+
rowKey: import("../../../utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
6
|
+
}, {
|
|
7
|
+
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
+
size: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
9
|
+
height: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
10
|
+
data: import("../../../utils").EpPropFinalized<(new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]) | ((new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]))[], unknown, unknown, () => never[], boolean>;
|
|
11
|
+
rowKey: import("../../../utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
12
|
+
}>> & {
|
|
13
|
+
"onRow-click"?: ((row: any) => any) | undefined;
|
|
14
|
+
}>>;
|
|
15
|
+
emit: (event: "row-click", row: any) => void;
|
|
16
|
+
totalHeight: import("vue").Ref<string>;
|
|
17
|
+
marginTop: import("vue").Ref<string>;
|
|
18
|
+
currentIndex: import("vue").Ref<number>;
|
|
19
|
+
current: import("vue").Ref<null>;
|
|
20
|
+
nsLazy: {
|
|
21
|
+
namespace: import("vue").ComputedRef<string>;
|
|
22
|
+
b: (blockSuffix?: string) => string;
|
|
23
|
+
e: (element?: string | undefined) => string;
|
|
24
|
+
m: (modifier?: string | undefined) => string;
|
|
25
|
+
be: (blockSuffix?: string | undefined, element?: string | undefined) => string;
|
|
26
|
+
em: (element?: string | undefined, modifier?: string | undefined) => string;
|
|
27
|
+
bm: (blockSuffix?: string | undefined, modifier?: string | undefined) => string;
|
|
28
|
+
bem: (blockSuffix?: string | undefined, element?: string | undefined, modifier?: string | undefined) => string;
|
|
29
|
+
is: {
|
|
30
|
+
(name: string, state: boolean | undefined): string;
|
|
31
|
+
(name: string): string;
|
|
32
|
+
};
|
|
33
|
+
cssVar: (object: Record<string, string>) => Record<string, string>;
|
|
34
|
+
cssVarName: (name: string) => string;
|
|
35
|
+
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
36
|
+
cssVarBlockName: (name: string) => string;
|
|
37
|
+
};
|
|
38
|
+
containerCls: import("vue").ComputedRef<string[]>;
|
|
39
|
+
calcList: import("vue").ComputedRef<Record<string, any>[]>;
|
|
40
|
+
scrollList: (e: Event) => void;
|
|
41
|
+
rowClick: (row: any) => void;
|
|
42
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
'row-click': (row: any) => any;
|
|
44
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
size: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
46
|
+
height: import("../../../utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
47
|
+
data: import("../../../utils").EpPropFinalized<(new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]) | ((new (...args: any[]) => Record<string, any>[]) | (() => Record<string, any>[]))[], unknown, unknown, () => never[], boolean>;
|
|
48
|
+
rowKey: import("../../../utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
49
|
+
}>> & {
|
|
50
|
+
"onRow-click"?: ((row: any) => any) | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
size: number;
|
|
53
|
+
data: Record<string, any>[];
|
|
54
|
+
height: number;
|
|
55
|
+
rowKey: string;
|
|
56
|
+
}>;
|
|
57
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from 'vue';
|
|
2
|
+
import { lazyListProps, lazyListEmits } from './lazy-list.mjs';
|
|
3
|
+
import '../../../hooks/index.mjs';
|
|
4
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
5
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
6
|
+
|
|
7
|
+
const _hoisted_1 = ["onClick"];
|
|
8
|
+
const __default__ = defineComponent({
|
|
9
|
+
name: "HzztLazyList"
|
|
10
|
+
});
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
...__default__,
|
|
13
|
+
props: lazyListProps,
|
|
14
|
+
emits: lazyListEmits,
|
|
15
|
+
setup(__props, { emit }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const totalHeight = ref("100%");
|
|
18
|
+
const marginTop = ref("0px");
|
|
19
|
+
const currentIndex = ref(1);
|
|
20
|
+
const current = ref(null);
|
|
21
|
+
const nsLazy = useNamespace("lazy-list");
|
|
22
|
+
const containerCls = computed(() => [
|
|
23
|
+
"overflow-y-auto",
|
|
24
|
+
nsLazy.b()
|
|
25
|
+
]);
|
|
26
|
+
watch(() => props.data, () => {
|
|
27
|
+
totalHeight.value = props.data.length * props.height + "px";
|
|
28
|
+
}, {
|
|
29
|
+
immediate: true
|
|
30
|
+
});
|
|
31
|
+
const calcList = computed(() => props.data.slice(currentIndex.value === 1 ? 0 : (currentIndex.value - 1) * props.size - props.size / 2, (currentIndex.value + 1) * props.size + props.size / 2));
|
|
32
|
+
function scrollList(e) {
|
|
33
|
+
const target = e.target;
|
|
34
|
+
const scrollTop = target.scrollTop;
|
|
35
|
+
if (scrollTop < props.size / 2 * props.height) {
|
|
36
|
+
currentIndex.value = 1;
|
|
37
|
+
} else {
|
|
38
|
+
currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);
|
|
39
|
+
}
|
|
40
|
+
if (currentIndex.value === 1) {
|
|
41
|
+
marginTop.value = "0px";
|
|
42
|
+
} else {
|
|
43
|
+
marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + "px";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function rowClick(row) {
|
|
47
|
+
current.value = row;
|
|
48
|
+
emit("row-click", row);
|
|
49
|
+
}
|
|
50
|
+
return (_ctx, _cache) => {
|
|
51
|
+
return openBlock(), createElementBlock("div", {
|
|
52
|
+
class: normalizeClass(unref(containerCls)),
|
|
53
|
+
onScroll: scrollList
|
|
54
|
+
}, [
|
|
55
|
+
createElementVNode("div", {
|
|
56
|
+
style: normalizeStyle({
|
|
57
|
+
height: totalHeight.value,
|
|
58
|
+
width: 0,
|
|
59
|
+
float: "left"
|
|
60
|
+
})
|
|
61
|
+
}, null, 4),
|
|
62
|
+
createElementVNode("div", {
|
|
63
|
+
style: normalizeStyle({ marginTop: marginTop.value })
|
|
64
|
+
}, [
|
|
65
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calcList), (item) => {
|
|
66
|
+
return openBlock(), createElementBlock("div", {
|
|
67
|
+
key: item[_ctx.rowKey],
|
|
68
|
+
style: normalizeStyle({
|
|
69
|
+
height: _ctx.height + "px"
|
|
70
|
+
}),
|
|
71
|
+
class: normalizeClass(["hzzt-lazy-list__item", current.value === item ? "is-active" : ""]),
|
|
72
|
+
onClick: ($event) => rowClick(item)
|
|
73
|
+
}, [
|
|
74
|
+
renderSlot(_ctx.$slots, "default", { data: item })
|
|
75
|
+
], 14, _hoisted_1);
|
|
76
|
+
}), 128))
|
|
77
|
+
], 4)
|
|
78
|
+
], 34);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var LazyList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "lazy-list.vue"]]);
|
|
83
|
+
|
|
84
|
+
export { LazyList as default };
|
|
85
|
+
//# sourceMappingURL=lazy-list2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-list2.mjs","sources":["../../../../../../packages/components/lazy-list/src/lazy-list.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\" @scroll=\"scrollList\">\n <div\n :style=\"{\n height: totalHeight,\n width: 0,\n float: 'left',\n }\"\n />\n <div :style=\"{marginTop: marginTop}\">\n <div\n v-for=\"item in calcList\"\n :key=\"item[rowKey]\"\n :style=\"{\n height: height+'px'\n }\"\n :class=\"['hzzt-lazy-list__item', current === item?'is-active':'']\"\n @click=\"rowClick(item)\"\n >\n <slot :data=\"item\" />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {lazyListEmits, lazyListProps} from './lazy-list'\n import {computed, ref, watch} from \"vue\";\n import {useNamespace} from \"@hzzt-plus/hooks\";\n\n defineOptions({\n name: 'HzztLazyList',\n })\n\n const props = defineProps(lazyListProps)\n const emit = defineEmits(lazyListEmits)\n\n const totalHeight = ref('100%');\n const marginTop = ref('0px');\n const currentIndex = ref(1);\n const current = ref(null);\n\n const nsLazy = useNamespace('lazy-list');\n\n const containerCls = computed(() => [\n 'overflow-y-auto',\n nsLazy.b(),\n ])\n\n watch(() => props.data, () => {\n totalHeight.value = props.data.length * props.height + 'px';\n }, {\n immediate: true,\n });\n\n const calcList = computed(\n () => props.data.slice(currentIndex.value === 1 ? 0 : ((currentIndex.value - 1) * props.size -\n props.size / 2), (currentIndex.value + 1) * props.size + props.size / 2));\n\n function scrollList(e: Event) {\n const target = e.target as HTMLElement;\n const scrollTop = target.scrollTop;\n if (scrollTop < props.size / 2 * props.height) {\n currentIndex.value = 1;\n } else {\n currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);\n }\n if (currentIndex.value === 1) {\n marginTop.value = '0px';\n } else {\n marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + 'px';\n }\n }\n\n function rowClick(row: any) {\n current.value = row;\n emit('row-click', row);\n }\n\n\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;;;mCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,WAAA,GAAc,IAAI,MAAM,CAAA,CAAA;AAC9B,IAAM,MAAA,SAAA,GAAY,IAAI,KAAK,CAAA,CAAA;AAC3B,IAAM,MAAA,YAAA,GAAe,IAAI,CAAC,CAAA,CAAA;AAC1B,IAAM,MAAA,OAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AAExB,IAAM,MAAA,MAAA,GAAS,aAAa,WAAW,CAAA,CAAA;AAEvC,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM;AAAA,MAClC,iBAAA;AAAA,MACA,OAAO,CAAE,EAAA;AAAA,KACV,CAAA,CAAA;AAED,IAAM,KAAA,CAAA,MAAM,KAAM,CAAA,IAAA,EAAM,MAAM;AAC5B,MAAA,WAAA,CAAY,KAAQ,GAAA,KAAA,CAAM,IAAK,CAAA,MAAA,GAAS,MAAM,MAAS,GAAA,IAAA,CAAA;AAAA,KACtD,EAAA;AAAA,MACD,SAAW,EAAA,IAAA;AAAA,KACZ,CAAA,CAAA;AAED,IAAA,MAAM,QAAW,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,IAAA,CAAA,KAAA,CAAA,YAAA,CAAA,KAAA,KAAA,CAAA,GAAA,CAAA,GAAA,CAAA,YAAA,CAAA,KAAA,GAAA,CAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,EAAA,CAAA,YAAA,CAAA,KAAA,GAAA,CAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,IACf,mBAAiB,CAAA,CAAA,EAAA;AACwD,MAAC,MAAA,MAAA,GAAA,CAAA,CAAA,MAAA,CAAA;AAE5E,MAAA,MAAA,YAAoB,MAAU,CAAA,SAAA,CAAA;AAC5B,MAAA,IAAA,YAAiB,KAAA,CAAA,IAAA,GAAA,CAAA,GAAA,KAAA,CAAA,MAAA,EAAA;AACjB,QAAA,kBAAyB,GAAA,CAAA,CAAA;AACzB,OAAA,MAAgB;AACd,QAAA,YAAA,CAAa,KAAQ,GAAA,IAAA,CAAA,IAAA,CAAA,CAAA,SAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,GAAA,KAAA,CAAA,MAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,MAAA,CAAA,CAAA;AAAA,OAChB;AACL,MAAA,IAAA,YAAqB,CAAA,KAAA,KAAA,CAAK,EAAM;AAAsE,QACxG,SAAA,CAAA,KAAA,GAAA,KAAA,CAAA;AACA,OAAI,MAAA;AACF,QAAA,SAAA,CAAU,KAAQ,GAAA,CAAA,CAAA,YAAA,CAAA,KAAA,GAAA,CAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,IAAA,KAAA,CAAA,MAAA,GAAA,IAAA,CAAA;AAAA,OACb;AACL,KAAU;AAAkF,IAC9F,SAAA,QAAA,CAAA,GAAA,EAAA;AAAA,MACF,OAAA,CAAA,KAAA,GAAA,GAAA,CAAA;AAEA,MAAA,IAAA,CAAA,WAAkB,EAAU,GAAA,CAAA,CAAA;AAC1B,KAAA;AACA,IAAA,OAAK,aAAa,KAAG;AAAA,MACvB,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Scroll from './src/
|
|
3
|
-
import './src/
|
|
2
|
+
import Scroll from './src/scroll2.mjs';
|
|
3
|
+
import './src/scroll.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const HzztScroll = withInstall(Scroll);
|
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
import { defineComponent, ref, onUpdated, openBlock, createElementBlock, normalizeClass, createVNode, createCommentVNode, createElementVNode, normalizeStyle, renderSlot } from 'vue';
|
|
2
|
-
import { useResizeObserver } from '@vueuse/core';
|
|
3
|
-
import HzztIcon from '../../icon/src/index.mjs';
|
|
4
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
5
1
|
|
|
6
|
-
const __default__ = defineComponent({
|
|
7
|
-
name: "HzztScroll"
|
|
8
|
-
});
|
|
9
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
-
...__default__,
|
|
11
|
-
setup(__props) {
|
|
12
|
-
const navTranslateX = ref(0);
|
|
13
|
-
const scrollRef = ref(null);
|
|
14
|
-
const scrollContentRef = ref(null);
|
|
15
|
-
const scrollable = ref(false);
|
|
16
|
-
function update() {
|
|
17
|
-
if (!scrollRef.value || !scrollContentRef.value)
|
|
18
|
-
return;
|
|
19
|
-
const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;
|
|
20
|
-
const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;
|
|
21
|
-
if (scrollWidth >= contentWidth) {
|
|
22
|
-
scrollable.value = false;
|
|
23
|
-
navTranslateX.value = 0;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
scrollable.value = true;
|
|
27
|
-
}
|
|
28
|
-
useResizeObserver(scrollContentRef, update);
|
|
29
|
-
onUpdated(() => update());
|
|
30
|
-
function btnNavPrev() {
|
|
31
|
-
var _a;
|
|
32
|
-
const containerSize = ((_a = scrollRef.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
33
|
-
const currentOffset = navTranslateX.value;
|
|
34
|
-
if (!currentOffset)
|
|
35
|
-
return;
|
|
36
|
-
const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
|
|
37
|
-
navTranslateX.value = newOffset;
|
|
38
|
-
}
|
|
39
|
-
function btnNavNext() {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
const navSize = ((_a = scrollContentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
42
|
-
const currentOffset = navTranslateX.value;
|
|
43
|
-
const containerSize = ((_b = scrollRef.value) == null ? void 0 : _b.offsetWidth) || 0;
|
|
44
|
-
if (navSize - currentOffset < containerSize)
|
|
45
|
-
return;
|
|
46
|
-
const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
|
|
47
|
-
navTranslateX.value = newOffset;
|
|
48
|
-
}
|
|
49
|
-
return (_ctx, _cache) => {
|
|
50
|
-
return openBlock(), createElementBlock("div", {
|
|
51
|
-
class: normalizeClass([{ "is-scrollable": scrollable.value }, "relative hzzt-scroll"])
|
|
52
|
-
}, [
|
|
53
|
-
scrollable.value ? (openBlock(), createElementBlock("div", {
|
|
54
|
-
key: 0,
|
|
55
|
-
class: "hzzt-scroll__nav-prev",
|
|
56
|
-
onClick: btnNavPrev
|
|
57
|
-
}, [
|
|
58
|
-
createVNode(HzztIcon, { name: "arrow-left" })
|
|
59
|
-
])) : createCommentVNode("v-if", true),
|
|
60
|
-
scrollable.value ? (openBlock(), createElementBlock("div", {
|
|
61
|
-
key: 1,
|
|
62
|
-
class: "hzzt-scroll__nav-next",
|
|
63
|
-
onClick: btnNavNext
|
|
64
|
-
}, [
|
|
65
|
-
createVNode(HzztIcon, { name: "arrow-right" })
|
|
66
|
-
])) : createCommentVNode("v-if", true),
|
|
67
|
-
createElementVNode("div", {
|
|
68
|
-
ref_key: "scrollRef",
|
|
69
|
-
ref: scrollRef,
|
|
70
|
-
class: "overflow-hidden"
|
|
71
|
-
}, [
|
|
72
|
-
createElementVNode("div", {
|
|
73
|
-
ref_key: "scrollContentRef",
|
|
74
|
-
ref: scrollContentRef,
|
|
75
|
-
style: normalizeStyle({ transform: `translateX(${-navTranslateX.value}px)` }),
|
|
76
|
-
class: "hzzt-scroll__content"
|
|
77
|
-
}, [
|
|
78
|
-
renderSlot(_ctx.$slots, "default")
|
|
79
|
-
], 4)
|
|
80
|
-
], 512)
|
|
81
|
-
], 2);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
var Scroll = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "scroll.vue"]]);
|
|
86
|
-
|
|
87
|
-
export { Scroll as default };
|
|
88
2
|
//# sourceMappingURL=scroll.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"scroll.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,88 @@
|
|
|
1
|
+
import { defineComponent, ref, onUpdated, openBlock, createElementBlock, normalizeClass, createVNode, createCommentVNode, createElementVNode, normalizeStyle, renderSlot } from 'vue';
|
|
2
|
+
import { useResizeObserver } from '@vueuse/core';
|
|
3
|
+
import HzztIcon from '../../icon/src/index.mjs';
|
|
4
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
1
5
|
|
|
6
|
+
const __default__ = defineComponent({
|
|
7
|
+
name: "HzztScroll"
|
|
8
|
+
});
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
...__default__,
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const navTranslateX = ref(0);
|
|
13
|
+
const scrollRef = ref(null);
|
|
14
|
+
const scrollContentRef = ref(null);
|
|
15
|
+
const scrollable = ref(false);
|
|
16
|
+
function update() {
|
|
17
|
+
if (!scrollRef.value || !scrollContentRef.value)
|
|
18
|
+
return;
|
|
19
|
+
const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;
|
|
20
|
+
const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;
|
|
21
|
+
if (scrollWidth >= contentWidth) {
|
|
22
|
+
scrollable.value = false;
|
|
23
|
+
navTranslateX.value = 0;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
scrollable.value = true;
|
|
27
|
+
}
|
|
28
|
+
useResizeObserver(scrollContentRef, update);
|
|
29
|
+
onUpdated(() => update());
|
|
30
|
+
function btnNavPrev() {
|
|
31
|
+
var _a;
|
|
32
|
+
const containerSize = ((_a = scrollRef.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
33
|
+
const currentOffset = navTranslateX.value;
|
|
34
|
+
if (!currentOffset)
|
|
35
|
+
return;
|
|
36
|
+
const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
|
|
37
|
+
navTranslateX.value = newOffset;
|
|
38
|
+
}
|
|
39
|
+
function btnNavNext() {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const navSize = ((_a = scrollContentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
42
|
+
const currentOffset = navTranslateX.value;
|
|
43
|
+
const containerSize = ((_b = scrollRef.value) == null ? void 0 : _b.offsetWidth) || 0;
|
|
44
|
+
if (navSize - currentOffset < containerSize)
|
|
45
|
+
return;
|
|
46
|
+
const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
|
|
47
|
+
navTranslateX.value = newOffset;
|
|
48
|
+
}
|
|
49
|
+
return (_ctx, _cache) => {
|
|
50
|
+
return openBlock(), createElementBlock("div", {
|
|
51
|
+
class: normalizeClass([{ "is-scrollable": scrollable.value }, "relative hzzt-scroll"])
|
|
52
|
+
}, [
|
|
53
|
+
scrollable.value ? (openBlock(), createElementBlock("div", {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "hzzt-scroll__nav-prev",
|
|
56
|
+
onClick: btnNavPrev
|
|
57
|
+
}, [
|
|
58
|
+
createVNode(HzztIcon, { name: "arrow-left" })
|
|
59
|
+
])) : createCommentVNode("v-if", true),
|
|
60
|
+
scrollable.value ? (openBlock(), createElementBlock("div", {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "hzzt-scroll__nav-next",
|
|
63
|
+
onClick: btnNavNext
|
|
64
|
+
}, [
|
|
65
|
+
createVNode(HzztIcon, { name: "arrow-right" })
|
|
66
|
+
])) : createCommentVNode("v-if", true),
|
|
67
|
+
createElementVNode("div", {
|
|
68
|
+
ref_key: "scrollRef",
|
|
69
|
+
ref: scrollRef,
|
|
70
|
+
class: "overflow-hidden"
|
|
71
|
+
}, [
|
|
72
|
+
createElementVNode("div", {
|
|
73
|
+
ref_key: "scrollContentRef",
|
|
74
|
+
ref: scrollContentRef,
|
|
75
|
+
style: normalizeStyle({ transform: `translateX(${-navTranslateX.value}px)` }),
|
|
76
|
+
class: "hzzt-scroll__content"
|
|
77
|
+
}, [
|
|
78
|
+
renderSlot(_ctx.$slots, "default")
|
|
79
|
+
], 4)
|
|
80
|
+
], 512)
|
|
81
|
+
], 2);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var Scroll = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "scroll.vue"]]);
|
|
86
|
+
|
|
87
|
+
export { Scroll as default };
|
|
2
88
|
//# sourceMappingURL=scroll2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"scroll2.mjs","sources":["../../../../../../packages/components/scroll/src/scroll.vue"],"sourcesContent":["<template>\n <div :class=\"{'is-scrollable':scrollable}\" class=\"relative hzzt-scroll\">\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-prev\" @click=\"btnNavPrev\">\n <hzzt-icon name=\"arrow-left\" />\n </div>\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-next\" @click=\"btnNavNext\">\n <hzzt-icon name=\"arrow-right\" />\n </div>\n <div ref=\"scrollRef\" class=\"overflow-hidden\">\n <div ref=\"scrollContentRef\" :style=\"{transform: `translateX(${-navTranslateX}px)`}\" class=\"hzzt-scroll__content\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {onUpdated, ref} from 'vue';\n import {useResizeObserver} from '@vueuse/core';\n import HzztIcon from \"@hzzt-plus/components/icon/src/index.vue\";\n\n defineOptions({\n name: 'HzztScroll',\n })\n\n const navTranslateX = ref(0);\n const scrollRef = ref<HTMLElement | null>(null);\n const scrollContentRef = ref<HTMLElement | null>(null);\n const scrollable = ref(false);\n\n function update() {\n if (!scrollRef.value || !scrollContentRef.value) return;\n const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;\n const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;\n if (scrollWidth >= contentWidth) {\n scrollable.value = false;\n navTranslateX.value = 0;\n return;\n }\n scrollable.value = true;\n }\n\n useResizeObserver(scrollContentRef, update);\n\n onUpdated(() => update());\n\n function btnNavPrev() {\n const containerSize = scrollRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n if (!currentOffset) return;\n const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;\n navTranslateX.value = newOffset;\n }\n\n function btnNavNext() {\n const navSize = scrollContentRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n const containerSize = scrollRef.value?.offsetWidth || 0;\n if (navSize - currentOffset < containerSize) return;\n const newOffset = navSize - currentOffset > containerSize * 2 ?\n currentOffset + containerSize :\n navSize - containerSize;\n navTranslateX.value = newOffset;\n }\n</script>\n"],"names":[],"mappings":";;;;;mCAqBgB,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,aAAA,GAAgB,IAAI,CAAC,CAAA,CAAA;AAC3B,IAAM,MAAA,SAAA,GAAY,IAAwB,IAAI,CAAA,CAAA;AAC9C,IAAM,MAAA,gBAAA,GAAmB,IAAwB,IAAI,CAAA,CAAA;AACrD,IAAM,MAAA,UAAA,GAAa,IAAI,KAAK,CAAA,CAAA;AAE5B,IAAA,SAAS,MAAS,GAAA;AAChB,MAAA,IAAI,CAAC,SAAA,CAAU,KAAS,IAAA,CAAC,gBAAiB,CAAA,KAAA;AAAO,QAAA,OAAA;AACjD,MAAA,MAAM,WAAc,GAAA,SAAA,CAAU,KAAQ,GAAA,SAAA,CAAU,MAAM,WAAc,GAAA,CAAA,CAAA;AACpE,MAAA,MAAM,YAAe,GAAA,gBAAA,CAAiB,KAAQ,GAAA,gBAAA,CAAiB,MAAM,WAAc,GAAA,CAAA,CAAA;AACnF,MAAA,IAAI,eAAe,YAAc,EAAA;AAC/B,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,CAAA,CAAA;AACtB,QAAA,OAAA;AAAA,OACF;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB;AAEA,IAAA,iBAAA,CAAkB,kBAAkB,MAAM,CAAA,CAAA;AAE1C,IAAU,SAAA,CAAA,MAAM,QAAQ,CAAA,CAAA;AAExB,IAAA,SAAS,UAAa,GAAA;AACpB,MAAM,IAAA,EAAA,CAAA;AACN,MAAA,MAAM,gBAAgB,CAAc,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACpC,MAAA,MAAK,aAAA,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,IAAA,CAAA,aAAA;AACpB,QAAA,OAAkB;AAClB,MAAA,MAAA,SAAsB,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,CAAA;AAAA,MACxB,aAAA,CAAA,KAAA,GAAA,SAAA,CAAA;AAEA,KAAA;AACE,IAAM,SAAA,UAA2B,GAAA;AACjC,MAAA,IAAA,EAAM;AACN,MAAM,MAAA,OAAA,GAAA,CAAA,CAAA,EAAA,GAA0B,gBAAO,CAAe,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACtD,MAAA,mBAA8B,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,MAAA,aAAA,GAAA,CAAA,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AAC7C,MAAA,IAAA,uBAA4B,GAAA,aAAA;AAG5B,QAAA,OAAA;AAAsB,MACxB,MAAA,SAAA,GAAA,OAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,GAAA,aAAA,GAAA,aAAA,GAAA,OAAA,GAAA,aAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -99,6 +99,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
99
99
|
}>;
|
|
100
100
|
input: (str: string) => void;
|
|
101
101
|
change: (str: string) => void;
|
|
102
|
+
focus: () => void;
|
|
102
103
|
keydown: (e: KeyboardEvent | Event) => void;
|
|
103
104
|
showSelect: () => void;
|
|
104
105
|
selectChange: (v: string) => void;
|
|
@@ -86,6 +86,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
86
86
|
function change(str) {
|
|
87
87
|
emit("change", str);
|
|
88
88
|
}
|
|
89
|
+
function focus() {
|
|
90
|
+
if (selectRef.value) {
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
selectRef.value.dropdownMenuVisible = true;
|
|
93
|
+
}, 200);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
89
96
|
function keydown(e) {
|
|
90
97
|
var _a, _b;
|
|
91
98
|
const key = "key" in e && e.key;
|
|
@@ -129,7 +136,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129
136
|
inputVal.value = str;
|
|
130
137
|
setTimeout(() => {
|
|
131
138
|
inputRef.value.focus();
|
|
132
|
-
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
selectRef.value.dropdownMenuVisible = false;
|
|
141
|
+
}, 250);
|
|
133
142
|
emit("change", str);
|
|
134
143
|
});
|
|
135
144
|
}
|
|
@@ -150,6 +159,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
150
159
|
}, unref(_inputProps), {
|
|
151
160
|
onInput: input,
|
|
152
161
|
onChange: change,
|
|
162
|
+
onFocus: focus,
|
|
153
163
|
onKeydown: keydown
|
|
154
164
|
}), {
|
|
155
165
|
suffix: withCtx(() => [
|