@vitrosoftware/common-ui-ts 1.1.176 → 1.1.177
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/add-field-button/list.css +24 -0
- package/css/std/controls/search/search.css +4 -0
- package/dist/index.css +18 -10
- package/dist/index.js +125 -120
- 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 +1 -0
- 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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.vitro-list {
|
|
2
|
+
background: #fff;
|
|
3
|
+
border-radius: 4px;
|
|
4
|
+
max-width: 252px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.vitro-list :global(.ps) > div:first-child {
|
|
8
|
+
padding-left: 12px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.vitro-item {
|
|
12
|
+
margin-bottom: 4px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.vitro-item:last-child {
|
|
16
|
+
padding-bottom: 8px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.vitro-item a {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
display: block;
|
|
22
|
+
line-height: 24px;
|
|
23
|
+
padding: 0 4px 0 4px;
|
|
24
|
+
}
|
package/dist/index.css
CHANGED
|
@@ -6942,27 +6942,31 @@ li:first-child ._command-menu-item_vitro-item_2pVhk23:hover {
|
|
|
6942
6942
|
padding: 8px 12px;
|
|
6943
6943
|
}
|
|
6944
6944
|
|
|
6945
|
-
.
|
|
6946
|
-
border-radius: 4px;
|
|
6945
|
+
._list_vitro-list_1I2JJ6w {
|
|
6947
6946
|
background: #fff;
|
|
6947
|
+
border-radius: 4px;
|
|
6948
6948
|
max-width: 252px;
|
|
6949
6949
|
}
|
|
6950
6950
|
|
|
6951
|
-
.
|
|
6952
|
-
padding: 12px 12px 8px 12px;
|
|
6953
|
-
}
|
|
6954
|
-
|
|
6955
|
-
._checkbox-list_vitro-checkbox-list_1iZSkkv .ps > div:first-child {
|
|
6951
|
+
._list_vitro-list_1I2JJ6w .ps > div:first-child {
|
|
6956
6952
|
padding-left: 12px;
|
|
6957
6953
|
}
|
|
6958
6954
|
|
|
6959
|
-
.
|
|
6955
|
+
._list_vitro-item_2XsFSic {
|
|
6960
6956
|
margin-bottom: 4px;
|
|
6961
6957
|
}
|
|
6962
6958
|
|
|
6963
|
-
.
|
|
6959
|
+
._list_vitro-item_2XsFSic:last-child {
|
|
6964
6960
|
padding-bottom: 8px;
|
|
6965
|
-
}
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6963
|
+
._list_vitro-item_2XsFSic a {
|
|
6964
|
+
cursor: pointer;
|
|
6965
|
+
display: block;
|
|
6966
|
+
line-height: 24px;
|
|
6967
|
+
padding: 0 4px 0 4px;
|
|
6968
|
+
}
|
|
6969
|
+
|
|
6966
6970
|
._search_vitro-search_QkJksC_ {
|
|
6967
6971
|
position: relative;
|
|
6968
6972
|
align-self: baseline;
|
|
@@ -7018,6 +7022,10 @@ li:first-child ._command-menu-item_vitro-item_2pVhk23:hover {
|
|
|
7018
7022
|
grid-gap: 28px 16px;
|
|
7019
7023
|
}
|
|
7020
7024
|
|
|
7025
|
+
._search_vitro-filter_2n-Y-mS [class^="_criterion_vitro-control"] {
|
|
7026
|
+
max-width: calc(100% - 87px);
|
|
7027
|
+
}
|
|
7028
|
+
|
|
7021
7029
|
._search_vitro-add-field_2hHt1Z2 {
|
|
7022
7030
|
margin: 18px 0 16px 66px;
|
|
7023
7031
|
}
|
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.177";
|
|
63549
63549
|
var description = "vitro software common ui ts";
|
|
63550
63550
|
var author = "";
|
|
63551
63551
|
var license = "MIT";
|
|
@@ -66951,7 +66951,9 @@ var ConditionSelect = React.forwardRef(function (props, ref) {
|
|
|
66951
66951
|
});
|
|
66952
66952
|
|
|
66953
66953
|
var Criterion = function Criterion(props) {
|
|
66954
|
-
var _useState = React.useState(props.operatorList ? props.operatorList
|
|
66954
|
+
var _useState = React.useState(props.operatorList ? props.defaultOperator ? props.operatorList.find(function (x) {
|
|
66955
|
+
return x.type === props.defaultOperator;
|
|
66956
|
+
}) || props.operatorList[0] : props.operatorList[0] : null),
|
|
66955
66957
|
operator = _useState[0],
|
|
66956
66958
|
setOperator = _useState[1];
|
|
66957
66959
|
var _useState2 = React.useState(false),
|
|
@@ -66961,11 +66963,6 @@ var Criterion = function Criterion(props) {
|
|
|
66961
66963
|
state = _useState3[0],
|
|
66962
66964
|
setState = _useState3[1];
|
|
66963
66965
|
var componentProps = props.content.props;
|
|
66964
|
-
var defaultOperator = props.operatorList ? (componentProps.value ? props.operatorList.find(function (x) {
|
|
66965
|
-
return x.type === componentProps.value.operator;
|
|
66966
|
-
}) : props.operatorList.find(function (x) {
|
|
66967
|
-
return x.type === props.defaultOperator;
|
|
66968
|
-
})) || props.operatorList[0] : null;
|
|
66969
66966
|
var defaultCondition = (componentProps.value ? props.conditionList.find(function (x) {
|
|
66970
66967
|
return x.type === componentProps.value.condition;
|
|
66971
66968
|
}) : props.conditionList.find(function (x) {
|
|
@@ -66974,7 +66971,7 @@ var Criterion = function Criterion(props) {
|
|
|
66974
66971
|
var value = React.useMemo(function () {
|
|
66975
66972
|
return {
|
|
66976
66973
|
internalName: componentProps.name,
|
|
66977
|
-
operator: defaultOperator
|
|
66974
|
+
operator: props.defaultOperator || 0,
|
|
66978
66975
|
valueList: componentProps.value ? componentProps.value.valueList : [],
|
|
66979
66976
|
condition: defaultCondition.type
|
|
66980
66977
|
};
|
|
@@ -66984,7 +66981,6 @@ var Criterion = function Criterion(props) {
|
|
|
66984
66981
|
var conditionSelectRef = React.useRef(null);
|
|
66985
66982
|
React.useEffect(function () {
|
|
66986
66983
|
window.addEventListener(exports.EVENT.CLICK, onBlurSelect);
|
|
66987
|
-
setOperator(defaultOperator);
|
|
66988
66984
|
return function () {
|
|
66989
66985
|
window.removeEventListener(exports.EVENT.CLICK, onBlurSelect);
|
|
66990
66986
|
};
|
|
@@ -66994,6 +66990,18 @@ var Criterion = function Criterion(props) {
|
|
|
66994
66990
|
conditionSelectRef.current.style.left = labelRef.current.offsetWidth + 8 + UNIT.PX;
|
|
66995
66991
|
}
|
|
66996
66992
|
}, [labelRef]);
|
|
66993
|
+
React.useEffect(function () {
|
|
66994
|
+
if (props.content.props && props.content.props.value && props.operatorList) {
|
|
66995
|
+
var _operator = props.operatorList.find(function (x) {
|
|
66996
|
+
return x.type === componentProps.value.operator;
|
|
66997
|
+
});
|
|
66998
|
+
if (_operator) {
|
|
66999
|
+
setOperator(_operator);
|
|
67000
|
+
value.operator = _operator.type;
|
|
67001
|
+
}
|
|
67002
|
+
value.valueList = componentProps.value ? componentProps.value.valueList : [];
|
|
67003
|
+
}
|
|
67004
|
+
}, [props.content]);
|
|
66997
67005
|
var onOperatorClick = function onOperatorClick(operator) {
|
|
66998
67006
|
setOperator(operator);
|
|
66999
67007
|
value.operator = operator.type;
|
|
@@ -67076,7 +67084,7 @@ var Criterion = function Criterion(props) {
|
|
|
67076
67084
|
isRequired: false
|
|
67077
67085
|
}))), React__default.createElement(ImageButton, {
|
|
67078
67086
|
onClick: function onClick() {
|
|
67079
|
-
return props.onDelete(componentProps.
|
|
67087
|
+
return props.onDelete(componentProps.controlKey);
|
|
67080
67088
|
},
|
|
67081
67089
|
className: styles$1d['vitro-button-cancel']
|
|
67082
67090
|
}));
|
|
@@ -67207,7 +67215,7 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67207
67215
|
value = _Object$entries$_i[1];
|
|
67208
67216
|
setControlList(function (prevState) {
|
|
67209
67217
|
return prevState.map(function (control) {
|
|
67210
|
-
return control.
|
|
67218
|
+
return control.controlKey === key && control.value !== value ? _extends({}, control, {
|
|
67211
67219
|
value: value
|
|
67212
67220
|
}) : control;
|
|
67213
67221
|
});
|
|
@@ -67234,11 +67242,13 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67234
67242
|
};
|
|
67235
67243
|
var createBaseControl = function createBaseControl(field) {
|
|
67236
67244
|
var _field$fieldValueMap;
|
|
67245
|
+
var controlKey = field.key ? field.key : field.internalName;
|
|
67237
67246
|
var control = {
|
|
67238
67247
|
id: field.id,
|
|
67239
67248
|
label: field.name,
|
|
67240
67249
|
name: field.internalName,
|
|
67241
|
-
key:
|
|
67250
|
+
key: controlKey,
|
|
67251
|
+
controlKey: controlKey,
|
|
67242
67252
|
code: field.component ? field.component : field.fieldType.reactComponent,
|
|
67243
67253
|
isRequired: field.isRequired,
|
|
67244
67254
|
isReadOnly: props.isReadOnly || field.isReadOnly,
|
|
@@ -67247,8 +67257,8 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67247
67257
|
errorMessage: null,
|
|
67248
67258
|
isAutoComplete: false,
|
|
67249
67259
|
multiline: (_field$fieldValueMap = field.fieldValueMap) === null || _field$fieldValueMap === void 0 ? void 0 : _field$fieldValueMap.multiline,
|
|
67250
|
-
onChange: function onChange(value
|
|
67251
|
-
return onChangeControl(value,
|
|
67260
|
+
onChange: function onChange(value) {
|
|
67261
|
+
return onChangeControl(value, controlKey);
|
|
67252
67262
|
},
|
|
67253
67263
|
isRow: isControlRow(field.internalName),
|
|
67254
67264
|
field: field,
|
|
@@ -67257,16 +67267,16 @@ var FieldIterator = React.forwardRef(function (props, ref) {
|
|
|
67257
67267
|
};
|
|
67258
67268
|
return control;
|
|
67259
67269
|
};
|
|
67260
|
-
var onChangeControl = function onChangeControl(value,
|
|
67270
|
+
var onChangeControl = function onChangeControl(value, controlKey) {
|
|
67261
67271
|
setControlList(function (prevState) {
|
|
67262
|
-
return setControlValue(prevState, value,
|
|
67272
|
+
return setControlValue(prevState, value, controlKey);
|
|
67263
67273
|
});
|
|
67264
|
-
changedFieldValueMap.set(
|
|
67274
|
+
changedFieldValueMap.set(controlKey, value);
|
|
67265
67275
|
props.onChange(changedFieldValueMap, saveStatus);
|
|
67266
67276
|
};
|
|
67267
|
-
var setControlValue = function setControlValue(controlList, val,
|
|
67277
|
+
var setControlValue = function setControlValue(controlList, val, controlKey) {
|
|
67268
67278
|
return controlList.map(function (field) {
|
|
67269
|
-
if (field.
|
|
67279
|
+
if (field.controlKey === controlKey) {
|
|
67270
67280
|
return _extends({}, field, {
|
|
67271
67281
|
value: val
|
|
67272
67282
|
});
|
|
@@ -67511,7 +67521,7 @@ var CriterionFieldIterator = function CriterionFieldIterator(props) {
|
|
|
67511
67521
|
if (props.valueList) {
|
|
67512
67522
|
var valueMap = new Map();
|
|
67513
67523
|
props.valueList.map(function (x) {
|
|
67514
|
-
valueMap.set(x.
|
|
67524
|
+
valueMap.set(x.key, x);
|
|
67515
67525
|
});
|
|
67516
67526
|
setFieldValueMap(Object.fromEntries(valueMap));
|
|
67517
67527
|
setChangedFieldValueMap(valueMap);
|
|
@@ -67653,7 +67663,7 @@ var SearchInput = function SearchInput(props) {
|
|
|
67653
67663
|
var _loop = function _loop() {
|
|
67654
67664
|
var value = _step.value;
|
|
67655
67665
|
newList = newList.filter(function (x) {
|
|
67656
|
-
return x.
|
|
67666
|
+
return x.key !== value.key;
|
|
67657
67667
|
});
|
|
67658
67668
|
};
|
|
67659
67669
|
for (var _iterator = _createForOfIteratorHelperLoose(valueList), _step; !(_step = _iterator()).done;) {
|
|
@@ -67758,60 +67768,39 @@ var SearchValueList = function SearchValueList(props) {
|
|
|
67758
67768
|
onChange: onInputChange,
|
|
67759
67769
|
className: props.inputClassName,
|
|
67760
67770
|
isMobileView: Boolean(props.isMobileView)
|
|
67761
|
-
})), React__default.createElement(ScrollBar, null, props.children, itemList.length ? itemList.map(function (item) {
|
|
67771
|
+
})), React__default.createElement(ScrollBar, null, props.children, itemList && itemList.length ? itemList.map(function (item) {
|
|
67762
67772
|
return props.valueTemplate(item);
|
|
67763
67773
|
}) : React__default.createElement("span", {
|
|
67764
67774
|
className: styles$1k['vitro-empty-placeholder']
|
|
67765
67775
|
}, props.emptyPlaceHolder || localeService.create(LOCALE$a.EMPTY_PLACEHOLDER))));
|
|
67766
67776
|
};
|
|
67767
67777
|
|
|
67768
|
-
var styles$1l = {"vitro-
|
|
67778
|
+
var styles$1l = {"vitro-list":"_list_vitro-list_1I2JJ6w","vitro-item":"_list_vitro-item_2XsFSic"};
|
|
67769
67779
|
|
|
67770
|
-
var
|
|
67771
|
-
var
|
|
67772
|
-
|
|
67773
|
-
|
|
67774
|
-
var _onChange = function onChange(value, id) {
|
|
67775
|
-
setItemList(function (prevState) {
|
|
67776
|
-
return prevState.map(function (item) {
|
|
67777
|
-
if (item.id === id) {
|
|
67778
|
-
item.value = value;
|
|
67779
|
-
}
|
|
67780
|
-
return item;
|
|
67781
|
-
});
|
|
67782
|
-
});
|
|
67783
|
-
if (props.onChange) {
|
|
67784
|
-
props.onChange(getSelectedItemList());
|
|
67780
|
+
var List$1 = React.forwardRef(function (props, ref) {
|
|
67781
|
+
var _onClick = function onClick(id) {
|
|
67782
|
+
if (props.onClick) {
|
|
67783
|
+
props.onClick(id);
|
|
67785
67784
|
}
|
|
67786
67785
|
};
|
|
67787
|
-
var
|
|
67788
|
-
|
|
67789
|
-
|
|
67790
|
-
}
|
|
67791
|
-
|
|
67792
|
-
|
|
67793
|
-
|
|
67794
|
-
|
|
67795
|
-
var getCheckbox = function getCheckbox(item) {
|
|
67796
|
-
return React__default.createElement(Checkbox, {
|
|
67797
|
-
label: item.name,
|
|
67798
|
-
name: item.name,
|
|
67799
|
-
value: props.isAllSelected ? true : item.value,
|
|
67800
|
-
onChange: function onChange(value, name) {
|
|
67801
|
-
return _onChange(value, item.id);
|
|
67802
|
-
},
|
|
67803
|
-
className: styles$1l['vitro-checkbox']
|
|
67804
|
-
});
|
|
67786
|
+
var getItemTemplate = function getItemTemplate(item) {
|
|
67787
|
+
return React__default.createElement("div", {
|
|
67788
|
+
className: styles$1l['vitro-item']
|
|
67789
|
+
}, React__default.createElement("a", {
|
|
67790
|
+
onClick: function onClick() {
|
|
67791
|
+
return _onClick(item.id);
|
|
67792
|
+
}
|
|
67793
|
+
}, item.name));
|
|
67805
67794
|
};
|
|
67806
67795
|
var filterValueTemplate = function filterValueTemplate(item) {
|
|
67807
67796
|
return item.name;
|
|
67808
67797
|
};
|
|
67809
67798
|
return React__default.createElement("div", {
|
|
67810
|
-
className: styles$1l['vitro-
|
|
67799
|
+
className: styles$1l['vitro-list'],
|
|
67811
67800
|
ref: ref
|
|
67812
67801
|
}, React__default.createElement(SearchValueList, {
|
|
67813
67802
|
itemList: props.itemList,
|
|
67814
|
-
valueTemplate:
|
|
67803
|
+
valueTemplate: getItemTemplate,
|
|
67815
67804
|
filterValueTemplate: filterValueTemplate,
|
|
67816
67805
|
className: styles$1l['vitro-search-value-list']
|
|
67817
67806
|
}));
|
|
@@ -67844,6 +67833,9 @@ var AddFieldButton = React.forwardRef(function (props, ref) {
|
|
|
67844
67833
|
}
|
|
67845
67834
|
}
|
|
67846
67835
|
};
|
|
67836
|
+
var onFieldListChange = function onFieldListChange(id) {
|
|
67837
|
+
props.onFieldListChange(id);
|
|
67838
|
+
};
|
|
67847
67839
|
return React__default.createElement("div", {
|
|
67848
67840
|
className: styles$1m['vitro-add-field']
|
|
67849
67841
|
}, React__default.createElement(Button$2, {
|
|
@@ -67861,11 +67853,10 @@ var AddFieldButton = React.forwardRef(function (props, ref) {
|
|
|
67861
67853
|
container: (_props$filterContaine = props.filterContainerRef) !== null && _props$filterContaine !== void 0 && _props$filterContaine.current ? props.filterContainerRef.current : undefined,
|
|
67862
67854
|
placement: props.isMobileView ? exports.PLACEMENT.BOTTOM + CTRL.DASH + exports.PLACEMENT.START : exports.PLACEMENT.RIGHT + CTRL.DASH + exports.PLACEMENT.START,
|
|
67863
67855
|
className: styles$1m['vitro-add-field-dialog']
|
|
67864
|
-
}, React__default.createElement(
|
|
67856
|
+
}, React__default.createElement(List$1, {
|
|
67865
67857
|
ref: addFieldListRef,
|
|
67866
|
-
itemList: props.
|
|
67867
|
-
|
|
67868
|
-
isAllSelected: props.isAllFieldsVisible
|
|
67858
|
+
itemList: props.fieldList,
|
|
67859
|
+
onClick: onFieldListChange
|
|
67869
67860
|
})));
|
|
67870
67861
|
});
|
|
67871
67862
|
|
|
@@ -67905,12 +67896,18 @@ var Search = function Search(props) {
|
|
|
67905
67896
|
};
|
|
67906
67897
|
}, []);
|
|
67907
67898
|
React.useEffect(function () {
|
|
67908
|
-
var checkboxList = props.fieldList;
|
|
67909
67899
|
if (props.visibleFieldList) {
|
|
67910
|
-
|
|
67911
|
-
|
|
67900
|
+
var visibleFieldList = [];
|
|
67901
|
+
props.visibleFieldList.forEach(function (visibleField) {
|
|
67902
|
+
var field = _extends({}, visibleField);
|
|
67903
|
+
if (!visibleField.key) {
|
|
67904
|
+
field.key = getUUID();
|
|
67905
|
+
}
|
|
67906
|
+
visibleFieldList.push(field);
|
|
67907
|
+
});
|
|
67908
|
+
setFilterFieldList(visibleFieldList);
|
|
67912
67909
|
}
|
|
67913
|
-
setCheckboxFieldList(
|
|
67910
|
+
setCheckboxFieldList(props.fieldList);
|
|
67914
67911
|
}, [props.visibleFieldList]);
|
|
67915
67912
|
React.useEffect(function () {
|
|
67916
67913
|
if (props.maxFieldCount) {
|
|
@@ -67929,21 +67926,32 @@ var Search = function Search(props) {
|
|
|
67929
67926
|
}, [selectedSearchCriterionList]);
|
|
67930
67927
|
React.useEffect(function () {
|
|
67931
67928
|
if (props.searchCriterionList && props.searchCriterionList.length) {
|
|
67932
|
-
var list = getSelectedCriterionList(props.searchCriterionList);
|
|
67929
|
+
var list = getSelectedCriterionList(getSeacrhCriterionWithKey(props.searchCriterionList));
|
|
67933
67930
|
setSelectedSearchCriterionList(list);
|
|
67934
67931
|
var selectedFieldList = getSelectedFieldList(list);
|
|
67935
67932
|
setFilterFieldList(selectedFieldList);
|
|
67936
|
-
setCheckboxFieldList(
|
|
67933
|
+
setCheckboxFieldList(props.fieldList);
|
|
67937
67934
|
} else {
|
|
67938
67935
|
reset();
|
|
67939
67936
|
}
|
|
67940
67937
|
}, [props.searchCriterionList]);
|
|
67938
|
+
var getSeacrhCriterionWithKey = function getSeacrhCriterionWithKey(searchCriterionList) {
|
|
67939
|
+
var criterionList = [];
|
|
67940
|
+
for (var _iterator = _createForOfIteratorHelperLoose(searchCriterionList), _step; !(_step = _iterator()).done;) {
|
|
67941
|
+
var criterionItem = _step.value;
|
|
67942
|
+
var criterion = _extends({}, criterionItem, {
|
|
67943
|
+
key: getUUID()
|
|
67944
|
+
});
|
|
67945
|
+
criterionList.push(criterion);
|
|
67946
|
+
}
|
|
67947
|
+
return criterionList;
|
|
67948
|
+
};
|
|
67941
67949
|
var reset = function reset() {
|
|
67942
67950
|
setSearchCriterionList([]);
|
|
67943
67951
|
setSelectedSearchCriterionList([]);
|
|
67944
67952
|
var selectedFieldList = getSelectedFieldList([]);
|
|
67945
67953
|
setFilterFieldList(selectedFieldList);
|
|
67946
|
-
setCheckboxFieldList(
|
|
67954
|
+
setCheckboxFieldList(props.fieldList);
|
|
67947
67955
|
setIsShowAddFieldDialog(false);
|
|
67948
67956
|
setIsShowDialog(false);
|
|
67949
67957
|
setState(CTRL.EMPTY);
|
|
@@ -67954,19 +67962,16 @@ var Search = function Search(props) {
|
|
|
67954
67962
|
var onAddField = function onAddField() {
|
|
67955
67963
|
setIsShowAddFieldDialog(!isShowAddFieldDialog);
|
|
67956
67964
|
};
|
|
67957
|
-
var onFieldListChange = function onFieldListChange(
|
|
67958
|
-
var fieldList = [];
|
|
67959
|
-
var
|
|
67960
|
-
|
|
67961
|
-
|
|
67962
|
-
|
|
67965
|
+
var onFieldListChange = function onFieldListChange(selectedFieldId) {
|
|
67966
|
+
var fieldList = [].concat(filterFieldList);
|
|
67967
|
+
var field = props.fieldList.find(function (x) {
|
|
67968
|
+
return x.id === selectedFieldId;
|
|
67969
|
+
});
|
|
67970
|
+
if (field) {
|
|
67971
|
+
var fieldWithKey = _extends({}, field, {
|
|
67972
|
+
key: getUUID()
|
|
67963
67973
|
});
|
|
67964
|
-
|
|
67965
|
-
fieldList.push(field);
|
|
67966
|
-
}
|
|
67967
|
-
};
|
|
67968
|
-
for (var _iterator = _createForOfIteratorHelperLoose(selectedFieldIdList), _step; !(_step = _iterator()).done;) {
|
|
67969
|
-
_loop();
|
|
67974
|
+
fieldList.push(fieldWithKey);
|
|
67970
67975
|
}
|
|
67971
67976
|
setFilterFieldList(fieldList);
|
|
67972
67977
|
};
|
|
@@ -67977,37 +67982,22 @@ var Search = function Search(props) {
|
|
|
67977
67982
|
setState(CTRL.EMPTY);
|
|
67978
67983
|
}
|
|
67979
67984
|
};
|
|
67980
|
-
var onDeleteField = function onDeleteField(
|
|
67985
|
+
var onDeleteField = function onDeleteField(key) {
|
|
67981
67986
|
setFilterFieldList(function (prevState) {
|
|
67982
67987
|
return prevState.filter(function (field) {
|
|
67983
|
-
return field.
|
|
67988
|
+
return field.key !== key;
|
|
67984
67989
|
});
|
|
67985
67990
|
});
|
|
67986
|
-
|
|
67987
|
-
return prevState.
|
|
67988
|
-
|
|
67989
|
-
return _extends({}, field, {
|
|
67990
|
-
value: false
|
|
67991
|
-
});
|
|
67992
|
-
} else {
|
|
67993
|
-
return field;
|
|
67994
|
-
}
|
|
67991
|
+
setSearchCriterionList(function (prevState) {
|
|
67992
|
+
return prevState.filter(function (criterion) {
|
|
67993
|
+
return criterion.key !== key;
|
|
67995
67994
|
});
|
|
67996
67995
|
});
|
|
67997
|
-
var field = props.fieldList.find(function (field) {
|
|
67998
|
-
return field.id === id;
|
|
67999
|
-
});
|
|
68000
|
-
if (field) {
|
|
68001
|
-
setSearchCriterionList(function (prevState) {
|
|
68002
|
-
return prevState.filter(function (criterion) {
|
|
68003
|
-
return criterion.internalName !== field.internalName;
|
|
68004
|
-
});
|
|
68005
|
-
});
|
|
68006
|
-
}
|
|
68007
67996
|
};
|
|
68008
67997
|
var onFilterChange = function onFilterChange(changedFieldValueMap, saveStatus) {
|
|
68009
67998
|
var criterionList = [];
|
|
68010
67999
|
changedFieldValueMap.forEach(function (value, key) {
|
|
68000
|
+
value.key = key;
|
|
68011
68001
|
criterionList.push(value);
|
|
68012
68002
|
});
|
|
68013
68003
|
setSearchCriterionList(criterionList);
|
|
@@ -68017,10 +68007,23 @@ var Search = function Search(props) {
|
|
|
68017
68007
|
};
|
|
68018
68008
|
var onSearch = function onSearch(value, criterionList) {
|
|
68019
68009
|
var list = criterionList ? criterionList : searchCriterionList;
|
|
68020
|
-
props.onSearch(list);
|
|
68010
|
+
props.onSearch(getSearchCriterionListWithoutKey(list));
|
|
68021
68011
|
setSelectedSearchCriterionList(getSelectedCriterionList(list));
|
|
68022
68012
|
closeSettings();
|
|
68023
68013
|
};
|
|
68014
|
+
var getSearchCriterionListWithoutKey = function getSearchCriterionListWithoutKey(criterionList) {
|
|
68015
|
+
var list = [];
|
|
68016
|
+
criterionList === null || criterionList === void 0 ? void 0 : criterionList.forEach(function (item) {
|
|
68017
|
+
var criterion = {
|
|
68018
|
+
internalName: item.internalName,
|
|
68019
|
+
operator: item.operator,
|
|
68020
|
+
condition: item.condition,
|
|
68021
|
+
valueList: item.valueList
|
|
68022
|
+
};
|
|
68023
|
+
list.push(criterion);
|
|
68024
|
+
});
|
|
68025
|
+
return list;
|
|
68026
|
+
};
|
|
68024
68027
|
var getSelectedCriterionList = function getSelectedCriterionList(criterionList) {
|
|
68025
68028
|
var list = criterionList.map(function (x) {
|
|
68026
68029
|
var fieldName = props.fieldList.find(function (field) {
|
|
@@ -68038,24 +68041,13 @@ var Search = function Search(props) {
|
|
|
68038
68041
|
var field = props.fieldList.find(function (field) {
|
|
68039
68042
|
return field.internalName === x.internalName;
|
|
68040
68043
|
});
|
|
68041
|
-
|
|
68044
|
+
var fieldWithKey = _extends({}, field, {
|
|
68045
|
+
key: x.key
|
|
68046
|
+
});
|
|
68047
|
+
fieldList.push(fieldWithKey);
|
|
68042
68048
|
});
|
|
68043
68049
|
return fieldList;
|
|
68044
68050
|
};
|
|
68045
|
-
var getCheckboxFieldList = function getCheckboxFieldList(visibleFieldList) {
|
|
68046
|
-
var checkboxList = props.fieldList.map(function (field) {
|
|
68047
|
-
if (visibleFieldList.find(function (f) {
|
|
68048
|
-
return f.id === field.id;
|
|
68049
|
-
})) {
|
|
68050
|
-
return _extends({}, field, {
|
|
68051
|
-
value: true
|
|
68052
|
-
});
|
|
68053
|
-
} else {
|
|
68054
|
-
return field;
|
|
68055
|
-
}
|
|
68056
|
-
});
|
|
68057
|
-
return checkboxList;
|
|
68058
|
-
};
|
|
68059
68051
|
var onCancelSearch = function onCancelSearch() {
|
|
68060
68052
|
setSearchCriterionList([]);
|
|
68061
68053
|
setSelectedSearchCriterionList([]);
|
|
@@ -68064,11 +68056,17 @@ var Search = function Search(props) {
|
|
|
68064
68056
|
props.onCancel();
|
|
68065
68057
|
};
|
|
68066
68058
|
var onInputChange = function onInputChange(value) {
|
|
68059
|
+
var _props$visibleFieldLi, _defaultSearchField$;
|
|
68060
|
+
var defaultSearchField = (_props$visibleFieldLi = props.visibleFieldList) === null || _props$visibleFieldLi === void 0 ? void 0 : _props$visibleFieldLi.filter(function (field) {
|
|
68061
|
+
return field.internalName === props.defaultSearchFieldName;
|
|
68062
|
+
});
|
|
68063
|
+
var key = defaultSearchField && defaultSearchField.length && (_defaultSearchField$ = defaultSearchField[0]) !== null && _defaultSearchField$ !== void 0 && _defaultSearchField$.key ? defaultSearchField[0].key : getUUID();
|
|
68067
68064
|
var criterion = {
|
|
68068
68065
|
condition: CONDITION_CONTAINS,
|
|
68069
68066
|
operator: 0,
|
|
68070
68067
|
internalName: props.defaultSearchFieldName,
|
|
68071
|
-
valueList: [value]
|
|
68068
|
+
valueList: [value],
|
|
68069
|
+
key: key
|
|
68072
68070
|
};
|
|
68073
68071
|
setSearchCriterionList([criterion]);
|
|
68074
68072
|
};
|
|
@@ -68090,6 +68088,13 @@ var Search = function Search(props) {
|
|
|
68090
68088
|
var onCancel = function onCancel() {
|
|
68091
68089
|
closeSettings();
|
|
68092
68090
|
};
|
|
68091
|
+
var getUUID = function getUUID() {
|
|
68092
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
68093
|
+
var r = Math.random() * 16 | 0,
|
|
68094
|
+
v = c == 'x' ? r : r & 0x3 | 0x8;
|
|
68095
|
+
return v.toString(16);
|
|
68096
|
+
});
|
|
68097
|
+
};
|
|
68093
68098
|
var content = React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
68094
68099
|
className: styles$1m['vitro-filter-container'],
|
|
68095
68100
|
ref: filterContainerRef
|
|
@@ -68110,7 +68115,7 @@ var Search = function Search(props) {
|
|
|
68110
68115
|
onAddField: onAddField,
|
|
68111
68116
|
isShowAddFieldDialog: isShowAddFieldDialog,
|
|
68112
68117
|
isMobileView: props.isMobileView,
|
|
68113
|
-
|
|
68118
|
+
fieldList: checkboxFieldList,
|
|
68114
68119
|
onFieldListChange: onFieldListChange,
|
|
68115
68120
|
isAllFieldsVisible: props.isAllFieldsVisible,
|
|
68116
68121
|
filterContainerRef: filterContainerRef,
|