@vitrosoftware/common-ui-ts 1.1.173 → 1.1.174

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