Skip to content

Commit

Permalink
Merge pull request #10451 from element-plus/dev
Browse files Browse the repository at this point in the history
D2M
  • Loading branch information
jw-foss committed Nov 6, 2022
2 parents 9718804 + 1688a6e commit 3c43836
Show file tree
Hide file tree
Showing 110 changed files with 1,925 additions and 941 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-commit-message-post.yml
Expand Up @@ -30,10 +30,10 @@ jobs:

- name: Assert result
id: assert
run: echo "::set-output name=succeeded::$(<lint-result.txt)"
run: echo "succeeded=$(<lint-result.txt)" >> $GITHUB_OUTPUT
- name: Get PR number
id: pr
run: echo "::set-output name=pr::$(<pr.txt)"
run: echo "pr=$(<pr.txt)" >> $GITHUB_OUTPUT

on-success:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-commit-message.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand All @@ -42,7 +42,7 @@ jobs:

- name: Lint commit
id: lint_commit
run: pnpm lint:commit || echo "::set-output name=failed::true"
run: pnpm lint:commit || echo "failed=true" >> $GITHUB_OUTPUT

- name: Set success result
if: ${{ steps.lint_commit.outputs.failed != 'true' }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-docs-build.yml
Expand Up @@ -41,7 +41,8 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-docs-deploy.yml
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Output pr number
id: pr
run: echo "::set-output name=id::$(<pr.txt)"
run: echo "id=$(<pr.txt)" >> $GITHUB_OUTPUT

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:

- name: Output pr number
id: pr
run: echo "::set-output name=id::$(<pr.txt)"
run: echo "id=$(<pr.txt)" >> $GITHUB_OUTPUT

- name: Deploy has failed
uses: actions-cool/maintain-one-comment@v3.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-build-product.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs-deploy-manual.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs-deploy.yml
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-npm-nightly.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT

- name: Get git head
run: echo "GIT_HEAD=${GITHUB_SHA}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-size-report.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging-docs.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ssr.yml
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-unit.yml
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.en-US.md
@@ -1,5 +1,50 @@
## Changelog

### 2.2.20

_2022-11-06_

#### Features

- Components [dropdown] add props for teleported API (#10012 by @consultation-applio)
- Docs vite-press new component (#10346 by @jw-foss)
- Docs api typing shortcuts (#10353 by @jw-foss)
- Docs [components] additions (#10374 by @jw-foss)

#### Bug fixes

- Components [select-v2] empty value should be undefined (#10189 by @holazz)
- Components [popover] abnormal style when effect is dark (#10190 by @holazz)
- Components [table] fixed column supported in grouped header (#10096 by @tinyfind)
- Components [popper] enable the adaptive configuration (#10104 by @tolking)
- Components [select] blur trigger remote event should pass string (#10218 by @btea)
- Components [form] throw non-validation error (#10255 by @holazz)
- Components [checkbox] circular reference (#10278 by @btea)
- Components [input-number] increase and decrease error (#10067 by @gjfei)
- Components [tooltip] remove deprecated api (#10264 by @chenxch)
- Components [cascader] consistent component height (#10214 by @holazz)
- Components [date-picker] monthRange mode switching month sync (#10292 by @chenxch)
- Components [upload] add uid for file handleStart (#9876 by @init-qy)
- Components [carousel] missing root ref (#10312 by @holazz)
- Utils [vnode] flattedChildren support subTree (#10298 by @chenxch)
- Components [tree-v2] add missing icon (#10340 by @init-qy)
- Components [tree-v2] default icon render test (#10342 by @init-qy)
- Docs [autocomplete] (#10426 by @jw-foss)
- Components [cascader] remove extra space in the search text (#10439 by @holazz)
- Docs [autocomplete] [affix] (#10443 by @jw-foss)
- Component [table] can't select row children (#10221 by @faga295)

#### Refactors

- Components [calendar] (#10163 by @jw-foss)
- Components [carousel] (#10188 by @jw-foss)
- Components [carousel-item] (#10219 by @jw-foss)
- Components [tabs] simplify logic with hooks (#10224 by @holazz)
- Components [select] use util function (#10286 by @btea)
- Components [collapse] (#10289 by @jw-foss)
- Components [input] export instance type (#10368 by @chenxch)
- Docs tooltip plugin (#10440 by @tolking)

### 2.2.19

_2022-10-21_
Expand Down
5 changes: 5 additions & 0 deletions docs/.vitepress/config/plugins.ts
Expand Up @@ -5,6 +5,8 @@ import mdContainer from 'markdown-it-container'
import { docRoot } from '@element-plus/build-utils'
import externalLinkIcon from '../plugins/external-link-icon'
import tableWrapper from '../plugins/table-wrapper'
import tooltip from '../plugins/tooltip'
import { ApiTableContainer } from '../plugins/api-table'
import { highlight } from '../utils/highlight'
import type Token from 'markdown-it/lib/token'
import type Renderer from 'markdown-it/lib/renderer'
Expand All @@ -26,6 +28,7 @@ interface ContainerOpts {
export const mdPlugin = (md: MarkdownIt) => {
md.use(externalLinkIcon)
md.use(tableWrapper)
md.use(tooltip)
md.use(mdContainer, 'demo', {
validate(params) {
return !!params.trim().match(/^demo\s*(.*)$/)
Expand Down Expand Up @@ -57,4 +60,6 @@ export const mdPlugin = (md: MarkdownIt) => {
}
},
} as ContainerOpts)

md.use(ApiTableContainer)
}
40 changes: 40 additions & 0 deletions docs/.vitepress/plugins/api-table.ts
@@ -0,0 +1,40 @@
import markdown from 'markdown-it'

import type MarkdownIt from 'markdown-it'

const ApiMd = new markdown()

export const ApiTableContainer = (md: MarkdownIt) => {
const fence = md.renderer.rules.fence!

ApiMd.renderer.rules = md.renderer.rules
md.renderer.rules.fence = (...args) => {
const [tokens, idx, ...rest] = args
const [options, env] = rest
const token = tokens[idx]
if (token.info === 'api') {
const newTokens = md.parse(token.content, env)

let result = ''
const { rules } = md.renderer
newTokens.forEach((newToken, idx) => {
const { type } = newToken
if (type === 'inline') {
result += md.renderer.renderInline(newToken.children!, options, env)
} else if (typeof rules[type] !== 'undefined') {
result += rules[newToken.type]!(
newTokens,
idx,
options,
env,
md.renderer
)
} else {
result += md.renderer.renderToken(newTokens, idx, options)
}
})
return result
}
return fence.call(md, ...args)
}
}
29 changes: 29 additions & 0 deletions docs/.vitepress/plugins/tooltip.ts
@@ -0,0 +1,29 @@
import type MarkdownIt from 'markdown-it'

export default (md: MarkdownIt): void => {
md.renderer.rules.tooltip = (tokens, idx) => {
const token = tokens[idx]

return `<api-typing type="${token.content}" details="${token.info}" />`
}

md.inline.ruler.before('emphasis', 'tooltip', (state, silent) => {
const tooltipRegExp = /^\^\[([^\]]*)\](`[^`]*`)?/
const str = state.src.slice(state.pos, state.posMax)

if (!tooltipRegExp.test(str)) return false
if (silent) return true

const result = str.match(tooltipRegExp)

if (!result) return false

const token = state.push('tooltip', 'tooltip', 0)
token.content = result[1].replace(/\\\|/g, '|')
token.info = (result[2] || '').replace(/^`(.*)`$/, '$1')
token.level = state.level
state.pos += result[0].length

return true
})
}
7 changes: 7 additions & 0 deletions docs/.vitepress/vitepress/components/globals/vp-api-bool.vue
@@ -0,0 +1,7 @@
<script setup lang="ts">
import Primitive from './vp-api-primitive.vue'
</script>

<template>
<Primitive type="boolean" />
</template>
20 changes: 20 additions & 0 deletions docs/.vitepress/vitepress/components/globals/vp-api-enum.vue
@@ -0,0 +1,20 @@
<script setup lang="ts">
import { computed } from 'vue'
import { isString } from '@vue/shared'
import ApiTyping from './vp-api-typing.vue'
const props = defineProps({
values: {
type: Array,
required: true,
},
})
const processString = (s: unknown) => (isString(s) ? `'${s}'` : s)
const details = computed(() => props.values.map(processString).join(' | '))
</script>

<template>
<api-typing type="enum" :details="details" />
</template>
33 changes: 33 additions & 0 deletions docs/.vitepress/vitepress/components/globals/vp-api-external.vue
@@ -0,0 +1,33 @@
<script setup lang="ts">
import VpLink from '../common/vp-link.vue'
defineProps({
text: {
type: String,
required: true,
},
url: {
type: String,
required: true,
},
prefix: {
type: String,
default: '',
},
})
</script>

<template>
<slot>
<span v-if="prefix" class="mr-1">{{ prefix }}</span>
<VpLink :href="url">
{{ text }}
</VpLink>
</slot>
</template>

<style scoped>
:deep(.el-icon) {
font-size: 18px;
}
</style>

0 comments on commit 3c43836

Please sign in to comment.