@lemon-fe/kits 1.0.0-131 → 1.0.0-132
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.
|
@@ -121,7 +121,9 @@ function Filter(props) {
|
|
|
121
121
|
simple = props.simple,
|
|
122
122
|
_props$defaultCollaps = props.defaultCollapsed,
|
|
123
123
|
defaultCollapsed = _props$defaultCollaps === void 0 ? true : _props$defaultCollaps,
|
|
124
|
-
autoPlaceholder = props.autoPlaceholder
|
|
124
|
+
autoPlaceholder = props.autoPlaceholder,
|
|
125
|
+
_props$preserveFields = props.preserveFields,
|
|
126
|
+
preserveFields = _props$preserveFields === void 0 ? true : _props$preserveFields;
|
|
125
127
|
var prefix = prefixClassName('filter');
|
|
126
128
|
var emptyValue = useMemo(function () {
|
|
127
129
|
return Object.fromEntries(data.map(function (item) {
|
|
@@ -336,7 +338,7 @@ function Filter(props) {
|
|
|
336
338
|
|
|
337
339
|
var handleFinish = function handleFinish(val, type) {
|
|
338
340
|
if (onChange) {
|
|
339
|
-
onChange(_objectSpread(_objectSpread({}, value), val), type);
|
|
341
|
+
onChange(preserveFields ? _objectSpread(_objectSpread({}, value), val) : val, type);
|
|
340
342
|
}
|
|
341
343
|
};
|
|
342
344
|
|
|
@@ -372,6 +374,14 @@ function Filter(props) {
|
|
|
372
374
|
});
|
|
373
375
|
};
|
|
374
376
|
|
|
377
|
+
var isFieldHidden = function isFieldHidden(field) {
|
|
378
|
+
if (field.hidden || activeKeys !== null && !activeKeys.has(field.key)) {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return false;
|
|
383
|
+
};
|
|
384
|
+
|
|
375
385
|
var items = useMemo(function () {
|
|
376
386
|
if (keywords) {
|
|
377
387
|
return data.filter(function (item) {
|
|
@@ -390,11 +400,7 @@ function Filter(props) {
|
|
|
390
400
|
};
|
|
391
401
|
|
|
392
402
|
var result = data.filter(function (item) {
|
|
393
|
-
|
|
394
|
-
return true;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
return false;
|
|
403
|
+
return !isFieldHidden(item);
|
|
398
404
|
});
|
|
399
405
|
|
|
400
406
|
if (!width) {
|
|
@@ -527,6 +533,10 @@ function Filter(props) {
|
|
|
527
533
|
overflowY: 'hidden'
|
|
528
534
|
} : undefined
|
|
529
535
|
}, data.map(function (item) {
|
|
536
|
+
if (!preserveFields && isFieldHidden(item)) {
|
|
537
|
+
return null;
|
|
538
|
+
}
|
|
539
|
+
|
|
530
540
|
var className = classNames(prefix('form-item'), {
|
|
531
541
|
hidden: !cols.has(item.key) ? true : false
|
|
532
542
|
});
|
|
@@ -50,6 +50,11 @@ export interface FilterProps<T extends Record<string, any> = Record<string, any>
|
|
|
50
50
|
* 根据item.type以及item.label生成,自动注入到extraProps属性里,带有select则是请选择否则就是请输入
|
|
51
51
|
*/
|
|
52
52
|
autoPlaceholder?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* @description 当字段隐藏时,保留字段值并在查询返回
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
preserveFields?: boolean;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
export interface ComponentOption {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@color-success: #2ca471;
|
|
2
2
|
@color-warning: #e37319;
|
|
3
3
|
@color-error: #d54a42;
|
|
4
|
-
@color-disabled:
|
|
4
|
+
@color-disabled: rgba(51, 51, 51, 0.5);
|
|
5
5
|
|
|
6
6
|
.@{prefixCls}-state {
|
|
7
7
|
display: inline-flex;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
color: @color;
|
|
55
55
|
|
|
56
56
|
&::before {
|
|
57
|
-
background-color: fade(@color,
|
|
57
|
+
background-color: fade(@color, 5);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|