@bit-sun/business-component 4.0.12-alpha.8 → 4.0.13-alpha.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.
Files changed (34) hide show
  1. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -1
  2. package/dist/components/Business/PropertyModal/index.d.ts +23 -0
  3. package/dist/components/Business/PropertyModal/mockData.d.ts +10 -0
  4. package/dist/components/Business/PropertyModal/propertyGroup.d.ts +4 -0
  5. package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +4 -0
  6. package/dist/components/Functional/QueryMutipleSelect/index.d.ts +5 -0
  7. package/dist/components/Functional/SearchSelect/utils.d.ts +16 -1
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.esm.js +1515 -589
  10. package/dist/index.js +1512 -584
  11. package/package.json +3 -3
  12. package/src/components/Business/BsSulaQueryTable/utils.tsx +5 -4
  13. package/src/components/Business/PropertyModal/index.less +58 -0
  14. package/src/components/Business/PropertyModal/index.md +33 -0
  15. package/src/components/Business/PropertyModal/index.tsx +271 -0
  16. package/src/components/Business/PropertyModal/mockData.ts +160 -0
  17. package/src/components/Business/PropertyModal/propertyGroup.tsx +205 -0
  18. package/src/components/Business/SearchSelect/BusinessUtils.tsx +50 -3
  19. package/src/components/Business/SearchSelect/index.md +3 -4
  20. package/src/components/Business/SearchSelect/index.tsx +4 -1
  21. package/src/components/Business/columnSettingTable/columnSetting.tsx +2 -1
  22. package/src/components/Business/columnSettingTable/components/TableSumComponent.tsx +25 -0
  23. package/src/components/Business/columnSettingTable/components/style.less +25 -0
  24. package/src/components/Business/columnSettingTable/index.tsx +3 -28
  25. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +2 -27
  26. package/src/components/Functional/QueryMutipleSelect/index.less +117 -0
  27. package/src/components/Functional/QueryMutipleSelect/index.md +41 -0
  28. package/src/components/Functional/QueryMutipleSelect/index.tsx +245 -0
  29. package/src/components/Functional/SearchSelect/index.less +33 -1
  30. package/src/components/Functional/SearchSelect/index.tsx +76 -269
  31. package/src/components/Functional/SearchSelect/utils.tsx +401 -0
  32. package/src/components/Solution/RuleComponent/ruleFiled.js +93 -93
  33. package/src/index.ts +2 -0
  34. package/src/components/Functional/SearchSelect/utils.ts +0 -38
