mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-23 11:59:34 +08:00
chore(ci): optimizing the generated code hint file (#7634)
This commit is contained in:
parent
a4e7486ba5
commit
2dc4e463fd
@ -51,13 +51,13 @@ In this section, you can learn how to use Config Provider to provide experimenta
|
||||
| message | message related configuration, [see the following table](#message-attributes) | MessageGlobalConfig | - | see the following table |
|
||||
| experimental-features | features at experimental stage to be added, all features are default to be set to false | Object | - | - |
|
||||
|
||||
## Button Attributes
|
||||
## Button Attribute
|
||||
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| --------------- | ----------------------------------------------------------- | ------- | --------------- | ------- |
|
||||
| autoInsertSpace | automatically insert a space between two chinese characters | boolean | - | false |
|
||||
|
||||
## Message Attributes
|
||||
## Message Attribute
|
||||
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| --------- | --------------------------------------------------------------------- | ------ | --------------- | ------- |
|
||||
|
@ -127,7 +127,7 @@ select-v2/remote-search
|
||||
|
||||
## SelectV2 Attributes
|
||||
|
||||
| Param | Description | Type | Accepted Values | Default |
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ------------------- | ------------- |
|
||||
| model-value / v-model | biding value | string / number / boolean / object | — | — |
|
||||
| multiple | is multiple | boolean | — | false |
|
||||
@ -178,7 +178,7 @@ select-v2/remote-search
|
||||
|
||||
## SelectV2 Slots
|
||||
|
||||
| name | Description |
|
||||
| Name | Description |
|
||||
| ------- | ----------------------------- |
|
||||
| default | Option renderer |
|
||||
| empty | content when options is empty |
|
||||
|
@ -67,7 +67,7 @@ tree-v2/filter
|
||||
|
||||
:::
|
||||
|
||||
## Attributes
|
||||
## TreeV2 Attributes
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------- |
|
||||
@ -95,7 +95,7 @@ tree-v2/filter
|
||||
| children | specify which node object is used as the node's subtree | string | children |
|
||||
| disabled | specify which key of node object represents if node's checkbox is disabled | string | disabled |
|
||||
|
||||
## Method
|
||||
## TreeV2 Method
|
||||
|
||||
`Tree` has the following method, which returns the currently selected array of nodes.
|
||||
| Method | Description | Parameters |
|
||||
@ -112,7 +112,7 @@ tree-v2/filter
|
||||
| setCurrentKey | set highlighted node by key | `(key: TreeKey)` |
|
||||
| setData | When the data is very large, using reactive data will cause the poor performance, so we provide a way to avoid this situation | `(data: TreeData)` |
|
||||
|
||||
## Events
|
||||
## TreeV2 Events
|
||||
|
||||
| Event Name | Description | Parameters |
|
||||
| ---------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
@ -124,7 +124,7 @@ tree-v2/filter
|
||||
| node-expand | triggers when current node open | `(data: TreeNodeData, node: TreeNode)` |
|
||||
| node-collapse | triggers when current node close | `(data: TreeNodeData, node: TreeNode)` |
|
||||
|
||||
## Slots
|
||||
## TreeV2 Slots
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ---------------------------------------------------------------------------------------------- |
|
||||
|
@ -8,22 +8,27 @@ import {
|
||||
} from '@element-plus/build-utils'
|
||||
|
||||
import type { TaskFunction } from 'gulp'
|
||||
import type { InstallOptions } from 'components-helper'
|
||||
import type {
|
||||
ReAttribute,
|
||||
ReComponentName,
|
||||
ReDocUrl,
|
||||
ReWebTypesSource,
|
||||
} from 'components-helper'
|
||||
|
||||
const reComponentName: InstallOptions['reComponentName'] = (title: string) =>
|
||||
const reComponentName: ReComponentName = (title: string) =>
|
||||
`el-${title
|
||||
.replace(/\B([A-Z])/g, '-$1')
|
||||
.replace(/[ ]+/g, '-')
|
||||
.toLowerCase()}`
|
||||
|
||||
const reDocUrl: InstallOptions['reDocUrl'] = (fileName, header) => {
|
||||
const reDocUrl: ReDocUrl = (fileName, header) => {
|
||||
const docs = 'https://element-plus.org/en-US/component/'
|
||||
const _header = header ? header.replaceAll(/\s+/g, '-').toLowerCase() : ''
|
||||
|
||||
return `${docs}${fileName}.html${_header ? '#' : ''}${_header}`
|
||||
}
|
||||
|
||||
const reWebTypesSource: InstallOptions['reWebTypesSource'] = (title) => {
|
||||
const reWebTypesSource: ReWebTypesSource = (title) => {
|
||||
const symbol = `El${title
|
||||
.replaceAll(/-/g, ' ')
|
||||
.replaceAll(/^\w|\s+\w/g, (item) => {
|
||||
@ -33,9 +38,11 @@ const reWebTypesSource: InstallOptions['reWebTypesSource'] = (title) => {
|
||||
return { symbol }
|
||||
}
|
||||
|
||||
const reAttribute: InstallOptions['reAttribute'] = (value, key) => {
|
||||
const _value = value.match(/^\*\*(.*)\*\*$/)
|
||||
const str = _value ? _value[1] : value
|
||||
const reAttribute: ReAttribute = (value, key) => {
|
||||
const str = value
|
||||
.replace(/^\*\*(.*)\*\*$/, (_, item) => item)
|
||||
.replace(/^`(.*)`$/, (_, item) => item)
|
||||
.replaceAll(/<del>.*<\/del>/g, '')
|
||||
|
||||
if (key === 'Name' && /^(-|—)$/.test(str)) {
|
||||
return 'default'
|
||||
@ -47,7 +54,12 @@ const reAttribute: InstallOptions['reAttribute'] = (value, key) => {
|
||||
} else if (key === 'Attribute' && /v-model/.test(str)) {
|
||||
return 'model-value'
|
||||
} else if (key === 'Attribute') {
|
||||
return str.replace(/\B([A-Z])/g, '-$1').toLowerCase()
|
||||
return str
|
||||
.replaceAll(/\s*[\\*]\s*/g, '')
|
||||
.replaceAll(/\s*<.*>\s*/g, '')
|
||||
.replaceAll(/\s*\(.*\)\s*/g, '')
|
||||
.replaceAll(/\B([A-Z])/g, '-$1')
|
||||
.toLowerCase()
|
||||
} else if (key === 'Type') {
|
||||
return str
|
||||
.replace(/\s*\/\s*/g, '|')
|
||||
@ -98,7 +110,7 @@ export const buildHelper: TaskFunction = (done) => {
|
||||
propsOptions: 'Accepted Values',
|
||||
eventsName: 'Event Name',
|
||||
tableRegExp:
|
||||
'#+\\s+(.*\\s*Attributes|.*\\s*Events|.*\\s*Slots|.*\\s*Directives)\\s*\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)',
|
||||
/#+\s+(.*\s*Attributes|.*\s*Events|.*\s*Slots|.*\s*Directives)\s*\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,
|
||||
})
|
||||
|
||||
done()
|
||||
|
Loading…
Reference in New Issue
Block a user