@alicloud/console-components-search 0.1.3 → 0.2.2

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.
Files changed (66) hide show
  1. package/README.md +104 -131
  2. package/demos/demo1.demo.tsx +100 -90
  3. package/doc-dist/0.js +1917 -16
  4. package/doc-dist/1.js +16 -1917
  5. package/doc-dist/10.js +1 -1
  6. package/doc-dist/11.js +1 -1
  7. package/doc-dist/12.js +1 -1
  8. package/doc-dist/13.js +1 -1
  9. package/doc-dist/14.js +1 -1
  10. package/doc-dist/15.js +1 -1
  11. package/doc-dist/3.js +5 -5
  12. package/doc-dist/4.js +1 -1
  13. package/doc-dist/5.js +2 -2
  14. package/doc-dist/6.js +1 -1
  15. package/doc-dist/7.js +1 -1
  16. package/doc-dist/8.js +1 -1
  17. package/doc-dist/9.js +1 -1
  18. package/doc-dist/deps/main.css +1 -1
  19. package/doc-dist/deps/main.js +8 -8
  20. package/doc-dist/deps/main.os.css +1 -1
  21. package/doc-dist/index.js +3 -3
  22. package/doc-dist/log-deps-build.log +3 -3
  23. package/es/constants.js +4 -1
  24. package/es/index.js +1 -1
  25. package/es/modeSingleSingle/InputPrefix.js +29 -0
  26. package/es/modeSingleSingle/index2.js +369 -0
  27. package/es/search.js +2 -3
  28. package/es/searchTagList/PureTag.js +57 -0
  29. package/es/searchTagList/index.js +30 -14
  30. package/es/style.js +2 -2
  31. package/lib/constants.d.ts +2 -0
  32. package/lib/constants.js +6 -2
  33. package/lib/index.d.ts +2 -1
  34. package/lib/index.js +1 -1
  35. package/lib/modeSingleSingle/InputPrefix.d.ts +2 -0
  36. package/lib/modeSingleSingle/InputPrefix.js +43 -0
  37. package/lib/modeSingleSingle/index2.d.ts +4 -0
  38. package/lib/modeSingleSingle/index2.js +400 -0
  39. package/lib/search.js +2 -4
  40. package/lib/searchTagList/PureTag.d.ts +14 -0
  41. package/lib/searchTagList/PureTag.js +71 -0
  42. package/lib/searchTagList/index.d.ts +3 -1
  43. package/lib/searchTagList/index.js +31 -15
  44. package/lib/style.js +2 -2
  45. package/lib/types/IRcSearchProps.type.d.ts +22 -21
  46. package/lib/types/IRcSearchTagItemProps.type.d.ts +2 -2
  47. package/lib/types/IRcSearchTagListProps.type.d.ts +9 -5
  48. package/package.json +2 -1
  49. package/demos/demo2.demo.tsx +0 -81
  50. package/demos/demo3.demo.tsx +0 -90
  51. package/demos/demo4.demo.tsx +0 -137
  52. package/dist/index.css +0 -1
  53. package/dist/index.js +0 -60
  54. package/doc-dist/16.js +0 -6
  55. package/doc-dist/17.js +0 -6
  56. package/doc-dist/18.js +0 -6
  57. package/doc-dist/19.js +0 -6
  58. package/doc-dist/20.js +0 -6
  59. package/docs/markdown-render.doc.md +0 -21
  60. package/docs/test.doc.md +0 -8
  61. package/es/modeSingleMulti/index.js +0 -868
  62. package/es/modeSingleSingle/index.js +0 -201
  63. package/lib/modeSingleMulti/index.d.ts +0 -2
  64. package/lib/modeSingleMulti/index.js +0 -894
  65. package/lib/modeSingleSingle/index.d.ts +0 -2
  66. package/lib/modeSingleSingle/index.js +0 -226
