Skip to content

Commit

Permalink
feat: support taro3
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Feb 21, 2024
1 parent a347dba commit 53a2c45
Show file tree
Hide file tree
Showing 688 changed files with 11,078 additions and 2,111 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Install the supported ui component library in your project and install the plug-
- arco-design/react 2
- arco-design/vue 2
- uview-ui 1、2
- taro 3

### [antdv demo](assets/antdv.gif)

Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- arco-design/react 2
- arco-design/vue 2
- uview-ui 1、2
- taro 3

### [antdv demo](assets/antdv.gif)

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"arcoDesign2",
"arcoDesignVue2",
"uview1",
"uview2"
"uview2",
"@tarojs/components3"
]
},
"description": "Choose the UI framework. If your selection includes `auto`, the extension will ignore the config and automatically detect the UI framework."
Expand Down
6 changes: 3 additions & 3 deletions scripts/generateIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const fg = require('fast-glob')
const fsp = require('node:fs/promises')

export async function run() {
const folder = 'src/ui/antDesignVue'
const name = 'antDesignVue4'
const isHyphen = true /** 生成的模板中的使用是 true ? a-affix : AAfix */
const folder = 'src/ui/taro'
const name = 'taro3'
const isHyphen = false /** 生成的模板中的使用是 true ? a-affix : AAfix */
const url = path.resolve(root, `${folder}/${name}`)
const entry = await fg(['**/*.json'], { dot: true, cwd: url })
const imports = entry.map((_url: string) => `import ${_url.split('.')[0]} from './${_url}'`)
Expand Down
23 changes: 22 additions & 1 deletion scripts/taro.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function run() {
: ''
methods.push({ name, description, description_zh: description, params })
})
const name = 'U' + link.split('/').slice(-1)[0].split('.')[0].split('-').map(i => {
const name = link.split('/').slice(-1)[0].split('.')[0].split('-').map(i => {
return i[0].toUpperCase() + i.slice(1)
}).join('')
const result = { name, props, link, link_zh: link, typeDetail: {}, events, methods, slots }
Expand All @@ -94,3 +94,24 @@ function getProps() {
})
return props
}



