@alicloud/console-components-search 0.1.0 → 0.1.1

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.
@@ -86,17 +86,14 @@ 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
99
  onChange={onChange1}
@@ -105,8 +102,7 @@ const Demo1: React.FC<IRcSearchProps> = (props) => {
105
102
  <br /><br /><br />
106
103
  搜索类型:(promise调用)<br />
107
104
  <Search
108
- mode="single-single"
109
- regionId="demo"
105
+ simple
110
106
  resourceType="demo"
111
107
  options={options}
112
108
  onSuggest={onSuggestPromise}
@@ -116,9 +112,7 @@ const Demo1: React.FC<IRcSearchProps> = (props) => {
116
112
  <br /><br /><br />
117
113
  搜索类型:(不支持模糊搜索 fuzzyDisable: true)<br />
118
114
  <Search
119
- mode="single-single"
120
- regionId="demo"
121
- resourceType="demo"
115
+ simple
122
116
  options={noFuzzyoptions}
123
117
  onSuggest={onSuggestPromise}
124
118
  onChange={onChange1}
@@ -127,9 +121,7 @@ const Demo1: React.FC<IRcSearchProps> = (props) => {
127
121
  <br /><br /><br />
128
122
  单选类型:<br />
129
123
  <Search
130
- mode="single-single"
131
- regionId="demo"
132
- resourceType="demo"
124
+ simple
133
125
  options={options2}
134
126
  onChange={onChange1}
135
127
  onSearch={onSearch}
@@ -51,52 +51,25 @@ let options = [
51
51
  const Demo2: React.FC<IRcSearchProps> = (props) => {
52
52
  const [tagList, setTagList] = useState<any>([]);
53
53
 
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
54
  function onTagChangeByTagList (newTags: any) {
78
55
  console.log(`onTagChange:`, newTags);
79
56
  setTagList(newTags);
80
-
81
57
  }
82
58
 
83
- async function onSearch (allFileds:any) {
84
- console.log(`onSearch:`, 'allFileds', allFileds)
85
- console.log(`提交搜索: ${JSON.stringify(allFileds)}`)
59
+ async function onSearch (field:any) {
60
+ alert(JSON.stringify(field))
61
+ console.log(`onSearch:`, 'allFileds', field)
62
+ console.log(`提交搜索: ${JSON.stringify(field)}`)
86
63
  }
87
64
 
88
65
 
89
66
  return (
90
67
  <div>
91
68
  <Search
92
- mode="single-multi"
93
69
  defaultDataIndex="name"
94
70
  regionId="demo"
95
71
  resourceType="demo"
96
72
  options={options}
97
- onChange={onChange}
98
- onSuggest={onSuggest}
99
- onTagChange={onTagChange}
100
73
  onSearch={onSearch}
101
74
  tags={tagList}
102
75
  />
@@ -51,32 +51,9 @@ let options = [
51
51
  const Demo3: React.FC<IRcSearchProps> = (props) => {
52
52
  const [tagList, setTagList] = useState<any>([]);
53
53
 
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)}`)
54
+ async function onSearch (field:any) {
55
+ console.log(field)
56
+ setTagList(field);
80
57
  }
81
58
 
82
59
  return (
@@ -85,14 +62,8 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
85
62
  <div>
86
63
  <Button type="primary" style={{marginRight: '10px'}}>主按钮</Button>
87
64
  <Search
88
- mode="multi-multi"
89
65
  defaultDataIndex="name"
90
- regionId="demo"
91
- resourceType="demo"
92
66
  options={options}
93
- onChange={onChange}
94
- onSuggest={onSuggest}
95
- onTagChange={onTagChange}
96
67
  onSearch={onSearch}
97
68
  tags={tagList}
98
69
  style={{marginRight: '10px', width: '500px'}}
@@ -101,7 +72,8 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
101
72
 
102
73
  </div>
103
74
 
104
- <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList} onChange={onTagChange} />
75
+ <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList}/>
76
+
105
77
  <Table>
106
78
  <Table.Column title="Key" dataIndex="key" />
107
79
  <Table.Column title="实例ID/名称" dataIndex="id" />
@@ -122,7 +122,6 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
122
122
  <div>
123
123
  <p>无默认分类, 默认多类别搜索</p>
124
124
  <Search
125
- mode="multi-multi"
126
125
  options={options}
127
126
  regionId="demo"
128
127
  resourceType="demo"
@@ -130,7 +129,6 @@ const Demo3: React.FC<IRcSearchProps> = (props) => {
130
129
  onSuggest={onSuggest}
131
130
  defaultPlaceholder="请搜索"
132
131
  onSuggestNoDataIndex={onSuggestNoIndex}
133
- onTagChange={onTagChange}
134
132
  onSearch={onSearch}
135
133
  tags={tagList}
136
134
  />