package/lib/style.js CHANGED
@@ -15,7 +15,7 @@ var prefix = function prefix(props) {
15
15
 
16
16
  var SearchWarp = _styledComponents.default.div.withConfig({
17
17
  componentId: "sc-1afc1cn-0"
18
- })(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;border:1px solid var(--input-hover-border-color,#0064c8);;}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
18
+ })(["height:100%;width:100%;display:flex;.left-wrap{flex:1;border-left:1px solid rgba(192,198,204,1);border-bottom:1px solid rgba(192,198,204,1);border-top:1px solid rgba(192,198,204,1);border-right:1px solid rgba(192,198,204,1);display:flex;border-bottom-left-radius:2px;border-top-left-radius:2px;&.focus{border:1px solid #0064c8;border:1px solid var(--input-focus-border-color,#0064c8);;border-right:1px solid rgba(192,198,204,1);}.condition{height:26px;display:inline-block;margin-top:2px;}.condition-item{height:26px;display:inline-block;line-height:26px;background:#EFF3F8;border-radius:2px;background-color:#EFF3F8;padding:0 8px;margin:0 2px;font-size:12px;color:#333;position:relative;&-txt{padding-right:4px;}&:hover{background-color:#E0E4E8;}}.condition-select{width:100%;height:100%;opacity:0;position:absolute;top:0;left:0;min-width:auto;", "select-inner{min-width:auto;}}.forms{flex:1;position:relative;.clear-level1{position:absolute;top:1px;right:1px;height:28px;width:30px;background-color:#fff;z-index:99;color:#333;text-align:center;line-height:28px;font-size:12px;cursor:pointer;padding:6px 0 0 6px;}}.main-input{height:auto;border:none;box-shadow:none;&.single{flex:1;}&.select{width:100%;}&.multi{width:100%;}", "input,", "input{height:auto;box-shadow:none;}}", "input", "medium{height:auto;}}.right-wrap{width:32px;.search-btn{width:32px;padding:0 !important;border-bottom-left-radius:0;border-top-left-radius:0;&.focus{border-color:#0064c8;border-color:var(--input-focus-border-color,#0064c8);}border-left:none;}}"], prefix, prefix, prefix, prefix, prefix);
19
19
 
20
20
  exports.SearchWarp = SearchWarp;
21
21
 
@@ -33,6 +33,6 @@ exports.MultiBtnWarp = MultiBtnWarp;
33
33
 
34
34
  var TagListWrap = _styledComponents.default.div.withConfig({
35
35
  componentId: "sc-1afc1cn-3"
36
- })(["", "tag-medium", "tag-closable > ", "tag-close-btn{margin-left:8px;padding-right:6px;}", "tag-medium", "tag-closable > ", "tag-body{max-width:calc(100% - 8px - 8px - var(--tag-size-m-padding-lr,8px));}", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon:before,", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon ", "icon-remote{font-size:16px;}&& [class*='-icon-close']:hover::before{color:#181818;}&& [class*='-icon-close']::before{color:#808080;content:var(--icon-content-delete-filling);}.remove-btn{margin-bottom:8px;line-height:24px;display:inline-block;vertical-align:middle;cursor:pointer;}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
36
+ })(["", "tag-medium", "tag-closable > ", "tag-close-btn{margin-left:8px;padding-right:6px;}", "tag-medium", "tag-closable > ", "tag-body{max-width:calc(100% - 8px - 8px - var(--tag-size-m-padding-lr,8px));}", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon:before,", "tag-medium", "tag-closable > ", "tag-close-btn ", "icon ", "icon-remote{font-size:16px;}&& [class*='-icon-close']:hover::before{color:#181818;}&& [class*='-icon-close']::before{color:#808080;font-size:12px !important;}.remove-btn{margin-bottom:8px;line-height:24px;display:inline-block;vertical-align:middle;cursor:pointer;}"], prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix, prefix);
37
37
 
38
38
  exports.TagListWrap = TagListWrap;
@@ -1,5 +1,9 @@
1
+ /**
2
+ * 这是IRcSearchProps的说明。breezr-docs支持从源码中提取接口信息并文档化,因此你可以使用接口来定义Props,从而能便捷地将Props的信息通过文档透出。
3
+ *
4
+ * 下面列举的props其实是随便写的,仅仅用来说明breezr-docs的接口提取功能。
5
+ */
1
6
  import { IRcSearchOptionsProps } from './IRcSearchOptions.type';
2
- import { IRcSearchTagItemProps } from './IRcSearchTagItemProps.type';
3
7
  export interface IRcSearchProps {
4
8
  /**
5
9
  * 是否是简单搜索, 不支持多 filter, 但是支持模糊
@@ -20,42 +24,39 @@ export interface IRcSearchProps {
20
24
  */
21
25
  options: IRcSearchOptionsProps[];
22
26
  /**
23
- * tags 传入的taglist, 用于, 同步
27
+ * 默认placeholder
24
28
  */
25
- tags?: IRcSearchTagItemProps[];
29
+ placeholder?: string;
26
30
  /**
27
31
  * 默认类别
28
- * 仅在mode是"single-multi" | "multi-multi"生效
29
32
  */
30
33
  defaultDataIndex?: string;
31
34
  /**
32
- * 默认placeholder
33
- * 仅在mode是"single-multi" | "multi-multi"生效, 且, 未配置默认值时生效
35
+ * 搜索触发
34
36
  */
35
- defaultPlaceholder?: string;
37
+ onSearch?: (value: string, dataIndex: string, extra?: any) => void;
36
38
  /**
37
- * regionId
39
+ * 模糊搜索的回调函数(仅输入框返回),用于构建模糊搜索的联想列表
38
40
  */
39
- regionId?: string;
41
+ onSuggest?: (value: string, dataIndex: string) => void;
40
42
  /**
41
- * resourceType
43
+ * 模糊搜索的 suggestions
42
44
  */
43
- resourceType?: string;
45
+ suggestions?: any[];
44
46
  /**
45
- * 搜索触发
47
+ * 是否是模糊搜索
46
48
  */
47
- onSearch?: (allFields: any) => void;
49
+ fuzzy?: boolean;
48
50
  /**
49
- * 模糊搜索的回调函数(仅输入框返回),用于构建模糊搜索的联想列表
51
+ * regionId, 数据上报用
50
52
  */
51
- onSuggest?: (value: string, dataIndex: string) => void;
53
+ regionId?: string;
52
54
  /**
53
- * 模糊搜索的回调函数(仅输入框返回),当没设置defaultDataIndex,且有多个input类别时触发,
54
- * 可自定义二级返回List
55
- */
56
- onSuggestNoDataIndex?: (value: string) => Promise<any>;
55
+ * resourceType, 数据上报用, 格式 ACS::ECS::INSTANCE
56
+ */
57
+ resourceType?: string;
57
58
  /**
58
- * 提供单选和多选, 触发。
59
+ * 样式 class 前缀
59
60
  */
60
- onSelect?: () => void;
61
+ prefix?: string;
61
62
  }
@@ -11,7 +11,7 @@ export interface IRcSearchTagItemProps {
11
11
  /**
12
12
  * tag的类别的key
13
13
  */
14
- dataIndex: string;
14
+ dataIndex?: string;
15
15
  /**
16
16
  * tag的类别的值
17
17
  */
@@ -19,5 +19,5 @@ export interface IRcSearchTagItemProps {
19
19
  /**
20
20
  * tag的类别的展示值
21
21
  */
22
- valueShow: string;
22
+ valueLabel?: string;
23
23
  }
@@ -14,19 +14,23 @@ export interface IRcSearchTagListProps {
14
14
  */
15
15
  style?: any;
16
16
  /**
17
- * tags 传入的taglist, 用于, 同步
17
+ * 筛选项
18
18
  */
19
- tagList: IRcSearchTagItemProps[];
19
+ dataSource: IRcSearchTagItemProps[];
20
20
  /**
21
21
  * regionId
22
22
  */
23
- regionId: string;
23
+ regionId?: string;
24
24
  /**
25
25
  * resourceType
26
26
  */
27
27
  resourceType?: string;
28
28
  /**
29
- * 当删减tag时, 返回新的taglist, 可直接赋值给rc-search组件
29
+ * 当删减 tag 时, 返回新的筛选项
30
30
  */
31
- onChange?: (newTags: any) => void;
31
+ onChange?: (deletedFilter: IRcSearchTagItemProps, remainFilters: IRcSearchTagItemProps[]) => void;
32
+ /**
33
+ * 清除山选项
34
+ */
35
+ onClear?: () => void;
32
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/console-components-search",
3
- "version": "0.1.3",
3
+ "version": "0.2.2",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "license": "MIT",
@@ -35,6 +35,7 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
+ "@alicloud/console-components-truncate": "^1.0.16",
38
39
  "@alicloud/console-logger-sls": "^1.2.31"
39
40
  }
40
41
  }
@@ -1,81 +0,0 @@
1
- /**
2
- * @title 场景二 + 结合SearchTagList使用
3
- * @canFullScreen
4
- */
5
-
6
- import React, {useState} from "react";
7
- import { Search, IRcSearchProps, SearchTagList } from "@alicloud/console-components-search";
8
-
9
- // interface IProps {}
10
- let options = [
11
- {
12
- label: '实例名称',
13
- dataIndex: 'name',
14
- template: 'input',
15
- templateProps: {
16
- placeholder: '按实例名称搜索',
17
- dataSource: []
18
- }
19
- },
20
- {
21
- label: '网络类型',
22
- dataIndex: 'type',
23
- template: 'select',
24
- templateProps: {
25
- placeholder: '请选择网络类型',
26
- dataSource: [
27
- {label: 'A', value: 'a'},
28
- {label: 'B', value: 'b'},
29
- {label: 'C', value: 'c'},
30
- {label: 'D', value: 'd'},
31
- ]
32
- }
33
- },
34
- {
35
- label: '付费类型',
36
- dataIndex: 'pay',
37
- template: 'multiple',
38
- templateProps: {
39
- placeholder: '请选择付费类型',
40
- dataSource: [
41
- {label: 'A', value: 'a'},
42
- {label: 'B', value: 'b'},
43
- {label: 'C', value: 'c'},
44
- {label: 'D', value: 'd'},
45
- ]
46
- }
47
- }
48
- ]
49
-
50
- const Demo2: React.FC<IRcSearchProps> = (props) => {
51
- const [tagList, setTagList] = useState<any>([]);
52
-
53
- function onTagChangeByTagList (newTags: any) {
54
- console.log(`onTagChange:`, newTags);
55
- setTagList(newTags);
56
- }
57
-
58
- async function onSearch (field:any) {
59
- console.log(`onSearch:`, 'allFileds', field)
60
- console.log(`提交搜索: ${JSON.stringify(field)}`)
61
- }
62
-
63
-
64
- return (
65
- <div>
66
- <Search
67
- defaultDataIndex="name"
68
- regionId="demo"
69
- resourceType="demo"
70
- options={options}
71
- onSearch={onSearch}
72
- tags={tagList}
73
- />
74
- <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList} onChange={onTagChangeByTagList} />
75
-
76
- </div>
77
-
78
- )
79
- };
80
-
81
- export default Demo2;
@@ -1,90 +0,0 @@
1
- /**
2
- * @title 场景三 + 结合表格使用
3
- * @describe 场景三:结合表格使用
4
- * @canFullScreen
5
- */
6
-
7
- import React, {useState} from "react";
8
- import { Search, IRcSearchProps, SearchTagList } from "@alicloud/console-components-search";
9
- import { Button, Table } from '@alicloud/console-components'
10
- // interface IProps {}
11
- let options = [
12
- {
13
- label: '实例名称',
14
- dataIndex: 'name',
15
- template: 'input',
16
- templateProps: {
17
- placeholder: '按实例名称搜索',
18
- dataSource: []
19
- },
20
- groupName:"test"
21
- },
22
- {
23
- label: '网络类型',
24
- dataIndex: 'type',
25
- template: 'select',
26
- templateProps: {
27
- placeholder: '请选择网络类型',
28
- dataSource: [
29
- {label: 'A', value: 'a'},
30
- {label: 'B', value: 'b'},
31
- {label: 'C', value: 'c'},
32
- {label: 'D', value: 'd'},
33
- ]
34
- },
35
- groupName:"test"
36
- },
37
- {
38
- label: '付费类型',
39
- dataIndex: 'pay',
40
- template: 'multiple',
41
- templateProps: {
42
- placeholder: '请选择付费类型',
43
- dataSource: [
44
- {label: 'A', value: 'a'},
45
- {label: 'B', value: 'b'},
46
- {label: 'C', value: 'c'},
47
- {label: 'D', value: 'd'},
48
- ]
49
- },
50
- groupName:"test2"
51
- }
52
- ]
53
-
54
- const Demo3: React.FC<IRcSearchProps> = (props) => {
55
- const [tagList, setTagList] = useState<any>([]);
56
-
57
- async function onSearch (field:any) {
58
- console.log(field)
59
- setTagList(field);
60
- }
61
-
62
- return (
63
- <div>
64
- <p>有默认分类: 实例名称</p>
65
- <div>
66
- <Button type="primary" style={{marginRight: '10px'}}>主按钮</Button>
67
- <Search
68
- defaultDataIndex="name"
69
- options={options}
70
- onSearch={onSearch}
71
- tags={tagList}
72
- style={{marginRight: '10px', width: '500px'}}
73
- />
74
- <Button type="normal">普通按钮</Button>
75
-
76
- </div>
77
-
78
- <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList}/>
79
-
80
- <Table>
81
- <Table.Column title="Key" dataIndex="key" />
82
- <Table.Column title="实例ID/名称" dataIndex="id" />
83
- <Table.Column title="状态" dataIndex="status" />
84
- </Table>
85
- </div>
86
-
87
- )
88
- };
89
-
90
- export default Demo3;
@@ -1,137 +0,0 @@
1
- /**
2
- * @title 场景三 + 无默认类别
3
- * @describe 场景四:无默认类别
4
- * @canFullScreen
5
- */
6
-
7
- import React, {useState} from "react";
8
- import { Search, IRcSearchProps, SearchTagList } from "@alicloud/console-components-search";
9
- import { Radio } from '@alicloud/console-components'
10
-
11
- const RadioGroup = Radio.Group;
12
- // interface IProps {}
13
- let options = [
14
- {
15
- label: '实例名称',
16
- dataIndex: 'name',
17
- template: 'input',
18
- templateProps: {
19
- placeholder: '请输入',
20
- dataSource: []
21
- }
22
- },
23
- {
24
- label: '密钥名称',
25
- dataIndex: 'netkey',
26
- template: 'input',
27
- templateProps: {
28
- placeholder: '请输入',
29
- dataSource: []
30
- }
31
- },
32
- {
33
- label: '网络类型',
34
- dataIndex: 'type',
35
- template: 'select',
36
- templateProps: {
37
- placeholder: '请选择',
38
- dataSource: [
39
- {label: 'A', value: 'a'},
40
- {label: 'B', value: 'b'},
41
- {label: 'C', value: 'c'},
42
- {label: 'D', value: 'd'},
43
- ]
44
- }
45
- },
46
- {
47
- label: '付费类型',
48
- dataIndex: 'pay',
49
- template: 'multiple',
50
- templateProps: {
51
- placeholder: '请选择',
52
- dataSource: [
53
- {label: 'A', value: 'a'},
54
- {label: 'B', value: 'b'},
55
- {label: 'C', value: 'c'},
56
- {label: 'D', value: 'd'},
57
- ]
58
- }
59
- }
60
- ]
61
-
62
- const Demo3: React.FC<IRcSearchProps> = (props) => {
63
- const [tagList, setTagList] = useState<any>([]);
64
-
65
- async function onSuggest (value: string, dataIndex: string) {
66
- console.log()
67
- if (!value) {
68
- return [];
69
- }
70
- return [
71
- // {label: value, value: `${dataIndex}-${value}`}
72
- `${value}-1`,
73
- `${value}-2`,
74
- `${value}-3`,
75
- `${value}-4`,
76
- `${value}-5`,
77
- ]
78
- }
79
-
80
- async function onSuggestNoIndex (value: string) {
81
- if (!value) {
82
- return [];
83
- }
84
-
85
- return [
86
- {
87
- label: '实例名称',
88
- dataIndex: 'name',
89
- children: [
90
- {label: `${value}-1`, value: `${value}-1`, dataIndex: 'name'},
91
- {label: `${value}-2`, value: `${value}-2`, dataIndex: 'name'},
92
- {label: `${value}-3`, value: `${value}-3`, dataIndex: 'name'},
93
- ]
94
- },
95
- {
96
- label: '密钥名称',
97
- dataIndex: 'netkey',
98
- children: [
99
- {label: `${value}-1`, value: `${value}-1`, dataIndex: 'name'},
100
- {label: `${value}-2`, value: `${value}-2`, dataIndex: 'name'},
101
- {label: `${value}-3`, value: `${value}-3`, dataIndex: 'name'},
102
- ]
103
- }
104
- ]
105
- }
106
-
107
- function onTagChange(newTags: any) {
108
- console.log(`onTagChange:`, newTags);
109
- setTagList(newTags);
110
- }
111
-
112
- async function onSearch (allFileds:any) {
113
- console.log(`onSearch:`, 'allFileds', allFileds)
114
- console.log(`提交搜索: ${JSON.stringify(allFileds)}`)
115
- }
116
-
117
- return (
118
- <div>
119
- <p>无默认分类, 默认多类别搜索</p>
120
- <Search
121
- options={options}
122
- regionId="demo"
123
- resourceType="demo"
124
- onSuggest={onSuggest}
125
- defaultPlaceholder="请搜索"
126
- onSuggestNoDataIndex={onSuggestNoIndex}
127
- onSearch={onSearch}
128
- tags={tagList}
129
- />
130
- <SearchTagList regionId="demo" resourceType="demo" style={{marginTop: '8px'}} tagList={tagList} onChange={onTagChange} />
131
- <br /><br /><br />
132
- </div>
133
-
134
- )
135
- };
136
-
137
- export default Demo3;
package/dist/index.css DELETED
@@ -1 +0,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}