function getProps() {
const props = {}
$0.closest('tbody').querySelectorAll('tr').forEach(item => {
const name = item.children[0].firstChild.textContent
const type = item.children[1].textContent
const description = item.children[3].textContent
const required = item.children[2].textContent ==='是'
props[name] = {
description,
description_zh: description,
default: '',
value: '',
type,
required
}
})
return props
}
43 changes: 28 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ export function activate(context: vscode.ExtensionContext) {
return eventCallbacks.get(key).filter((item: any) => !hasProps.find((prop: any) => item?.params?.[1] === prop))
}
else if (propName) {
const r = completionsCallback.filter((item: any) => isValue
const r: any[] = []
completionsCallback.filter((item: any) => isValue
? hasProps.find((prop: any) => item?.params?.[1] === prop)
: !hasProps.find((prop: any) => item?.params?.[1] === prop))
.filter((item: any) => {
Expand All @@ -307,6 +308,15 @@ export function activate(context: vscode.ExtensionContext) {
if (result.isDynamic && label[0] === ':')
label = label.slice(1)

item.propType.split('/').forEach((p: string) => {
r.push(createCompletionItem({
content: p.trim(),
snippet: p.trim().replace(/'`/g, ''),
documentation: item.documentation,
detail: item.detail,
type: item.kind,
}))
})
return item.label.match(/^\w+={[^}]*}/)
? undefined
: createCompletionItem(isValue
Expand Down Expand Up @@ -372,20 +382,23 @@ export function activate(context: vscode.ExtensionContext) {
return data
}
}, (item: any) => {
if (item.params[2]) {
item.command = {
title: 'common-intellisense-import',
command: 'common-intellisense.import',
arguments: [item.params, item.loc, (item.snippet || item.content).split('\n').length - 1],
if (!item.command) {
if (item.params[2]) {
item.command = {
title: 'common-intellisense-import',
command: 'common-intellisense.import',
arguments: [item.params, item.loc, (item.snippet || item.content).split('\n').length - 1],
}
}
}
else {
item.command = {
title: 'common-intellisense.slots',
command: 'common-intellisense.slots',
arguments: [],
else {
item.command = {
title: 'common-intellisense.slots',
command: 'common-intellisense.slots',
arguments: [],
}
}
}

return item
}, ['"', '\'', '-', ' ', '@', '.', ':']))

Expand Down Expand Up @@ -703,9 +716,9 @@ function getEffectWord(preText: string) {
}

function getHoverAttribute(attributeList: any[], attr: string) {
return attributeList.filter((a) => {
return a?.params?.[1]?.replace('v-model:', '') === toCamel(attr)
}).map(i => `- ${i.label}`).join('\n\n')
return attributeList.filter(a =>
toCamel(a?.params?.[1]?.replace('v-model:', '') || '') === toCamel(attr),
).map(i => `- ${i.label}`).join('\n\n')
}

const IMPORT_UI_REG = /import\s+{([^\}]+)}\s+from\s+['"]([^"']+)['"]/g
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/autoComplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"value": "",
"description": "Initial selected option.",
"default": "",
"type": "string|string[]| 无",
"type": "string | string[] | 无",
"description_zh": "指定默认选中的条目"
},
":dataSource": {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/avatar.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"value": "",
"description": "the size of the avatar",
"default": "default",
"type": "number | string: `large` `small` `default`",
"type": "number / large / small / default",
"description_zh": "设置头像的大小"
},
"src": {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/datePicker.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"valueFormat": {
"default": "-",
"value": "",
"type": "string,具体格式",
"type": "string",
"description": "optional, format of binding value. If not specified, the binding value will be a Date object",
"description_zh": "可选,绑定值的格式,对 value、defaultValue、defaultPickerValue 起作用。不指定则绑定值为 moment 对象"
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/descriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"middle",
"small"
],
"type": "default | middle | small",
"type": "default / middle / small",
"description": "set the size of the list. Can be set to `middle`,`small`, or not filled",
"description_zh": "设置列表的大小。可以设置为 middle 、small, 或不填(只有设置 bordered={true} 生效)"
},
Expand Down
4 changes: 2 additions & 2 deletions src/ui/antDesignVue/antDesignVue1/divider.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"description": "position of title inside divider",
"default": "center",
"type": "left | right | center",
"type": "left / right / center",
"description_zh": "分割线标题的位置"
},
"type": {
Expand All @@ -26,7 +26,7 @@
],
"description": "direction type of divider",
"default": "horizontal",
"type": "horizontal | vertical",
"type": "horizontal / vertical",
"description_zh": "水平还是垂直类型"
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/drawer.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"bottom",
"left"
],
"type": "'top' | 'right' | 'bottom' | 'left'",
"type": "top / right / bottom / left",
"description": "The placement of the Drawer.",
"description_zh": "抽屉的方向"
},
Expand Down
8 changes: 4 additions & 4 deletions src/ui/antDesignVue/antDesignVue1/form.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
"description_zh": "隐藏所有表单项的必选标记"
},
"labelAlign": {
"default": "'right'",
"default": "right",
"value": [
"right",
"left"
],
"type": "'left' | 'right'",
"type": "left / right",
"description": "text align of label of all items",
"description_zh": "label 标签的文本对齐方式"
},
"layout": {
"default": "'horizontal'",
"default": "horizontal",
"value": [
"horizontal",
"vertical",
"inline"
],
"type": "'horizontal'|'vertical'|'inline'",
"type": "horizontal / vertical / inline",
"description": "Define form layout",
"description_zh": "表单布局"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/formItem.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"'left'",
"'right'"
],
"type": "'left' | 'right'",
"type": "left / right",
"description": "text align of label",
"description_zh": "标签文本对齐方式"
},
Expand Down
4 changes: 2 additions & 2 deletions src/ui/antDesignVue/antDesignVue1/formModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"left",
"right"
],
"type": "'left' | 'right'",
"type": "left / right",
"description": "text align of label of all items",
"description_zh": "label 标签的文本对齐方式"
},
Expand All @@ -39,7 +39,7 @@
"vertical",
"inline"
],
"type": "'horizontal'|'vertical'|'inline'",
"type": "horizontal / vertical / inline",
"description": "Define form layout",
"description_zh": "表单布局"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/formModelItem.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"'left'",
"'right'"
],
"type": "'left' | 'right'",
"type": "left / right",
"description": "text align of label",
"description_zh": "标签文本对齐方式"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/layoutSider.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"light",
"dark"
],
"type": "string: light dark",
"type": "light / dark",
"description": "color theme of the sidebar",
"description_zh": "主题颜色"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"middle",
"small"
],
"type": "default | middle | small",
"type": "default / middle / small",
"description": "The size of list",
"description_zh": "list 的尺寸"
},
Expand Down
4 changes: 2 additions & 2 deletions src/ui/antDesignVue/antDesignVue1/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"horizontal",
"inline"
],
"type": "string: vertical vertical-right horizontal inline",
"type": "vertical / vertical-right / horizontal / inline",
"description": "type of the menu; vertical, horizontal, and inline modes are supported",
"description_zh": "菜单类型,现在支持垂直、水平、和内嵌模式三种"
},
Expand Down Expand Up @@ -96,7 +96,7 @@
"light",
"dark"
],
"type": "string: light dark",
"type": "light / dark",
"description": "color theme of the menu",
"description_zh": "主题颜色"
},
Expand Down
4 changes: 2 additions & 2 deletions src/ui/antDesignVue/antDesignVue1/progress.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"round",
"square"
],
"type": "Enum{ 'round', 'square' }",
"type": "round / square",
"description": "to set the style of the progress linecap",
"description_zh": "设置进度线帽的样式"
},
Expand Down Expand Up @@ -98,7 +98,7 @@
"left",
"right"
],
"type": "Enum{ 'top', 'bottom', 'left', 'right' }",
"type": "top / bottom / left / right",
"description": "gap position of half circle",
"description_zh": "仪表盘进度条缺口位置"
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/antDesignVue/antDesignVue1/radioGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"default",
"small"
],
"type": "large | default | small",
"type": "large / default / small",
"description": "size for radio button style",
"description_zh": "大小,只对按钮样式生效"
},
Expand All @@ -53,7 +53,7 @@
"outline",
"solid"
],
"type": "outline | solid",
"type": "outline / solid",
"description": "style type of radio button",
"description_zh": "RadioButton 的风格样式,目前有描边和填色两种风格"
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/rangePicker.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"mode": {
"default": "'date'",
"value": "",
"type": "time|date|month|year|decade",
"type": "time / date / month / year / decade",
"description": "日期面板的状态(设置后无法选择年份/月份?)",
"description_zh": "日期面板的状态(设置后无法选择年份/月份?)"
},
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
"description": "The status of the result, which determines the icon and color",
"default": "info",
"type": "success | error | info | warning | 404 | 403 | 500",
"type": "success / error / info / warning / 404 / 403 / 500",
"description_zh": "结果的状态,决定图标和颜色"
},
"subTitle": {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/antDesignVue/antDesignVue1/row.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"value": ["top", "middle", "bottom"],
"description": "Vertical alignment",
"default": "sm",
"type": "top | middle | bottom",
"type": "top / middle / bottom",
"description_zh": "flex 布局下的垂直对齐方式:top middle bottom"
},
"gutter": {
Expand All @@ -19,7 +19,7 @@
"value": ["start", "end ", "center ", "space-around ", "space-between"],
"description": "Arrange it horizontally",
"default": "start",
"type": "start | end | center | space-around | space-between",
"type": "start / end / center / space-around / space-between",
"description_zh": "水平排列方式"
},
"type": {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/antDesignVue/antDesignVue1/select.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"value": ["multiple", "tags", "combobox"],
"description": "Set the mode of Select to Multi-Select or Label",
"default": "-",
"type": "'multiple' | 'tags' | 'combobox'",
"type": "multiple / tags / combobox",
"description_zh": "设置 Select 的模式为多选或标签"
},
"notFoundContent": {
Expand Down

0 comments on commit 53a2c45

Please sign in to comment.