@element-plus/nightly 0.0.20240610 → 0.0.20240612
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/dist/index.full.js +3 -3
- package/dist/index.full.min.js +3 -3
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +3 -3
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +3 -3
- 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-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.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/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.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/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.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/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.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/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.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/anchor/index.mjs +1 -1
- package/es/components/anchor/src/anchor-link.mjs +6 -82
- package/es/components/anchor/src/anchor-link.mjs.map +1 -1
- package/es/components/anchor/src/anchor-link2.mjs +82 -6
- package/es/components/anchor/src/anchor-link2.mjs.map +1 -1
- package/es/components/color-picker/index.mjs +2 -2
- package/es/components/color-picker/src/color-picker.mjs +46 -414
- package/es/components/color-picker/src/color-picker.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker2.mjs +414 -46
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/color-picker/src/components/predefine.mjs +1 -1
- package/es/components/index.mjs +2 -2
- package/es/components/pagination/src/components/total.mjs +7 -28
- package/es/components/pagination/src/components/total.mjs.map +1 -1
- package/es/components/pagination/src/components/total2.mjs +28 -7
- package/es/components/pagination/src/components/total2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/table-v2/src/composables/use-row.mjs +1 -1
- package/es/components/table-v2/src/composables/use-row.mjs.map +1 -1
- package/es/components/tour/src/mask.mjs +78 -19
- package/es/components/tour/src/mask.mjs.map +1 -1
- package/es/components/tour/src/mask2.mjs +19 -78
- package/es/components/tour/src/mask2.mjs.map +1 -1
- package/es/components/tour/src/tour2.mjs +1 -1
- package/es/components/watermark/index.mjs +2 -2
- package/es/components/watermark/src/watermark.mjs +28 -209
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark2.mjs +209 -28
- package/es/components/watermark/src/watermark2.mjs.map +1 -1
- package/es/index.mjs +2 -2
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/anchor/index.js +1 -1
- package/lib/components/anchor/src/anchor-link.js +6 -82
- package/lib/components/anchor/src/anchor-link.js.map +1 -1
- package/lib/components/anchor/src/anchor-link2.js +82 -6
- package/lib/components/anchor/src/anchor-link2.js.map +1 -1
- package/lib/components/color-picker/index.js +2 -2
- package/lib/components/color-picker/src/color-picker.js +46 -412
- package/lib/components/color-picker/src/color-picker.js.map +1 -1
- package/lib/components/color-picker/src/color-picker2.js +412 -46
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/color-picker/src/components/predefine.js +1 -1
- package/lib/components/index.js +2 -2
- package/lib/components/pagination/src/components/total.js +7 -28
- package/lib/components/pagination/src/components/total.js.map +1 -1
- package/lib/components/pagination/src/components/total2.js +28 -7
- package/lib/components/pagination/src/components/total2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/table-v2/src/composables/use-row.js +1 -1
- package/lib/components/table-v2/src/composables/use-row.js.map +1 -1
- package/lib/components/tour/src/mask.js +78 -19
- package/lib/components/tour/src/mask.js.map +1 -1
- package/lib/components/tour/src/mask2.js +19 -78
- package/lib/components/tour/src/mask2.js.map +1 -1
- package/lib/components/tour/src/tour2.js +1 -1
- package/lib/components/watermark/index.js +2 -2
- package/lib/components/watermark/src/watermark.js +28 -209
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark2.js +209 -28
- package/lib/components/watermark/src/watermark2.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/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"total2.js","sources":["../../../../../../../packages/components/pagination/src/components/total.
|
|
1
|
+
{"version":3,"file":"total2.js","sources":["../../../../../../../packages/components/pagination/src/components/total.vue"],"sourcesContent":["<template>\n <span :class=\"ns.e('total')\" :disabled=\"disabled\">\n {{\n t('el.pagination.total', {\n total,\n })\n }}\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { usePagination } from '../usePagination'\nimport { paginationTotalProps } from './total'\n\nconst { t } = useLocale()\nconst ns = useNamespace('pagination')\nconst { disabled } = usePagination()\n\ndefineOptions({\n name: 'ElPaginationTotal',\n})\n\ndefineProps(paginationTotalProps)\n</script>\n"],"names":["useLocale","useNamespace","usePagination"],"mappings":";;;;;;;;;;;;;uCAmBc,CAAA;AAAA,EACZ,IAAM,EAAA,mBAAA;AACR,CAAA,CAAA,CAAA;;;;;AANA,IAAM,MAAA,EAAE,MAAMA,eAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAKC,qBAAa,YAAY,CAAA,CAAA;AACpC,IAAM,MAAA,EAAE,aAAaC,2BAAc,EAAA,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -11,7 +11,7 @@ var prev = require('./components/prev2.js');
|
|
|
11
11
|
var next = require('./components/next2.js');
|
|
12
12
|
var sizes = require('./components/sizes2.js');
|
|
13
13
|
var jumper = require('./components/jumper2.js');
|
|
14
|
-
var total = require('./components/
|
|
14
|
+
var total = require('./components/total2.js');
|
|
15
15
|
var pager = require('./components/pager2.js');
|
|
16
16
|
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
17
17
|
var types = require('../../../utils/types.js');
|
|
@@ -40,7 +40,7 @@ const useRow = (props, {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
const tableRoot = tableInstance.vnode.el;
|
|
43
|
-
const rows = tableRoot.querySelectorAll(`[rowkey
|
|
43
|
+
const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
|
|
44
44
|
rows.forEach((row) => {
|
|
45
45
|
if (hovered) {
|
|
46
46
|
row.classList.add(ns.is("hovered"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-row.js","sources":["../../../../../../../packages/components/table-v2/src/composables/use-row.ts"],"sourcesContent":["import { computed, getCurrentInstance, ref, shallowRef, unref } from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { isNumber } from '@element-plus/utils'\nimport { FixedDir } from '../constants'\n\nimport type { ComponentInternalInstance, Ref, ShallowRef } from 'vue'\nimport type { TableV2Props } from '../table'\nimport type {\n RowExpandParams,\n RowHeightChangedParams,\n RowHoverParams,\n} from '../row'\nimport type { FixedDirection, KeyType } from '../types'\nimport type { onRowRenderedParams } from '../grid'\nimport type { TableGridInstance } from '../table-grid'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\n\ntype Heights = Record<KeyType, number>\ntype GridInstanceRef = Ref<TableGridInstance | undefined>\n\ntype UseRowProps = {\n mainTableRef: GridInstanceRef\n leftTableRef: GridInstanceRef\n rightTableRef: GridInstanceRef\n tableInstance: ComponentInternalInstance\n ns: UseNamespaceReturn\n isScrolling: ShallowRef<boolean>\n}\n\nexport const useRow = (\n props: TableV2Props,\n {\n mainTableRef,\n leftTableRef,\n rightTableRef,\n tableInstance,\n ns,\n isScrolling,\n }: UseRowProps\n) => {\n const vm = getCurrentInstance()!\n const { emit } = vm\n const isResetting = shallowRef(false)\n const expandedRowKeys = ref<KeyType[]>(props.defaultExpandedRowKeys || [])\n const lastRenderedRowIndex = ref(-1)\n const resetIndex = shallowRef<number | null>(null)\n const rowHeights = ref<Heights>({})\n const pendingRowHeights = ref<Heights>({})\n const leftTableHeights = shallowRef<Heights>({})\n const mainTableHeights = shallowRef<Heights>({})\n const rightTableHeights = shallowRef<Heights>({})\n const isDynamic = computed(() => isNumber(props.estimatedRowHeight))\n\n function onRowsRendered(params: onRowRenderedParams) {\n props.onRowsRendered?.(params)\n\n if (params.rowCacheEnd > unref(lastRenderedRowIndex)) {\n lastRenderedRowIndex.value = params.rowCacheEnd\n }\n }\n\n function onRowHovered({ hovered, rowKey }: RowHoverParams) {\n if (isScrolling.value) {\n return\n }\n const tableRoot = tableInstance!.vnode.el as HTMLElement\n const rows = tableRoot.querySelectorAll(`[rowkey=${rowKey as string}]`)\n rows.forEach((row) => {\n if (hovered) {\n row.classList.add(ns.is('hovered'))\n } else {\n row.classList.remove(ns.is('hovered'))\n }\n })\n }\n\n function onRowExpanded({\n expanded,\n rowData,\n rowIndex,\n rowKey,\n }: RowExpandParams) {\n const _expandedRowKeys = [...unref(expandedRowKeys)]\n const currentKeyIndex = _expandedRowKeys.indexOf(rowKey)\n if (expanded) {\n if (currentKeyIndex === -1) _expandedRowKeys.push(rowKey)\n } else {\n if (currentKeyIndex > -1) _expandedRowKeys.splice(currentKeyIndex, 1)\n }\n expandedRowKeys.value = _expandedRowKeys\n\n emit('update:expandedRowKeys', _expandedRowKeys)\n props.onRowExpand?.({\n expanded,\n rowData,\n rowIndex,\n rowKey,\n })\n // If this is not controlled, then use this to notify changes\n props.onExpandedRowsChange?.(_expandedRowKeys)\n }\n\n const flushingRowHeights = debounce(() => {\n isResetting.value = true\n rowHeights.value = { ...unref(rowHeights), ...unref(pendingRowHeights) }\n resetAfterIndex(unref(resetIndex)!, false)\n pendingRowHeights.value = {}\n // force update\n resetIndex.value = null\n mainTableRef.value?.forceUpdate()\n leftTableRef.value?.forceUpdate()\n rightTableRef.value?.forceUpdate()\n vm.proxy?.$forceUpdate()\n isResetting.value = false\n }, 0)\n\n function resetAfterIndex(index: number, forceUpdate = false) {\n if (!unref(isDynamic)) return\n ;[mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {\n const table = unref(tableRef)\n if (table) table.resetAfterRowIndex(index, forceUpdate)\n })\n }\n\n function resetHeights(rowKey: KeyType, height: number, rowIdx: number) {\n const resetIdx = unref(resetIndex)\n if (resetIdx === null) {\n resetIndex.value = rowIdx\n } else {\n if (resetIdx > rowIdx) {\n resetIndex.value = rowIdx\n }\n }\n\n pendingRowHeights.value[rowKey] = height\n }\n\n function onRowHeightChange(\n { rowKey, height, rowIndex }: RowHeightChangedParams,\n fixedDir: FixedDirection\n ) {\n if (!fixedDir) {\n mainTableHeights.value[rowKey] = height\n } else {\n if (fixedDir === FixedDir.RIGHT) {\n rightTableHeights.value[rowKey] = height\n } else {\n leftTableHeights.value[rowKey] = height\n }\n }\n\n const maximumHeight = Math.max(\n ...[leftTableHeights, rightTableHeights, mainTableHeights].map(\n (records) => records.value[rowKey] || 0\n )\n )\n\n if (unref(rowHeights)[rowKey] !== maximumHeight) {\n resetHeights(rowKey, maximumHeight, rowIndex)\n flushingRowHeights()\n }\n }\n\n return {\n expandedRowKeys,\n lastRenderedRowIndex,\n isDynamic,\n isResetting,\n rowHeights,\n\n resetAfterIndex,\n onRowExpanded,\n onRowHovered,\n onRowsRendered,\n onRowHeightChange,\n }\n}\n\nexport type UseRowReturn = ReturnType<typeof useRow>\n"],"names":["getCurrentInstance","shallowRef","ref","computed","isNumber","unref","debounce","FixedDir"],"mappings":";;;;;;;;;;AAIY,MAAC,MAAM,GAAG,CAAC,KAAK,EAAE;AAC9B,EAAE,YAAY;AACd,EAAE,YAAY;AACd,EAAE,aAAa;AACf,EAAE,aAAa;AACf,EAAE,EAAE;AACJ,EAAE,WAAW;AACb,CAAC,KAAK;AACN,EAAE,MAAM,EAAE,GAAGA,sBAAkB,EAAE,CAAC;AAClC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACtB,EAAE,MAAM,WAAW,GAAGC,cAAU,CAAC,KAAK,CAAC,CAAC;AACxC,EAAE,MAAM,eAAe,GAAGC,OAAG,CAAC,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;AAClE,EAAE,MAAM,oBAAoB,GAAGA,OAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,EAAE,MAAM,UAAU,GAAGD,cAAU,CAAC,IAAI,CAAC,CAAC;AACtC,EAAE,MAAM,UAAU,GAAGC,OAAG,CAAC,EAAE,CAAC,CAAC;AAC7B,EAAE,MAAM,iBAAiB,GAAGA,OAAG,CAAC,EAAE,CAAC,CAAC;AACpC,EAAE,MAAM,gBAAgB,GAAGD,cAAU,CAAC,EAAE,CAAC,CAAC;AAC1C,EAAE,MAAM,gBAAgB,GAAGA,cAAU,CAAC,EAAE,CAAC,CAAC;AAC1C,EAAE,MAA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C;AACpD,MAAM,kBAAkB,EAAE,CAAC;AAC3B,KAAK;AACL,GAAG;AACH,EAAE,OAAO;AACT,IAAI,eAAe;AACnB,IAAI,oBAAoB;AACxB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAAI,iBAAiB;AACrB,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-row.js","sources":["../../../../../../../packages/components/table-v2/src/composables/use-row.ts"],"sourcesContent":["import { computed, getCurrentInstance, ref, shallowRef, unref } from 'vue'\nimport { debounce } from 'lodash-unified'\nimport { isNumber } from '@element-plus/utils'\nimport { FixedDir } from '../constants'\n\nimport type { ComponentInternalInstance, Ref, ShallowRef } from 'vue'\nimport type { TableV2Props } from '../table'\nimport type {\n RowExpandParams,\n RowHeightChangedParams,\n RowHoverParams,\n} from '../row'\nimport type { FixedDirection, KeyType } from '../types'\nimport type { onRowRenderedParams } from '../grid'\nimport type { TableGridInstance } from '../table-grid'\nimport type { UseNamespaceReturn } from '@element-plus/hooks'\n\ntype Heights = Record<KeyType, number>\ntype GridInstanceRef = Ref<TableGridInstance | undefined>\n\ntype UseRowProps = {\n mainTableRef: GridInstanceRef\n leftTableRef: GridInstanceRef\n rightTableRef: GridInstanceRef\n tableInstance: ComponentInternalInstance\n ns: UseNamespaceReturn\n isScrolling: ShallowRef<boolean>\n}\n\nexport const useRow = (\n props: TableV2Props,\n {\n mainTableRef,\n leftTableRef,\n rightTableRef,\n tableInstance,\n ns,\n isScrolling,\n }: UseRowProps\n) => {\n const vm = getCurrentInstance()!\n const { emit } = vm\n const isResetting = shallowRef(false)\n const expandedRowKeys = ref<KeyType[]>(props.defaultExpandedRowKeys || [])\n const lastRenderedRowIndex = ref(-1)\n const resetIndex = shallowRef<number | null>(null)\n const rowHeights = ref<Heights>({})\n const pendingRowHeights = ref<Heights>({})\n const leftTableHeights = shallowRef<Heights>({})\n const mainTableHeights = shallowRef<Heights>({})\n const rightTableHeights = shallowRef<Heights>({})\n const isDynamic = computed(() => isNumber(props.estimatedRowHeight))\n\n function onRowsRendered(params: onRowRenderedParams) {\n props.onRowsRendered?.(params)\n\n if (params.rowCacheEnd > unref(lastRenderedRowIndex)) {\n lastRenderedRowIndex.value = params.rowCacheEnd\n }\n }\n\n function onRowHovered({ hovered, rowKey }: RowHoverParams) {\n if (isScrolling.value) {\n return\n }\n const tableRoot = tableInstance!.vnode.el as HTMLElement\n const rows = tableRoot.querySelectorAll(`[rowkey=\"${String(rowKey)}\"]`)\n rows.forEach((row) => {\n if (hovered) {\n row.classList.add(ns.is('hovered'))\n } else {\n row.classList.remove(ns.is('hovered'))\n }\n })\n }\n\n function onRowExpanded({\n expanded,\n rowData,\n rowIndex,\n rowKey,\n }: RowExpandParams) {\n const _expandedRowKeys = [...unref(expandedRowKeys)]\n const currentKeyIndex = _expandedRowKeys.indexOf(rowKey)\n if (expanded) {\n if (currentKeyIndex === -1) _expandedRowKeys.push(rowKey)\n } else {\n if (currentKeyIndex > -1) _expandedRowKeys.splice(currentKeyIndex, 1)\n }\n expandedRowKeys.value = _expandedRowKeys\n\n emit('update:expandedRowKeys', _expandedRowKeys)\n props.onRowExpand?.({\n expanded,\n rowData,\n rowIndex,\n rowKey,\n })\n // If this is not controlled, then use this to notify changes\n props.onExpandedRowsChange?.(_expandedRowKeys)\n }\n\n const flushingRowHeights = debounce(() => {\n isResetting.value = true\n rowHeights.value = { ...unref(rowHeights), ...unref(pendingRowHeights) }\n resetAfterIndex(unref(resetIndex)!, false)\n pendingRowHeights.value = {}\n // force update\n resetIndex.value = null\n mainTableRef.value?.forceUpdate()\n leftTableRef.value?.forceUpdate()\n rightTableRef.value?.forceUpdate()\n vm.proxy?.$forceUpdate()\n isResetting.value = false\n }, 0)\n\n function resetAfterIndex(index: number, forceUpdate = false) {\n if (!unref(isDynamic)) return\n ;[mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {\n const table = unref(tableRef)\n if (table) table.resetAfterRowIndex(index, forceUpdate)\n })\n }\n\n function resetHeights(rowKey: KeyType, height: number, rowIdx: number) {\n const resetIdx = unref(resetIndex)\n if (resetIdx === null) {\n resetIndex.value = rowIdx\n } else {\n if (resetIdx > rowIdx) {\n resetIndex.value = rowIdx\n }\n }\n\n pendingRowHeights.value[rowKey] = height\n }\n\n function onRowHeightChange(\n { rowKey, height, rowIndex }: RowHeightChangedParams,\n fixedDir: FixedDirection\n ) {\n if (!fixedDir) {\n mainTableHeights.value[rowKey] = height\n } else {\n if (fixedDir === FixedDir.RIGHT) {\n rightTableHeights.value[rowKey] = height\n } else {\n leftTableHeights.value[rowKey] = height\n }\n }\n\n const maximumHeight = Math.max(\n ...[leftTableHeights, rightTableHeights, mainTableHeights].map(\n (records) => records.value[rowKey] || 0\n )\n )\n\n if (unref(rowHeights)[rowKey] !== maximumHeight) {\n resetHeights(rowKey, maximumHeight, rowIndex)\n flushingRowHeights()\n }\n }\n\n return {\n expandedRowKeys,\n lastRenderedRowIndex,\n isDynamic,\n isResetting,\n rowHeights,\n\n resetAfterIndex,\n onRowExpanded,\n onRowHovered,\n onRowsRendered,\n onRowHeightChange,\n }\n}\n\nexport type UseRowReturn = ReturnType<typeof useRow>\n"],"names":["getCurrentInstance","shallowRef","ref","computed","isNumber","unref","debounce","FixedDir"],"mappings":";;;;;;;;;;AAIY,MAAC,MAAM,GAAG,CAAC,KAAK,EAAE;AAC9B,EAAE,YAAY;AACd,EAAE,YAAY;AACd,EAAE,aAAa;AACf,EAAE,aAAa;AACf,EAAE,EAAE;AACJ,EAAE,WAAW;AACb,CAAC,KAAK;AACN,EAAE,MAAM,EAAE,GAAGA,sBAAkB,EAAE,CAAC;AAClC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACtB,EAAE,MAAM,WAAW,GAAGC,cAAU,CAAC,KAAK,CAAC,CAAC;AACxC,EAAE,MAAM,eAAe,G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GAAG,MAAM,CAAC;AACjD,OAAO,MAAM;AACb,QAAQ,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAChD,OAAO;AACP,KAAK;AACL,IAAI,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5I,IAAI,IAAIF,SAAK,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,aAAa,EAAE;AACrD,MAAM,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;AACpD,MAAM,kBAAkB,EAAE,CAAC;AAC3B,KAAK;AACL,GAAG;AACH,EAAE,OAAO;AACT,IAAI,eAAe;AACnB,IAAI,oBAAoB;AACxB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,UAAU;AACd,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB,IAAI,iBAAiB;AACrB,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -2,27 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
6
|
-
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
require('../../../hooks/index.js');
|
|
7
|
+
var mask = require('./mask2.js');
|
|
8
|
+
var helper = require('./helper.js');
|
|
9
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
10
|
+
var index = require('../../../hooks/use-lockscreen/index.js');
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const _hoisted_1 = { style: {
|
|
13
|
+
width: "100%",
|
|
14
|
+
height: "100%"
|
|
15
|
+
} };
|
|
16
|
+
const _hoisted_2 = ["d"];
|
|
17
|
+
const __default__ = vue.defineComponent({
|
|
18
|
+
name: "ElTourMask",
|
|
19
|
+
inheritAttrs: false
|
|
20
|
+
});
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
22
|
+
...__default__,
|
|
23
|
+
props: mask.maskProps,
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const { ns } = vue.inject(helper.tourKey);
|
|
27
|
+
const radius = vue.computed(() => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
|
|
30
|
+
});
|
|
31
|
+
const roundInfo = vue.computed(() => {
|
|
32
|
+
const v = radius.value;
|
|
33
|
+
const baseInfo = `a${v},${v} 0 0 1`;
|
|
34
|
+
return {
|
|
35
|
+
topRight: `${baseInfo} ${v},${v}`,
|
|
36
|
+
bottomRight: `${baseInfo} ${-v},${v}`,
|
|
37
|
+
bottomLeft: `${baseInfo} ${-v},${-v}`,
|
|
38
|
+
topLeft: `${baseInfo} ${v},${-v}`
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
const path = vue.computed(() => {
|
|
42
|
+
const width = window.innerWidth;
|
|
43
|
+
const height = window.innerHeight;
|
|
44
|
+
const info = roundInfo.value;
|
|
45
|
+
const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
|
|
46
|
+
const _radius = radius.value;
|
|
47
|
+
return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
|
|
48
|
+
});
|
|
49
|
+
const pathStyle = vue.computed(() => {
|
|
50
|
+
return {
|
|
51
|
+
fill: props.fill,
|
|
52
|
+
pointerEvents: "auto",
|
|
53
|
+
cursor: "auto"
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
index.useLockscreen(vue.toRef(props, "visible"), {
|
|
57
|
+
ns
|
|
58
|
+
});
|
|
59
|
+
return (_ctx, _cache) => {
|
|
60
|
+
return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
|
|
61
|
+
key: 0,
|
|
62
|
+
class: vue.unref(ns).e("mask"),
|
|
63
|
+
style: {
|
|
64
|
+
position: "fixed",
|
|
65
|
+
left: 0,
|
|
66
|
+
right: 0,
|
|
67
|
+
top: 0,
|
|
68
|
+
bottom: 0,
|
|
69
|
+
zIndex: _ctx.zIndex,
|
|
70
|
+
pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
|
|
71
|
+
}
|
|
72
|
+
}, _ctx.$attrs), [
|
|
73
|
+
(vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, [
|
|
74
|
+
vue.createElementVNode("path", {
|
|
75
|
+
class: vue.normalizeClass(vue.unref(ns).e("hollow")),
|
|
76
|
+
style: vue.normalizeStyle(vue.unref(pathStyle)),
|
|
77
|
+
d: vue.unref(path)
|
|
78
|
+
}, null, 14, _hoisted_2)
|
|
79
|
+
]))
|
|
80
|
+
], 16)) : vue.createCommentVNode("v-if", true);
|
|
81
|
+
};
|
|
24
82
|
}
|
|
25
83
|
});
|
|
84
|
+
var ElTourMask = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "mask.vue"]]);
|
|
26
85
|
|
|
27
|
-
exports
|
|
86
|
+
exports["default"] = ElTourMask;
|
|
28
87
|
//# sourceMappingURL=mask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.js","sources":["../../../../../../packages/components/tour/src/mask.
|
|
1
|
+
{"version":3,"file":"mask.js","sources":["../../../../../../packages/components/tour/src/mask.vue"],"sourcesContent":["<template>\n <div\n v-if=\"visible\"\n :class=\"ns.e('mask')\"\n :style=\"({\n position: 'fixed',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n zIndex,\n pointerEvents: pos && targetAreaClickable ? 'none' : 'auto',\n } as any)\"\n v-bind=\"$attrs\"\n >\n <svg\n :style=\"{\n width: '100%',\n height: '100%',\n }\"\n >\n <path :class=\"ns.e('hollow')\" :style=\"pathStyle\" :d=\"path\" />\n </svg>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject, toRef } from 'vue'\nimport { useLockscreen } from '@element-plus/hooks'\nimport { maskProps } from './mask'\nimport { tourKey } from './helper'\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElTourMask',\n inheritAttrs: false,\n})\n\nconst props = defineProps(maskProps)\n\nconst { ns } = inject(tourKey)!\nconst radius = computed(() => props.pos?.radius ?? 2)\nconst roundInfo = computed(() => {\n const v = radius.value\n const baseInfo = `a${v},${v} 0 0 1`\n return {\n topRight: `${baseInfo} ${v},${v}`,\n bottomRight: `${baseInfo} ${-v},${v}`,\n bottomLeft: `${baseInfo} ${-v},${-v}`,\n topLeft: `${baseInfo} ${v},${-v}`,\n }\n})\n\nconst path = computed(() => {\n const width = window.innerWidth\n const height = window.innerHeight\n const info = roundInfo.value\n const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`\n const _radius = radius.value\n return props.pos\n ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${\n props.pos.width - _radius * 2\n } ${info.topRight} v${props.pos.height - _radius * 2} ${\n info.bottomRight\n } h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${\n -props.pos.height + _radius * 2\n } ${info.topLeft} z`\n : _path\n})\n\nconst pathStyle = computed<CSSProperties>(() => {\n return {\n fill: props.fill,\n pointerEvents: 'auto',\n cursor: 'auto',\n }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A;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,86 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require('../../../
|
|
7
|
-
var mask = require('./mask.js');
|
|
8
|
-
var helper = require('./helper.js');
|
|
9
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
10
|
-
var index = require('../../../hooks/use-lockscreen/index.js');
|
|
5
|
+
require('../../../utils/index.js');
|
|
6
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
11
7
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var _a, _b;
|
|
29
|
-
return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
|
|
30
|
-
});
|
|
31
|
-
const roundInfo = vue.computed(() => {
|
|
32
|
-
const v = radius.value;
|
|
33
|
-
const baseInfo = `a${v},${v} 0 0 1`;
|
|
34
|
-
return {
|
|
35
|
-
topRight: `${baseInfo} ${v},${v}`,
|
|
36
|
-
bottomRight: `${baseInfo} ${-v},${v}`,
|
|
37
|
-
bottomLeft: `${baseInfo} ${-v},${-v}`,
|
|
38
|
-
topLeft: `${baseInfo} ${v},${-v}`
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
const path = vue.computed(() => {
|
|
42
|
-
const width = window.innerWidth;
|
|
43
|
-
const height = window.innerHeight;
|
|
44
|
-
const info = roundInfo.value;
|
|
45
|
-
const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
|
|
46
|
-
const _radius = radius.value;
|
|
47
|
-
return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
|
|
48
|
-
});
|
|
49
|
-
const pathStyle = vue.computed(() => {
|
|
50
|
-
return {
|
|
51
|
-
fill: props.fill,
|
|
52
|
-
pointerEvents: "auto",
|
|
53
|
-
cursor: "auto"
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
index.useLockscreen(vue.toRef(props, "visible"), {
|
|
57
|
-
ns
|
|
58
|
-
});
|
|
59
|
-
return (_ctx, _cache) => {
|
|
60
|
-
return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
|
|
61
|
-
key: 0,
|
|
62
|
-
class: vue.unref(ns).e("mask"),
|
|
63
|
-
style: {
|
|
64
|
-
position: "fixed",
|
|
65
|
-
left: 0,
|
|
66
|
-
right: 0,
|
|
67
|
-
top: 0,
|
|
68
|
-
bottom: 0,
|
|
69
|
-
zIndex: _ctx.zIndex,
|
|
70
|
-
pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
|
|
71
|
-
}
|
|
72
|
-
}, _ctx.$attrs), [
|
|
73
|
-
(vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, [
|
|
74
|
-
vue.createElementVNode("path", {
|
|
75
|
-
class: vue.normalizeClass(vue.unref(ns).e("hollow")),
|
|
76
|
-
style: vue.normalizeStyle(vue.unref(pathStyle)),
|
|
77
|
-
d: vue.unref(path)
|
|
78
|
-
}, null, 14, _hoisted_2)
|
|
79
|
-
]))
|
|
80
|
-
], 16)) : vue.createCommentVNode("v-if", true);
|
|
81
|
-
};
|
|
8
|
+
const maskProps = runtime.buildProps({
|
|
9
|
+
zIndex: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 1001
|
|
12
|
+
},
|
|
13
|
+
visible: Boolean,
|
|
14
|
+
fill: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "rgba(0,0,0,0.5)"
|
|
17
|
+
},
|
|
18
|
+
pos: {
|
|
19
|
+
type: runtime.definePropType(Object)
|
|
20
|
+
},
|
|
21
|
+
targetAreaClickable: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
82
24
|
}
|
|
83
25
|
});
|
|
84
|
-
var ElTourMask = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "mask.vue"]]);
|
|
85
26
|
|
|
86
|
-
exports
|
|
27
|
+
exports.maskProps = maskProps;
|
|
87
28
|
//# sourceMappingURL=mask2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask2.js","sources":["../../../../../../packages/components/tour/src/mask.
|
|
1
|
+
{"version":3,"file":"mask2.js","sources":["../../../../../../packages/components/tour/src/mask.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { PosInfo } from './types'\n\nexport const maskProps = buildProps({\n /**\n * @description mask's zIndex\n */\n zIndex: {\n type: Number,\n default: 1001,\n },\n /**\n * @description whether to show the mask\n */\n visible: Boolean,\n /**\n * @description mask's fill\n */\n fill: {\n type: String,\n default: 'rgba(0,0,0,0.5)',\n },\n /***\n * @description mask's transparent space position\n */\n pos: {\n type: definePropType<PosInfo | null>(Object),\n },\n /**\n * @description whether the target element can be clickable, when using mask\n */\n targetAreaClickable: {\n type: Boolean,\n default: true,\n },\n})\n\nexport type MaskProps = ExtractPropTypes<typeof maskProps>\n"],"names":["buildProps","definePropType"],"mappings":";;;;;;;AACY,MAAC,SAAS,GAAGA,kBAAU,CAAC;AACpC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,iBAAiB;AAC9B,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAEC,sBAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,mBAAmB,EAAE;AACvB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC;;;;"}
|
|
@@ -6,7 +6,7 @@ var vue = require('vue');
|
|
|
6
6
|
var core = require('@vueuse/core');
|
|
7
7
|
require('../../../hooks/index.js');
|
|
8
8
|
require('../../../utils/index.js');
|
|
9
|
-
var mask = require('./
|
|
9
|
+
var mask = require('./mask.js');
|
|
10
10
|
var content = require('./content2.js');
|
|
11
11
|
var steps = require('./steps.js');
|
|
12
12
|
var tour = require('./tour.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('../../utils/index.js');
|
|
6
|
-
var watermark$1 = require('./src/
|
|
7
|
-
var watermark = require('./src/
|
|
6
|
+
var watermark$1 = require('./src/watermark2.js');
|
|
7
|
+
var watermark = require('./src/watermark.js');
|
|
8
8
|
var install = require('../../utils/vue/install.js');
|
|
9
9
|
|
|
10
10
|
const ElWatermark = install.withInstall(watermark$1["default"]);
|
|
@@ -2,217 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var watermark = require('./watermark2.js');
|
|
8
|
-
var utils = require('./utils.js');
|
|
9
|
-
var useClips = require('./useClips.js');
|
|
10
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
5
|
+
require('../../../utils/index.js');
|
|
6
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
11
7
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
|
|
38
|
-
});
|
|
39
|
-
const fontFamily = vue.computed(() => {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
|
|
42
|
-
});
|
|
43
|
-
const textAlign = vue.computed(() => {
|
|
44
|
-
var _a, _b;
|
|
45
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
|
|
46
|
-
});
|
|
47
|
-
const textBaseline = vue.computed(() => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
|
|
50
|
-
});
|
|
51
|
-
const gapX = vue.computed(() => props.gap[0]);
|
|
52
|
-
const gapY = vue.computed(() => props.gap[1]);
|
|
53
|
-
const gapXCenter = vue.computed(() => gapX.value / 2);
|
|
54
|
-
const gapYCenter = vue.computed(() => gapY.value / 2);
|
|
55
|
-
const offsetLeft = vue.computed(() => {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
|
|
58
|
-
});
|
|
59
|
-
const offsetTop = vue.computed(() => {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
|
|
62
|
-
});
|
|
63
|
-
const getMarkStyle = () => {
|
|
64
|
-
const markStyle = {
|
|
65
|
-
zIndex: props.zIndex,
|
|
66
|
-
position: "absolute",
|
|
67
|
-
left: 0,
|
|
68
|
-
top: 0,
|
|
69
|
-
width: "100%",
|
|
70
|
-
height: "100%",
|
|
71
|
-
pointerEvents: "none",
|
|
72
|
-
backgroundRepeat: "repeat"
|
|
73
|
-
};
|
|
74
|
-
let positionLeft = offsetLeft.value - gapXCenter.value;
|
|
75
|
-
let positionTop = offsetTop.value - gapYCenter.value;
|
|
76
|
-
if (positionLeft > 0) {
|
|
77
|
-
markStyle.left = `${positionLeft}px`;
|
|
78
|
-
markStyle.width = `calc(100% - ${positionLeft}px)`;
|
|
79
|
-
positionLeft = 0;
|
|
80
|
-
}
|
|
81
|
-
if (positionTop > 0) {
|
|
82
|
-
markStyle.top = `${positionTop}px`;
|
|
83
|
-
markStyle.height = `calc(100% - ${positionTop}px)`;
|
|
84
|
-
positionTop = 0;
|
|
85
|
-
}
|
|
86
|
-
markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
|
|
87
|
-
return markStyle;
|
|
88
|
-
};
|
|
89
|
-
const containerRef = vue.shallowRef(null);
|
|
90
|
-
const watermarkRef = vue.shallowRef();
|
|
91
|
-
const stopObservation = vue.ref(false);
|
|
92
|
-
const destroyWatermark = () => {
|
|
93
|
-
if (watermarkRef.value) {
|
|
94
|
-
watermarkRef.value.remove();
|
|
95
|
-
watermarkRef.value = void 0;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const appendWatermark = (base64Url, markWidth) => {
|
|
99
|
-
var _a;
|
|
100
|
-
if (containerRef.value && watermarkRef.value) {
|
|
101
|
-
stopObservation.value = true;
|
|
102
|
-
watermarkRef.value.setAttribute("style", utils.getStyleStr({
|
|
103
|
-
...getMarkStyle(),
|
|
104
|
-
backgroundImage: `url('${base64Url}')`,
|
|
105
|
-
backgroundSize: `${Math.floor(markWidth)}px`
|
|
106
|
-
}));
|
|
107
|
-
(_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
|
|
108
|
-
setTimeout(() => {
|
|
109
|
-
stopObservation.value = false;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const getMarkSize = (ctx) => {
|
|
114
|
-
let defaultWidth = 120;
|
|
115
|
-
let defaultHeight = 64;
|
|
116
|
-
const image = props.image;
|
|
117
|
-
const content = props.content;
|
|
118
|
-
const width = props.width;
|
|
119
|
-
const height = props.height;
|
|
120
|
-
if (!image && ctx.measureText) {
|
|
121
|
-
ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
|
|
122
|
-
const contents = Array.isArray(content) ? content : [content];
|
|
123
|
-
const sizes = contents.map((item) => {
|
|
124
|
-
const metrics = ctx.measureText(item);
|
|
125
|
-
return [
|
|
126
|
-
metrics.width,
|
|
127
|
-
metrics.fontBoundingBoxAscent !== void 0 ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent
|
|
128
|
-
];
|
|
129
|
-
});
|
|
130
|
-
defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])));
|
|
131
|
-
defaultHeight = Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length + (contents.length - 1) * useClips.FontGap;
|
|
132
|
-
}
|
|
133
|
-
return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
|
|
134
|
-
};
|
|
135
|
-
const getClips = useClips["default"]();
|
|
136
|
-
const renderWatermark = () => {
|
|
137
|
-
const canvas = document.createElement("canvas");
|
|
138
|
-
const ctx = canvas.getContext("2d");
|
|
139
|
-
const image = props.image;
|
|
140
|
-
const content = props.content;
|
|
141
|
-
const rotate = props.rotate;
|
|
142
|
-
if (ctx) {
|
|
143
|
-
if (!watermarkRef.value) {
|
|
144
|
-
watermarkRef.value = document.createElement("div");
|
|
145
|
-
}
|
|
146
|
-
const ratio = utils.getPixelRatio();
|
|
147
|
-
const [markWidth, markHeight] = getMarkSize(ctx);
|
|
148
|
-
const drawCanvas = (drawContent) => {
|
|
149
|
-
const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
|
|
150
|
-
color: color.value,
|
|
151
|
-
fontSize: fontSize.value,
|
|
152
|
-
fontStyle: fontStyle.value,
|
|
153
|
-
fontWeight: fontWeight.value,
|
|
154
|
-
fontFamily: fontFamily.value,
|
|
155
|
-
textAlign: textAlign.value,
|
|
156
|
-
textBaseline: textBaseline.value
|
|
157
|
-
}, gapX.value, gapY.value);
|
|
158
|
-
appendWatermark(textClips, clipWidth);
|
|
159
|
-
};
|
|
160
|
-
if (image) {
|
|
161
|
-
const img = new Image();
|
|
162
|
-
img.onload = () => {
|
|
163
|
-
drawCanvas(img);
|
|
164
|
-
};
|
|
165
|
-
img.onerror = () => {
|
|
166
|
-
drawCanvas(content);
|
|
167
|
-
};
|
|
168
|
-
img.crossOrigin = "anonymous";
|
|
169
|
-
img.referrerPolicy = "no-referrer";
|
|
170
|
-
img.src = image;
|
|
171
|
-
} else {
|
|
172
|
-
drawCanvas(content);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
vue.onMounted(() => {
|
|
177
|
-
renderWatermark();
|
|
178
|
-
});
|
|
179
|
-
vue.watch(() => props, () => {
|
|
180
|
-
renderWatermark();
|
|
181
|
-
}, {
|
|
182
|
-
deep: true,
|
|
183
|
-
flush: "post"
|
|
184
|
-
});
|
|
185
|
-
vue.onBeforeUnmount(() => {
|
|
186
|
-
destroyWatermark();
|
|
187
|
-
});
|
|
188
|
-
const onMutate = (mutations) => {
|
|
189
|
-
if (stopObservation.value) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
mutations.forEach((mutation) => {
|
|
193
|
-
if (utils.reRendering(mutation, watermarkRef.value)) {
|
|
194
|
-
destroyWatermark();
|
|
195
|
-
renderWatermark();
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
core.useMutationObserver(containerRef, onMutate, {
|
|
200
|
-
attributes: true,
|
|
201
|
-
subtree: true,
|
|
202
|
-
childList: true
|
|
203
|
-
});
|
|
204
|
-
return (_ctx, _cache) => {
|
|
205
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
206
|
-
ref_key: "containerRef",
|
|
207
|
-
ref: containerRef,
|
|
208
|
-
style: vue.normalizeStyle([style])
|
|
209
|
-
}, [
|
|
210
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
211
|
-
], 4);
|
|
212
|
-
};
|
|
8
|
+
const watermarkProps = runtime.buildProps({
|
|
9
|
+
zIndex: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 9
|
|
12
|
+
},
|
|
13
|
+
rotate: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: -22
|
|
16
|
+
},
|
|
17
|
+
width: Number,
|
|
18
|
+
height: Number,
|
|
19
|
+
image: String,
|
|
20
|
+
content: {
|
|
21
|
+
type: runtime.definePropType([String, Array]),
|
|
22
|
+
default: "Element Plus"
|
|
23
|
+
},
|
|
24
|
+
font: {
|
|
25
|
+
type: runtime.definePropType(Object)
|
|
26
|
+
},
|
|
27
|
+
gap: {
|
|
28
|
+
type: runtime.definePropType(Array),
|
|
29
|
+
default: () => [100, 100]
|
|
30
|
+
},
|
|
31
|
+
offset: {
|
|
32
|
+
type: runtime.definePropType(Array)
|
|
213
33
|
}
|
|
214
34
|
});
|
|
215
|
-
var Watermark = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "watermark.vue"]]);
|
|
216
35
|
|
|
217
|
-
exports
|
|
36
|
+
exports.watermarkProps = watermarkProps;
|
|
218
37
|
//# sourceMappingURL=watermark.js.map
|