@vitrosoftware/common-ui-ts 1.1.174 → 1.1.176

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.
@@ -59,6 +59,10 @@ html, body {
59
59
  overscroll-behavior-x: none;
60
60
  }
61
61
 
62
+ p {
63
+ margin: unset;
64
+ }
65
+
62
66
  :global(#root) {
63
67
  position: absolute;
64
68
  top: 0;
@@ -53,10 +53,6 @@
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
-
60
56
  .vitro-add-field {
61
57
  margin: 18px 0 16px 66px;
62
58
  }
@@ -91,4 +91,23 @@
91
91
 
92
92
  :global(.vitro-mobile-layout) .vitro-table-view {
93
93
  height: calc(100% - 1px);
94
- }
94
+ }
95
+
96
+ .vitro-table-view :global(.TWMain) strong,
97
+ .vitro-table-view :global(.TWMain) b {
98
+ font-weight: bold;
99
+ }
100
+
101
+ .vitro-table-view em {
102
+ color: inherit;
103
+ font-style: italic;
104
+ }
105
+
106
+ .vitro-table-view :global(.TWMain) s {
107
+ color: inherit;
108
+ text-decoration: line-through;
109
+ }
110
+
111
+ .vitro-table-view :global(.TWMain) u {
112
+ color: inherit;
113
+ }
package/dist/index.css CHANGED
@@ -59,6 +59,10 @@ html, body {
59
59
  overscroll-behavior-x: none;
60
60
  }
61
61
 
62
+ p {
63
+ margin: unset;
64
+ }
65
+
62
66
  #root {
63
67
  position: absolute;
64
68
  top: 0;
@@ -775,8 +779,26 @@ html, body {
775
779
 
776
780
  .vitro-mobile-layout ._table-view_vitro-table-view_1tTs32D {
777
781
  height: calc(100% - 1px);
778
- }
782
+ }
779
783
 