@@ -0,0 +1,117 @@
1
+ @border-color: #d9d9d9;
2
+ @primary-color: #005cff;
3
+
4
+ .query_select {
5
+ // 选择器 隐藏滚动条 横向滑动
6
+ .ant-select-selector{
7
+ height: 24px;
8
+ overflow: hidden;
9
+ .ant-select-selection-overflow{
10
+ height: 40px;
11
+ flex-wrap: nowrap;
12
+ overflow-x: auto;
13
+ }
14
+ .ant-select-selection-overflow-item {
15
+ align-self: auto;
16
+ }
17
+ }
18
+ &_show {
19
+ display: flex;
20
+
21
+ // 下拉框清除图标位置调整
22
+ .ant-select-clear {
23
+ right: 33px;
24
+ }
25
+
26
+ // 解决多选宽度不够 滑动会白一块的问题
27
+ .ant-select-multiple.ant-select-show-arrow .ant-select-selector, .ant-select-multiple.ant-select-allow-clear .ant-select-selector {
28
+ padding-right: 28px;
29
+ }
30
+
31
+ .ant-select-dropdown {
32
+ top: 24px !important;
33
+ left: -110px !important;
34
+ width: calc(100% + 110px) !important;
35
+ }
36
+ }
37
+
38
+ &_expand_button {
39
+ position: relative;
40
+ right: -11px;
41
+ width: 30px;
42
+ border-left: 1px solid @border-color;
43
+ height: 24px;
44
+ cursor: pointer;
45
+ font-size: 12px;
46
+ color: rgba(0, 0, 0, 0.85);
47
+ span {
48
+ position: absolute;
49
+ left: 50%;
50
+ top: 50%;
51
+ transform: translate(-50%, -50%);
52
+ }
53
+ }
54
+ &_expand_button:hover {
55
+ background-color: @primary-color;
56
+ color: #fff;
57
+ border-top-right-radius: 2px;
58
+ border-bottom-right-radius: 2px;
59
+ }
60
+
61
+ &_wrapper {
62
+ &_top {
63
+ color: #8E8E8E;
64
+ }
65
+ }
66
+
67
+ &_textArea {
68
+ margin-top: 10px;
69
+ .ant-input {
70
+ height: 300px;
71
+ background: #FAFAFA;
72
+ border: 0.8px solid #E0E0E0;
73
+ resize: none;
74
+ border-radius: 0;
75
+ }
76
+ }
77
+ }
78
+
79
+ .multiInput_modal{
80
+ .ant-modal-header{
81
+ height: 32px;
82
+ padding: 0 16px;
83
+ font-size: 12px;
84
+ }
85
+ .ant-modal-title{
86
+ line-height: 32px;
87
+ }
88
+ .ant-modal-close-x{
89
+ width: 32px;
90
+ height: 32px;
91
+ line-height: 32px;
92
+ }
93
+ .ant-modal-footer{
94
+ padding-right: 8px;
95
+ height: 44px;
96
+ .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
97
+ margin-left: 6px;
98
+ }
99
+ .ant-btn {
100
+ width: 56px;
101
+ height: 28px;
102
+ font-weight: 500;
103
+ }
104
+ }
105
+ }
106
+
107
+ .searchSelectMaxTagToolTip {
108
+ .ant-tooltip-inner {
109
+ max-height: 72px;
110
+ overflow-x: auto;
111
+ padding: 0px;
112
+ }
113
+ .ant-tag {
114
+ display: flex;
115
+ width: fit-content;
116
+ }
117
+ }
@@ -0,0 +1,41 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 功能组件
7
+ order: 0
8
+ title: 批量搜索查询组件
9
+ order: 2
10
+ ---
11
+
12
+ ## QueryMutipleInput
13
+
14
+ Demo:
15
+
16
+ ```tsx
17
+ import React, { useRef } from 'react';
18
+ import { QueryMutipleSearchSelect } from '../../../index';
19
+
20
+ export default () => {
21
+ const requestConfig = {
22
+ url: '/items/item/listNoPage/Simple',
23
+ filter: 'qp-name-like', // qp-itemCode-like
24
+ // filter: 'qp-skuCode,name-orGroup,like',
25
+ mappingTextField: 'name',
26
+ mappingValueField: 'itemCode',
27
+ sourceName: 'qp-itemCode-in'
28
+ }
29
+ const handleOnChange = (value) => {
30
+ console.log(value);
31
+ };
32
+
33
+ return (
34
+ <div>
35
+ <QueryMutipleSearchSelect onValueChange={handleOnChange} requestConfig={requestConfig} />
36
+ </div>
37
+ );
38
+ };
39
+ ```
40
+
41
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -0,0 +1,245 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useDebounceFn } from 'ahooks';
3
+ import _, { isNil } from "lodash"
4
+ import { Select, Input, Button, Modal, ConfigProvider, Spin, message } from 'antd';
5
+ import { DashOutlined } from '@ant-design/icons';
6
+ import request from '@/utils/request';
7
+ import { judgeIsRequestError } from '@/utils/requestUtils';
8
+ import './index.less';
9
+ import { convertUrlQueryParams, convertBodyParams, convertResData, handleSourceName, makeUniqueValue, LightHeightOption, handleSelectOptionsShowValue, maxTagPlaceholder } from '../SearchSelect/utils';
10
+
11
+ export const getValue = (value: any, selectMode?: any) => {
12
+ return selectMode ? (typeof value == 'string' && value?.length && value?.split?.(',')||[]) : value;
13
+ }
14
+
15
+ const QueryMutipleSearchSelect = ({ onValueChange, requestConfig={}, selectProps={}, ctx }: any) => {
16
+ const { filter, method = 'get', url, extralHeaders = {}, otherParams = {}, specialBracket = false, noNeedSplit = false, } = requestConfig;
17
+ const selectParamsKey = filter || 'qp-codeAndName-like';
18
+ const resultSourceKey = handleSourceName(requestConfig?.sourceName || ctx?.name || 'skuCode')
19
+ const currentSelectProps = {
20
+ showArrow: true,
21
+ showSearch: true,
22
+ filterOption: false,
23
+ allowClear: true,
24
+ listHeight: 160,
25
+ labelInValue: false,
26
+ maxTagCount: 4,
27
+ ...selectProps,
28
+ }
29
+ const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
30
+
31
+ const [isModalVisible, setIsModalVisible] = useState(false);
32
+ const [open, setOpen] = useState(false);
33
+ const [value, setValue] = useState<any>();
34
+ const [popvalue, setPopValue] = useState();
35
+ const [source, setSource] = useState([]);
36
+ const { run } = useDebounceFn(
37
+ () => {
38
+ getData()
39
+ },
40
+ {
41
+ wait: 1000,
42
+ },
43
+ );
44
+
45
+ const [fetching, setFetching] = useState(false);
46
+ const [searchValue, setSearchValue] = useState('');
47
+ const [uniqueValue, setUniqueValue] = useState(resultSourceKey);
48
+
49
+ useEffect(() => {
50
+ if(value) {
51
+ setPopValue(value);
52
+ onValueChange(value);
53
+ }
54
+ }, [value]);
55
+
56
+ useEffect(() => {
57
+ setUniqueValue(makeUniqueValue());
58
+ }, [resultSourceKey])
59
+
60
+ const showModal = () => {
61
+ setIsModalVisible(true);
62
+ //弹窗打开时 默认搜索内容换行显示
63
+ setPopValue((data: any) => data?.replace(/,/g, '\n'));
64
+ };
65
+
66
+ const handleOk = () => {
67
+ formaData(popvalue);
68
+ setIsModalVisible(false);
69
+ };
70
+
71
+ const formaData = (v: any) => {
72
+ let formatValue: any = ToCDB(v)
73
+ ?.split(/[/\n/\s,;]/)
74
+ ?.filter((item) => item)
75
+ ?.join(',');
76
+ console.log(formatValue,'1111formatValue')
77
+ setValue(formatValue);
78
+ };
79
+
80
+ const handleCancel = () => {
81
+ setIsModalVisible(false);
82
+ };
83
+
84
+ const outerChange = (v: any) => {
85
+ formaData(v)
86
+ };
87
+
88
+ const onChange = (e: any) => {
89
+ const v = e.target.value;
90
+ setPopValue(v);
91
+ };
92
+
93
+ // 获取下拉框数据源-不分页
94
+ const getData = (params: any = {}, callback?: any) => {
95
+ if (!requestConfig) return;
96
+ if (!url) return;
97
+
98
+ setFetching(true)
99
+
100
+ const queryParams = {
101
+ ...otherParams, // 默认参数
102
+ ...params,
103
+ };
104
+ if (isNil(queryParams[selectParamsKey])) {
105
+ queryParams[selectParamsKey] = searchValue;
106
+ }
107
+
108
+ let getRequest;
109
+ const methodName = method?.toLocaleLowerCase();
110
+ if(['post','patch','put'].includes(methodName)) {
111
+ getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
112
+ } else {
113
+ getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
114
+ }
115
+
116
+ if (!getRequest) return;
117
+
118
+ getRequest.then((result: any) => {
119
+ setFetching(false)
120
+ result = result.data;
121
+ if (judgeIsRequestError(result)) {
122
+ message.error(result.msg);
123
+ return;
124
+ }
125
+ const res = result.data;
126
+ const dSource: any = convertResData(requestConfig, res, { selectMode, labelInValue: currentSelectProps?.labelInValue, value, type: 1, items: source, needTopSelectedSource: false });
127
+
128
+ if(callback) {
129
+ callback(source)
130
+ } else {
131
+ setSource(dSource)
132
+ }
133
+ })
134
+ .catch((err: any) => { setFetching(false) });
135
+ }
136
+ const onSearchChange = (v: any) => {
137
+ setSearchValue(v);
138
+ run();
139
+ }
140
+
141
+ return (
142
+ <div className={'query_select'}>
143
+ <div className="query_select_show" id={`query_multiple_select_div_${uniqueValue}`}>
144
+ <Select
145
+ value={getValue(value, selectMode)}
146
+ onChange={outerChange}
147
+ open={open}
148
+ onBlur={(v: any) => {
149
+ onSearchChange(v)
150
+ setOpen(false);
151
+ }}
152
+ onClick={() => setOpen(true)}
153
+ onPaste={(e: any) => {
154
+ formaData(e.clipboardData.getData('text'));
155
+ e.preventDefault();
156
+ }}
157
+ onSearch={(v) => onSearchChange(v)}
158
+ onSelect={() => {
159
+ if(selectMode) return;
160
+ setTimeout(() => {
161
+ setOpen(false)
162
+ }, 0)
163
+ }}
164
+ style={{ width: 'calc(100%)' }}
165
+ suffixIcon={<div className={`query_select_expand_button`} onClick={showModal}><DashOutlined /></div>}
166
+ placeholder="请选择"
167
+ maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:currentSelectProps, onChange:outerChange, value:getValue(value, selectMode), setIsMaxTagsOpen:()=>{} })}
168
+ notFoundContent={
169
+ fetching ? (
170
+ <Spin size="small" className='searchSelectSpin' />
171
+ ) : (
172
+ <div style={{ textAlign: 'center' }}>
173
+ <div>{searchValue?'无匹配结果,请更换其他内容再试':`请录入内容模糊查询`}</div>
174
+ </div>
175
+ )
176
+ }
177
+ getPopupContainer={(triggerNode) => triggerNode.parentElement}
178
+ {...currentSelectProps}
179
+ >
180
+ {source.map((item: any) => (
181
+ <Select.Option key={item.value} label={item.text}>
182
+ {LightHeightOption({
183
+ text: handleSelectOptionsShowValue(specialBracket, noNeedSplit, item),
184
+ filterTxt: searchValue,
185
+ needToolTips: false
186
+ })}
187
+ </Select.Option>
188
+ ))}
189
+ </Select>
190
+ </div>
191
+ <Modal
192
+ width={600}
193
+ title="多值录入"
194
+ visible={isModalVisible}
195
+ onOk={handleOk}
196
+ onCancel={handleCancel}
197
+ className='multiInput_modal'
198
+ bodyStyle={{
199
+ padding: '10px 16px'
200
+ }}
201
+ footer={[
202
+ <ConfigProvider autoInsertSpaceInButton = { false }>
203
+ <Button key="back" onClick={handleCancel}>
204
+ 取消
205
+ </Button>
206
+ </ConfigProvider>,
207
+ <ConfigProvider autoInsertSpaceInButton = { false }>
208
+ <Button key="submit" type="primary" onClick={handleOk}>
209
+ 录入
210
+ </Button>
211
+ </ConfigProvider>,
212
+ ]}
213
+ >
214
+ <div className={'query_select_wrapper'}>
215
+ <div className={'query_select_wrapper_top'}>如需同时使用多个值进行查询,请使用逗号,分号、空格或换行进行值的分割,中英文格式的符号均支持</div>
216
+ <div className={'query_select_textArea'}>
217
+ <Input.TextArea
218
+ placeholder='在此录入...'
219
+ value={popvalue}
220
+ onChange={onChange}
221
+ rows={12}
222
+ showCount={false}
223
+ />
224
+ </div>
225
+ </div>
226
+ </Modal>
227
+ </div>
228
+ );
229
+ };
230
+
231
+ function ToCDB(selectStr: any) {
232
+ var tmp = '';
233
+ if(!selectStr?.length) return '';
234
+ const str = Array.isArray(selectStr) ? selectStr.join(',') : selectStr;
235
+ for (var i = 0; i < str?.length; i++) {
236
+ if (str?.charCodeAt?.(i) > 65248 && str?.charCodeAt?.(i) < 65375) {
237
+ tmp += String.fromCharCode(str?.charCodeAt(i) - 65248);
238
+ } else {
239
+ tmp += String.fromCharCode(str.charCodeAt(i));
240
+ }
241
+ }
242
+ return tmp;
243
+ }
244
+
245
+ export default QueryMutipleSearchSelect;
@@ -2,9 +2,27 @@
2
2
  @primary-color: #005cff;
