@alicloud/console-components-search 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,11 +3,10 @@
3
3
  基础搜索组件: 当前控制台的基础搜索主要针对列表页的搜索场景,此次基础搜索组件主要通过一个简约通用的框架满足控制台针对列表页不同场景下的搜索需求
4
4
  按照使用场景分为三种使用场景
5
5
  - 场景一:单维度单类别单选 (eg:该功能模块下只支持“实例名称”这唯一类别的搜索);
6
- - 场景二:单维度多类别单选(eg:该功能模块下只支持“实例名称”这唯一类别的搜索网络类型包括多个子类别);
7
- - 场景三:多维度多类别(eg:该功能模块下支持“网络类型”这一类别和其他同等类别的交集搜索);
6
+ - 场景二:带着多个筛选维度的输入
8
7
 
9
8
  ### SearchTagList
10
- 场景二、三需结合SearchTagList使用, SearchTagList用与展示Search已选的筛选条件(以tag的形式),分成两个组件可以更灵活的定位SearchTagList的位置(比如表格场景)
9
+ 场景二 需结合SearchTagList使用, SearchTagList用与展示Search已选的筛选条件(以tag的形式),分成两个组件可以更灵活的定位SearchTagList的位置(比如表格场景)
11
10
 
12
11
  ## install
13
12
 