784
+ ._table-view_vitro-table-view_1tTs32D .TWMain strong,
785
+ ._table-view_vitro-table-view_1tTs32D .TWMain b {
786
+ font-weight: bold;
787
+ }
788
+
789
+ ._table-view_vitro-table-view_1tTs32D em {
790
+ color: inherit;
791
+ font-style: italic;
792
+ }
793
+
794
+ ._table-view_vitro-table-view_1tTs32D .TWMain s {
795
+ color: inherit;
796
+ text-decoration: line-through;
797
+ }
798
+
799
+ ._table-view_vitro-table-view_1tTs32D .TWMain u {
800
+ color: inherit;
801
+ }
780
802
  ._progress-bar_vitro-progress-bar_u2VLQeW {
781
803
  width: 100%;
782
804
  height: 8px;
@@ -6920,31 +6942,27 @@ li:first-child ._command-menu-item_vitro-item_2pVhk23:hover {
6920
6942
  padding: 8px 12px;
6921
6943
  }
6922
6944
 
6923
- ._list_vitro-list_1I2JJ6w {
6924
- background: #fff;
6945
+ ._checkbox-list_vitro-checkbox-list_1iZSkkv {
6925
6946
  border-radius: 4px;
6947
+ background: #fff;
6926
6948
  max-width: 252px;
6927
6949
  }
6928
6950
 
6929
- ._list_vitro-list_1I2JJ6w .ps > div:first-child {
6951
+ ._checkbox-list_vitro-search-value-list_2i58fRK > div:first-child {
6952
+ padding: 12px 12px 8px 12px;
6953
+ }
6954
+
6955
+ ._checkbox-list_vitro-checkbox-list_1iZSkkv .ps > div:first-child {
6930
6956
  padding-left: 12px;
6931
6957
  }
6932
6958
 
6933
- ._list_vitro-item_2XsFSic {
6959
+ ._checkbox-list_vitro-checkbox-list_1iZSkkv ._checkbox-list_vitro-checkbox_1EqsnoQ {
6934
6960
  margin-bottom: 4px;
6935
6961
  }
6936
6962
 
6937
- ._list_vitro-item_2XsFSic:last-child {
6963
+ ._checkbox-list_vitro-checkbox_1EqsnoQ:last-child {
6938
6964
  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
-
6965
+ }
6948
6966
  ._search_vitro-search_QkJksC_ {
6949
6967
  position: relative;
6950
6968
  align-self: baseline;
@@ -7000,10 +7018,6 @@ li:first-child ._command-menu-item_vitro-item_2pVhk23:hover {
7000
7018
  grid-gap: 28px 16px;
7001
7019
  }
7002
7020
 
7003
- ._search_vitro-filter_2n-Y-mS [class^="_criterion_vitro-control"] {
7004
- max-width: calc(100% - 87px);
7005
- }
7006
-
7007
7021
  ._search_vitro-add-field_2hHt1Z2 {
7008
7022
  margin: 18px 0 16px 66px;
7009
7023
  }
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.174";
63548
+ var version$1 = "1.1.176";
63549
63549
  var description = "vitro software common ui ts";
63550
63550
  var author = "";
63551
63551
  var license = "MIT";
@@ -65334,6 +65334,22 @@ var CommandMenuDropdownButton = function CommandMenuDropdownButton(props) {
65334
65334
  var isShowImage = (_props$itemList = props.itemList) !== null && _props$itemList !== void 0 && _props$itemList.find(function (item) {
65335
65335
  return item.imageUrl;
65336
65336
  }) ? true : false;
65337
+ var contentRef = React.useRef(null);
65338
+ React.useEffect(function () {
65339
+ var observer = new IntersectionObserver(function (_ref) {
65340
+ var entry = _ref[0];
65341
+ if (contentRef.current && contentRef.current.parentElement && entry.isIntersecting) {
65342
+ contentRef.current.parentElement.scrollTop = 1;
65343
+ contentRef.current.parentElement.scrollTop = 0;
65344
+ }
65345
+ });
65346
+ if (contentRef.current) {
65347
+ observer.observe(contentRef.current);
65348
+ }
65349
+ return function () {
65350
+ observer.disconnect();
65351
+ };
65352
+ }, [contentRef]);
65337
65353
  var onClick = function onClick(e) {
65338
65354
  if (props.onClick) {
65339
65355
  props.onClick(e);
@@ -65359,7 +65375,8 @@ var CommandMenuDropdownButton = function CommandMenuDropdownButton(props) {
65359
65375
  setIsRight: setIsRight
65360
65376
  }))), React__default.createElement(reactstrap.DropdownMenu, null, React__default.createElement(ScrollBar, {
65361
65377
  className: styles$W['vitro-scrollbar'],
65362
- isHideScrollX: true
65378
+ isHideScrollX: true,
65379
+ contentRef: contentRef
65363
65380
  }, props.itemList && props.itemList.map(function (i) {
65364
65381
  return React__default.createElement(CommandMenuSubItem, Object.assign({
65365
65382
  toggle: props.toggle,
@@ -66934,9 +66951,7 @@ var ConditionSelect = React.forwardRef(function (props, ref) {
66934
66951
  });
66935
66952
 
66936
66953
  var Criterion = function Criterion(props) {
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),
66954
+ var _useState = React.useState(props.operatorList ? props.operatorList[0] : null),
66940
66955
  operator = _useState[0],
66941
66956
  setOperator = _useState[1];
66942
66957
  var _useState2 = React.useState(false),
@@ -66946,6 +66961,11 @@ var Criterion = function Criterion(props) {
66946
66961
  state = _useState3[0],
66947
66962
  setState = _useState3[1];
66948
66963
  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;
66949
66969
  var defaultCondition = (componentProps.value ? props.conditionList.find(function (x) {
66950
66970
  return x.type === componentProps.value.condition;
66951
66971
  }) : props.conditionList.find(function (x) {
@@ -66954,7 +66974,7 @@ var Criterion = function Criterion(props) {
66954
66974
  var value = React.useMemo(function () {
66955
66975
  return {
66956
66976
  internalName: componentProps.name,
66957
- operator: props.defaultOperator || 0,
66977
+ operator: defaultOperator ? defaultOperator.type : 0,
66958
66978
  valueList: componentProps.value ? componentProps.value.valueList : [],
66959
66979
  condition: defaultCondition.type
66960
66980
  };
@@ -66964,6 +66984,7 @@ var Criterion = function Criterion(props) {
66964
66984
  var conditionSelectRef = React.useRef(null);
66965
66985
  React.useEffect(function () {
66966
66986
  window.addEventListener(exports.EVENT.CLICK, onBlurSelect);
66987
+ setOperator(defaultOperator);
66967
66988
  return function () {
66968
66989
  window.removeEventListener(exports.EVENT.CLICK, onBlurSelect);
66969
66990
  };
@@ -66973,18 +66994,6 @@ var Criterion = function Criterion(props) {
66973
66994
  conditionSelectRef.current.style.left = labelRef.current.offsetWidth + 8 + UNIT.PX;
66974
66995
  }
66975
66996
  }, [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
66997
  var onOperatorClick = function onOperatorClick(operator) {
66989
66998
  setOperator(operator);
66990
66999
  value.operator = operator.type;
@@ -67067,7 +67076,7 @@ var Criterion = function Criterion(props) {
67067
67076
  isRequired: false
67068
67077
  }))), React__default.createElement(ImageButton, {
67069
67078
  onClick: function onClick() {
67070
- return props.onDelete(componentProps.controlKey);
67079
+ return props.onDelete(componentProps.id);
67071
67080
  },
67072
67081
  className: styles$1d['vitro-button-cancel']
67073
67082
  }));
@@ -67198,7 +67207,7 @@ var FieldIterator = React.forwardRef(function (props, ref) {
67198
67207
  value = _Object$entries$_i[1];
67199
67208
  setControlList(function (prevState) {
67200
67209
  return prevState.map(function (control) {
67201
- return control.controlKey === key && control.value !== value ? _extends({}, control, {
67210
+ return control.name === key && control.value !== value ? _extends({}, control, {
67202
67211
  value: value
67203
67212
  }) : control;
67204
67213
  });
@@ -67225,13 +67234,11 @@ var FieldIterator = React.forwardRef(function (props, ref) {
67225
67234
  };
67226
67235
  var createBaseControl = function createBaseControl(field) {
67227
67236
  var _field$fieldValueMap;
67228
- var controlKey = field.key ? field.key : field.internalName;
67229
67237
  var control = {
67230
67238
  id: field.id,
67231
67239
  label: field.name,
67232
67240
  name: field.internalName,
67233
- key: controlKey,
67234
- controlKey: controlKey,
67241
+ key: field.internalName,
67235
67242
  code: field.component ? field.component : field.fieldType.reactComponent,
67236
67243
  isRequired: field.isRequired,
67237
67244
  isReadOnly: props.isReadOnly || field.isReadOnly,
@@ -67240,8 +67247,8 @@ var FieldIterator = React.forwardRef(function (props, ref) {
67240
67247
  errorMessage: null,
67241
67248
  isAutoComplete: false,
67242
67249
  multiline: (_field$fieldValueMap = field.fieldValueMap) === null || _field$fieldValueMap === void 0 ? void 0 : _field$fieldValueMap.multiline,
67243
- onChange: function onChange(value) {
67244
- return onChangeControl(value, controlKey);
67250
+ onChange: function onChange(value, name) {
67251
+ return onChangeControl(value, name);
67245
67252
  },
67246
67253
  isRow: isControlRow(field.internalName),
67247
67254
  field: field,
@@ -67250,16 +67257,16 @@ var FieldIterator = React.forwardRef(function (props, ref) {
67250
67257
  };
67251
67258
  return control;
67252
67259
  };
67253
- var onChangeControl = function onChangeControl(value, controlKey) {
67260
+ var onChangeControl = function onChangeControl(value, fieldName) {
67254
67261
  setControlList(function (prevState) {
67255
- return setControlValue(prevState, value, controlKey);
67262
+ return setControlValue(prevState, value, fieldName);
67256
67263
  });
67257
- changedFieldValueMap.set(controlKey, value);
67264
+ changedFieldValueMap.set(fieldName, value);
67258
67265
  props.onChange(changedFieldValueMap, saveStatus);
67259
67266
  };
67260
- var setControlValue = function setControlValue(controlList, val, controlKey) {
67267
+ var setControlValue = function setControlValue(controlList, val, fieldName) {
67261
67268
  return controlList.map(function (field) {
67262
- if (field.controlKey === controlKey) {
67269
+ if (field.name === fieldName) {
67263
67270
  return _extends({}, field, {
67264
67271
  value: val
67265
67272
  });
@@ -67504,7 +67511,7 @@ var CriterionFieldIterator = function CriterionFieldIterator(props) {
67504
67511
  if (props.valueList) {
67505
67512
  var valueMap = new Map();
67506
67513
  props.valueList.map(function (x) {
67507
- valueMap.set(x.key, x);
67514
+ valueMap.set(x.internalName, x);
67508
67515
  });
67509
67516
  setFieldValueMap(Object.fromEntries(valueMap));
67510
67517
  setChangedFieldValueMap(valueMap);
@@ -67646,7 +67653,7 @@ var SearchInput = function SearchInput(props) {
67646
67653
  var _loop = function _loop() {
67647
67654
  var value = _step.value;
67648
67655
  newList = newList.filter(function (x) {
67649
- return x.key !== value.key;
67656
+ return x.internalName !== value.internalName;
67650
67657
  });
67651
67658
  };
67652
67659
  for (var _iterator = _createForOfIteratorHelperLoose(valueList), _step; !(_step = _iterator()).done;) {
@@ -67758,32 +67765,53 @@ var SearchValueList = function SearchValueList(props) {
67758
67765
  }, props.emptyPlaceHolder || localeService.create(LOCALE$a.EMPTY_PLACEHOLDER))));
67759
67766
  };
67760
67767
 
67761
- var styles$1l = {"vitro-list":"_list_vitro-list_1I2JJ6w","vitro-item":"_list_vitro-item_2XsFSic"};
67768
+ 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
67769
 
67763
- var List$1 = React.forwardRef(function (props, ref) {
67764
- var _onClick = function onClick(id) {
67765
- if (props.onClick) {
67766
- props.onClick(id);
67770
+ var CheckboxList = React.forwardRef(function (props, ref) {
67771
+ var _useState = React.useState(props.itemList),
67772
+ itemList = _useState[0],
67773
+ setItemList = _useState[1];
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());
67767
67785
  }
67768
67786
  };
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));
67787
+ var getSelectedItemList = function getSelectedItemList() {
67788
+ var selectedList = itemList.filter(function (item) {
67789
+ return item.value;
67790
+ });
67791
+ return selectedList.map(function (item) {
67792
+ return item.id;
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
+ });
67777
67805
  };
67778
67806
  var filterValueTemplate = function filterValueTemplate(item) {
67779
67807
  return item.name;
67780
67808
  };
67781
67809
  return React__default.createElement("div", {
67782
- className: styles$1l['vitro-list'],
67810
+ className: styles$1l['vitro-checkbox-list'],
67783
67811
  ref: ref
67784
67812
  }, React__default.createElement(SearchValueList, {
67785
67813
  itemList: props.itemList,
67786
- valueTemplate: getItemTemplate,
67814
+ valueTemplate: getCheckbox,
67787
67815
  filterValueTemplate: filterValueTemplate,
67788
67816
  className: styles$1l['vitro-search-value-list']
67789
67817
  }));
@@ -67816,9 +67844,6 @@ var AddFieldButton = React.forwardRef(function (props, ref) {
67816
67844
  }
67817
67845
  }
67818
67846
  };
67819
- var onFieldListChange = function onFieldListChange(id) {
67820
- props.onFieldListChange(id);
67821
- };
67822
67847
  return React__default.createElement("div", {
67823
67848
  className: styles$1m['vitro-add-field']
67824
67849
  }, React__default.createElement(Button$2, {
@@ -67836,10 +67861,11 @@ var AddFieldButton = React.forwardRef(function (props, ref) {
67836
67861
  container: (_props$filterContaine = props.filterContainerRef) !== null && _props$filterContaine !== void 0 && _props$filterContaine.current ? props.filterContainerRef.current : undefined,
67837
67862
  placement: props.isMobileView ? exports.PLACEMENT.BOTTOM + CTRL.DASH + exports.PLACEMENT.START : exports.PLACEMENT.RIGHT + CTRL.DASH + exports.PLACEMENT.START,
67838
67863
  className: styles$1m['vitro-add-field-dialog']
67839
- }, React__default.createElement(List$1, {
67864
+ }, React__default.createElement(CheckboxList, {
67840
67865
  ref: addFieldListRef,
67841
- itemList: props.fieldList,
67842
- onClick: onFieldListChange
67866
+ itemList: props.checkboxFieldList,
67867
+ onChange: props.onFieldListChange,
67868
+ isAllSelected: props.isAllFieldsVisible
67843
67869
  })));
67844
67870
  });
67845
67871
 
@@ -67879,18 +67905,12 @@ var Search = function Search(props) {
67879
67905
  };
67880
67906
  }, []);
67881
67907
  React.useEffect(function () {
67908
+ var checkboxList = props.fieldList;
67882
67909
  if (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);
67910
+ setFilterFieldList(props.visibleFieldList);
67911
+ checkboxList = getCheckboxFieldList(props.visibleFieldList);
67892
67912
  }
67893
- setCheckboxFieldList(props.fieldList);
67913
+ setCheckboxFieldList(checkboxList);
67894
67914
  }, [props.visibleFieldList]);
67895
67915
  React.useEffect(function () {
67896
67916
  if (props.maxFieldCount) {
@@ -67909,32 +67929,21 @@ var Search = function Search(props) {
67909
67929
  }, [selectedSearchCriterionList]);
67910
67930
  React.useEffect(function () {
67911
67931
  if (props.searchCriterionList && props.searchCriterionList.length) {
67912
- var list = getSelectedCriterionList(getSeacrhCriterionWithKey(props.searchCriterionList));
67932
+ var list = getSelectedCriterionList(props.searchCriterionList);
67913
67933
  setSelectedSearchCriterionList(list);
67914
67934
  var selectedFieldList = getSelectedFieldList(list);
67915
67935
  setFilterFieldList(selectedFieldList);
67916
- setCheckboxFieldList(props.fieldList);
67936
+ setCheckboxFieldList(getCheckboxFieldList(selectedFieldList));
67917
67937
  } else {
67918
67938
  reset();
67919
67939
  }
67920
67940
  }, [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
67941
  var reset = function reset() {
67933
67942
  setSearchCriterionList([]);
67934
67943
  setSelectedSearchCriterionList([]);
67935
67944
  var selectedFieldList = getSelectedFieldList([]);
67936
67945
  setFilterFieldList(selectedFieldList);
67937
- setCheckboxFieldList(props.fieldList);
67946
+ setCheckboxFieldList(selectedFieldList);
67938
67947
  setIsShowAddFieldDialog(false);
67939
67948
  setIsShowDialog(false);
67940
67949
  setState(CTRL.EMPTY);
@@ -67945,16 +67954,19 @@ var Search = function Search(props) {
67945
67954
  var onAddField = function onAddField() {
67946
67955
  setIsShowAddFieldDialog(!isShowAddFieldDialog);
67947
67956
  };
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()
67957
+ var onFieldListChange = function onFieldListChange(selectedFieldIdList) {
67958
+ var fieldList = [];
67959
+ var _loop = function _loop() {
67960
+ var id = _step.value;
67961
+ var field = props.fieldList.find(function (x) {
67962
+ return x.id === id;
67956
67963
  });
67957
- fieldList.push(fieldWithKey);
67964
+ if (field) {
67965
+ fieldList.push(field);
67966
+ }
67967
+ };
67968
+ for (var _iterator = _createForOfIteratorHelperLoose(selectedFieldIdList), _step; !(_step = _iterator()).done;) {
67969
+ _loop();
67958
67970
  }
67959
67971
  setFilterFieldList(fieldList);
67960
67972
  };
@@ -67965,22 +67977,37 @@ var Search = function Search(props) {
67965
67977
  setState(CTRL.EMPTY);
67966
67978
  }
67967
67979
  };
67968
- var onDeleteField = function onDeleteField(key) {
67980
+ var onDeleteField = function onDeleteField(id) {
67969
67981
  setFilterFieldList(function (prevState) {
67970
67982
  return prevState.filter(function (field) {
67971
- return field.key !== key;
67983
+ return field.id !== id;
67972
67984
  });
67973
67985
  });
67974
- setSearchCriterionList(function (prevState) {
67975
- return prevState.filter(function (criterion) {
67976
- return criterion.key !== key;
67986
+ setCheckboxFieldList(function (prevState) {
67987
+ return prevState.map(function (field) {
67988
+ if (field.id === id) {
67989
+ return _extends({}, field, {
67990
+ value: false
67991
+ });
67992
+ } else {
67993
+ return field;
67994
+ }
67977
67995
  });
67978
67996
  });
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
+ }
67979
68007
  };
67980
68008
  var onFilterChange = function onFilterChange(changedFieldValueMap, saveStatus) {
67981
68009
  var criterionList = [];
67982
68010
  changedFieldValueMap.forEach(function (value, key) {
67983
- value.key = key;
67984
68011
  criterionList.push(value);
67985
68012
  });
67986
68013
  setSearchCriterionList(criterionList);
@@ -67990,23 +68017,10 @@ var Search = function Search(props) {
67990
68017
  };
67991
68018
  var onSearch = function onSearch(value, criterionList) {
67992
68019
  var list = criterionList ? criterionList : searchCriterionList;
67993
- props.onSearch(getSearchCriterionListWithoutKey(list));
68020
+ props.onSearch(list);
67994
68021
  setSelectedSearchCriterionList(getSelectedCriterionList(list));
67995
68022
  closeSettings();
67996
68023
  };
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
68024
  var getSelectedCriterionList = function getSelectedCriterionList(criterionList) {
68011
68025
  var list = criterionList.map(function (x) {
68012
68026
  var fieldName = props.fieldList.find(function (field) {
@@ -68024,13 +68038,24 @@ var Search = function Search(props) {
68024
68038
  var field = props.fieldList.find(function (field) {
68025
68039
  return field.internalName === x.internalName;
68026
68040
  });
68027
- var fieldWithKey = _extends({}, field, {
68028
- key: x.key
68029
- });
68030
- fieldList.push(fieldWithKey);
68041
+ fieldList.push(field);
68031
68042
  });
68032
68043
  return fieldList;
68033
68044
  };
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
+ };
68034
68059
  var onCancelSearch = function onCancelSearch() {
68035
68060
  setSearchCriterionList([]);
68036
68061
  setSelectedSearchCriterionList([]);
@@ -68039,17 +68064,11 @@ var Search = function Search(props) {
68039
68064
  props.onCancel();
68040
68065
  };
68041
68066
  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
68067
  var criterion = {
68048
68068
  condition: CONDITION_CONTAINS,
68049
68069
  operator: 0,
68050
68070
  internalName: props.defaultSearchFieldName,
68051
- valueList: [value],
68052
- key: key
68071
+ valueList: [value]
68053
68072
  };
68054
68073
  setSearchCriterionList([criterion]);
68055
68074
  };
@@ -68071,13 +68090,6 @@ var Search = function Search(props) {
68071
68090
  var onCancel = function onCancel() {
68072
68091
  closeSettings();
68073
68092
  };
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
68093
  var content = React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
68082
68094
  className: styles$1m['vitro-filter-container'],
68083
68095
  ref: filterContainerRef
@@ -68098,7 +68110,7 @@ var Search = function Search(props) {
68098
68110
  onAddField: onAddField,
68099
68111
  isShowAddFieldDialog: isShowAddFieldDialog,
68100
68112
  isMobileView: props.isMobileView,
68101
- fieldList: checkboxFieldList,
68113
+ checkboxFieldList: checkboxFieldList,
68102
68114
  onFieldListChange: onFieldListChange,
68103
68115
  isAllFieldsVisible: props.isAllFieldsVisible,
68104
68116
  filterContainerRef: filterContainerRef,