@lingxiteam/ebe-utils 0.2.3 → 0.2.4
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/lib/h5public/src/components/factory/src/DynamicTable/components/TypeCells.tsx +5 -2
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +15 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +5 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +30 -26
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +5 -1
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +4 -0
- package/lib/public/src/utils/cmd.ts +8 -0
- package/package.json +2 -2
|
@@ -79,6 +79,8 @@ const TypeCells: React.FC<CellProps> = (props) => {
|
|
|
79
79
|
const { code, operator, value } = data;
|
|
80
80
|
|
|
81
81
|
const toStringVal = (val: any) => `${val}`;
|
|
82
|
+
const toNumberVal = (val: any) =>
|
|
83
|
+
!isNaN(Number(val)) ? Number(val) : toStringVal(val);
|
|
82
84
|
|
|
83
85
|
switch (operator) {
|
|
84
86
|
case OPERATOR_EQUAL:
|
|
@@ -86,9 +88,10 @@ const TypeCells: React.FC<CellProps> = (props) => {
|
|
|
86
88
|
case OPERATOR_NOT_EQUAL:
|
|
87
89
|
return toStringVal(row[code]) !== toStringVal(value);
|
|
88
90
|
case OPERATOR_GREATER_THAN:
|
|
89
|
-
|
|
91
|
+
// 优先转成数字类型比较大小
|
|
92
|
+
return toNumberVal(row[code]) > toNumberVal(value);
|
|
90
93
|
case OPERATOR_LESS_THAN:
|
|
91
|
-
return row[code] < value;
|
|
94
|
+
return toNumberVal(row[code]) < toNumberVal(value);
|
|
92
95
|
case OPERATOR_INCLUDE:
|
|
93
96
|
if (typeof row[code].includes === 'function') {
|
|
94
97
|
return row[code].includes(value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
2
2
|
import { Col, Form as AntdForm, Row } from 'antd';
|
|
3
3
|
import type { FormLayout } from 'antd/lib/form/Form';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
import { isEqual } from 'lodash';
|
|
5
6
|
import React, {
|
|
6
7
|
Children,
|
|
@@ -146,6 +147,16 @@ export const FormChildren = (props: FormChildrenType) => {
|
|
|
146
147
|
return colSpace as number;
|
|
147
148
|
})();
|
|
148
149
|
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (Number(rowSpace) >= 14) {
|
|
152
|
+
// 动态设置 CSS 变量
|
|
153
|
+
document.documentElement.style.setProperty(
|
|
154
|
+
'--explainHelp-Line-height',
|
|
155
|
+
`${Number(rowSpace)}px`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}, []);
|
|
159
|
+
|
|
149
160
|
/**
|
|
150
161
|
* 布局子组件
|
|
151
162
|
*/
|
|
@@ -235,7 +246,10 @@ export const FormChildren = (props: FormChildrenType) => {
|
|
|
235
246
|
return (
|
|
236
247
|
<Row
|
|
237
248
|
ref={formRef}
|
|
238
|
-
className={
|
|
249
|
+
className={classNames({
|
|
250
|
+
'form-tips': Number(rowSpace) < 14,
|
|
251
|
+
'explainHelp-line-height': Number(rowSpace) >= 14,
|
|
252
|
+
})}
|
|
239
253
|
gutter={[compatColSpace, rowSpace as number]}
|
|
240
254
|
>
|
|
241
255
|
{layoutChildren()}
|
|
@@ -26,6 +26,8 @@ const validateCondition = (data: any, row: any) => {
|
|
|
26
26
|
const { code, operator, value } = data;
|
|
27
27
|
|
|
28
28
|
const toStringVal = (val: any) => `${val}`;
|
|
29
|
+
const toNumberVal = (val: any) =>
|
|
30
|
+
!isNaN(Number(val)) ? Number(val) : toStringVal(val);
|
|
29
31
|
|
|
30
32
|
switch (operator) {
|
|
31
33
|
case OPERATOR_EQUAL:
|
|
@@ -33,9 +35,10 @@ const validateCondition = (data: any, row: any) => {
|
|
|
33
35
|
case OPERATOR_NOT_EQUAL:
|
|
34
36
|
return toStringVal(row[code]) !== toStringVal(value);
|
|
35
37
|
case OPERATOR_GREATER_THAN:
|
|
36
|
-
|
|
38
|
+
// 优先转成数字类型比较大小
|
|
39
|
+
return toNumberVal(row[code]) > toNumberVal(value);
|
|
37
40
|
case OPERATOR_LESS_THAN:
|
|
38
|
-
return row[code] < value;
|
|
41
|
+
return toNumberVal(row[code]) < toNumberVal(value);
|
|
39
42
|
case OPERATOR_INCLUDE:
|
|
40
43
|
if (typeof row[code].includes === 'function') {
|
|
41
44
|
return row[code].includes(value);
|
|
@@ -11,7 +11,7 @@ const SingleBtn = (props: SingleBtnProps) => {
|
|
|
11
11
|
onBtnClick,
|
|
12
12
|
getLocale,
|
|
13
13
|
actionsMap,
|
|
14
|
-
|
|
14
|
+
hideMorePopover,
|
|
15
15
|
BtnIcon,
|
|
16
16
|
c,
|
|
17
17
|
idx,
|
|
@@ -42,7 +42,7 @@ const SingleBtn = (props: SingleBtnProps) => {
|
|
|
42
42
|
isPopover &&
|
|
43
43
|
!(typeof c === 'string' ? c === 'delete' : c.type === 'delete')
|
|
44
44
|
) {
|
|
45
|
-
|
|
45
|
+
hideMorePopover();
|
|
46
46
|
}
|
|
47
47
|
}}
|
|
48
48
|
onDoubleClick={(e) => {
|
|
@@ -96,7 +96,7 @@ const SingleBtn = (props: SingleBtnProps) => {
|
|
|
96
96
|
onConfirm={(e: any) => {
|
|
97
97
|
onDeleteClick(e);
|
|
98
98
|
if (isPopover) {
|
|
99
|
-
|
|
99
|
+
hideMorePopover();
|
|
100
100
|
}
|
|
101
101
|
}}
|
|
102
102
|
>
|
|
@@ -98,11 +98,37 @@ const OperationCell = (props: OperationCellProps) => {
|
|
|
98
98
|
return BtnIcon;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
// 更多操作按钮气泡卡片
|
|
102
|
+
const onMorePopVisible = (vis: boolean, idx: number) => {
|
|
103
|
+
setMorePopVisible(vis);
|
|
104
|
+
if (fixedAction && tableRef?.current) {
|
|
105
|
+
const fixedActionEle =
|
|
106
|
+
tableRef.current?.querySelectorAll('.ued-table-actions')?.[idx]
|
|
107
|
+
?.parentNode;
|
|
108
|
+
// 操作列固定时 此时fixedActionEle默认antd样式为 position: sticky;z-index: 2
|
|
109
|
+
// 由于气泡卡片挂在fixedActionEle里面导致被后面的列遮盖
|
|
110
|
+
if (fixedActionEle) {
|
|
111
|
+
if (timerRef.current) {
|
|
112
|
+
clearTimeout(timerRef.current);
|
|
113
|
+
}
|
|
114
|
+
if (!vis) {
|
|
115
|
+
// 防止卡片部分被遮盖再隐藏
|
|
116
|
+
timerRef.current = setTimeout(() => {
|
|
117
|
+
fixedActionEle.style.zIndex = 2;
|
|
118
|
+
timerRef.current = null;
|
|
119
|
+
}, 200);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
fixedActionEle.style.zIndex = 3;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
101
127
|
// 操作栏单个内置按钮
|
|
102
128
|
const renderBuiltInSingleBtn = (
|
|
103
129
|
c: any,
|
|
104
130
|
row: any,
|
|
105
|
-
rowIndex: number
|
|
131
|
+
rowIndex: number,
|
|
106
132
|
idx: number,
|
|
107
133
|
defaultBtnList: any,
|
|
108
134
|
isPopover = false,
|
|
@@ -145,7 +171,7 @@ const OperationCell = (props: OperationCellProps) => {
|
|
|
145
171
|
<SingleBtn
|
|
146
172
|
getLocale={getLocale}
|
|
147
173
|
actionsMap={actionsMap}
|
|
148
|
-
|
|
174
|
+
hideMorePopover={() => onMorePopVisible(false, rowIndex)}
|
|
149
175
|
BtnIcon={BtnIcon}
|
|
150
176
|
c={c}
|
|
151
177
|
idx={idx}
|
|
@@ -199,7 +225,7 @@ const OperationCell = (props: OperationCellProps) => {
|
|
|
199
225
|
if (typeof onClick === 'function') {
|
|
200
226
|
onClick(currentRowKey ? row[currentRowKey] : row, row, index);
|
|
201
227
|
}
|
|
202
|
-
|
|
228
|
+
onMorePopVisible(false, index);
|
|
203
229
|
}}
|
|
204
230
|
>
|
|
205
231
|
<div className="ued-table-actions-extendBtn" style={buttonStyle}>
|
|
@@ -310,29 +336,7 @@ const OperationCell = (props: OperationCellProps) => {
|
|
|
310
336
|
triggerNode?.parentNode as HTMLElement
|
|
311
337
|
}
|
|
312
338
|
onOpenChange={(vis: boolean) => {
|
|
313
|
-
|
|
314
|
-
if (fixedAction && tableRef?.current) {
|
|
315
|
-
const fixedActionEle =
|
|
316
|
-
tableRef.current?.querySelectorAll(
|
|
317
|
-
'.ued-table-actions',
|
|
318
|
-
)?.[index]?.parentNode;
|
|
319
|
-
// 操作列固定时 此时fixedActionEle默认antd样式为 position: sticky;z-index: 2
|
|
320
|
-
// 由于气泡卡片挂在fixedActionEle里面导致被后面的列遮盖
|
|
321
|
-
if (fixedActionEle) {
|
|
322
|
-
if (timerRef.current) {
|
|
323
|
-
clearTimeout(timerRef.current);
|
|
324
|
-
}
|
|
325
|
-
if (!vis) {
|
|
326
|
-
// 防止卡片部分被遮盖再隐藏
|
|
327
|
-
timerRef.current = setTimeout(() => {
|
|
328
|
-
fixedActionEle.style.zIndex = 2;
|
|
329
|
-
timerRef.current = null;
|
|
330
|
-
}, 200);
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
fixedActionEle.style.zIndex = 3;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
339
|
+
onMorePopVisible(vis, index);
|
|
336
340
|
}}
|
|
337
341
|
>
|
|
338
342
|
<Button
|
|
@@ -113,6 +113,7 @@ export interface MyTreeProps {
|
|
|
113
113
|
closeExpandedKey?: any;
|
|
114
114
|
showLine?: any;
|
|
115
115
|
getEngineApis: any;
|
|
116
|
+
nodeIconsType?: 'default' | 'forceDropdown';
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
// const prefixCls = 'tree';
|
|
@@ -141,6 +142,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
141
142
|
onClickMenuItem,
|
|
142
143
|
customRenderCode,
|
|
143
144
|
getEngineApis,
|
|
145
|
+
nodeIconsType = 'default',
|
|
144
146
|
...resetProps
|
|
145
147
|
} = props;
|
|
146
148
|
|
|
@@ -187,6 +189,8 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
187
189
|
|
|
188
190
|
// 当前操作字段key
|
|
189
191
|
const [editingKey, setEditingKey] = useState('');
|
|
192
|
+
// 强制菜单模式
|
|
193
|
+
const forceDrowdown = nodeIconsType === 'forceDropdown';
|
|
190
194
|
|
|
191
195
|
useImperativeHandle(ref, () => ({
|
|
192
196
|
get dataSource() {
|
|
@@ -880,7 +884,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
880
884
|
}
|
|
881
885
|
return true;
|
|
882
886
|
});
|
|
883
|
-
if (finalNodeIcons.length <= 3) {
|
|
887
|
+
if (finalNodeIcons.length <= 3 && !forceDrowdown) {
|
|
884
888
|
iconsDom = (
|
|
885
889
|
<div key={c.key} className="ued-tree-icons ued-tree-icons-normal">
|
|
886
890
|
{renderIcons(c, finalNodeIcons)}
|
|
@@ -480,3 +480,11 @@ export const getLocalLocation = ({
|
|
|
480
480
|
}
|
|
481
481
|
});
|
|
482
482
|
};
|
|
483
|
+
|
|
484
|
+
export const isTrue = (value: any) => {
|
|
485
|
+
return value == true || value === 'true';
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
export const isFalse = (value: any) => {
|
|
489
|
+
return value == false || value === 'false';
|
|
490
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/ebe-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@babel/types": "^7.12.12",
|
|
20
20
|
"cac": "^6.7.14",
|
|
21
21
|
"fs-extra": "9.x",
|
|
22
|
-
"@lingxiteam/ebe": "0.2.
|
|
22
|
+
"@lingxiteam/ebe": "0.2.4"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|