3
3
 
4
4
  .search_select {
5
+ // 选择器 隐藏滚动条 横向滑动
6
+ .ant-select-selector{
7
+ height: 24px;
8
+ overflow: hidden;
9
+ .ant-select-selection-overflow{
10
+ height: 40px;
11
+ flex-wrap: nowrap;
12
+ overflow-x: auto;
13
+ }
14
+ .ant-select-selection-overflow-item {
15
+ align-self: auto;
16
+ }
17
+ }
5
18
  &_show {
6
19
  display: flex;
7
20
 
21
+ .ant-select-dropdown {
22
+ top: 24px !important;
23
+ width: calc(141%) !important;
24
+ }
25
+
8
26
  // 下拉框清除图标位置调整
9
27
  .ant-select-clear {
10
28
  right: 33px;
@@ -16,6 +34,13 @@
16
34
  }
17
35
  }
18
36
 
37
+ &_show.search_select_show_list {
38
+ .ant-select-dropdown {
39
+ top: 24px !important;
40
+ width: calc(100% + 110px) !important;
41
+ }
42
+ }
43
+
19
44
  &_expand_button {
20
45
  position: relative;
21
46
  right: -11px;
@@ -134,7 +159,6 @@
134
159
  background-color: #fff;
135
160
  .ant-form {
136
161
  padding: 0;
137
- overflow: hidden;
138
162
  display: flex;
139
163
  align-items: flex-start;
140
164
 
@@ -288,3 +312,11 @@
288
312
  height: 300px !important;
289
313
  }
290
314
  }
315
+
316
+ .searchSelectMaxTagToolTip {
317
+ .ant-tooltip-inner {
318
+ max-height: 72px;
319
+ overflow-x: auto;
320
+ padding: 0px;
321
+ }
322
+ }