@@ -87,9 +86,7 @@ async function onSearch (allFileds:any) {
87
86
  <div>
88
87
  搜索类型:(async 调用)<br />
89
88
  <Search
90
- mode="single-single"
91
- regionId="demo"
92
- resourceType="demo"
89
+ simple
93
90
  options={options}
94
91
  onSuggest={onSuggestAsync}
95
92
  onChange={onChange1}
@@ -97,9 +94,7 @@ async function onSearch (allFileds:any) {
97
94
  />
98
95
  <br /><br /><br /> 搜索类型:(promise调用)<br />
99
96
  <Search
100
- mode="single-single"
101
- regionId="demo"
102
- resourceType="demo"
97
+ simple
103
98
  options={options}
104
99
  onSuggest={onSuggestPromise}
105
100
  onChange={onChange1}
@@ -107,9 +102,7 @@ async function onSearch (allFileds:any) {
107
102
  />
108
103
  <br /><br /><br /> 单选类型:<br />
109
104
  <Search
110
- mode="single-single"
111
- regionId="demo"
112
- resourceType="demo"
105
+ simple
113
106
  options={options2}
114
107
  onChange={onChange1}
115
108
  onSearch={onSearch}
@@ -1,2 +1,2 @@
1
1
  export * from '@alicloud/console-components'
2
- import '@alicloud/console-components/dist/xconsole.css'
2
+ import '@alicloud/console-components/dist/wind.css'
@@ -86,52 +86,40 @@ const Demo1: React.FC<IRcSearchProps> = (props) => {
86
86
  }
87
87
 
88
88
  async function onSearch (allFileds:any) {
89
- console.log(`onSearch:`, 'allFileds', allFileds)
90
- console.log(`提交搜索: ${JSON.stringify(allFileds)}`)
89
+ alert(JSON.stringify(allFileds))
91
90
  }
92
91
 
93
92
  return (
94
93
  <div>
95
94
  搜索类型:(async 调用)<br />
96
95
  <Search
97
- mode="single-single"
98
- regionId="demo"
99
- resourceType="demo"
96
+ simple
100
97
  options={options}
101
98
  onSuggest={onSuggestAsync}
102
- onChange={onChange1}
103
99
  onSearch={onSearch}
104
100
  />
105
101
  <br /><br /><br />
106
102
  搜索类型:(promise调用)<br />
107
103
  <Search
108
- mode="single-single"
109
- regionId="demo"
104
+ simple
110
105
  resourceType="demo"
111
106
  options={options}
112
107
  onSuggest={onSuggestPromise}
113
- onChange={onChange1}
114
108
  onSearch={onSearch}
115
109
  />
116
110
  <br /><br /><br />
117
111
  搜索类型:(不支持模糊搜索 fuzzyDisable: true)<br />
118
112
  <Search
119
- mode="single-single"
120
- regionId="demo"
121
- resourceType="demo"
113
+ simple
122
114
  options={noFuzzyoptions}
123
115
  onSuggest={onSuggestPromise}
124
- onChange={onChange1}
125
116
  onSearch={onSearch}
126
117
  />
127
118
  <br /><br /><br />
128
119
  单选类型:<br />
129
120
  <Search
130
- mode="single-single"
131
- regionId="demo"
132
- resourceType="demo"
121
+ simple
133
122
  options={options2}
134
- onChange={onChange1}
135
123
  onSearch={onSearch}
136
124
  />
137
125
  <br />
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * @title 场景二 + 结合SearchTagList使用
3
- * @describe 场景二:single-multi:单维度多类别单选
4
3
  * @canFullScreen
5
4
  */
6
5
 
@@ -51,52 +50,24 @@ let options = [
51
50
  const Demo2: React.FC<IRcSearchProps> = (props) => {
52
51
  const [tagList, setTagList] = useState<any>([]);
53
52
 
54
- async function onSuggest (value: string, dataIndex: string) {
55
- if (!value) {
56
- return [];
57
- }
58
- return [
59
- // {label: value, value: `${dataIndex}-${value}`}
60
- `${value}-1`,
61
- `${value}-2`,
62
- `${value}-3`,
63
- `${value}-4`,
64
- `${value}-5`,
65
- ]
66
- }
67
-
68
- async function onChange (changedFileds:any, allFileds:any) {
69
- console.log(`changedFileds:`, changedFileds, 'allFileds', allFileds)
70
- }
71
-
72
- function onTagChange(newTags: any) {
73
- console.log(`onTagChange:`, newTags);
74
- setTagList(newTags);
75
- }
76
-
77
53
  function onTagChangeByTagList (newTags: any) {
78
54
  console.log(`onTagChange:`, newTags);
79
55
  setTagList(newTags);
80
-
81
56
  }
82
57
 
83
- async function onSearch (allFileds:any) {
84
- console.log(`onSearch:`, 'allFileds', allFileds)
85
- console.log(`提交搜索: ${JSON.stringify(allFileds)}`)
58
+ async function onSearch (field:any) {
59
+ console.log(`onSearch:`, 'allFileds', field)
60
+ console.log(`提交搜索: ${JSON.stringify(field)}`)
86
61
  }
87
62
 
88
63
 
89
64
  return (
90
65
  <div>
91
66
  <Search
92
- mode="single-multi"
93
67
  defaultDataIndex="name"
94
68
  regionId="demo"
95
69
  resourceType="demo"
96
70
  options={options}
97
- onChange={onChange}
98
- onSuggest={onSuggest}
99
- onTagChange={onTagChange}
100
71
  onSearch={onSearch}
101
72
  tags={tagList}
102
73
  />
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @title 场景三 + 结合表格使用
3
- * @describe 场景三:multi-multi:多维度多类别单选
3
+ * @describe 场景三:结合表格使用
4
4
  * @canFullScreen
5
5
  */
6
6
 
@@ -16,7 +16,8 @@ let options = [
16
16
  templateProps: {
17
17
  placeholder: '按实例名称搜索',
18
18
  dataSource: []
19
- }
19
+ },
20
+ groupName:"test"
20
21
  },
21
22
  {
22
23
  label: '网络类型',
@@ -30,7 +31,8 @@ let options = [
30
31
  {label: 'C', value: 'c'},
31
32
  {label: 'D', value: 'd'},
32
33
  ]
33
- }
34
+ },
35
+ groupName:"test"
34
36
  },
35
37
  {
36
38
  label: '付费类型',
@@ -44,39 +46,17 @@ let options = [
44
46
  {label: 'C', value: 'c'},
45
47
  {label: 'D', value: 'd'},
46
48
  ]
47
- }
49
+ },
50
+ groupName:"test2"
48
51
  }
49
52
  ]
50
53
 
51
54
  const Demo3: React.FC<IRcSearchProps> = (props) => {
52
55
  const [tagList, setTagList] = useState<any>([]);
53
56
 
54
- async function onSuggest (value: string, dataIndex: string) {
55
- if (!value) {
56
- return [];
57
- }
58
- return [
59
- // {label: value, value: `${dataIndex}-${value}`}
60
- `${value}-1`,
61
- `${value}-2`,
62
- `${value}-3`,
63
- `${value}-4`,
64
- `${value}-5`,
65
- ]
66
- }
67
-
68
- async function onChange (changedFileds:any, allFileds:any) {
69
- console.log(`changedFileds:`, changedFileds, 'allFileds', allFileds)
70
- }
71
-
72
- function onTagChange(newTags: any) {
73
- console.log(`onTagChange:`, newTags);
74
- setTagList(newTags);
75
- }
76
-
77
- async function onSearch (allFileds:any) {
78
- console.log(`onSearch:`, 'allFileds', allFileds)
79
- console.log(`提交搜索: ${JSON.stringify(allFileds)}`)
57
+ async function onSearch (field:any) {
58
+ console.log(field)
59
+ setTagList(field);
80
60
  }
81
61
 
82
62
  return (
@@ -85,14 +65,8 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
85
65
  <div>
86
66
  <Button type="primary" style={{marginRight: '10px'}}>主按钮</Button>
87
67
  <Search
88
- mode="multi-multi"
89
68
  defaultDataIndex="name"
90
- regionId="demo"
91
- resourceType="demo"
92
69
  options={options}
93
- onChange={onChange}
94
- onSuggest={onSuggest}
95
- onTagChange={onTagChange}
96
70
  onSearch={onSearch}
97
71
  tags={tagList}
98
72
  style={{marginRight: '10px', width: '500px'}}
@@ -101,7 +75,8 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
101
75
 
102
76
  </div>
103
77
 
104
- <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList} onChange={onTagChange} />
78
+ <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList}/>
79
+
105
80
  <Table>
106
81
  <Table.Column title="Key" dataIndex="key" />
107
82
  <Table.Column title="实例ID/名称" dataIndex="id" />
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @title 场景三 + 无默认类别
3
- * @describe 场景三:multi-multi:多维度多类别单选
3
+ * @describe 场景四:无默认类别
4
4
  * @canFullScreen
5
5
  */
6
6
 
@@ -104,10 +104,6 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
104
104
  ]
105
105
  }
106
106
 
107
- async function onChange (changedFileds:any, allFileds:any) {
108
- console.log(`changedFileds:`, changedFileds, 'allFileds', allFileds)
109
- }
110
-
111
107
  function onTagChange(newTags: any) {
112
108
  console.log(`onTagChange:`, newTags);
113
109
  setTagList(newTags);
@@ -122,15 +118,12 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
122
118
  <div>
123
119
  <p>无默认分类, 默认多类别搜索</p>
124
120
  <Search
125
- mode="multi-multi"
126
121
  options={options}
127
122
  regionId="demo"
128
123
  resourceType="demo"
129
- onChange={onChange}
130
124
  onSuggest={onSuggest}
131
125
  defaultPlaceholder="请搜索"
132
126
  onSuggestNoDataIndex={onSuggestNoIndex}
133
- onTagChange={onTagChange}
134
127
  onSearch={onSearch}
135
128
  tags={tagList}
136
129
  />
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- body .xconsole-rcsearch-multi-pop .next-select-menu-item{padding-left:0!important}body .xconsole-rcsearch-multi-pop .next-select-menu-item .next-menu-icon-selected{display:none}body .xconsole-rcsearch-multi-pop .next-menu-group-label{padding-left:0}
1
+ body .xconsole-rcsearch-multi-pop .next-select-menu-item{padding-left:0!important}body .xconsole-rcsearch-multi-pop .next-select-menu-item .next-menu-icon-selected{display:none}body .xconsole-rcsearch-multi-pop .next-menu-group-label{padding-left:0}body .xconsole-rc-search-popup{margin-top:4px}