@vitrosoftware/common-ui-ts 1.1.174 → 1.1.175
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/css/std/controls/search/search.css +0 -4
- package/dist/index.css +10 -18
- package/dist/index.js +119 -124
- package/dist/index.js.map +1 -1
- package/dist/src/controls/AddFieldButton/AddFieldButton.d.ts +2 -2
- package/dist/src/controls/Criterion/Criterion.d.ts +1 -1
- package/dist/src/controls/CriterionFieldIterator/CriterionFieldIterator.d.ts +1 -1
- package/dist/src/controls/Search/SearchCriterion.d.ts +0 -1
- package/package.json +1 -1
- package/src/controls/BimViewer/js/bim-viewer.js +2 -2
- package/src/controls/DxfViewer/js/dxf-viewer.js +14 -14
- package/src/controls/PdfViewer/js/pdf-viewer.js +1 -1
- package/css/std/controls/add-field-button/list.css +0 -24
package/dist/index.css
CHANGED
|
@@ -6920,31 +6920,27 @@ li:first-child ._command-menu-item_vitro-item_2pVhk23:hover {
|
|
|
6920
6920
|
padding: 8px 12px;
|
|
6921
6921
|
}
|
|
6922
6922
|
|
|
6923
|
-
.
|
|
6924
|
-
background: #fff;
|
|
6923
|
+
._checkbox-list_vitro-checkbox-list_1iZSkkv {
|
|
6925
6924
|
border-radius: 4px;
|
|
6925
|
+
background: #fff;
|
|
6926
6926
|
max-width: 252px;
|
|
6927
6927
|
}
|
|
6928
6928
|
|
|
6929
|
-
.
|
|
6929
|
+
._checkbox-list_vitro-search-value-list_2i58fRK > div:first-child {
|
|
6930
|
+
padding: 12px 12px 8px 12px;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
._checkbox-list_vitro-checkbox-list_1iZSkkv .ps > div:first-child {
|
|
6930
6934
|
padding-left: 12px;
|
|
6931
6935
|
}
|
|
6932
6936
|
|
|
6933
|
-
.
|
|
6937
|
+
._checkbox-list_vitro-checkbox-list_1iZSkkv ._checkbox-list_vitro-checkbox_1EqsnoQ {
|
|
6934
6938
|
margin-bottom: 4px;
|
|
6935
6939
|
}
|
|
6936
6940
|
|
|
6937
|
-
.
|
|
6941
|
+
._checkbox-list_vitro-checkbox_1EqsnoQ:last-child {
|
|
6938
6942
|
padding-bottom: 8px;
|
|
6939
|
-
}
|
|
6940
|
-
|
|
6941
|
-
._list_vitro-item_2XsFSic a {
|
|
6942
|
-
cursor: pointer;
|
|
6943
|
-
display: block;
|
|
6944
|
-
line-height: 24px;
|
|
6945
|
-
padding: 0 4px 0 4px;
|
|
6946
|
-
}
|
|
6947
|
-
|
|
6943
|
+
}
|
|
6948
6944
|
._search_vitro-search_QkJksC_ {
|
|
6949
6945
|
position: relative;
|
|
6950
6946
|
align-self: baseline;
|
|
@@ -7000,10 +6996,6 @@ li:first-child ._command-menu-item_vitro-item_2pVhk23:hover {
|
|
|
7000
6996
|
grid-gap: 28px 16px;
|
|
7001
6997
|
}
|
|
7002
6998
|
|
|
7003
|
-
._search_vitro-filter_2n-Y-mS [class^="_criterion_vitro-control"] {
|
|
7004
|
-
max-width: calc(100% - 87px);
|
|
7005
|
-
}
|
|
7006
|
-
|
|
7007
6999
|
._search_vitro-add-field_2hHt1Z2 {
|
|
7008
7000
|
margin: 18px 0 16px 66px;
|
|
7009
7001
|
}
|
package/dist/index.js
CHANGED
|
@@ -63545,7 +63545,7 @@ var Viewer = function Viewer(props) {
|
|
|
63545
63545
|
};
|
|
63546
63546
|
|
|
63547
63547
|
var name = "@vitrosoftware/common-ui-ts";
|
|
63548
|
-
var version$1 = "1.1.
|
|
63548
|
+
var version$1 = "1.1.175";
|
|
63549
63549
|
var description = "vitro software common ui ts";
|
|
63550
63550
|
var author = "";
|
|
63551
63551
|
var license = "MIT";
|
|
@@ -66934,9 +66934,7 @@ var ConditionSelect = React.forwardRef(function (props, ref) {
|
|
|
66934
66934
|
});
|
|
66935
66935
|
|
|
66936
66936
|
var Criterion = function Criterion(props) {
|
|
66937
|
-
var _useState = React.useState(props.operatorList ? props.
|
|
66938
|
-
return x.type === props.defaultOperator;
|
|
66939
|
-
}) || props.operatorList[0] : props.operatorList[0] : null),
|
|
66937
|
+
var _useState = React.useState(props.operatorList ? props.operatorList[0] : null),
|
|
66940
66938
|
operator = _useState[0],
|
|
66941
66939
|
setOperator = _useState[1];
|
|
66942
66940
|
var _useState2 = React.useState(false),
|
|
@@ -66946,6 +66944,11 @@ var Criterion = function Criterion(props) {
|
|
|
66946
66944
|
state = _useState3[0],
|
|
66947
66945
|
setState = _useState3[1];
|
|
66948
66946
|
var componentProps = props.content.props;
|
|
66947
|
+
var defaultOperator = props.operatorList ? (componentProps.value ? props.operatorList.find(function (x) {
|
|
66948
|
+
return x.type === componentProps.value.operator;
|
|
66949
|
+
}) : props.operatorList.find(function (x) {
|
|
66950
|
+
return x.type === props.defaultOperator;
|
|
66951
|
+
})) || props.operatorList[0] : null;
|
|
66949
66952
|
var defaultCondition = (componentProps.value ? props.conditionList.find(function (x) {
|
|
66950
66953
|
return x.type === componentProps.value.condition;
|
|
66951
66954
|
}) : props.conditionList.find(function (x) {
|
|
@@ -66954,7 +66957,7 @@ var Criterion = function Criterion(props) {
|
|
|
66954
66957
|
var value = React.useMemo(function () {
|
|
66955
66958
|
return {
|
|
66956
66959
|
internalName: componentProps.name,
|
|
66957
|
-
operator:
|
|
66960
|
+
operator: defaultOperator ? defaultOperator.type : 0,
|
|
66958
66961
|
valueList: componentProps.value ? componentProps.value.valueList : [],
|
|
66959
66962
|
condition: defaultCondition.type
|
|
66960
66963
|
};
|
|
@@ -66964,6 +66967,7 @@ var Criterion = function Criterion(props) {
|
|
|
66964
66967
|
var conditionSelectRef = React.useRef(null);
|
|
66965
66968
|
React.useEffect(function () {
|
|
66966
66969
|
window.addEventListener(exports.EVENT.CLICK, onBlurSelect);
|
|
66970
|
+
setOperator(defaultOperator);
|
|
66967
66971
|
return function () {
|
|
66968
66972
|
window.removeEventListener(exports.EVENT.CLICK, onBlurSelect);
|
|
66969
66973
|
};
|
|
@@ -66973,18 +66977,6 @@ var Criterion = function Criterion(props) {
|
|
|
66973
66977
|
conditionSelectRef.current.style.left = labelRef.current.offsetWidth + 8 + UNIT.PX;
|
|
66974
66978
|
}
|
|
66975
66979
|
}, [labelRef]);
|
|
66976
|
-
React.useEffect(function () {
|
|
66977
|
-
if (props.content.props && props.content.props.value && props.operatorList) {
|
|
66978
|
-
var _operator = props.operatorList.find(function (x) {
|
|
66979
|
-
return x.type === componentProps.value.operator;
|
|
66980
|
-
});
|
|
66981
|
-
if (_operator) {
|
|
66982
|
-
setOperator(_operator);
|
|
66983
|
-
value.operator = _operator.type;
|
|
66984
|
-
}
|
|
66985
|
-
value.valueList = componentProps.value ? componentProps.value.valueList : [];
|
|
66986
|
-
}
|
|
66987
|
-
}, [props.content]);
|
|
66988
66980
|
var onOperatorClick = function onOperatorClick(operator) {
|
|
66989
66981
|
setOperator(operator);
|
|
66990
66982
|
value.operator = operator.type;
|
|
@@ -67067,7 +67059,7 @@ var Criterion = function Criterion(props) {
|
|
|
67067
67059
|
isRequired: false
|
|
67068
67060
|
}))), React__default.createElement(ImageButton, {
|
|
67069
67061
|
onClick: function onClick() {
|
|
67070
|
-
return props.onDelete(componentProps.
|
|
67062
|
+
return props.onDelete(componentProps.id);
|
|
67071
67063
|
},
|
|
67072
67064
|
className: styles$1d['vitro-button-cancel']
|
|
67073
67065
|
}));
|
|
@@ -67198,7 +67190,7 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67198
67190
|
value = _Object$entries$_i[1];
|
|
67199
67191
|
setControlList(function (prevState) {
|
|
67200
67192
|
return prevState.map(function (control) {
|
|
67201
|
-
return control.
|
|
67193
|
+
return control.name === key && control.value !== value ? _extends({}, control, {
|
|
67202
67194
|
value: value
|
|
67203
67195
|
}) : control;
|
|
67204
67196
|
});
|
|
@@ -67225,13 +67217,11 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67225
67217
|
};
|
|
67226
67218
|
var createBaseControl = function createBaseControl(field) {
|
|
67227
67219
|
var _field$fieldValueMap;
|
|
67228
|
-
var controlKey = field.key ? field.key : field.internalName;
|
|
67229
67220
|
var control = {
|
|
67230
67221
|
id: field.id,
|
|
67231
67222
|
label: field.name,
|
|
67232
67223
|
name: field.internalName,
|
|
67233
|
-
key:
|
|
67234
|
-
controlKey: controlKey,
|
|
67224
|
+
key: field.internalName,
|
|
67235
67225
|
code: field.component ? field.component : field.fieldType.reactComponent,
|
|
67236
67226
|
isRequired: field.isRequired,
|
|
67237
67227
|
isReadOnly: props.isReadOnly || field.isReadOnly,
|
|
@@ -67240,8 +67230,8 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67240
67230
|
errorMessage: null,
|
|
67241
67231
|
isAutoComplete: false,
|
|
67242
67232
|
multiline: (_field$fieldValueMap = field.fieldValueMap) === null || _field$fieldValueMap === void 0 ? void 0 : _field$fieldValueMap.multiline,
|
|
67243
|
-
onChange: function onChange(value) {
|
|
67244
|
-
return onChangeControl(value,
|
|
67233
|
+
onChange: function onChange(value, name) {
|
|
67234
|
+
return onChangeControl(value, name);
|
|
67245
67235
|
},
|
|
67246
67236
|
isRow: isControlRow(field.internalName),
|
|
67247
67237
|
field: field,
|
|
@@ -67250,16 +67240,16 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67250
67240
|
};
|
|
67251
67241
|
return control;
|
|
67252
67242
|
};
|
|
67253
|
-
var onChangeControl = function onChangeControl(value,
|
|
67243
|
+
var onChangeControl = function onChangeControl(value, fieldName) {
|
|
67254
67244
|
setControlList(function (prevState) {
|
|
67255
|
-
return setControlValue(prevState, value,
|
|
67245
|
+
return setControlValue(prevState, value, fieldName);
|
|
67256
67246
|
});
|
|
67257
|
-
changedFieldValueMap.set(
|
|
67247
|
+
changedFieldValueMap.set(fieldName, value);
|
|
67258
67248
|
props.onChange(changedFieldValueMap, saveStatus);
|
|
67259
67249
|
};
|
|
67260
|
-
var setControlValue = function setControlValue(controlList, val,
|
|
67250
|
+
var setControlValue = function setControlValue(controlList, val, fieldName) {
|
|
67261
67251
|
return controlList.map(function (field) {
|
|
67262
|
-
if (field.
|
|
67252
|
+
if (field.name === fieldName) {
|
|
67263
67253
|
return _extends({}, field, {
|
|
67264
67254
|
value: val
|
|
67265
67255
|
});
|
|
@@ -67504,7 +67494,7 @@ var CriterionFieldIterator = function CriterionFieldIterator(props) {
|
|
|
67504
67494
|
if (props.valueList) {
|
|
67505
67495
|
var valueMap = new Map();
|
|
67506
67496
|
props.valueList.map(function (x) {
|
|
67507
|
-
valueMap.set(x.
|
|
67497
|
+
valueMap.set(x.internalName, x);
|
|
67508
67498
|
});
|
|
67509
67499
|
setFieldValueMap(Object.fromEntries(valueMap));
|
|
67510
67500
|
setChangedFieldValueMap(valueMap);
|
|
@@ -67646,7 +67636,7 @@ var SearchInput = function SearchInput(props) {
|
|
|
67646
67636
|
var _loop = function _loop() {
|
|
67647
67637
|
var value = _step.value;
|
|
67648
67638
|
newList = newList.filter(function (x) {
|
|
67649
|
-
return x.
|
|
67639
|
+
return x.internalName !== value.internalName;
|
|
67650
67640
|
});
|
|
67651
67641
|
};
|
|
67652
67642
|
for (var _iterator = _createForOfIteratorHelperLoose(valueList), _step; !(_step = _iterator()).done;) {
|
|
@@ -67758,32 +67748,53 @@ var SearchValueList = function SearchValueList(props) {
|
|
|
67758
67748
|
}, props.emptyPlaceHolder || localeService.create(LOCALE$a.EMPTY_PLACEHOLDER))));
|
|
67759
67749
|
};
|
|
67760
67750
|
|
|
67761
|
-
var styles$1l = {"vitro-list":"
|
|
67751
|
+
var styles$1l = {"vitro-checkbox-list":"_checkbox-list_vitro-checkbox-list_1iZSkkv","vitro-search-value-list":"_checkbox-list_vitro-search-value-list_2i58fRK","vitro-checkbox":"_checkbox-list_vitro-checkbox_1EqsnoQ"};
|
|
67762
67752
|
|
|
67763
|
-
var
|
|
67764
|
-
var
|
|
67765
|
-
|
|
67766
|
-
|
|
67753
|
+
var CheckboxList = React.forwardRef(function (props, ref) {
|
|
67754
|
+
var _useState = React.useState(props.itemList),
|
|
67755
|
+
itemList = _useState[0],
|
|
67756
|
+
setItemList = _useState[1];
|
|
67757
|
+
var _onChange = function onChange(value, id) {
|
|
67758
|
+
setItemList(function (prevState) {
|
|
67759
|
+
return prevState.map(function (item) {
|
|
67760
|
+
if (item.id === id) {
|
|
67761
|
+
item.value = value;
|
|
67762
|
+
}
|
|
67763
|
+
return item;
|
|
67764
|
+
});
|
|
67765
|
+
});
|
|
67766
|
+
if (props.onChange) {
|
|
67767
|
+
props.onChange(getSelectedItemList());
|
|
67767
67768
|
}
|
|
67768
67769
|
};
|
|
67769
|
-
var
|
|
67770
|
-
|
|
67771
|
-
|
|
67772
|
-
}
|
|
67773
|
-
|
|
67774
|
-
|
|
67775
|
-
|
|
67776
|
-
|
|
67770
|
+
var getSelectedItemList = function getSelectedItemList() {
|
|
67771
|
+
var selectedList = itemList.filter(function (item) {
|
|
67772
|
+
return item.value;
|
|
67773
|
+
});
|
|
67774
|
+
return selectedList.map(function (item) {
|
|
67775
|
+
return item.id;
|
|
67776
|
+
});
|
|
67777
|
+
};
|
|
67778
|
+
var getCheckbox = function getCheckbox(item) {
|
|
67779
|
+
return React__default.createElement(Checkbox, {
|
|
67780
|
+
label: item.name,
|
|
67781
|
+
name: item.name,
|
|
67782
|
+
value: props.isAllSelected ? true : item.value,
|
|
67783
|
+
onChange: function onChange(value, name) {
|
|
67784
|
+
return _onChange(value, item.id);
|
|
67785
|
+
},
|
|
67786
|
+
className: styles$1l['vitro-checkbox']
|
|
67787
|
+
});
|
|
67777
67788
|
};
|
|
67778
67789
|
var filterValueTemplate = function filterValueTemplate(item) {
|
|
67779
67790
|
return item.name;
|
|
67780
67791
|
};
|
|
67781
67792
|
return React__default.createElement("div", {
|
|
67782
|
-
className: styles$1l['vitro-list'],
|
|
67793
|
+
className: styles$1l['vitro-checkbox-list'],
|
|
67783
67794
|
ref: ref
|
|
67784
67795
|
}, React__default.createElement(SearchValueList, {
|
|
67785
67796
|
itemList: props.itemList,
|
|
67786
|
-
valueTemplate:
|
|
67797
|
+
valueTemplate: getCheckbox,
|
|
67787
67798
|
filterValueTemplate: filterValueTemplate,
|
|
67788
67799
|
className: styles$1l['vitro-search-value-list']
|
|
67789
67800
|
}));
|
|
@@ -67816,9 +67827,6 @@ var AddFieldButton = React.forwardRef(function (props, ref) {
|
|
|
67816
67827
|
}
|
|
67817
67828
|
}
|
|
67818
67829
|
};
|
|
67819
|
-
var onFieldListChange = function onFieldListChange(id) {
|
|
67820
|
-
props.onFieldListChange(id);
|
|
67821
|
-
};
|
|
67822
67830
|
return React__default.createElement("div", {
|
|
67823
67831
|
className: styles$1m['vitro-add-field']
|
|
67824
67832
|
}, React__default.createElement(Button$2, {
|
|
@@ -67836,10 +67844,11 @@ var AddFieldButton = React.forwardRef(function (props, ref) {
|
|
|
67836
67844
|
container: (_props$filterContaine = props.filterContainerRef) !== null && _props$filterContaine !== void 0 && _props$filterContaine.current ? props.filterContainerRef.current : undefined,
|
|
67837
67845
|
placement: props.isMobileView ? exports.PLACEMENT.BOTTOM + CTRL.DASH + exports.PLACEMENT.START : exports.PLACEMENT.RIGHT + CTRL.DASH + exports.PLACEMENT.START,
|
|
67838
67846
|
className: styles$1m['vitro-add-field-dialog']
|
|
67839
|
-
}, React__default.createElement(
|
|
67847
|
+
}, React__default.createElement(CheckboxList, {
|
|
67840
67848
|
ref: addFieldListRef,
|
|
67841
|
-
itemList: props.
|
|
67842
|
-
|
|
67849
|
+
itemList: props.checkboxFieldList,
|
|
67850
|
+
onChange: props.onFieldListChange,
|
|
67851
|
+
isAllSelected: props.isAllFieldsVisible
|
|
67843
67852
|
})));
|
|
67844
67853
|
});
|
|
67845
67854
|
|
|
@@ -67879,18 +67888,12 @@ var Search = function Search(props) {
|
|
|
67879
67888
|
};
|
|
67880
67889
|
}, []);
|
|
67881
67890
|
React.useEffect(function () {
|
|
67891
|
+
var checkboxList = props.fieldList;
|
|
67882
67892
|
if (props.visibleFieldList) {
|
|
67883
|
-
|
|
67884
|
-
props.visibleFieldList
|
|
67885
|
-
var field = _extends({}, visibleField);
|
|
67886
|
-
if (!visibleField.key) {
|
|
67887
|
-
field.key = getUUID();
|
|
67888
|
-
}
|
|
67889
|
-
visibleFieldList.push(field);
|
|
67890
|
-
});
|
|
67891
|
-
setFilterFieldList(visibleFieldList);
|
|
67893
|
+
setFilterFieldList(props.visibleFieldList);
|
|
67894
|
+
checkboxList = getCheckboxFieldList(props.visibleFieldList);
|
|
67892
67895
|
}
|
|
67893
|
-
setCheckboxFieldList(
|
|
67896
|
+
setCheckboxFieldList(checkboxList);
|
|
67894
67897
|
}, [props.visibleFieldList]);
|
|
67895
67898
|
React.useEffect(function () {
|
|
67896
67899
|
if (props.maxFieldCount) {
|
|
@@ -67909,32 +67912,21 @@ var Search = function Search(props) {
|
|
|
67909
67912
|
}, [selectedSearchCriterionList]);
|
|
67910
67913
|
React.useEffect(function () {
|
|
67911
67914
|
if (props.searchCriterionList && props.searchCriterionList.length) {
|
|
67912
|
-
var list = getSelectedCriterionList(
|
|
67915
|
+
var list = getSelectedCriterionList(props.searchCriterionList);
|
|
67913
67916
|
setSelectedSearchCriterionList(list);
|
|
67914
67917
|
var selectedFieldList = getSelectedFieldList(list);
|
|
67915
67918
|
setFilterFieldList(selectedFieldList);
|
|
67916
|
-
setCheckboxFieldList(
|
|
67919
|
+
setCheckboxFieldList(getCheckboxFieldList(selectedFieldList));
|
|
67917
67920
|
} else {
|
|
67918
67921
|
reset();
|
|
67919
67922
|
}
|
|
67920
67923
|
}, [props.searchCriterionList]);
|
|
67921
|
-
var getSeacrhCriterionWithKey = function getSeacrhCriterionWithKey(searchCriterionList) {
|
|
67922
|
-
var criterionList = [];
|
|
67923
|
-
for (var _iterator = _createForOfIteratorHelperLoose(searchCriterionList), _step; !(_step = _iterator()).done;) {
|
|
67924
|
-
var criterionItem = _step.value;
|
|
67925
|
-
var criterion = _extends({}, criterionItem, {
|
|
67926
|
-
key: getUUID()
|
|
67927
|
-
});
|
|
67928
|
-
criterionList.push(criterion);
|
|
67929
|
-
}
|
|
67930
|
-
return criterionList;
|
|
67931
|
-
};
|
|
67932
67924
|
var reset = function reset() {
|
|
67933
67925
|
setSearchCriterionList([]);
|
|
67934
67926
|
setSelectedSearchCriterionList([]);
|
|
67935
67927
|
var selectedFieldList = getSelectedFieldList([]);
|
|
67936
67928
|
setFilterFieldList(selectedFieldList);
|
|
67937
|
-
setCheckboxFieldList(
|
|
67929
|
+
setCheckboxFieldList(selectedFieldList);
|
|
67938
67930
|
setIsShowAddFieldDialog(false);
|
|
67939
67931
|
setIsShowDialog(false);
|
|
67940
67932
|
setState(CTRL.EMPTY);
|
|
@@ -67945,16 +67937,19 @@ var Search = function Search(props) {
|
|
|
67945
67937
|
var onAddField = function onAddField() {
|
|
67946
67938
|
setIsShowAddFieldDialog(!isShowAddFieldDialog);
|
|
67947
67939
|
};
|
|
67948
|
-
var onFieldListChange = function onFieldListChange(
|
|
67949
|
-
var fieldList = []
|
|
67950
|
-
var
|
|
67951
|
-
|
|
67952
|
-
|
|
67953
|
-
|
|
67954
|
-
var fieldWithKey = _extends({}, field, {
|
|
67955
|
-
key: getUUID()
|
|
67940
|
+
var onFieldListChange = function onFieldListChange(selectedFieldIdList) {
|
|
67941
|
+
var fieldList = [];
|
|
67942
|
+
var _loop = function _loop() {
|
|
67943
|
+
var id = _step.value;
|
|
67944
|
+
var field = props.fieldList.find(function (x) {
|
|
67945
|
+
return x.id === id;
|
|
67956
67946
|
});
|
|
67957
|
-
|
|
67947
|
+
if (field) {
|
|
67948
|
+
fieldList.push(field);
|
|
67949
|
+
}
|
|
67950
|
+
};
|
|
67951
|
+
for (var _iterator = _createForOfIteratorHelperLoose(selectedFieldIdList), _step; !(_step = _iterator()).done;) {
|
|
67952
|
+
_loop();
|
|
67958
67953
|
}
|
|
67959
67954
|
setFilterFieldList(fieldList);
|
|
67960
67955
|
};
|
|
@@ -67965,22 +67960,37 @@ var Search = function Search(props) {
|
|
|
67965
67960
|
setState(CTRL.EMPTY);
|
|
67966
67961
|
}
|
|
67967
67962
|
};
|
|
67968
|
-
var onDeleteField = function onDeleteField(
|
|
67963
|
+
var onDeleteField = function onDeleteField(id) {
|
|
67969
67964
|
setFilterFieldList(function (prevState) {
|
|
67970
67965
|
return prevState.filter(function (field) {
|
|
67971
|
-
return field.
|
|
67966
|
+
return field.id !== id;
|
|
67972
67967
|
});
|
|
67973
67968
|
});
|
|
67974
|
-
|
|
67975
|
-
return prevState.
|
|
67976
|
-
|
|
67969
|
+
setCheckboxFieldList(function (prevState) {
|
|
67970
|
+
return prevState.map(function (field) {
|
|
67971
|
+
if (field.id === id) {
|
|
67972
|
+
return _extends({}, field, {
|
|
67973
|
+
value: false
|
|
67974
|
+
});
|
|
67975
|
+
} else {
|
|
67976
|
+
return field;
|
|
67977
|
+
}
|
|
67977
67978
|
});
|
|
67978
67979
|
});
|
|
67980
|
+
var field = props.fieldList.find(function (field) {
|
|
67981
|
+
return field.id === id;
|
|
67982
|
+
});
|
|
67983
|
+
if (field) {
|
|
67984
|
+
setSearchCriterionList(function (prevState) {
|
|
67985
|
+
return prevState.filter(function (criterion) {
|
|
67986
|
+
return criterion.internalName !== field.internalName;
|
|
67987
|
+
});
|
|
67988
|
+
});
|
|
67989
|
+
}
|
|
67979
67990
|
};
|
|
67980
67991
|
var onFilterChange = function onFilterChange(changedFieldValueMap, saveStatus) {
|
|
67981
67992
|
var criterionList = [];
|
|
67982
67993
|
changedFieldValueMap.forEach(function (value, key) {
|
|
67983
|
-
value.key = key;
|
|
67984
67994
|
criterionList.push(value);
|
|
67985
67995
|
});
|
|
67986
67996
|
setSearchCriterionList(criterionList);
|
|
@@ -67990,23 +68000,10 @@ var Search = function Search(props) {
|
|
|
67990
68000
|
};
|
|
67991
68001
|
var onSearch = function onSearch(value, criterionList) {
|
|
67992
68002
|
var list = criterionList ? criterionList : searchCriterionList;
|
|
67993
|
-
props.onSearch(
|
|
68003
|
+
props.onSearch(list);
|
|
67994
68004
|
setSelectedSearchCriterionList(getSelectedCriterionList(list));
|
|
67995
68005
|
closeSettings();
|
|
67996
68006
|
};
|
|
67997
|
-
var getSearchCriterionListWithoutKey = function getSearchCriterionListWithoutKey(criterionList) {
|
|
67998
|
-
var list = [];
|
|
67999
|
-
criterionList === null || criterionList === void 0 ? void 0 : criterionList.forEach(function (item) {
|
|
68000
|
-
var criterion = {
|
|
68001
|
-
internalName: item.internalName,
|
|
68002
|
-
operator: item.operator,
|
|
68003
|
-
condition: item.condition,
|
|
68004
|
-
valueList: item.valueList
|
|
68005
|
-
};
|
|
68006
|
-
list.push(criterion);
|
|
68007
|
-
});
|
|
68008
|
-
return list;
|
|
68009
|
-
};
|
|
68010
68007
|
var getSelectedCriterionList = function getSelectedCriterionList(criterionList) {
|
|
68011
68008
|
var list = criterionList.map(function (x) {
|
|
68012
68009
|
var fieldName = props.fieldList.find(function (field) {
|
|
@@ -68024,13 +68021,24 @@ var Search = function Search(props) {
|
|
|
68024
68021
|
var field = props.fieldList.find(function (field) {
|
|
68025
68022
|
return field.internalName === x.internalName;
|
|
68026
68023
|
});
|
|
68027
|
-
|
|
68028
|
-
key: x.key
|
|
68029
|
-
});
|
|
68030
|
-
fieldList.push(fieldWithKey);
|
|
68024
|
+
fieldList.push(field);
|
|
68031
68025
|
});
|
|
68032
68026
|
return fieldList;
|
|
68033
68027
|
};
|
|
68028
|
+
var getCheckboxFieldList = function getCheckboxFieldList(visibleFieldList) {
|
|
68029
|
+
var checkboxList = props.fieldList.map(function (field) {
|
|
68030
|
+
if (visibleFieldList.find(function (f) {
|
|
68031
|
+
return f.id === field.id;
|
|
68032
|
+
})) {
|
|
68033
|
+
return _extends({}, field, {
|
|
68034
|
+
value: true
|
|
68035
|
+
});
|
|
68036
|
+
} else {
|
|
68037
|
+
return field;
|
|
68038
|
+
}
|
|
68039
|
+
});
|
|
68040
|
+
return checkboxList;
|
|
68041
|
+
};
|
|
68034
68042
|
var onCancelSearch = function onCancelSearch() {
|
|
68035
68043
|
setSearchCriterionList([]);
|
|
68036
68044
|
setSelectedSearchCriterionList([]);
|
|
@@ -68039,17 +68047,11 @@ var Search = function Search(props) {
|
|
|
68039
68047
|
props.onCancel();
|
|
68040
68048
|
};
|
|
68041
68049
|
var onInputChange = function onInputChange(value) {
|
|
68042
|
-
var _props$visibleFieldLi, _defaultSearchField$;
|
|
68043
|
-
var defaultSearchField = (_props$visibleFieldLi = props.visibleFieldList) === null || _props$visibleFieldLi === void 0 ? void 0 : _props$visibleFieldLi.filter(function (field) {
|
|
68044
|
-
return field.internalName === props.defaultSearchFieldName;
|
|
68045
|
-
});
|
|
68046
|
-
var key = defaultSearchField && defaultSearchField.length && (_defaultSearchField$ = defaultSearchField[0]) !== null && _defaultSearchField$ !== void 0 && _defaultSearchField$.key ? defaultSearchField[0].key : getUUID();
|
|
68047
68050
|
var criterion = {
|
|
68048
68051
|
condition: CONDITION_CONTAINS,
|
|
68049
68052
|
operator: 0,
|
|
68050
68053
|
internalName: props.defaultSearchFieldName,
|
|
68051
|
-
valueList: [value]
|
|
68052
|
-
key: key
|
|
68054
|
+
valueList: [value]
|
|
68053
68055
|
};
|
|
68054
68056
|
setSearchCriterionList([criterion]);
|
|
68055
68057
|
};
|
|
@@ -68071,13 +68073,6 @@ var Search = function Search(props) {
|
|
|
68071
68073
|
var onCancel = function onCancel() {
|
|
68072
68074
|
closeSettings();
|
|
68073
68075
|
};
|
|
68074
|
-
var getUUID = function getUUID() {
|
|
68075
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
68076
|
-
var r = Math.random() * 16 | 0,
|
|
68077
|
-
v = c == 'x' ? r : r & 0x3 | 0x8;
|
|
68078
|
-
return v.toString(16);
|
|
68079
|
-
});
|
|
68080
|
-
};
|
|
68081
68076
|
var content = React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
68082
68077
|
className: styles$1m['vitro-filter-container'],
|
|
68083
68078
|
ref: filterContainerRef
|
|
@@ -68098,7 +68093,7 @@ var Search = function Search(props) {
|
|
|
68098
68093
|
onAddField: onAddField,
|
|
68099
68094
|
isShowAddFieldDialog: isShowAddFieldDialog,
|
|
68100
68095
|
isMobileView: props.isMobileView,
|
|
68101
|
-
|
|
68096
|
+
checkboxFieldList: checkboxFieldList,
|
|
68102
68097
|
onFieldListChange: onFieldListChange,
|
|
68103
68098
|
isAllFieldsVisible: props.isAllFieldsVisible,
|
|
68104
68099
|
filterContainerRef: filterContainerRef,
|