@element-plus/nightly 0.0.20220126 → 0.0.20220127
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 +259 -172
- package/dist/index.full.min.js +11 -11
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +11 -11
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +259 -172
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- 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/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.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/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/cascader/index.d.ts +4 -0
- package/es/components/cascader/src/index.vue.d.ts +2 -0
- package/es/components/index.mjs +1 -1
- package/es/components/pagination/src/components/jumper.mjs +6 -3
- package/es/components/pagination/src/components/jumper.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.mjs +7 -3
- package/es/components/pagination/src/components/sizes.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.vue.d.ts +3 -0
- package/es/components/pagination/src/components/total.mjs +10 -4
- package/es/components/pagination/src/components/total.mjs.map +1 -1
- package/es/components/pagination/src/components/total.vue.d.ts +1 -0
- package/es/components/pagination/src/pagination.mjs +12 -1
- package/es/components/pagination/src/pagination.mjs.map +1 -1
- package/es/components/scrollbar/index.d.ts +2 -1
- package/es/components/scrollbar/index.mjs +1 -1
- package/es/components/scrollbar/index.mjs.map +1 -1
- package/es/components/scrollbar/src/bar.d.ts +5 -5
- package/es/components/scrollbar/src/bar.mjs +18 -6
- package/es/components/scrollbar/src/bar.mjs.map +1 -1
- package/es/components/scrollbar/src/bar.vue.d.ts +18 -37
- package/es/components/scrollbar/src/bar2.mjs +34 -118
- package/es/components/scrollbar/src/bar2.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.vue.d.ts +1 -0
- package/es/components/scrollbar/src/scrollbar2.mjs +14 -20
- package/es/components/scrollbar/src/scrollbar2.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb.d.ts +9 -0
- package/es/components/scrollbar/src/thumb.mjs +15 -0
- package/es/components/scrollbar/src/thumb.mjs.map +1 -0
- package/es/components/scrollbar/src/thumb.vue.d.ts +43 -0
- package/es/components/scrollbar/src/thumb2.mjs +135 -0
- package/es/components/scrollbar/src/thumb2.mjs.map +1 -0
- package/es/components/select/src/select.mjs +3 -0
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader/index.d.ts +4 -0
- package/lib/components/cascader/src/index.vue.d.ts +2 -0
- package/lib/components/index.js +2 -2
- package/lib/components/pagination/src/components/jumper.js +6 -3
- package/lib/components/pagination/src/components/jumper.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.js +7 -3
- package/lib/components/pagination/src/components/sizes.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.vue.d.ts +3 -0
- package/lib/components/pagination/src/components/total.js +10 -4
- package/lib/components/pagination/src/components/total.js.map +1 -1
- package/lib/components/pagination/src/components/total.vue.d.ts +1 -0
- package/lib/components/pagination/src/pagination.js +12 -1
- package/lib/components/pagination/src/pagination.js.map +1 -1
- package/lib/components/scrollbar/index.d.ts +2 -1
- package/lib/components/scrollbar/index.js +2 -2
- package/lib/components/scrollbar/index.js.map +1 -1
- package/lib/components/scrollbar/src/bar.d.ts +5 -5
- package/lib/components/scrollbar/src/bar.js +18 -6
- package/lib/components/scrollbar/src/bar.js.map +1 -1
- package/lib/components/scrollbar/src/bar.vue.d.ts +18 -37
- package/lib/components/scrollbar/src/bar2.js +33 -117
- package/lib/components/scrollbar/src/bar2.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.vue.d.ts +1 -0
- package/lib/components/scrollbar/src/scrollbar2.js +13 -19
- package/lib/components/scrollbar/src/scrollbar2.js.map +1 -1
- package/lib/components/scrollbar/src/thumb.d.ts +9 -0
- package/lib/components/scrollbar/src/thumb.js +19 -0
- package/lib/components/scrollbar/src/thumb.js.map +1 -0
- package/lib/components/scrollbar/src/thumb.vue.d.ts +43 -0
- package/lib/components/scrollbar/src/thumb2.js +139 -0
- package/lib/components/scrollbar/src/thumb2.js.map +1 -0
- package/lib/components/select/src/select.js +3 -0
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-breadcrumb.css +1 -1
- package/theme-chalk/el-pagination.css +1 -1
- package/theme-chalk/el-select.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/breadcrumb.scss +2 -0
- package/theme-chalk/src/common/var.scss +1 -1
- package/theme-chalk/src/pagination.scss +69 -51
- package/theme-chalk/src/select.scss +3 -3
- package/web-types.json +1 -1
|
@@ -165,6 +165,14 @@ var Pagination = vue.defineComponent({
|
|
|
165
165
|
currentPageBridge.value += 1;
|
|
166
166
|
emit("next-click", currentPageBridge.value);
|
|
167
167
|
}
|
|
168
|
+
function addClass(element, cls) {
|
|
169
|
+
if (element) {
|
|
170
|
+
if (!element.props) {
|
|
171
|
+
element.props = {};
|
|
172
|
+
}
|
|
173
|
+
element.props.class = [element.props.class, cls].join(" ");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
168
176
|
vue.provide(pagination.elPaginationKey, {
|
|
169
177
|
pageCount: pageCountBridge,
|
|
170
178
|
disabled: vue.computed(() => props.disabled),
|
|
@@ -211,7 +219,8 @@ var Pagination = vue.defineComponent({
|
|
|
211
219
|
pageSize: pageSizeBridge.value,
|
|
212
220
|
pageSizes: props.pageSizes,
|
|
213
221
|
popperClass: props.popperClass,
|
|
214
|
-
disabled: props.disabled
|
|
222
|
+
disabled: props.disabled,
|
|
223
|
+
size: props.small ? "small" : "default"
|
|
215
224
|
}),
|
|
216
225
|
slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
|
|
217
226
|
total: vue.h(total["default"], { total: isAbsent(props.total) ? 0 : props.total })
|
|
@@ -232,6 +241,8 @@ var Pagination = vue.defineComponent({
|
|
|
232
241
|
if (haveRightWrapper && rightWrapperChildren.length > 0) {
|
|
233
242
|
rootChildren.unshift(rightWrapperRoot);
|
|
234
243
|
}
|
|
244
|
+
addClass(rootChildren[0], "is-first");
|
|
245
|
+
addClass(rootChildren[rootChildren.length - 1], "is-last");
|
|
235
246
|
return vue.h("div", {
|
|
236
247
|
role: "pagination",
|
|
237
248
|
"aria-label": "pagination",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sources":["../../../../../../packages/components/pagination/src/pagination.ts"],"sourcesContent":["import {\n h,\n ref,\n provide,\n computed,\n defineComponent,\n getCurrentInstance,\n watch,\n} from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport { debugWarn } from '@element-plus/utils/error'\nimport { buildProps, definePropType, mutable } from '@element-plus/utils/props'\nimport { elPaginationKey } from '@element-plus/tokens'\n\nimport Prev from './components/prev.vue'\nimport Next from './components/next.vue'\nimport Sizes from './components/sizes.vue'\nimport Jumper from './components/jumper.vue'\nimport Total from './components/total.vue'\nimport Pager from './components/pager.vue'\n\nimport type { VNode, ExtractPropTypes } from 'vue'\n\n/**\n * It it user's responsibility to guarantee that the value of props.total... is number\n * (same as pageSize, defaultPageSize, currentPage, defaultCurrentPage, pageCount)\n * Otherwise we can reasonable infer that the corresponding field is absent\n */\nconst isAbsent = (v: unknown): v is undefined => typeof v !== 'number'\n\ntype LayoutKey =\n | 'prev'\n | 'pager'\n | 'next'\n | 'jumper'\n | '->'\n | 'total'\n | 'sizes'\n | 'slot'\n\nexport const paginationProps = buildProps({\n total: Number,\n pageSize: Number,\n defaultPageSize: Number,\n currentPage: Number,\n defaultCurrentPage: Number,\n pageCount: Number,\n pagerCount: {\n type: Number,\n validator: (value: unknown) => {\n return (\n typeof value === 'number' &&\n (value | 0) === value &&\n value > 4 &&\n value < 22 &&\n value % 2 === 1\n )\n },\n default: 7,\n },\n layout: {\n type: String,\n default: (\n ['prev', 'pager', 'next', 'jumper', '->', 'total'] as LayoutKey[]\n ).join(', '),\n },\n pageSizes: {\n type: definePropType<number[]>(Array),\n default: () => mutable([10, 20, 30, 40, 50, 100] as const),\n },\n popperClass: {\n type: String,\n default: '',\n },\n prevText: {\n type: String,\n default: '',\n },\n nextText: {\n type: String,\n default: '',\n },\n small: Boolean,\n background: Boolean,\n disabled: Boolean,\n hideOnSinglePage: Boolean,\n} as const)\nexport type PaginationProps = ExtractPropTypes<typeof paginationProps>\n\nexport const paginationEmits = {\n 'update:current-page': (val: number) => typeof val === 'number',\n 'update:page-size': (val: number) => typeof val === 'number',\n 'size-change': (val: number) => typeof val === 'number',\n 'current-change': (val: number) => typeof val === 'number',\n 'prev-click': (val: number) => typeof val === 'number',\n 'next-click': (val: number) => typeof val === 'number',\n}\nexport type PaginationEmits = typeof paginationEmits\n\nconst componentName = 'ElPagination'\nexport default defineComponent({\n name: componentName,\n\n props: paginationProps,\n emits: paginationEmits,\n\n setup(props, { emit, slots }) {\n const { t } = useLocale()\n const vnodeProps = getCurrentInstance()!.vnode.props || {}\n // we can find @xxx=\"xxx\" props on `vnodeProps` to check if user bind corresponding events\n const hasCurrentPageListener =\n 'onUpdate:currentPage' in vnodeProps ||\n 'onUpdate:current-page' in vnodeProps ||\n 'onCurrentChange' in vnodeProps\n const hasPageSizeListener =\n 'onUpdate:pageSize' in vnodeProps ||\n 'onUpdate:page-size' in vnodeProps ||\n 'onSizeChange' in vnodeProps\n const assertValidUsage = computed(() => {\n // Users have to set either one, otherwise count of pages cannot be determined\n if (isAbsent(props.total) && isAbsent(props.pageCount)) return false\n // <el-pagination ...otherProps :current-page=\"xxx\" /> without corresponding listener is forbidden now\n // Users have to use two way binding of `currentPage`\n // If users just want to provide a default value, `defaultCurrentPage` is here for you\n if (!isAbsent(props.currentPage) && !hasCurrentPageListener) return false\n // When you want to change sizes, things get more complex, detailed below\n // Basically the most important value we need is page count\n // either directly from props.pageCount\n // or calculated from props.total\n // we will take props.pageCount precedence over props.total\n if (props.layout.includes('sizes')) {\n if (!isAbsent(props.pageCount)) {\n // if props.pageCount is assign by user, then user have to watch pageSize change\n // and recalculate pageCount\n if (!hasPageSizeListener) return false\n } else if (!isAbsent(props.total)) {\n // Otherwise, we will see if user have props.pageSize defined\n // If so, meaning user want to have pageSize controlled himself/herself from component\n // Thus page size listener is required\n // users are account for page size change\n if (!isAbsent(props.pageSize)) {\n if (!hasPageSizeListener) {\n return false\n }\n } else {\n // (else block just for explaination)\n // else page size is controlled by el-pagination internally\n }\n }\n }\n return true\n })\n\n const innerPageSize = ref(\n isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize\n )\n const innerCurrentPage = ref(\n isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage\n )\n\n const pageSizeBridge = computed({\n get() {\n return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize\n },\n set(v: number) {\n if (isAbsent(props.pageSize)) {\n innerPageSize.value = v\n }\n if (hasPageSizeListener) {\n emit('update:page-size', v)\n emit('size-change', v)\n }\n },\n })\n\n const pageCountBridge = computed<number>(() => {\n let pageCount = 0\n if (!isAbsent(props.pageCount)) {\n pageCount = props.pageCount\n } else if (!isAbsent(props.total)) {\n pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value))\n }\n return pageCount\n })\n\n const currentPageBridge = computed<number>({\n get() {\n return isAbsent(props.currentPage)\n ? innerCurrentPage.value\n : props.currentPage\n },\n set(v) {\n let newCurrentPage = v\n if (v < 1) {\n newCurrentPage = 1\n } else if (v > pageCountBridge.value) {\n newCurrentPage = pageCountBridge.value\n }\n if (isAbsent(props.currentPage)) {\n innerCurrentPage.value = newCurrentPage\n }\n if (hasCurrentPageListener) {\n emit('update:current-page', newCurrentPage)\n emit('current-change', newCurrentPage)\n }\n },\n })\n\n watch(pageCountBridge, (val) => {\n if (currentPageBridge.value > val) currentPageBridge.value = val\n })\n\n function handleCurrentChange(val: number) {\n currentPageBridge.value = val\n }\n\n function handleSizeChange(val: number) {\n pageSizeBridge.value = val\n const newPageCount = pageCountBridge.value\n if (currentPageBridge.value > newPageCount) {\n currentPageBridge.value = newPageCount\n }\n }\n\n function prev() {\n if (props.disabled) return\n currentPageBridge.value -= 1\n emit('prev-click', currentPageBridge.value)\n }\n\n function next() {\n if (props.disabled) return\n currentPageBridge.value += 1\n emit('next-click', currentPageBridge.value)\n }\n\n provide(elPaginationKey, {\n pageCount: pageCountBridge,\n disabled: computed(() => props.disabled),\n currentPage: currentPageBridge,\n changeEvent: handleCurrentChange,\n handleSizeChange,\n })\n\n return () => {\n if (!assertValidUsage.value) {\n debugWarn(componentName, t('el.pagination.deprecationWarning'))\n return null\n }\n if (!props.layout) return null\n if (props.hideOnSinglePage && pageCountBridge.value <= 1) return null\n const rootChildren: Array<VNode | VNode[] | null> = []\n const rightWrapperChildren: Array<VNode | VNode[] | null> = []\n const rightWrapperRoot = h(\n 'div',\n { class: 'el-pagination__rightwrapper' },\n rightWrapperChildren\n )\n const TEMPLATE_MAP: Record<\n Exclude<LayoutKey, '->'>,\n VNode | VNode[] | null\n > = {\n prev: h(Prev, {\n disabled: props.disabled,\n currentPage: currentPageBridge.value,\n prevText: props.prevText,\n onClick: prev,\n }),\n jumper: h(Jumper),\n pager: h(Pager, {\n currentPage: currentPageBridge.value,\n pageCount: pageCountBridge.value,\n pagerCount: props.pagerCount,\n onChange: handleCurrentChange,\n disabled: props.disabled,\n }),\n next: h(Next, {\n disabled: props.disabled,\n currentPage: currentPageBridge.value,\n pageCount: pageCountBridge.value,\n nextText: props.nextText,\n onClick: next,\n }),\n sizes: h(Sizes, {\n pageSize: pageSizeBridge.value,\n pageSizes: props.pageSizes,\n popperClass: props.popperClass,\n disabled: props.disabled,\n }),\n slot: slots?.default?.() ?? null,\n total: h(Total, { total: isAbsent(props.total) ? 0 : props.total }),\n }\n\n const components = props.layout\n .split(',')\n .map((item: string) => item.trim()) as LayoutKey[]\n\n let haveRightWrapper = false\n\n components.forEach((c) => {\n if (c === '->') {\n haveRightWrapper = true\n return\n }\n if (!haveRightWrapper) {\n rootChildren.push(TEMPLATE_MAP[c])\n } else {\n rightWrapperChildren.push(TEMPLATE_MAP[c])\n }\n })\n\n if (haveRightWrapper && rightWrapperChildren.length > 0) {\n rootChildren.unshift(rightWrapperRoot)\n }\n\n return h(\n 'div',\n {\n role: 'pagination',\n 'aria-label': 'pagination',\n class: [\n 'el-pagination',\n {\n 'is-background': props.background,\n 'el-pagination--small': props.small,\n },\n ],\n },\n rootChildren\n )\n }\n },\n})\n"],"names":["buildProps","definePropType","mutable","defineComponent","useLocale","getCurrentInstance","computed","ref","watch","prev","next","provide","elPaginationKey","debugWarn","h","Prev","Jumper","Pager","Next","Sizes","Total"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,QAAQ,CAAC;AAClC,MAAC,eAAe,GAAGA,gBAAU,CAAC;AAC1C,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,eAAe,EAAE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AAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5E,MAAM,IAAI,gBAAgB,GAAG,KAAK,CAAC;AACnC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;AAChC,QAAQ,IAAI,CAAC,KAAK,IAAI,EAAE;AACxB,UAAU,gBAAgB,GAAG,IAAI,CAAC;AAClC,UAAU,OAAO;AACjB,SAAS;AACT,QAAQ,IAAI,CAAC,gBAAgB,EAAE;AAC/B,UAAU,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,SAAS,MAAM;AACf,UAAU,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,SAAS;AACT,OAAO,CAAC,CAAC;AACT,MAAM,IAAI,gBAAgB,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/D,QAAQ,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC/C,OAAO;AACP,MAAM,OAAON,KAAC,CAAC,KAAK,EAAE;AACtB,QAAQ,IAAI,EAAE,YAAY;AAC1B,QAAQ,YAAY,EAAE,YAAY;AAClC,QAAQ,KAAK,EAAE;AACf,UAAU,eAAe;AACzB,UAAU;AACV,YAAY,eAAe,EAAE,KAAK,CAAC,UAAU;AAC7C,YAAY,sBAAsB,EAAE,KAAK,CAAC,KAAK;AAC/C,WAAW;AACX,SAAS;AACT,OAAO,EAAE,YAAY,CAAC,CAAC;AACvB,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"pagination.js","sources":["../../../../../../packages/components/pagination/src/pagination.ts"],"sourcesContent":["import {\n h,\n ref,\n provide,\n computed,\n defineComponent,\n getCurrentInstance,\n watch,\n} from 'vue'\nimport { useLocale } from '@element-plus/hooks'\nimport { debugWarn } from '@element-plus/utils/error'\nimport { buildProps, definePropType, mutable } from '@element-plus/utils/props'\nimport { elPaginationKey } from '@element-plus/tokens'\n\nimport Prev from './components/prev.vue'\nimport Next from './components/next.vue'\nimport Sizes from './components/sizes.vue'\nimport Jumper from './components/jumper.vue'\nimport Total from './components/total.vue'\nimport Pager from './components/pager.vue'\n\nimport type { VNode, ExtractPropTypes } from 'vue'\n\n/**\n * It it user's responsibility to guarantee that the value of props.total... is number\n * (same as pageSize, defaultPageSize, currentPage, defaultCurrentPage, pageCount)\n * Otherwise we can reasonable infer that the corresponding field is absent\n */\nconst isAbsent = (v: unknown): v is undefined => typeof v !== 'number'\n\ntype LayoutKey =\n | 'prev'\n | 'pager'\n | 'next'\n | 'jumper'\n | '->'\n | 'total'\n | 'sizes'\n | 'slot'\n\nexport const paginationProps = buildProps({\n total: Number,\n pageSize: Number,\n defaultPageSize: Number,\n currentPage: Number,\n defaultCurrentPage: Number,\n pageCount: Number,\n pagerCount: {\n type: Number,\n validator: (value: unknown) => {\n return (\n typeof value === 'number' &&\n (value | 0) === value &&\n value > 4 &&\n value < 22 &&\n value % 2 === 1\n )\n },\n default: 7,\n },\n layout: {\n type: String,\n default: (\n ['prev', 'pager', 'next', 'jumper', '->', 'total'] as LayoutKey[]\n ).join(', '),\n },\n pageSizes: {\n type: definePropType<number[]>(Array),\n default: () => mutable([10, 20, 30, 40, 50, 100] as const),\n },\n popperClass: {\n type: String,\n default: '',\n },\n prevText: {\n type: String,\n default: '',\n },\n nextText: {\n type: String,\n default: '',\n },\n small: Boolean,\n background: Boolean,\n disabled: Boolean,\n hideOnSinglePage: Boolean,\n} as const)\nexport type PaginationProps = ExtractPropTypes<typeof paginationProps>\n\nexport const paginationEmits = {\n 'update:current-page': (val: number) => typeof val === 'number',\n 'update:page-size': (val: number) => typeof val === 'number',\n 'size-change': (val: number) => typeof val === 'number',\n 'current-change': (val: number) => typeof val === 'number',\n 'prev-click': (val: number) => typeof val === 'number',\n 'next-click': (val: number) => typeof val === 'number',\n}\nexport type PaginationEmits = typeof paginationEmits\n\nconst componentName = 'ElPagination'\nexport default defineComponent({\n name: componentName,\n\n props: paginationProps,\n emits: paginationEmits,\n\n setup(props, { emit, slots }) {\n const { t } = useLocale()\n const vnodeProps = getCurrentInstance()!.vnode.props || {}\n // we can find @xxx=\"xxx\" props on `vnodeProps` to check if user bind corresponding events\n const hasCurrentPageListener =\n 'onUpdate:currentPage' in vnodeProps ||\n 'onUpdate:current-page' in vnodeProps ||\n 'onCurrentChange' in vnodeProps\n const hasPageSizeListener =\n 'onUpdate:pageSize' in vnodeProps ||\n 'onUpdate:page-size' in vnodeProps ||\n 'onSizeChange' in vnodeProps\n const assertValidUsage = computed(() => {\n // Users have to set either one, otherwise count of pages cannot be determined\n if (isAbsent(props.total) && isAbsent(props.pageCount)) return false\n // <el-pagination ...otherProps :current-page=\"xxx\" /> without corresponding listener is forbidden now\n // Users have to use two way binding of `currentPage`\n // If users just want to provide a default value, `defaultCurrentPage` is here for you\n if (!isAbsent(props.currentPage) && !hasCurrentPageListener) return false\n // When you want to change sizes, things get more complex, detailed below\n // Basically the most important value we need is page count\n // either directly from props.pageCount\n // or calculated from props.total\n // we will take props.pageCount precedence over props.total\n if (props.layout.includes('sizes')) {\n if (!isAbsent(props.pageCount)) {\n // if props.pageCount is assign by user, then user have to watch pageSize change\n // and recalculate pageCount\n if (!hasPageSizeListener) return false\n } else if (!isAbsent(props.total)) {\n // Otherwise, we will see if user have props.pageSize defined\n // If so, meaning user want to have pageSize controlled himself/herself from component\n // Thus page size listener is required\n // users are account for page size change\n if (!isAbsent(props.pageSize)) {\n if (!hasPageSizeListener) {\n return false\n }\n } else {\n // (else block just for explaination)\n // else page size is controlled by el-pagination internally\n }\n }\n }\n return true\n })\n\n const innerPageSize = ref(\n isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize\n )\n const innerCurrentPage = ref(\n isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage\n )\n\n const pageSizeBridge = computed({\n get() {\n return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize\n },\n set(v: number) {\n if (isAbsent(props.pageSize)) {\n innerPageSize.value = v\n }\n if (hasPageSizeListener) {\n emit('update:page-size', v)\n emit('size-change', v)\n }\n },\n })\n\n const pageCountBridge = computed<number>(() => {\n let pageCount = 0\n if (!isAbsent(props.pageCount)) {\n pageCount = props.pageCount\n } else if (!isAbsent(props.total)) {\n pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value))\n }\n return pageCount\n })\n\n const currentPageBridge = computed<number>({\n get() {\n return isAbsent(props.currentPage)\n ? innerCurrentPage.value\n : props.currentPage\n },\n set(v) {\n let newCurrentPage = v\n if (v < 1) {\n newCurrentPage = 1\n } else if (v > pageCountBridge.value) {\n newCurrentPage = pageCountBridge.value\n }\n if (isAbsent(props.currentPage)) {\n innerCurrentPage.value = newCurrentPage\n }\n if (hasCurrentPageListener) {\n emit('update:current-page', newCurrentPage)\n emit('current-change', newCurrentPage)\n }\n },\n })\n\n watch(pageCountBridge, (val) => {\n if (currentPageBridge.value > val) currentPageBridge.value = val\n })\n\n function handleCurrentChange(val: number) {\n currentPageBridge.value = val\n }\n\n function handleSizeChange(val: number) {\n pageSizeBridge.value = val\n const newPageCount = pageCountBridge.value\n if (currentPageBridge.value > newPageCount) {\n currentPageBridge.value = newPageCount\n }\n }\n\n function prev() {\n if (props.disabled) return\n currentPageBridge.value -= 1\n emit('prev-click', currentPageBridge.value)\n }\n\n function next() {\n if (props.disabled) return\n currentPageBridge.value += 1\n emit('next-click', currentPageBridge.value)\n }\n\n function addClass(element: any, cls: string) {\n if (element) {\n if (!element.props) {\n element.props = {}\n }\n element.props.class = [element.props.class, cls].join(' ')\n }\n }\n\n provide(elPaginationKey, {\n pageCount: pageCountBridge,\n disabled: computed(() => props.disabled),\n currentPage: currentPageBridge,\n changeEvent: handleCurrentChange,\n handleSizeChange,\n })\n\n return () => {\n if (!assertValidUsage.value) {\n debugWarn(componentName, t('el.pagination.deprecationWarning'))\n return null\n }\n if (!props.layout) return null\n if (props.hideOnSinglePage && pageCountBridge.value <= 1) return null\n const rootChildren: Array<VNode | VNode[] | null> = []\n const rightWrapperChildren: Array<VNode | VNode[] | null> = []\n const rightWrapperRoot = h(\n 'div',\n { class: 'el-pagination__rightwrapper' },\n rightWrapperChildren\n )\n const TEMPLATE_MAP: Record<\n Exclude<LayoutKey, '->'>,\n VNode | VNode[] | null\n > = {\n prev: h(Prev, {\n disabled: props.disabled,\n currentPage: currentPageBridge.value,\n prevText: props.prevText,\n onClick: prev,\n }),\n jumper: h(Jumper),\n pager: h(Pager, {\n currentPage: currentPageBridge.value,\n pageCount: pageCountBridge.value,\n pagerCount: props.pagerCount,\n onChange: handleCurrentChange,\n disabled: props.disabled,\n }),\n next: h(Next, {\n disabled: props.disabled,\n currentPage: currentPageBridge.value,\n pageCount: pageCountBridge.value,\n nextText: props.nextText,\n onClick: next,\n }),\n sizes: h(Sizes, {\n pageSize: pageSizeBridge.value,\n pageSizes: props.pageSizes,\n popperClass: props.popperClass,\n disabled: props.disabled,\n size: props.small ? 'small' : 'default',\n }),\n slot: slots?.default?.() ?? null,\n total: h(Total, { total: isAbsent(props.total) ? 0 : props.total }),\n }\n\n const components = props.layout\n .split(',')\n .map((item: string) => item.trim()) as LayoutKey[]\n\n let haveRightWrapper = false\n\n components.forEach((c) => {\n if (c === '->') {\n haveRightWrapper = true\n return\n }\n if (!haveRightWrapper) {\n rootChildren.push(TEMPLATE_MAP[c])\n } else {\n rightWrapperChildren.push(TEMPLATE_MAP[c])\n }\n })\n\n if (haveRightWrapper && rightWrapperChildren.length > 0) {\n rootChildren.unshift(rightWrapperRoot)\n }\n\n addClass(rootChildren[0], 'is-first')\n addClass(rootChildren[rootChildren.length - 1], 'is-last')\n\n return h(\n 'div',\n {\n role: 'pagination',\n 'aria-label': 'pagination',\n class: [\n 'el-pagination',\n {\n 'is-background': props.background,\n 'el-pagination--small': props.small,\n },\n ],\n },\n rootChildren\n )\n }\n },\n})\n"],"names":["buildProps","definePropType","mutable","defineComponent","useLocale","getCurrentInstance","computed","ref","watch","prev","next","provide","elPaginationKey","debugWarn","h","Prev","Jumper","Pager","Next","Sizes","Total"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,QAAQ,CAAC;AAClC,MAAC,eAAe,GAAGA,gBAAU,CAAC;AAC1C,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,eAAe,EAAE,MAAM;AACzB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,kBAAkB,EAAE,MAAM;AAC5B,EAAE,SAAS,EAAE,MAAM;AACnB,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,SAAS,EAAE,CAAC,KAAK,KAAK;AAC1B,MAAM,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9G,KAAK;AACL,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAC1E,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAEC,oBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAMC,aAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AACrD,GAAG;A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AI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,SAAS,MAAM;AACf,UAAU,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,SAAS;AACT,OAAO,CAAC,CAAC;AACT,MAAM,IAAI,gBAAgB,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/D,QAAQ,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC/C,OAAO;AACP,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAC5C,MAAM,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACjE,MAAM,OAAON,KAAC,CAAC,KAAK,EAAE;AACtB,QAAQ,IAAI,EAAE,YAAY;AAC1B,QAAQ,YAAY,EAAE,YAAY;AAClC,QAAQ,KAAK,EAAE;AACf,UAAU,eAAe;AACzB,UAAU;AACV,YAAY,eAAe,EAAE,KAAK,CAAC,UAAU;AAC7C,YAAY,sBAAsB,EAAE,KAAK,CAAC,KAAK;AAC/C,WAAW;AACX,SAAS;AACT,OAAO,EAAE,YAAY,CAAC,CAAC;AACvB,KAAK,CAAC;AACN,GAAG;AACH,CAAC,CAAC;;;;;;"}
|
|
@@ -14,6 +14,7 @@ export declare const ElScrollbar: import("../../utils/types").SFCWithInstall<imp
|
|
|
14
14
|
scrollbar$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
15
15
|
wrap$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
16
16
|
resize$: import("vue").Ref<HTMLElement | undefined>;
|
|
17
|
+
barRef: import("vue").Ref<any>;
|
|
17
18
|
moveX: import("vue").Ref<number>;
|
|
18
19
|
moveY: import("vue").Ref<number>;
|
|
19
20
|
ratioX: import("vue").Ref<number>;
|
|
@@ -63,4 +64,4 @@ export declare const ElScrollbar: import("../../utils/types").SFCWithInstall<imp
|
|
|
63
64
|
export default ElScrollbar;
|
|
64
65
|
export * from './src/util';
|
|
65
66
|
export * from './src/scrollbar';
|
|
66
|
-
export * from './src/
|
|
67
|
+
export * from './src/thumb';
|
|
@@ -6,7 +6,7 @@ var withInstall = require('../../utils/with-install.js');
|
|
|
6
6
|
var scrollbar$1 = require('./src/scrollbar2.js');
|
|
7
7
|
var util = require('./src/util.js');
|
|
8
8
|
var scrollbar = require('./src/scrollbar.js');
|
|
9
|
-
var
|
|
9
|
+
var thumb = require('./src/thumb.js');
|
|
10
10
|
|
|
11
11
|
const ElScrollbar = withInstall.withInstall(scrollbar$1["default"]);
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ exports.BAR_MAP = util.BAR_MAP;
|
|
|
14
14
|
exports.renderThumbStyle = util.renderThumbStyle;
|
|
15
15
|
exports.scrollbarEmits = scrollbar.scrollbarEmits;
|
|
16
16
|
exports.scrollbarProps = scrollbar.scrollbarProps;
|
|
17
|
-
exports.
|
|
17
|
+
exports.thumbProps = thumb.thumbProps;
|
|
18
18
|
exports.ElScrollbar = ElScrollbar;
|
|
19
19
|
exports["default"] = ElScrollbar;
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/components/scrollbar/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils/with-install'\n\nimport Scrollbar from './src/scrollbar.vue'\n\nexport const ElScrollbar = withInstall(Scrollbar)\nexport default ElScrollbar\n\nexport * from './src/util'\nexport * from './src/scrollbar'\nexport * from './src/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/components/scrollbar/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils/with-install'\n\nimport Scrollbar from './src/scrollbar.vue'\n\nexport const ElScrollbar = withInstall(Scrollbar)\nexport default ElScrollbar\n\nexport * from './src/util'\nexport * from './src/scrollbar'\nexport * from './src/thumb'\n"],"names":["withInstall","Scrollbar"],"mappings":";;;;;;;;;;AAEY,MAAC,WAAW,GAAGA,uBAAW,CAACC,sBAAS;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue';
|
|
2
2
|
export declare const barProps: {
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
3
|
+
readonly always: import("element-plus/es/utils/props").BuildPropReturn<BooleanConstructor, true, unknown, unknown, unknown>;
|
|
4
|
+
readonly width: import("element-plus/es/utils/props").BuildPropReturn<StringConstructor, "", unknown, unknown, unknown>;
|
|
5
|
+
readonly height: import("element-plus/es/utils/props").BuildPropReturn<StringConstructor, "", unknown, unknown, unknown>;
|
|
6
|
+
readonly ratioX: import("element-plus/es/utils/props").BuildPropReturn<NumberConstructor, 1, unknown, unknown, unknown>;
|
|
7
|
+
readonly ratioY: import("element-plus/es/utils/props").BuildPropReturn<NumberConstructor, 1, unknown, unknown, unknown>;
|
|
8
8
|
};
|
|
9
9
|
export declare type BarProps = ExtractPropTypes<typeof barProps>;
|
|
@@ -5,14 +5,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var props = require('../../../utils/props.js');
|
|
6
6
|
|
|
7
7
|
const barProps = props.buildProps({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
always: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: true
|
|
11
|
+
},
|
|
12
|
+
width: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
height: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
ratioX: {
|
|
12
21
|
type: Number,
|
|
13
|
-
|
|
22
|
+
default: 1
|
|
14
23
|
},
|
|
15
|
-
|
|
24
|
+
ratioY: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 1
|
|
27
|
+
}
|
|
16
28
|
});
|
|
17
29
|
|
|
18
30
|
exports.barProps = barProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar.js","sources":["../../../../../../packages/components/scrollbar/src/bar.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const barProps = buildProps({\n
|
|
1
|
+
{"version":3,"file":"bar.js","sources":["../../../../../../packages/components/scrollbar/src/bar.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils/props'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const barProps = buildProps({\n always: {\n type: Boolean,\n default: true,\n },\n width: {\n type: String,\n default: '',\n },\n height: {\n type: String,\n default: '',\n },\n ratioX: {\n type: Number,\n default: 1,\n },\n ratioY: {\n type: Number,\n default: 1,\n },\n} as const)\nexport type BarProps = ExtractPropTypes<typeof barProps>\n"],"names":["buildProps"],"mappings":";;;;;;AACY,MAAC,QAAQ,GAAGA,gBAAU,CAAC;AACnC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,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,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,43 +1,24 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
readonly
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
2
|
+
readonly always: import("../../../utils/props").BuildPropReturn<BooleanConstructor, true, unknown, unknown, unknown>;
|
|
3
|
+
readonly width: import("../../../utils/props").BuildPropReturn<StringConstructor, "", unknown, unknown, unknown>;
|
|
4
|
+
readonly height: import("../../../utils/props").BuildPropReturn<StringConstructor, "", unknown, unknown, unknown>;
|
|
5
|
+
readonly ratioX: import("../../../utils/props").BuildPropReturn<NumberConstructor, 1, unknown, unknown, unknown>;
|
|
6
|
+
readonly ratioY: import("../../../utils/props").BuildPropReturn<NumberConstructor, 1, unknown, unknown, unknown>;
|
|
7
7
|
}, {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
offset: string;
|
|
12
|
-
scroll: string;
|
|
13
|
-
scrollSize: string;
|
|
14
|
-
size: string;
|
|
15
|
-
key: string;
|
|
16
|
-
axis: string;
|
|
17
|
-
client: string;
|
|
18
|
-
direction: string;
|
|
19
|
-
} | {
|
|
20
|
-
offset: string;
|
|
21
|
-
scroll: string;
|
|
22
|
-
scrollSize: string;
|
|
23
|
-
size: string;
|
|
24
|
-
key: string;
|
|
25
|
-
axis: string;
|
|
26
|
-
client: string;
|
|
27
|
-
direction: string;
|
|
28
|
-
}>;
|
|
29
|
-
thumbStyle: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
30
|
-
visible: import("vue").Ref<boolean>;
|
|
31
|
-
clickTrackHandler: (e: MouseEvent) => void;
|
|
32
|
-
clickThumbHandler: (e: MouseEvent) => void;
|
|
8
|
+
handleScroll: (wrap: HTMLDivElement) => void;
|
|
9
|
+
moveX: import("vue").Ref<number>;
|
|
10
|
+
moveY: import("vue").Ref<number>;
|
|
33
11
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
12
|
+
readonly always: import("../../../utils/props").BuildPropReturn<BooleanConstructor, true, unknown, unknown, unknown>;
|
|
13
|
+
readonly width: import("../../../utils/props").BuildPropReturn<StringConstructor, "", unknown, unknown, unknown>;
|
|
14
|
+
readonly height: import("../../../utils/props").BuildPropReturn<StringConstructor, "", unknown, unknown, unknown>;
|
|
15
|
+
readonly ratioX: import("../../../utils/props").BuildPropReturn<NumberConstructor, 1, unknown, unknown, unknown>;
|
|
16
|
+
readonly ratioY: import("../../../utils/props").BuildPropReturn<NumberConstructor, 1, unknown, unknown, unknown>;
|
|
39
17
|
}>>, {
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
height: string;
|
|
19
|
+
width: string;
|
|
20
|
+
always: import("../../../utils/props").BuildPropType<BooleanConstructor, unknown, unknown>;
|
|
21
|
+
ratioX: number;
|
|
22
|
+
ratioY: number;
|
|
42
23
|
}>;
|
|
43
24
|
export default _default;
|
|
@@ -3,135 +3,51 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var vue = require('vue');
|
|
6
|
-
var
|
|
7
|
-
require('../../../tokens/index.js');
|
|
8
|
-
var error = require('../../../utils/error.js');
|
|
9
|
-
var util = require('./util.js');
|
|
6
|
+
var thumb = require('./thumb2.js');
|
|
10
7
|
var bar = require('./bar.js');
|
|
11
8
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
12
|
-
var scrollbar = require('../../../tokens/scrollbar.js');
|
|
13
9
|
|
|
14
|
-
const COMPONENT_NAME = "Bar";
|
|
15
10
|
const _sfc_main = vue.defineComponent({
|
|
16
|
-
|
|
11
|
+
components: {
|
|
12
|
+
Thumb: thumb["default"]
|
|
13
|
+
},
|
|
17
14
|
props: bar.barProps,
|
|
18
15
|
setup(props) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const bar = vue.computed(() => util.BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
|
|
30
|
-
const thumbStyle = vue.computed(() => util.renderThumbStyle({
|
|
31
|
-
size: props.size,
|
|
32
|
-
move: props.move,
|
|
33
|
-
bar: bar.value
|
|
34
|
-
}));
|
|
35
|
-
const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar$1.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
|
|
36
|
-
const clickThumbHandler = (e) => {
|
|
37
|
-
var _a;
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
if (e.ctrlKey || [1, 2].includes(e.button))
|
|
40
|
-
return;
|
|
41
|
-
(_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
|
|
42
|
-
startDrag(e);
|
|
43
|
-
const el = e.currentTarget;
|
|
44
|
-
if (!el)
|
|
45
|
-
return;
|
|
46
|
-
barStore.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
|
|
16
|
+
const moveX = vue.ref(0);
|
|
17
|
+
const moveY = vue.ref(0);
|
|
18
|
+
const GAP = 4;
|
|
19
|
+
const handleScroll = (wrap) => {
|
|
20
|
+
if (wrap) {
|
|
21
|
+
const offsetHeight = wrap.offsetHeight - GAP;
|
|
22
|
+
const offsetWidth = wrap.offsetWidth - GAP;
|
|
23
|
+
moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
|
|
24
|
+
moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
|
|
25
|
+
}
|
|
47
26
|
};
|
|
48
|
-
const clickTrackHandler = (e) => {
|
|
49
|
-
if (!thumb.value || !instance.value || !scrollbar$1.wrapElement)
|
|
50
|
-
return;
|
|
51
|
-
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
|
|
52
|
-
const thumbHalf = thumb.value[bar.value.offset] / 2;
|
|
53
|
-
const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
54
|
-
scrollbar$1.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar$1.wrapElement[bar.value.scrollSize] / 100;
|
|
55
|
-
};
|
|
56
|
-
const startDrag = (e) => {
|
|
57
|
-
e.stopImmediatePropagation();
|
|
58
|
-
cursorDown = true;
|
|
59
|
-
document.addEventListener("mousemove", mouseMoveDocumentHandler);
|
|
60
|
-
document.addEventListener("mouseup", mouseUpDocumentHandler);
|
|
61
|
-
onselectstartStore = document.onselectstart;
|
|
62
|
-
document.onselectstart = () => false;
|
|
63
|
-
};
|
|
64
|
-
const mouseMoveDocumentHandler = (e) => {
|
|
65
|
-
if (!instance.value || !thumb.value)
|
|
66
|
-
return;
|
|
67
|
-
if (cursorDown === false)
|
|
68
|
-
return;
|
|
69
|
-
const prevPage = barStore.value[bar.value.axis];
|
|
70
|
-
if (!prevPage)
|
|
71
|
-
return;
|
|
72
|
-
const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
|
|
73
|
-
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
|
|
74
|
-
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
|
|
75
|
-
scrollbar$1.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar$1.wrapElement[bar.value.scrollSize] / 100;
|
|
76
|
-
};
|
|
77
|
-
const mouseUpDocumentHandler = () => {
|
|
78
|
-
cursorDown = false;
|
|
79
|
-
barStore.value[bar.value.axis] = 0;
|
|
80
|
-
document.removeEventListener("mousemove", mouseMoveDocumentHandler);
|
|
81
|
-
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
82
|
-
restoreOnselectstart();
|
|
83
|
-
if (cursorLeave)
|
|
84
|
-
visible.value = false;
|
|
85
|
-
};
|
|
86
|
-
const mouseMoveScrollbarHandler = () => {
|
|
87
|
-
cursorLeave = false;
|
|
88
|
-
visible.value = !!props.size;
|
|
89
|
-
};
|
|
90
|
-
const mouseLeaveScrollbarHandler = () => {
|
|
91
|
-
cursorLeave = true;
|
|
92
|
-
visible.value = cursorDown;
|
|
93
|
-
};
|
|
94
|
-
vue.onBeforeUnmount(() => {
|
|
95
|
-
restoreOnselectstart();
|
|
96
|
-
document.removeEventListener("mouseup", mouseUpDocumentHandler);
|
|
97
|
-
});
|
|
98
|
-
const restoreOnselectstart = () => {
|
|
99
|
-
if (document.onselectstart !== onselectstartStore)
|
|
100
|
-
document.onselectstart = onselectstartStore;
|
|
101
|
-
};
|
|
102
|
-
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
|
|
103
|
-
core.useEventListener(vue.toRef(scrollbar$1, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
|
|
104
27
|
return {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
thumbStyle,
|
|
109
|
-
visible,
|
|
110
|
-
clickTrackHandler,
|
|
111
|
-
clickThumbHandler
|
|
28
|
+
handleScroll,
|
|
29
|
+
moveX,
|
|
30
|
+
moveY
|
|
112
31
|
};
|
|
113
32
|
}
|
|
114
33
|
});
|
|
115
34
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]),
|
|
133
|
-
_: 1
|
|
134
|
-
});
|
|
35
|
+
const _component_thumb = vue.resolveComponent("thumb");
|
|
36
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
37
|
+
vue.createVNode(_component_thumb, {
|
|
38
|
+
move: _ctx.moveX,
|
|
39
|
+
ratio: _ctx.ratioX,
|
|
40
|
+
size: _ctx.width,
|
|
41
|
+
always: _ctx.always
|
|
42
|
+
}, null, 8, ["move", "ratio", "size", "always"]),
|
|
43
|
+
vue.createVNode(_component_thumb, {
|
|
44
|
+
move: _ctx.moveY,
|
|
45
|
+
ratio: _ctx.ratioY,
|
|
46
|
+
size: _ctx.height,
|
|
47
|
+
vertical: "",
|
|
48
|
+
always: _ctx.always
|
|
49
|
+
}, null, 8, ["move", "ratio", "size", "always"])
|
|
50
|
+
], 64);
|
|
135
51
|
}
|
|
136
52
|
var Bar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
137
53
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar2.js","sources":["../../../../../../packages/components/scrollbar/src/bar.vue"],"sourcesContent":["<template>\n <
|
|
1
|
+
{"version":3,"file":"bar2.js","sources":["../../../../../../packages/components/scrollbar/src/bar.vue"],"sourcesContent":["<template>\n <thumb :move=\"moveX\" :ratio=\"ratioX\" :size=\"width\" :always=\"always\" />\n <thumb\n :move=\"moveY\"\n :ratio=\"ratioY\"\n :size=\"height\"\n vertical\n :always=\"always\"\n />\n</template>\n<script lang=\"ts\">\nimport { defineComponent, ref } from 'vue'\nimport Thumb from './thumb.vue'\nimport { barProps } from './bar'\n\nexport default defineComponent({\n components: {\n Thumb,\n },\n props: barProps,\n setup(props) {\n const moveX = ref(0)\n const moveY = ref(0)\n const GAP = 4 // top 2 + bottom 2 of bar instance\n\n const handleScroll = (wrap: HTMLDivElement) => {\n if (wrap) {\n const offsetHeight = wrap.offsetHeight - GAP\n const offsetWidth = wrap.offsetWidth - GAP\n\n moveY.value = ((wrap.scrollTop * 100) / offsetHeight) * props.ratioY\n moveX.value = ((wrap.scrollLeft * 100) / offsetWidth) * props.ratioX\n }\n }\n\n return {\n handleScroll,\n moveX,\n moveY,\n }\n },\n})\n</script>\n"],"names":["defineComponent","Thumb","barProps","ref","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;AAeA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,YAAY;AAAA,WACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,MAAM,OAAO;AACX,UAAM,QAAQC,QAAI;AAClB,UAAM,QAAQA,QAAI;AAClB,UAAM,MAAM;AAEZ,UAAM,eAAe,CAAC,SAAyB;AAC7C,UAAI,MAAM;AACR,cAAM,eAAe,KAAK,eAAe;AACzC,cAAM,cAAc,KAAK,cAAc;AAEvC,cAAM,QAAU,KAAK,YAAY,MAAO,eAAgB,MAAM;AAC9D,cAAM,QAAU,KAAK,aAAa,MAAO,cAAe,MAAM;AAAA;AAAA;AAIlE,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA;;;SArCJC,iBAAsEC;AAAA,oBAAxD,kBAAK;AAAA,MAAG,MAAK,KAAE;AAAA,MAAS,OAAM;AAAA,MAAQ,MAAM,KAAE;AAAA;OAC5D,SAME;AAAA,oBALO,kBAAK;AAAA,MACX,MAAK,KAAE;AAAA,MACP,OAAM;AAAA,MACP;AAAA,MACC,UAAQ;AAAA;;;;;;;;"}
|
|
@@ -15,6 +15,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
15
15
|
scrollbar$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
16
16
|
wrap$: import("vue").Ref<HTMLDivElement | undefined>;
|
|
17
17
|
resize$: import("vue").Ref<HTMLElement | undefined>;
|
|
18
|
+
barRef: import("vue").Ref<any>;
|
|
18
19
|
moveX: import("vue").Ref<number>;
|
|
19
20
|
moveY: import("vue").Ref<number>;
|
|
20
21
|
ratioX: import("vue").Ref<number>;
|
|
@@ -27,6 +27,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
27
27
|
const resize$ = vue.ref();
|
|
28
28
|
const sizeWidth = vue.ref("0");
|
|
29
29
|
const sizeHeight = vue.ref("0");
|
|
30
|
+
const barRef = vue.ref();
|
|
30
31
|
const moveX = vue.ref(0);
|
|
31
32
|
const moveY = vue.ref(0);
|
|
32
33
|
const ratioY = vue.ref(1);
|
|
@@ -42,11 +43,9 @@ const _sfc_main = vue.defineComponent({
|
|
|
42
43
|
return [props.wrapStyle, style2];
|
|
43
44
|
});
|
|
44
45
|
const handleScroll = () => {
|
|
46
|
+
var _a;
|
|
45
47
|
if (wrap$.value) {
|
|
46
|
-
|
|
47
|
-
const offsetWidth = wrap$.value.offsetWidth - GAP;
|
|
48
|
-
moveY.value = wrap$.value.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
49
|
-
moveX.value = wrap$.value.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
48
|
+
(_a = barRef.value) == null ? void 0 : _a.handleScroll(wrap$.value);
|
|
50
49
|
emit("scroll", {
|
|
51
50
|
scrollTop: wrap$.value.scrollTop,
|
|
52
51
|
scrollLeft: wrap$.value.scrollLeft
|
|
@@ -103,6 +102,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
103
102
|
scrollbar$,
|
|
104
103
|
wrap$,
|
|
105
104
|
resize$,
|
|
105
|
+
barRef,
|
|
106
106
|
moveX,
|
|
107
107
|
moveY,
|
|
108
108
|
ratioX,
|
|
@@ -145,21 +145,15 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
145
145
|
_: 3
|
|
146
146
|
}, 8, ["class", "style"]))
|
|
147
147
|
], 38),
|
|
148
|
-
!_ctx.native ? (vue.openBlock(), vue.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
ratio: _ctx.ratioY,
|
|
158
|
-
size: _ctx.sizeHeight,
|
|
159
|
-
vertical: "",
|
|
160
|
-
always: _ctx.always
|
|
161
|
-
}, null, 8, ["move", "ratio", "size", "always"])
|
|
162
|
-
], 64)) : vue.createCommentVNode("v-if", true)
|
|
148
|
+
!_ctx.native ? (vue.openBlock(), vue.createBlock(_component_bar, {
|
|
149
|
+
key: 0,
|
|
150
|
+
ref: "barRef",
|
|
151
|
+
height: _ctx.sizeHeight,
|
|
152
|
+
width: _ctx.sizeWidth,
|
|
153
|
+
always: _ctx.always,
|
|
154
|
+
"ratio-x": _ctx.ratioX,
|
|
155
|
+
"ratio-y": _ctx.ratioY
|
|
156
|
+
}, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true)
|
|
163
157
|
], 512);
|
|
164
158
|
}
|
|
165
159
|
var Scrollbar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbar$\" class=\"el-scrollbar\">\n <div\n ref=\"wrap$\"\n :class=\"[\n wrapClass,\n 'el-scrollbar__wrap',\n native ? '' : 'el-scrollbar__wrap--hidden-default',\n ]\"\n :style=\"style\"\n @scroll=\"handleScroll\"\n >\n <component\n :is=\"tag\"\n ref=\"resize$\"\n :class=\"['el-scrollbar__view', viewClass]\"\n :style=\"viewStyle\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar
|
|
1
|
+
{"version":3,"file":"scrollbar2.js","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.vue"],"sourcesContent":["<template>\n <div ref=\"scrollbar$\" class=\"el-scrollbar\">\n <div\n ref=\"wrap$\"\n :class=\"[\n wrapClass,\n 'el-scrollbar__wrap',\n native ? '' : 'el-scrollbar__wrap--hidden-default',\n ]\"\n :style=\"style\"\n @scroll=\"handleScroll\"\n >\n <component\n :is=\"tag\"\n ref=\"resize$\"\n :class=\"['el-scrollbar__view', viewClass]\"\n :style=\"viewStyle\"\n >\n <slot />\n </component>\n </div>\n <template v-if=\"!native\">\n <bar\n ref=\"barRef\"\n :height=\"sizeHeight\"\n :width=\"sizeWidth\"\n :always=\"always\"\n :ratio-x=\"ratioX\"\n :ratio-y=\"ratioY\"\n ></bar>\n </template>\n </div>\n</template>\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n reactive,\n} from 'vue'\nimport { useResizeObserver, useEventListener } from '@vueuse/core'\nimport { addUnit, isNumber } from '@element-plus/utils/util'\nimport { debugWarn } from '@element-plus/utils/error'\nimport { scrollbarContextKey } from '@element-plus/tokens'\nimport Bar from './bar.vue'\n\nimport { scrollbarProps, scrollbarEmits } from './scrollbar'\nimport type { StyleValue, CSSProperties } from 'vue'\n\nexport default defineComponent({\n name: 'ElScrollbar',\n components: {\n Bar,\n },\n props: scrollbarProps,\n emits: scrollbarEmits,\n\n setup(props, { emit }) {\n let stopResizeObserver: (() => void) | undefined = undefined\n let stopResizeListener: (() => void) | undefined = undefined\n\n const scrollbar$ = ref<HTMLDivElement>()\n const wrap$ = ref<HTMLDivElement>()\n const resize$ = ref<HTMLElement>()\n\n const sizeWidth = ref('0')\n const sizeHeight = ref('0')\n const barRef = ref()\n const moveX = ref(0)\n const moveY = ref(0)\n const ratioY = ref(1)\n const ratioX = ref(1)\n const SCOPE = 'ElScrollbar'\n const GAP = 4 // top 2 + bottom 2 of bar instance\n\n const style = computed<StyleValue>(() => {\n const style: CSSProperties = {}\n if (props.height) style.height = addUnit(props.height)\n if (props.maxHeight) style.maxHeight = addUnit(props.maxHeight)\n return [props.wrapStyle, style]\n })\n\n const handleScroll = () => {\n if (wrap$.value) {\n barRef.value?.handleScroll(wrap$.value)\n\n emit('scroll', {\n scrollTop: wrap$.value.scrollTop,\n scrollLeft: wrap$.value.scrollLeft,\n })\n }\n }\n\n const setScrollTop = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(SCOPE, 'value must be a number')\n return\n }\n wrap$.value!.scrollTop = value\n }\n\n const setScrollLeft = (value: number) => {\n if (!isNumber(value)) {\n debugWarn(SCOPE, 'value must be a number')\n return\n }\n wrap$.value!.scrollLeft = value\n }\n\n const update = () => {\n if (!wrap$.value) return\n\n const offsetHeight = wrap$.value.offsetHeight - GAP\n const offsetWidth = wrap$.value.offsetWidth - GAP\n\n const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight\n const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth\n const height = Math.max(originalHeight, props.minSize)\n const width = Math.max(originalWidth, props.minSize)\n\n ratioY.value =\n originalHeight /\n (offsetHeight - originalHeight) /\n (height / (offsetHeight - height))\n ratioX.value =\n originalWidth /\n (offsetWidth - originalWidth) /\n (width / (offsetWidth - width))\n\n sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ''\n sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ''\n }\n\n watch(\n () => props.noresize,\n (noresize) => {\n if (noresize) {\n stopResizeObserver?.()\n stopResizeListener?.()\n } else {\n ;({ stop: stopResizeObserver } = useResizeObserver(resize$, update))\n stopResizeListener = useEventListener('resize', update)\n }\n },\n { immediate: true }\n )\n\n provide(\n scrollbarContextKey,\n reactive({\n scrollbarElement: scrollbar$,\n wrapElement: wrap$,\n })\n )\n\n onMounted(() => {\n if (!props.native) nextTick(() => update())\n })\n\n return {\n scrollbar$,\n wrap$,\n resize$,\n barRef,\n moveX,\n moveY,\n ratioX,\n ratioY,\n sizeWidth,\n sizeHeight,\n style,\n update,\n handleScroll,\n setScrollTop,\n setScrollLeft,\n }\n },\n})\n</script>\n"],"names":["defineComponent","Bar","scrollbarProps","scrollbarEmits","ref","computed","addUnit"],"mappings":";;;;;;;;;;;;;;AAqDA,MAAK,YAAaA,oBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,SACVC;AAAA;AAAA,EAEF,OAAOC;AAAA,EACP,OAAOC;AAAA,EAEP,MAAM,OAAO,EAAE,QAAQ;AACrB,QAAI,qBAA+C;AACnD,QAAI,qBAA+C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