@bit-sun/business-component 4.0.12-alpha.9 → 4.0.13-alpha.11

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 (35) 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 +18 -1
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.esm.js +1635 -635
  10. package/dist/index.js +1632 -630
  11. package/package.json +4 -3
  12. package/src/components/Business/BsSulaQueryTable/setting.tsx +3 -3
  13. package/src/components/Business/BsSulaQueryTable/utils.tsx +6 -4
  14. package/src/components/Business/PropertyModal/index.less +58 -0
  15. package/src/components/Business/PropertyModal/index.md +33 -0
  16. package/src/components/Business/PropertyModal/index.tsx +271 -0
  17. package/src/components/Business/PropertyModal/mockData.ts +160 -0
  18. package/src/components/Business/PropertyModal/propertyGroup.tsx +205 -0
  19. package/src/components/Business/SearchSelect/BusinessUtils.tsx +60 -3
  20. package/src/components/Business/SearchSelect/index.md +4 -5
  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/DataValidation/index.tsx +1 -0
  27. package/src/components/Functional/QueryMutipleSelect/index.less +117 -0
  28. package/src/components/Functional/QueryMutipleSelect/index.md +40 -0
  29. package/src/components/Functional/QueryMutipleSelect/index.tsx +242 -0
  30. package/src/components/Functional/SearchSelect/index.less +45 -7
  31. package/src/components/Functional/SearchSelect/index.tsx +85 -303
  32. package/src/components/Functional/SearchSelect/utils.tsx +439 -0
  33. package/src/components/Solution/RuleComponent/ruleFiled.js +93 -93
  34. package/src/index.ts +2 -0
  35. 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,40 @@
