Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions examples/sites/demos/apis/tag-input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
export default {
mode: ['pc', 'mobile-first'],
apis: [
{
name: 'tag-input',
type: 'component',
props: [
{
name: 'model-value / v-model',
type: 'array',
defaultValue: '[]',
desc: {
'zh-CN': '绑定值',
'en-US': '‌Binding Value'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'tag-group-size',
mfDemo: 'tag-group-size'
},
{
name: 'size',
type: "'medium' | 'small'",
defaultValue: "'medium'",
desc: {
'zh-CN': '尺寸',
'en-US': 'Size '
},
mode: ['pc', 'mobile-first'],
pcDemo: 'tag-group-size',
mfDemo: 'tag-group-size'
},
{
name: 'tag-type',
typeAnchorName: 'IType',
type: 'IType',
defaultValue: '',
desc: {
'zh-CN': '显示类型',
'en-US': 'Display type'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'tag-effect',
typeAnchorName: 'IEffect',
type: 'IEffect',
defaultValue: "'light'",
desc: {
'zh-CN': '主题',
'en-US': 'Theme Color'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'effect',
mfDemo: ''
},
{
name: 'clearable',
type: 'boolean',
defaultValue: 'false',
desc: {
'zh-CN': '是否可清空',
'en-US': 'Whether it can be cleared'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'disabled',
type: 'boolean',
defaultValue: 'false',
desc: {
'zh-CN': '是否禁用标签输入框',
'en-US': 'Whether the tag input box is disabled'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'max',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AUI6曾使用 maxTagCount 来表示要展示的最大数。---- 建议只使用这个

max如果是限制 data的数组长度,完全没有必要。
minCollapsedNum: 这个属性名字也不好理解哪个值最小, 显示的最小还是隐藏起来的tag数最小。

max, minCollapsedNum 建议都去掉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我认为还是有必要的
max:限制用户输入添加的标签数量的
minCollapsedNum:表示标签数量超过minCollapsedNum,就折叠展示后面的标签

type: 'number',
defaultValue: 'Infinity',
desc: {
'zh-CN': '最大允许输入的标签数量',
'en-US': 'Maximum number of tags allowed to be input'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'placeholder',
type: 'string',
defaultValue: '',
desc: {
'zh-CN': '占位符',
'en-US': 'Placeholder'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'readonly',
type: 'boolean',
defaultValue: 'false',
desc: {
'zh-CN': '是否只读',
'en-US': 'Whether it is read-only'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'draggable',
type: 'boolean',
defaultValue: 'false',
desc: {
'zh-CN': '是否可拖拽',
'en-US': 'Whether it is draggable'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'minCollapsedNum',
type: 'number',
defaultValue: 'Infinity',
desc: {
'zh-CN': '最小折叠数量',
'en-US': 'Minimum collapsed number'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
},
{
name: 'separator',
type: 'string',
defaultValue: ',',
desc: {
'zh-CN': '批量输入时标签分隔符',
'en-US': 'Tag separator for batch input'
},
mode: ['pc', 'mobile-first'],
pcDemo: 'basic-usage',
mfDemo: ''
}
],
events: [],
methods: [],
slots: [
{
name: 'prefix',
defaultValue: '',
desc: {
'zh-CN': '输入框前缀内容的插槽',
'en-US': 'Input prefix slot'
},
mode: ['pc'],
pcDemo: 'basic-usage'
},
{
name: 'suffix',
defaultValue: '',
desc: {
'zh-CN': '输入框后缀内容的插槽',
'en-US': 'Input suffix slot'
},
mode: ['pc'],
pcDemo: 'basic-usage'
}
]
}
],
types: []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div class="tiny-tag-input-demo">
<tiny-tag-input v-model="data" :placeholder="placeholder"></tiny-tag-input>
<tiny-tag-input v-model="data1" :placeholder="placeholder" tag-type="info" tag-effect="light"></tiny-tag-input>
<tiny-tag-input v-model="data2" :placeholder="placeholder" tag-type="success" tag-effect="plain"></tiny-tag-input>
</div>
</template>

<script setup>
import { TinyTagInput } from '@opentiny/vue'
import { reactive, ref } from 'vue'

const data = reactive(['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'])
const data1 = reactive(['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'])
const data2 = reactive(['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'])
const placeholder = ref('please enter a tag')
</script>

<style scoped>
.tiny-tag-input-demo .tiny-tag-input {
margin-bottom: 20px;
}
</style>
32 changes: 32 additions & 0 deletions examples/sites/demos/pc/app/tag-input/basic-usage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="tiny-tag-input-demo">
<tiny-tag-input v-model="data" :placeholder="placeholder"></tiny-tag-input>
<tiny-tag-input v-model="data1" :placeholder="placeholder" tag-type="info" tag-effect="light"></tiny-tag-input>
<tiny-tag-input v-model="data2" :placeholder="placeholder" tag-type="success" tag-effect="plain"></tiny-tag-input>
</div>
</template>

<script>
import { TinyTagInput } from '@opentiny/vue'

export default {
components: {
TinyTagInput
},
data() {
return {
data: ['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题: tagInput的数据格式,是否需要支持对象,比如 : {label: 'tag1', value: 't1" }

原因: select中的多选是使用到tagInput组件的, 它需要上面的格式。
以往在其它系统中,看到给数据行打tag, tag的数据体通常是一处复杂对象,类似于:
{id , text, color, createTime, ......} 这种

所以tagINput的data 不能是简单的 string[]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select多选组件应该无法使用这个组件。
这个是一个用户通过输出添加标签的功能,只能新增或者删除操作,操作的只能是文本,除了text外,用户并不能操作其他属性,添加的也没有其他属性。
string[]类型应该是绝大部分场景了,其他类型得考虑下使用场景

data1: ['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'],
data2: ['tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6'],
maxTagCount: 3,
placeholder: 'please enter a tag'
}
}
}
</script>

<style scoped>
.tiny-tag-input-demo .tiny-tag-input {
margin-bottom: 20px;
}
</style>
7 changes: 7 additions & 0 deletions examples/sites/demos/pc/app/tag-input/webdoc/tag-input.cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: TagInput 标签输入框
---

# TagInput 标签输入框

<div>用于输入标签。</div>
7 changes: 7 additions & 0 deletions examples/sites/demos/pc/app/tag-input/webdoc/tag-input.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: TagInput
---

# TagInput

<div>Used to enter the label.</div>
23 changes: 23 additions & 0 deletions examples/sites/demos/pc/app/tag-input/webdoc/tag-input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
column: '2',
owner: '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
owner: '',
owner: '',
meta: {
experimental: '3.29.0'
},

meta: {
experimental: '3.29.0'
},
show: true,
cloud: true,
demos: [
{
demoId: 'basic-usage',
name: {
'zh-CN': '基本用法',
'en-US': 'basic usage'
},
desc: {
'zh-CN': `按enter回车键添加标签,按backspace删除最后一个标签。<br>`,
'en-US': `Press Enter to add a tag, and press Backspace to delete the last one. <br>`
},
codeFiles: ['basic-usage.vue']
}
]
}
1 change: 1 addition & 0 deletions examples/sites/demos/pc/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export const cmpMenus = [
{ 'nameCn': '输入框', 'name': 'Input', 'key': 'input' },
{ 'nameCn': ' IP地址输入框', 'name': 'IpAddress', 'key': 'ip-address' },
{ 'nameCn': '数字输入框', 'name': 'Numeric', 'key': 'numeric' },
{ 'nameCn': '标签输入框', 'name': 'TagInput', 'key': 'tag-input', 'meta': { 'experimental': '3.29.0' } },
{ 'nameCn': '弹出编辑', 'name': 'PopEditor', 'key': 'popeditor' },
{ 'nameCn': '弹出上传', 'name': 'PopUpload', 'key': 'pop-upload' },
{ 'nameCn': '单选框', 'name': 'Radio', 'key': 'radio' },
Expand Down
19 changes: 19 additions & 0 deletions packages/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,25 @@
"type": "template",
"exclude": false
},
"TagInput": {
"path": "vue/src/tag-input/index.ts",
"type": "component",
"exclude": false,
"mode": [
"mobile-first",
"pc"
]
},
"TagInputPc": {
"path": "vue/src/tag-input/src/pc.vue",
"type": "template",
"exclude": false
},
"TagInputMobileFirst": {
"path": "vue/src/tag-input/src/mobile-first.vue",
"type": "template",
"exclude": false
},
"TextPopup": {
"path": "vue/src/text-popup/index.ts",
"type": "component",
Expand Down
Loading
Loading