Skip to content

Commit

Permalink
Merge pull request #13054 from element-plus/dev
Browse files Browse the repository at this point in the history
D2M
  • Loading branch information
iamkun committed Jun 2, 2023
2 parents f289012 + 606eade commit 68a75a0
Show file tree
Hide file tree
Showing 32 changed files with 217 additions and 211 deletions.
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ Please make sure these boxes are checked before submitting your PR, thank you!
- [ ] Make sure you follow contributing guide [English](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.en-US.md) | ([中文](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.zh-CN.md) | [Español](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.es.md) | [Français](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.fr-FR.md)).
- [ ] Make sure you are merging your commits to `dev` branch.
- [ ] Add some descriptions and refer to relative issues for your PR.

## Description

copilot:summary

## Related Issue

Fixes #\_\_\_.

## Explanation of Changes

copilot:walkthrough
17 changes: 17 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
## Changelog

### 2.3.6

_2023-06-02_

#### Bug fixes

- Components [popper] prioritise user's popper-style (#12833 by @Lionad-Morotar)
- Components [select-v2] Fix border color error (#12755 by @baiwusanyu-c)
- Components [notification] fix props.zIndex lose efficacy bug (#12474 by @Ganlvin)
- Components [select] optimize the triggering of blur event (#11524 by @tolking)
- Components [table] maxHeight shark (#12349 by @chenxch)
- Components [steps] preserve the order of subcomponents (#12896 by @makedopamine)

#### Refactors

- Components [message-box] remove useRestoreActive (#11646 by @tolking)

### 2.3.5

Expand Down
4 changes: 2 additions & 2 deletions docs/.vitepress/config/sponsors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const leftCustomImgSponsors = [
name: 'JSDesign',
name_cn: '即时设计',
img: '/images/js-design.png',
url: 'https://js.design/ai?source=element-plus&plan=ai',
url: 'https://js.design/?source=element-plus&plan=sy',
slogan: 'Professional online UI design tool',
slogan_cn: '借助AI技术,快速生成创意十足的UI设计稿',
slogan_cn: '专业在线UI设计工具',
banner_img: '/images/js-design-banner.jpg',
},
{
Expand Down
26 changes: 16 additions & 10 deletions docs/.vitepress/plugins/markdown-transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,24 @@ import type { Plugin } from 'vite'

type Append = Record<'headers' | 'footers' | 'scriptSetups', string[]>

let compPaths: string[]

export function MarkdownTransform(): Plugin {
return {
name: 'element-plus-md-transform',

enforce: 'pre',

async buildStart() {
const pattern = `{${[...languages, languages[0]].join(',')}}/component`

compPaths = await glob(pattern, {
cwd: docRoot,
absolute: true,
onlyDirectories: true,
})
},

async transform(code, id) {
if (!id.endsWith('.md')) return

Expand All @@ -28,12 +42,6 @@ export function MarkdownTransform(): Plugin {

code = transformVpScriptSetup(code, append)

const pattern = `{${[...languages, languages[0]].join(',')}}/component`
const compPaths = await glob(pattern, {
cwd: docRoot,
absolute: true,
onlyDirectories: true,
})
if (compPaths.some((compPath) => id.startsWith(compPath))) {
code = transformComponentMarkdown(id, componentId, code, append)
}
Expand Down Expand Up @@ -112,14 +120,12 @@ const transformComponentMarkdown = (
const sourceSection = `
## ${footerLocale[lang].source}
${linksText}
`
${linksText}`

const contributorsSection = `
## ${footerLocale[lang].contributors}
<Contributors id="${componentId}" />
`
<Contributors id="${componentId}" />`

append.footers.push(sourceSection, isComponent ? contributorsSection : '')

Expand Down
82 changes: 41 additions & 41 deletions docs/.vitepress/vitepress/components/vp-app.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { onMounted } from 'vue'
import { ElMessageBox } from 'element-plus'
// import { ElMessageBox } from 'element-plus'
import nprogress from 'nprogress'
import dayjs from 'dayjs'
import { isClient, useEventListener, useStorage, useToggle } from '@vueuse/core'
// import dayjs from 'dayjs'
import { isClient, useEventListener, useToggle } from '@vueuse/core'
import { useSidebar } from '../composables/sidebar'
import { useToggleWidgets } from '../composables/toggle-widgets'
import { useLang } from '../composables/lang'
// import { useLang } from '../composables/lang'
import { breakpoints } from '../constant'
import VPOverlay from './vp-overlay.vue'
import VPSkipLink from './vp-skip-link.vue'
Expand All @@ -16,16 +16,16 @@ import VPSidebar from './vp-sidebar.vue'
import VPContent from './vp-content.vue'
import VPSponsors from './vp-sponsors.vue'
const USER_PREFER_GITHUB_PAGE = 'USER_PREFER_GITHUB_PAGE'
// const USER_PREFER_GITHUB_PAGE = 'USER_PREFER_GITHUB_PAGE'
const [isSidebarOpen, toggleSidebar] = useToggle(false)
const { hasSidebar } = useSidebar()
const lang = useLang()
// const lang = useLang()
const mirrorUrl = 'element-plus.gitee.io'
const isMirrorUrl = () => {
if (!isClient) return
return window.location.hostname === mirrorUrl
}
// const mirrorUrl = 'element-plus.gitee.io'
// const isMirrorUrl = () => {
// if (!isClient) return
// return window.location.hostname === mirrorUrl
// }
useToggleWidgets(isSidebarOpen, () => {
if (!isClient) return
Expand All @@ -42,7 +42,7 @@ useEventListener('keydown', (e) => {
}
})
const userPrefer = useStorage<boolean | string>(USER_PREFER_GITHUB_PAGE, null)
// const userPrefer = useStorage<boolean | string>(USER_PREFER_GITHUB_PAGE, null)
onMounted(async () => {
if (!isClient) return
Expand Down Expand Up @@ -75,36 +75,36 @@ onMounted(async () => {
{ capture: true }
)
if (lang.value === 'zh-CN') {
if (isMirrorUrl()) return
// if (lang.value === 'zh-CN') {
// if (isMirrorUrl()) return
if (userPrefer.value) {
// no alert in the next 90 days
if (
dayjs
.unix(Number(userPrefer.value))
.add(90, 'day')
.diff(dayjs(), 'day', true) > 0
)
return
}
try {
await ElMessageBox.confirm(
'建议大陆用户访问部署在国内的站点,是否跳转?',
'提示',
{
confirmButtonText: '跳转',
cancelButtonText: '取消',
}
)
const toLang = '/zh-CN/'
location.href = `https://element-plus.gitee.io${toLang}${location.pathname.slice(
toLang.length
)}`
} catch {
userPrefer.value = String(dayjs().unix())
}
}
// if (userPrefer.value) {
// // no alert in the next 90 days
// if (
// dayjs
// .unix(Number(userPrefer.value))
// .add(90, 'day')
// .diff(dayjs(), 'day', true) > 0
// )
// return
// }
// try {
// await ElMessageBox.confirm(
// '建议大陆用户访问部署在国内的站点,是否跳转?',
// '提示',
// {
// confirmButtonText: '跳转',
// cancelButtonText: '取消',
// }
// )
// const toLang = '/zh-CN/'
// location.href = `https://element-plus.gitee.io${toLang}${location.pathname.slice(
// toLang.length
// )}`
// } catch {
// userPrefer.value = String(dayjs().unix())
// }
// }
// unregister sw
navigator?.serviceWorker?.getRegistrations().then((registrations) => {
for (const registration of registrations) {
Expand Down
26 changes: 14 additions & 12 deletions docs/en-US/component/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,30 @@ pagination/more-elements

:::

## Attributes
## API

### Attributes

| Name | Description | Type | Default |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------ |
| small | whether to use small pagination | ^[boolean] | false |
| background | whether the buttons have a background color | ^[boolean] | false |
| page-size / v-model:page-size | item count of each page | ^[number] | 10 |
| default-page-size | default initial value of page size | ^[number] | - |
| page-size / v-model:page-size | item count of each page | ^[number] | |
| default-page-size | default initial value of page size, not setting is the same as setting 10 | ^[number] | |
| total | total item count | ^[number] ||
| page-count | total page count. Set either `total` or `page-count` and pages will be displayed; if you need `page-sizes`, `total` is required | ^[number] ||
| pager-count | number of pagers. Pagination collapses when the total page count exceeds this value | ^[number]`5 \| 7 \| 9 \| 11 \| 13 \| 15 \| 17 \| 19 \| 21` | 7 |
| current-page / v-model:current-page | current page number | ^[number] | 1 |
| default-current-page | default initial value of current-page | ^[number] | - |
| current-page / v-model:current-page | current page number | ^[number] | |
| default-current-page | default initial value of current-page, not setting is the same as setting 1 | ^[number] | |
| layout | layout of Pagination, elements separated with a comma | ^[string]`string (consists of sizes, prev, pager, next, jumper, ->, total, slot)` | prev, pager, next, jumper, ->, total |
| page-sizes | options of item count per page | ^[array]`number[]` | [10, 20, 30, 40, 50, 100] |
| popper-class | custom class name for the page size Select's dropdown | ^[string] | |
| prev-text | text for the prev button | ^[string] | |
| page-sizes | options of item count per page | ^[object]`number[]` | [10, 20, 30, 40, 50, 100] |
| popper-class | custom class name for the page size Select's dropdown | ^[string] | '' |
| prev-text | text for the prev button | ^[string] | '' |
| prev-icon | icon for the prev button, higher priority of `prev-text` | ^[string] / ^[Component] | ArrowLeft |
| next-text | text for the next button | ^[string] | |
| next-text | text for the next button | ^[string] | '' |
| next-icon | icon for the next button, higher priority of `next-text` | ^[string] / ^[Component] | ArrowRight |
| disabled | whether Pagination is disabled | ^[boolean] | false |
| hide-on-single-page | whether to hide when there's only one page | ^[boolean] | - |
| hide-on-single-page | whether to hide when there's only one page | ^[boolean] | false |

:::warning

Expand All @@ -94,7 +96,7 @@ We'll detect some deprecated usages, if your pagination don't appeared or worked

:::

## Events
### Events

| Name | Description | Type |
| -------------- | ----------------------------------------------------------------- | ------------------------------------ |
Expand All @@ -109,7 +111,7 @@ Events above are not recommended(but are still supported for compatible reason),

:::

## Slots
### Slots

| Name | Description |
| ------- | ------------------------------------------------------------------- |
Expand Down
10 changes: 5 additions & 5 deletions docs/en-US/component/result.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ result/customized-content

### Attributes

| Name | Description | Type | Default |
| --------- | ------------------- | ---------------------------------------------------- | -------- |
| title | title of result | ^[string] | '' |
| sub-title | sub title of result | ^[string] | '' |
| icon | icon type of result | ^[enum]`'success' \| 'warning' \| 'info' \| 'error'` | info |
| Name | Description | Type | Default |
| --------- | ------------------- | ---------------------------------------------------- | ------- |
| title | title of result | ^[string] | '' |
| sub-title | sub title of result | ^[string] | '' |
| icon | icon type of result | ^[enum]`'success' \| 'warning' \| 'info' \| 'error'` | info |

### Slots

Expand Down
1 change: 0 additions & 1 deletion docs/en-US/component/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ tag/checkable
| ---- | ------------------------- |
|| customize default content |


## CheckTag API

### CheckTag Attributes
Expand Down
4 changes: 1 addition & 3 deletions docs/examples/tree/filtering.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import { ref, watch } from 'vue'
import { ElTree } from 'element-plus'
interface Tree {
id: number
label: string
children?: Tree[]
[key: string]: any
}
const filterText = ref('')
Expand Down
Binary file modified docs/public/images/js-design.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions packages/components/message-box/src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ import {
useDraggable,
useId,
useLockscreen,
useRestoreActive,
useSameTarget,
} from '@element-plus/hooks'
import ElInput from '@element-plus/components/input'
Expand Down Expand Up @@ -474,9 +473,6 @@ export default defineComponent({
useLockscreen(visible)
}
// restore to prev active element.
useRestoreActive(visible)
return {
...toRefs(state),
ns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,17 @@ describe('Notification.vue', () => {
})

test('should be able to render z-index style with zIndex flag', async () => {
const wrapper = _mount({})
const wrapper = _mount({
props: {
zIndex: 9999,
},
})
await nextTick()

expect(wrapper.vm.positionStyle).toEqual(
expect.objectContaining({
top: '0px',
zIndex: 9999,
})
)
})
Expand Down
5 changes: 1 addition & 4 deletions packages/components/notification/src/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ export const notificationProps = buildProps({
/**
* @description initial zIndex
*/
zIndex: {
type: Number,
default: 0,
},
zIndex: Number,
} as const)
export type NotificationProps = ExtractPropTypes<typeof notificationProps>

Expand Down
2 changes: 1 addition & 1 deletion packages/components/notification/src/notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const verticalProperty = computed(() =>
const positionStyle = computed<CSSProperties>(() => {
return {
[verticalProperty.value]: `${props.offset}px`,
zIndex: currentZIndex.value,
zIndex: props.zIndex ?? currentZIndex.value,
}
})
Expand Down

0 comments on commit 68a75a0

Please sign in to comment.