1
+ ---
2
+ nav:
3
+ title: '组件'
4
+ order: 1
5
+ group:
6
+ title: 功能组件
7
+ order: 0
8
+ title: 批量搜索查询组件
9
+ order: 2
10
+ ---
11
+
12
+ ## QueryMutipleSearchSelect
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-itemCode,name-orGroup,like',
24
+ mappingTextField: 'name',
25
+ mappingValueField: 'itemCode',
26
+ sourceName: 'qp-itemCode-in'
27
+ }
28
+ const handleOnChange = (value) => {
29
+ console.log(value);
30
+ };
31
+
32
+ return (
33
+ <div>
34
+ <QueryMutipleSearchSelect onValueChange={handleOnChange} requestConfig={requestConfig} />
35
+ </div>
36
+ );
37
+ };
38
+ ```
39
+
40
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -0,0 +1,242 @@
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
+ setPopValue(value);
51
+ onValueChange(value);
52
+ }, [value]);
53
+
54
+ useEffect(() => {
55
+ setUniqueValue(makeUniqueValue());
56
+ }, [resultSourceKey])
57
+
58
+ const showModal = () => {
59
+ setIsModalVisible(true);
60
+ //弹窗打开时 默认搜索内容换行显示
61
+ setPopValue((data: any) => data?.replace(/,/g, '\n'));
62
+ };
63
+
64
+ const handleOk = () => {
65
+ formaData(popvalue);
66
+ setIsModalVisible(false);
67
+ };
68
+
69
+ const formaData = (v: any) => {
70
+ let formatValue: any = ToCDB(v)
71
+ ?.split(/[/\n/\s,;]/)
72
+ ?.filter((item) => item)
73
+ ?.join(',');
74
+ setValue(formatValue);
75
+ };
76
+
77
+ const handleCancel = () => {
78
+ setIsModalVisible(false);
79
+ };
80
+
81
+ const outerChange = (v: any) => {
82
+ formaData(v)
83
+ };
84
+
85
+ const onChange = (e: any) => {
86
+ const v = e.target.value;
87
+ setPopValue(v);
88
+ };
89
+
90
+ // 获取下拉框数据源-不分页
91
+ const getData = (params: any = {}, callback?: any) => {
92
+ if (!requestConfig) return;
93
+ if (!url) return;
94
+
95
+ setFetching(true)
96
+
97
+ const queryParams = {
98
+ ...otherParams, // 默认参数
99
+ ...params,
100
+ };
101
+ if (isNil(queryParams[selectParamsKey])) {
102
+ queryParams[selectParamsKey] = searchValue;
103
+ }
104
+
105
+ let getRequest;
106
+ const methodName = method?.toLocaleLowerCase();
107
+ if(['post','patch','put'].includes(methodName)) {
108
+ getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
109
+ } else {
110
+ getRequest = request.get( `${url}${convertUrlQueryParams(queryParams)}`,{headers: { ...extralHeaders }})
111
+ }
112
+
113
+ if (!getRequest) return;
114
+
115
+ getRequest.then((result: any) => {
116
+ setFetching(false)
117
+ result = result.data;
118
+ if (judgeIsRequestError(result)) {
119
+ message.error(result.msg);
120
+ return;
121
+ }
122
+ const res = result.data;
123
+ const dSource: any = convertResData(requestConfig, res, { selectMode, labelInValue: currentSelectProps?.labelInValue, value, type: 1, items: source, needTopSelectedSource: false });
124
+
125
+ if(callback) {
126
+ callback(source)
127
+ } else {
128
+ setSource(dSource)
129
+ }
130
+ })
131
+ .catch((err: any) => { setFetching(false) });
132
+ }
133
+ const onSearchChange = (v: any) => {
134
+ setSearchValue(v);
135
+ run();
136
+ }
137
+
138
+ return (
139
+ <div className={'query_select'}>
140
+ <div className="query_select_show" id={`query_multiple_select_div_${uniqueValue}`}>
141
+ <Select
142
+ value={getValue(value, selectMode)}
143
+ onChange={outerChange}
144
+ open={open}
145
+ onBlur={(v: any) => {
146
+ onSearchChange(v)
147
+ setOpen(false);
148
+ }}
149
+ onClick={() => setOpen(true)}
150
+ onPaste={(e: any) => {
151
+ formaData(e.clipboardData.getData('text'));
152
+ e.preventDefault();
153
+ }}
154
+ onSearch={(v) => onSearchChange(v)}
155
+ onSelect={() => {
156
+ if(selectMode) return;
157
+ setTimeout(() => {
158
+ setOpen(false)
159
+ }, 0)
160
+ }}
161
+ style={{ width: 'calc(100%)' }}
162
+ suffixIcon={<div className={`query_select_expand_button`} onClick={showModal}><DashOutlined /></div>}
163
+ placeholder="请选择"
164
+ maxTagPlaceholder={(v)=> maxTagPlaceholder(v,{ selectProps:currentSelectProps, onChange:outerChange, value:getValue(value, selectMode), setIsMaxTagsOpen:()=>{} })}
165
+ notFoundContent={
166
+ fetching ? (
167
+ <Spin size="small" className='searchSelectSpin' />
168
+ ) : (
169
+ <div style={{ textAlign: 'center' }}>
170
+ <div>{searchValue?'无匹配结果,请更换其他内容再试': (selectProps?.notFoundText||`请录入编码/名称模糊查询`)}</div>
171
+ </div>
172
+ )
173
+ }
174
+ getPopupContainer={(triggerNode) => triggerNode.parentElement}
175
+ {...currentSelectProps}
176
+ >
177
+ {source.map((item: any) => (
178
+ <Select.Option key={item.value} label={item.text}>
179
+ {LightHeightOption({
180
+ text: handleSelectOptionsShowValue(specialBracket, noNeedSplit, item),
181
+ filterTxt: searchValue,
182
+ needToolTips: false
183
+ })}
184
+ </Select.Option>
185
+ ))}
186
+ </Select>
187
+ </div>
188
+ <Modal
189
+ width={600}
190
+ title="多值录入"
191
+ visible={isModalVisible}
192
+ onOk={handleOk}
193
+ onCancel={handleCancel}
194
+ className='multiInput_modal'
195
+ bodyStyle={{
196
+ padding: '10px 16px'
197
+ }}
198
+ footer={[
199
+ <ConfigProvider autoInsertSpaceInButton = { false }>
200
+ <Button key="back" onClick={handleCancel}>
201
+ 取消
202
+ </Button>
203
+ </ConfigProvider>,
204
+ <ConfigProvider autoInsertSpaceInButton = { false }>
205
+ <Button key="submit" type="primary" onClick={handleOk}>
206
+ 录入
207
+ </Button>
208
+ </ConfigProvider>,
209
+ ]}
210
+ >
211
+ <div className={'query_select_wrapper'}>
212
+ <div className={'query_select_wrapper_top'}>如需同时使用多个值进行查询,请使用逗号,分号、空格或换行进行值的分割,中英文格式的符号均支持</div>
213
+ <div className={'query_select_textArea'}>
214
+ <Input.TextArea
215
+ placeholder='在此录入...'
216
+ value={popvalue}
217
+ onChange={onChange}
218
+ rows={12}
219
+ showCount={false}
220
+ />
221
+ </div>
222
+ </div>
223
+ </Modal>
224
+ </div>
225
+ );
226
+ };
227
+
228
+ function ToCDB(selectStr: any) {
229
+ var tmp = '';
230
+ if(!selectStr?.length) return '';
231
+ const str = Array.isArray(selectStr) ? selectStr.join(',') : selectStr;
232
+ for (var i = 0; i < str?.length; i++) {
233
+ if (str?.charCodeAt?.(i) > 65248 && str?.charCodeAt?.(i) < 65375) {
234
+ tmp += String.fromCharCode(str?.charCodeAt(i) - 65248);
235
+ } else {
236
+ tmp += String.fromCharCode(str.charCodeAt(i));
237
+ }
238
+ }
239
+ return tmp;
240
+ }
241
+
242
+ 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;
@@ -48,11 +73,6 @@
48
73
  &_dropdown_table {
49
74
  // padding: 4px 10px 6px;
50
75
 
51
- // 下拉table 复选框为单选时候隐藏
52
- .ant-table-cell .ant-table-selection-column .ant-radio,table tr td.ant-table-selection-column .ant-radio-wrapper {
53
- display: none;
54
- }
55
-
56
76
  // 下拉table 表头表体样式
57
77
  .ant-table.ant-table-bordered > .ant-table-container > .ant-table-header > table {
58
78
  font-family: MiSans-Regular;
@@ -78,7 +98,18 @@
78
98
  .ant-table.ant-table-bordered > .ant-table-container {
79
99
  .ant-table-body > table > tbody > tr > td.ant-table-selection-column,
80
100
  .ant-table-header > table > thead > tr > th.ant-table-selection-column {
81
- display: none;
101
+ visibility: hidden; // 不使用 display: none; 是因为此设置不占位,会导致表格scroll.x: 'max-content' 计算不准确
102
+ padding: 0;
103
+ margin: 0;
104
+ width: 0;
105
+ height: 0;
106
+ min-width: 0;
107
+ min-height: 0;
108
+ border: none;
109
+
110
+ .ant-radio-wrapper {
111
+ display: none;
112
+ }
82
113
  }
83
114
  }
84
115
  }
@@ -134,7 +165,6 @@
134
165
  background-color: #fff;
135
166
  .ant-form {
136
167
  padding: 0;
137
- overflow: hidden;
138
168
  display: flex;
139
169
  align-items: flex-start;
140
170
 
@@ -288,3 +318,11 @@
288
318
  height: 300px !important;
289
319
  }
290
320
  }
321
+
322
+ .searchSelectMaxTagToolTip {
323
+ .ant-tooltip-inner {
324
+ max-height: 72px;
325
+ overflow-x: auto;
326
+ padding: 0px;
327
+ }
328
+ }