@bento-core/facet-filter 1.0.1-ccdihub.9 → 1.0.1-ctdc.0

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/README.md CHANGED
@@ -244,12 +244,66 @@ className={clsx(classes.sectionSummaryText, classes[facetClasses])}
244
244
  ## 10 CLearAllFilterButton Component
245
245
  Bento Core provides 1. function to clear all active filters, 2. disable flag (true incase of no active filters). Client is responsible for defining view (custom html).
246
246
  ```
247
- import { generateClearAllFilterBtn } from 'bento-core';
247
+ import { ClearAllFiltersBtn, FacetFilter } from '@bento-core/facet-filter';
248
+ import { getFilters } from '@bento-core/facet-filter';
248
249
 
249
250
  const CustomClearAllFiltersBtn = ({ onClearAllFilters, disable }) => {
250
251
  //...custom component 1. bind onClearFilters fn
251
252
  // 2. disable flag to disable button
252
- }
253
+ }
254
+ // get filter data
255
+ // filterState: state.statusReducer.filterState, (from reducer)
256
+ // const activeFilters = getFilters(filterState) // formating
257
+
258
+ <ClearAllFiltersBtn
259
+ Component={CustomClearAllFiltersBtn}
260
+ activeFilters={activeFilters}
261
+ />
262
+ ```
263
+
264
+ ## 11 Facet Value Component
265
+ ```
266
+ // response
267
+ // filterCaseCountByProgram: [{group: "COP", subjects: 301}]
268
+ const {
269
+ name,
270
+ customName,
271
+ subjects,
272
+ customSubjects,
273
+ tooltip,
274
+ } = checkboxItem;
275
+
276
+ // 1. by default facet value component display group ("COP")
277
+ // 2. set customName to display customize value
278
+ // 3. by default facet value component display subjects (301)
279
+ // 4. set customSubjects to display customize value or adjust correct field for subject count
280
+ // 5. tooltip - provide text value to tooltip text
281
+
282
+ /**
283
+ * Add Bento frontend filter count/subjects
284
+ * Add tootip text
285
+ */
286
+ const filterData = facetsConfig.reduce((acc, item) => {
287
+ const facetValues = searchData[item.apiPath];
288
+ if (!facetValues) {
289
+ return acc;
290
+ }
291
+ const subjectCounts = [...facetValues].map((checkbox) => {
292
+ const text = tooltipText[item.tooltipKey];
293
+ return {
294
+ ...checkbox,
295
+ customSubjects: checkbox.count,
296
+ tooltip: text ? text[checkbox.group] : undefined,
297
+ };
298
+ });
299
+ return { ...acc, [item.apiPath]: [...subjectCounts] };
300
+ }, {});
253
301
 
254
- const ClearAllFiltersButton = () => generateClearAllFilterBtn(CustomClearAllFiltersBtn);
302
+ <FacetFilter
303
+ data={filterData}
304
+ facetSectionConfig={facetSectionVariables}
305
+ facetsConfig={facetsConfig}
306
+ CustomFacetSection={CustomFacetSection}
307
+ CustomFacetView={CustomFacetView}
308
+ />
255
309
  ```
@@ -12,13 +12,13 @@ var _FacetFilterView = _interopRequireDefault(require("./FacetFilterView"));
12
12
  const _excluded = ["section"];
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
15
17
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
19
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
20
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
19
21
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22
22
  const FacetFilterController = props => {
23
23
  /**
24
24
  * update checkbox state
@@ -29,7 +29,8 @@ const FacetFilterController = props => {
29
29
  filterState,
30
30
  data,
31
31
  facetsConfig,
32
- facetSectionConfig
32
+ facetSectionConfig,
33
+ tooltipText = {}
33
34
  } = props;
34
35
  const updateFacetState = filterSections => {
35
36
  const updateSections = [...filterSections];
@@ -37,9 +38,16 @@ const FacetFilterController = props => {
37
38
  for (const [key, value] of Object.entries(filterState)) {
38
39
  updateSections.forEach(sideBar => {
39
40
  if (sideBar.type === _Types.InputTypes.CHECKBOX && sideBar.datafield === key) {
40
- sideBar.facetValues.forEach(item => {
41
- item.isChecked = value[item.name] ? value[item.name] : false;
41
+ const {
42
+ facetValues = []
43
+ } = sideBar;
44
+ const updateFacetVals = facetValues.map(item => {
45
+ const facetVal = item[sideBar.field];
46
+ return _objectSpread(_objectSpread({}, item), {}, {
47
+ isChecked: value[facetVal] ? value[facetVal] : false
48
+ });
42
49
  });
50
+ sideBar.facetValues = updateFacetVals;
43
51
  }
44
52
  if (sideBar.type === _Types.InputTypes.SLIDER && sideBar.datafield === key) {
45
53
  sideBar.facetValues = value;
@@ -49,9 +57,13 @@ const FacetFilterController = props => {
49
57
  } else {
50
58
  updateSections.forEach(sideBar => {
51
59
  if (sideBar.type === _Types.InputTypes.CHECKBOX) {
52
- sideBar.facetValues.forEach(item => {
53
- item.isChecked = false;
54
- });
60
+ const {
61
+ facetValues = []
62
+ } = sideBar;
63
+ const updateFacetVals = facetValues.map(item => _objectSpread(_objectSpread({}, item), {}, {
64
+ isChecked: false
65
+ }));
66
+ sideBar.facetValues = updateFacetVals;
55
67
  }
56
68
  /**
57
69
  * set default value for slider - on clear all filter
@@ -96,6 +108,7 @@ const FacetFilterController = props => {
96
108
  * Construct filter object
97
109
  * 1. add facet values to facets
98
110
  * 2. add 'name' key to each facet value
111
+ * 3. add '
99
112
  */
100
113
  const addFacetValues = facets => {
101
114
  const updateFacets = [];
@@ -105,19 +118,13 @@ const FacetFilterController = props => {
105
118
  facetValues: []
106
119
  });
107
120
  const {
108
- field,
109
121
  ApiLowerBoundName,
110
122
  ApiUpperBoundName,
111
123
  apiForFiltering
112
124
  } = updateFacet;
113
125
  if (data[apiForFiltering]) {
114
126
  if (Array.isArray(data[apiForFiltering])) {
115
- const updateField = data[apiForFiltering].map(item => {
116
- const addField = _objectSpread({}, item);
117
- addField.name = item[field];
118
- return addField;
119
- });
120
- updateFacet.facetValues = updateField;
127
+ updateFacet.facetValues = data[apiForFiltering];
121
128
  }
122
129
  /**
123
130
  * add object to facet values
@@ -128,7 +135,6 @@ const FacetFilterController = props => {
128
135
  updateFacet.minLowerBound = lowerBound;
129
136
  updateFacet.maxUpperBound = upperBound;
130
137
  updateFacet.facetValues = [lowerBound, upperBound];
131
- updateFacet.style = facet.style;
132
138
  }
133
139
  }
134
140
  updateFacets.push(updateFacet);
@@ -141,7 +147,6 @@ const FacetFilterController = props => {
141
147
  * Generate facet sections state
142
148
  *
143
149
  */
144
- // const displayFacets = facetsConfig.filter((facet) => facet.show).slice(0, 16);
145
150
  const displayFacets = facetsConfig.filter(facet => facet.show);
146
151
  const facetStates = addFacetValues(displayFacets);
147
152
  const updateState = updateFacetState(facetStates);
@@ -9,7 +9,6 @@ var _core = require("@material-ui/core");
9
9
  var _FacetFilterStyle = _interopRequireDefault(require("./FacetFilterStyle"));
10
10
  var _FacetSectionView = _interopRequireDefault(require("./components/section/FacetSectionView"));
11
11
  var _ReduxFacetView = _interopRequireDefault(require("./components/facet/ReduxFacetView"));
12
- var _FilterItems = _interopRequireDefault(require("./components/inputs/FilterItems"));
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
13
  /* eslint-disable arrow-body-style */
15
14
  /* eslint-disable padded-blocks */
@@ -29,11 +28,7 @@ const BentoFacetFilter = _ref => {
29
28
  }, section.items.map(facet => /*#__PURE__*/_react.default.createElement(_ReduxFacetView.default, {
30
29
  facet: facet,
31
30
  CustomView: CustomFacetView
32
- }, /*#__PURE__*/_react.default.createElement(_core.List, {
33
- className: "List_".concat(facet.label)
34
- }, /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
35
- facet: facet
36
- }))))))));
31
+ }))))));
37
32
  };
38
33
  var _default = (0, _core.withStyles)(_FacetFilterStyle.default)(BentoFacetFilter);
39
34
  exports.default = _default;
@@ -82,7 +82,7 @@ const FacetView = _ref => {
82
82
  className: (0, _clsx.default)(classes.subSectionSummaryText, {
83
83
  ["activeFacet".concat(facet.section)]: isActiveFacet
84
84
  })
85
- }, facet.label)), facetValues.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
85
+ }, facet.label)), (facet.type === _Types.InputTypes.SLIDER || facetValues.length === 0) && /*#__PURE__*/_react.default.createElement("div", {
86
86
  className: classes.NonSortGroup
87
87
  }, /*#__PURE__*/_react.default.createElement("span", {
88
88
  className: classes.NonSortGroupItem
@@ -114,10 +114,10 @@ const FacetView = _ref => {
114
114
  onClick: () => {
115
115
  onSortFacet(_Sort.sortType.NUMERIC);
116
116
  }
117
- }, "Sort by count"))), /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
117
+ }, "Sort by count"))), expand && /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
118
118
  facet: facet,
119
119
  sortBy: sortBy
120
- })), !expand && type === _Types.InputTypes.CHECKBOX && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.List, {
120
+ })), !expand && type === _Types.InputTypes.CHECKBOX && selectedItems.length > 0 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.List, {
121
121
  id: "filter_Items"
122
122
  }, /*#__PURE__*/_react.default.createElement(_FilterItems.default, {
123
123
  facet: displayFacet
@@ -9,8 +9,6 @@ var _styles = require("@material-ui/core/styles");
9
9
  var _core = require("@material-ui/core");
10
10
  var _clsx = _interopRequireDefault(require("clsx"));
11
11
  var _icons = require("@material-ui/icons");
12
- var _emptycheckbox = _interopRequireDefault(require("./assets/emptycheckbox.svg"));
13
- var _checkedbox = _interopRequireDefault(require("./assets/checkedbox.svg"));
14
12
  var _CheckboxStyle = _interopRequireDefault(require("./CheckboxStyle"));
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
14
  /* eslint-disable no-unused-vars */
@@ -20,8 +18,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
18
  /* eslint-disable object-curly-newline */
21
19
  /* eslint-disable object-shorthand */
22
20
  /* eslint-disable react/jsx-one-expression-per-line */
21
+ /* eslint-disable no-useless-escape */
23
22
 
24
- const alignment = 'flex-start';
25
23
  const CheckBoxView = _ref => {
26
24
  let {
27
25
  classes,
@@ -31,16 +29,19 @@ const CheckBoxView = _ref => {
31
29
  facet
32
30
  } = _ref;
33
31
  const {
34
- name,
35
- subjects,
36
32
  isChecked = false,
37
33
  index,
38
34
  section,
39
- tooltip,
40
- label
35
+ tooltip
41
36
  } = checkboxItem;
37
+ const {
38
+ field = 'group',
39
+ count = 'subjects',
40
+ customCount = text => "(".concat(text, ")")
41
+ } = facet;
42
42
  const indexType = index % 2 === 0 ? 'Even' : 'Odd';
43
- const checkedSection = "".concat(section).toLowerCase().replace(' ', '_');
43
+ const checkedSection = "".concat(section).toLowerCase().replace(/\ /g, '_');
44
+ const name = checkboxItem[field] || 'N/A';
44
45
  const handleToggle = () => {
45
46
  const toggleCheckBoxItem = {
46
47
  name: name,
@@ -55,9 +56,7 @@ const CheckBoxView = _ref => {
55
56
  ["".concat(checkedSection, "NameUnChecked")]: !isChecked,
56
57
  ["".concat(checkedSection, "NameChecked")]: isChecked
57
58
  })
58
- }, label ? /*#__PURE__*/_react.default.createElement(_core.Typography, {
59
- className: classes.checkboxLabel
60
- }, label) : /*#__PURE__*/_react.default.createElement(_core.Typography, {
59
+ }, /*#__PURE__*/_react.default.createElement(_core.Typography, {
61
60
  className: classes.checkboxName
62
61
  }, name));
63
62
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.ListItem, {
@@ -73,43 +72,41 @@ const CheckBoxView = _ref => {
73
72
  })
74
73
  }, /*#__PURE__*/_react.default.createElement(_core.Checkbox, {
75
74
  id: "checkbox_".concat(facet.label, "_").concat(name),
76
- icon: /*#__PURE__*/_react.default.createElement(_core.Icon, {
75
+ icon: /*#__PURE__*/_react.default.createElement(_icons.CheckBoxOutlineBlank, {
77
76
  style: {
78
- fontSize: '18px',
79
- lineHeight: '22px'
80
- }
81
- }, /*#__PURE__*/_react.default.createElement("img", {
82
- src: _emptycheckbox.default,
83
- alt: "checkbox-icon"
84
- })),
77
+ fontSize: 18
78
+ },
79
+ className: checkedSection
80
+ }),
85
81
  onClick: handleToggle,
86
82
  checked: isChecked,
87
- checkedIcon: /*#__PURE__*/_react.default.createElement(_core.Icon, {
83
+ checkedIcon: /*#__PURE__*/_react.default.createElement(_icons.CheckBox, {
88
84
  style: {
89
- fontSize: '18px',
90
- lineHeight: '22px'
85
+ fontSize: 18
91
86
  },
92
87
  className: "".concat(checkedSection, "CheckedIcon")
93
- }, /*#__PURE__*/_react.default.createElement("img", {
94
- src: _checkedbox.default,
95
- alt: "checkedBox-icon"
96
- })),
88
+ }),
97
89
  disableRipple: true,
98
90
  color: "secondary",
99
91
  classes: {
100
92
  root: classes.checkboxRoot
93
+ },
94
+ inputProps: {
95
+ 'aria-label': 'Select'
101
96
  }
102
97
  }), tooltip ? /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
103
98
  id: datafield,
104
99
  title: tooltip
105
100
  }, /*#__PURE__*/_react.default.createElement("div", {
106
101
  className: datafield
107
- }, /*#__PURE__*/_react.default.createElement(LabelComponent, null))) : /*#__PURE__*/_react.default.createElement(LabelComponent, null), /*#__PURE__*/_react.default.createElement(_core.ListItemText, null), /*#__PURE__*/_react.default.createElement(_core.Typography, {
102
+ }, name)) : /*#__PURE__*/_react.default.createElement(LabelComponent, null), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
103
+ className: "".concat(checkedSection, "_md_space")
104
+ }), /*#__PURE__*/_react.default.createElement(_core.Typography, {
108
105
  className: (0, _clsx.default)("".concat(checkedSection, "Subjects"), {
109
106
  ["".concat(checkedSection, "SubjectUnChecked")]: !isChecked,
110
107
  ["".concat(checkedSection, "SubjectChecked")]: isChecked
111
108
  })
112
- }, "(".concat(subjects, ")"))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
109
+ }, customCount(checkboxItem[count] || 0))), /*#__PURE__*/_react.default.createElement(_core.Divider, {
113
110
  style: {
114
111
  backgroundColor: isChecked ? '#FFFFFF' : '#b1b1b1',
115
112
  margin: '0px',
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
+ var _SliderStyle = _interopRequireDefault(require("./SliderStyle"));
9
10
  var _Types = require("../Types");
10
11
  var _InputMinMaxView = _interopRequireDefault(require("./InputMinMaxView"));
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -97,7 +98,6 @@ const SliderView = _ref => {
97
98
  min: minLowerBound,
98
99
  max: maxUpperBound,
99
100
  classes: {
100
- colorPrimary: classes.colorPrimary,
101
101
  rail: classes.rail,
102
102
  thumb: isValid() ? classes.thumb : classes.invalidThumb,
103
103
  track: isValid() ? classes.track : classes.invalidTrack
@@ -112,125 +112,5 @@ const SliderView = _ref => {
112
112
  className: isValid() ? classes.sliderText : classes.invalidSliderText
113
113
  }, sliderValue[0], ' - ', sliderValue[1], "\xA0", quantifier));
114
114
  };
115
- const styles = () => ({
116
- colorPrimary: props => props.facet.style && props.facet.style.colorPrimary ? props.facet.style.colorPrimary : {
117
- color: '#3f51b5'
118
- },
119
- sliderRoot: props => props.facet.style && props.facet.style.sliderRoot ? props.facet.style.sliderRoot : {
120
- marginTop: '10px',
121
- marginLeft: '20px',
122
- marginRight: 'Auto',
123
- paddingRight: '20px'
124
- },
125
- minValue: props => props.facet.style && props.facet.style.minValue ? props.facet.style.minValue : {
126
- fontFamily: 'Nunito',
127
- fontSize: '15px',
128
- color: '#000000',
129
- marginBottom: '0px',
130
- float: 'left',
131
- width: '75px',
132
- display: 'flex'
133
- },
134
- maxValue: props => props.facet.style && props.facet.style.maxValue ? props.facet.style.maxValue : {
135
- fontFamily: 'Nunito',
136
- fontSize: '15px',
137
- color: '#000000',
138
- float: 'right',
139
- marginBottom: '0px',
140
- display: 'flex'
141
- },
142
- rail: props => props.facet.style && props.facet.style.rail ? props.facet.style.rail : {
143
- borderRadius: 4,
144
- height: 6,
145
- background: '#142D64'
146
- },
147
- minInputLabel: props => props.facet.style && props.facet.style.minInputLabel ? props.facet.style.minInputLabel : {
148
- float: 'left',
149
- lineHeight: '34px',
150
- marginRight: '5px'
151
- },
152
- maxInputLabel: props => props.facet.style && props.facet.style.maxInputLabel ? props.facet.style.maxInputLabel : {
153
- float: 'left',
154
- lineHeight: '34px',
155
- marginRight: '5px'
156
- },
157
- thumb: props => props.facet.style && props.facet.style.thumb ? props.facet.style.thumb : {
158
- height: 16,
159
- width: 16,
160
- background: '#10A075'
161
- },
162
- invalidThumb: props => props.facet.style && props.facet.style.invalidThumb ? props.facet.style.invalidThumb : {
163
- height: 16,
164
- width: 16,
165
- background: '#F44336'
166
- },
167
- track: props => props.facet.style && props.facet.style.track ? props.facet.style.track : {
168
- borderRadius: 4,
169
- height: 6,
170
- background: '#10A075',
171
- '&~&': {
172
- background: '#142D64'
173
- }
174
- },
175
- invalidTrack: props => props.facet.style && props.facet.style.invalidTrack ? props.facet.style.invalidTrack : {
176
- borderRadius: 4,
177
- height: 6,
178
- background: '#F44336',
179
- '&~&': {
180
- background: '#142D64'
181
- }
182
- },
183
- upperBound: props => props.facet.style && props.facet.style.upperBound ? props.facet.style.upperBound : {
184
- fontFamily: 'Nunito',
185
- fontSize: '10px',
186
- color: '#000000',
187
- float: 'right',
188
- marginLeft: 'Auto',
189
- marginRight: 'Auto',
190
- marginBottom: '15px'
191
- },
192
- lowerBound: props => props.facet.style && props.facet.style.lowerBound ? props.facet.style.lowerBound : {
193
- fontFamily: 'Nunito',
194
- fontSize: '10px',
195
- color: '#000000',
196
- float: 'left',
197
- marginLeft: 'Auto',
198
- marginRight: 'Auto',
199
- marginBottom: '15px'
200
- },
201
- sliderText: props => props.facet.style && props.facet.style.sliderText ? props.facet.style.sliderText : {
202
- color: '#10a075',
203
- lineHeight: '120%',
204
- fontFamily: 'Nunito',
205
- fontSize: '14px',
206
- padding: '5px 15px 5px 0px',
207
- width: '100%',
208
- textAlign: 'right',
209
- background: '#f5fdee',
210
- marginTop: '10px'
211
- },
212
- invalidSliderText: props => props.facet.style && props.facet.style.invalidSliderText ? props.facet.style.invalidSliderText : {
213
- color: '#D32F2F',
214
- lineHeight: '120%',
215
- fontFamily: 'Nunito',
216
- fontSize: '14px',
217
- padding: '5px 15px 5px 0px',
218
- width: '100%',
219
- textAlign: 'right',
220
- background: '#E57373',
221
- marginTop: '10px'
222
- },
223
- sliderListItem: props => props.facet.style && props.facet.style.sliderListItem ? props.facet.style.sliderListItem : {
224
- height: '15px'
225
- },
226
- listItemGutters: props => props.facet.style && props.facet.style.listItemGutters ? props.facet.style.listItemGutters : {
227
- display: 'flex',
228
- justifyContent: 'space-between',
229
- padding: '2px 5px 2px 8px'
230
- },
231
- lowerUpperBound: props => props.facet.style && props.facet.style.lowerUpperBound ? props.facet.style.lowerUpperBound : {
232
- height: '15px'
233
- }
234
- });
235
- var _default = (0, _core.withStyles)(styles)(SliderView);
115
+ var _default = (0, _core.withStyles)(_SliderStyle.default)(SliderView);
236
116
  exports.default = _default;
@@ -46,28 +46,30 @@ const sortBySection = _ref => {
46
46
  let {
47
47
  facetValues,
48
48
  sort_type,
49
- sortBy
49
+ sortBy,
50
+ field,
51
+ count = 'subjects'
50
52
  } = _ref;
51
53
  const sortfacetValues = [...facetValues];
52
54
  if (!sortfacetValues) {
53
55
  return facetValues;
54
56
  }
55
57
  if (sortBy === sortType.NUMERIC) {
56
- sortfacetValues.sort((a, b) => b.subjects - a.subjects);
58
+ sortfacetValues.sort((a, b) => b[count] - a[count]);
57
59
  } else {
58
- sortfacetValues.sort((a, b) => lowerCaseString(a.name) > lowerCaseString(b.name) || -(lowerCaseString(a.name) < lowerCaseString(b.name)));
60
+ sortfacetValues.sort((a, b) => lowerCaseString(a[field]) > lowerCaseString(b[field]) || -(lowerCaseString(a[field]) < lowerCaseString(b[field])));
59
61
  }
60
62
  if (sort_type === sortType.CUSTOM_NUMBER && sortBy !== sortType.NUMERIC) {
61
63
  sortfacetValues.sort((a, b) => {
62
- const aNumbs = getNumberArray(a.name);
63
- const bNumbs = getNumberArray(b.name);
64
+ const aNumbs = getNumberArray(a[field]);
65
+ const bNumbs = getNumberArray(b[field]);
64
66
  const aNumb = Number(aNumbs[0]);
65
67
  const bNumb = Number(bNumbs[0]);
66
68
  return aNumbs.length === bNumbs.length ? aNumb > bNumb : -(aNumb <= bNumb);
67
69
  });
68
70
  }
69
71
  if (sort_type === sortType.RANGE && sortBy !== sortType.NUMERIC) {
70
- sortfacetValues.sort((a, b) => startIndex(a.name) > startIndex(b.name) || -(startIndex(a.name) < startIndex(b.name)));
72
+ sortfacetValues.sort((a, b) => startIndex(a[field]) > startIndex(b[field]) || -(startIndex(a[field]) < startIndex(b[field])));
71
73
  }
72
74
  /**
73
75
  * Display checked item always on top
package/package.json CHANGED
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-ccdihub.9",
4
- "description": "### Bento core sidebar design:",
3
+ "version": "1.0.1-ctdc.0",
4
+ "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "lint": "eslint src"
10
10
  },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/CBIIT/bento-frontend.git"
14
- },
11
+ "repository": "https://github.com/CBIIT/bento-frontend",
15
12
  "publishConfig": {
16
13
  "access": "public"
17
14
  },
@@ -27,9 +24,5 @@
27
24
  "react-redux": "^7.2.1"
28
25
  },
29
26
  "author": "CTOS Bento Team",
30
- "license": "ISC",
31
- "bugs": {
32
- "url": "https://github.com/CBIIT/bento-frontend/issues"
33
- },
34
- "homepage": "https://github.com/CBIIT/bento-frontend#readme"
27
+ "license": "ISC"
35
28
  }
@@ -25,6 +25,7 @@ const FacetFilterController = (props) => {
25
25
  data,
26
26
  facetsConfig,
27
27
  facetSectionConfig,
28
+ tooltipText = {},
28
29
  } = props;
29
30
 
30
31
  const updateFacetState = (filterSections) => {
@@ -33,9 +34,15 @@ const FacetFilterController = (props) => {
33
34
  for (const [key, value] of Object.entries(filterState)) {
34
35
  updateSections.forEach((sideBar) => {
35
36
  if (sideBar.type === InputTypes.CHECKBOX && sideBar.datafield === key) {
36
- sideBar.facetValues.forEach((item) => {
37
- item.isChecked = value[item.name] ? value[item.name] : false;
37
+ const { facetValues = [] } = sideBar;
38
+ const updateFacetVals = facetValues.map((item) => {
39
+ const facetVal = item[sideBar.field];
40
+ return {
41
+ ...item,
42
+ isChecked: value[facetVal] ? value[facetVal] : false,
43
+ };
38
44
  });
45
+ sideBar.facetValues = updateFacetVals;
39
46
  }
40
47
  if (sideBar.type === InputTypes.SLIDER && sideBar.datafield === key) {
41
48
  sideBar.facetValues = value;
@@ -45,9 +52,12 @@ const FacetFilterController = (props) => {
45
52
  } else {
46
53
  updateSections.forEach((sideBar) => {
47
54
  if (sideBar.type === InputTypes.CHECKBOX) {
48
- sideBar.facetValues.forEach((item) => {
49
- item.isChecked = false;
50
- });
55
+ const { facetValues = [] } = sideBar;
56
+ const updateFacetVals = facetValues.map((item) => ({
57
+ ...item,
58
+ isChecked: false,
59
+ }));
60
+ sideBar.facetValues = updateFacetVals;
51
61
  }
52
62
  /**
53
63
  * set default value for slider - on clear all filter
@@ -83,6 +93,7 @@ const FacetFilterController = (props) => {
83
93
  * Construct filter object
84
94
  * 1. add facet values to facets
85
95
  * 2. add 'name' key to each facet value
96
+ * 3. add '
86
97
  */
87
98
  const addFacetValues = (facets) => {
88
99
  const updateFacets = [];
@@ -90,19 +101,13 @@ const FacetFilterController = (props) => {
90
101
  facets.forEach((facet) => {
91
102
  const updateFacet = { ...facet, facetValues: [] };
92
103
  const {
93
- field,
94
104
  ApiLowerBoundName,
95
105
  ApiUpperBoundName,
96
106
  apiForFiltering,
97
107
  } = updateFacet;
98
108
  if (data[apiForFiltering]) {
99
109
  if (Array.isArray(data[apiForFiltering])) {
100
- const updateField = data[apiForFiltering].map((item) => {
101
- const addField = { ...item };
102
- addField.name = item[field];
103
- return addField;
104
- });
105
- updateFacet.facetValues = updateField;
110
+ updateFacet.facetValues = data[apiForFiltering];
106
111
  }
107
112
  /**
108
113
  * add object to facet values
@@ -113,7 +118,6 @@ const FacetFilterController = (props) => {
113
118
  updateFacet.minLowerBound = lowerBound;
114
119
  updateFacet.maxUpperBound = upperBound;
115
120
  updateFacet.facetValues = [lowerBound, upperBound];
116
- updateFacet.style = facet.style;
117
121
  }
118
122
  }
119
123
  updateFacets.push(updateFacet);
@@ -126,7 +130,6 @@ const FacetFilterController = (props) => {
126
130
  * Generate facet sections state
127
131
  *
128
132
  */
129
- // const displayFacets = facetsConfig.filter((facet) => facet.show).slice(0, 16);
130
133
  const displayFacets = facetsConfig.filter((facet) => facet.show);
131
134
  const facetStates = addFacetValues(displayFacets);
132
135
  const updateState = updateFacetState(facetStates);
@@ -3,13 +3,11 @@
3
3
  import React from 'react';
4
4
  import {
5
5
  Divider,
6
- List,
7
6
  withStyles,
8
7
  } from '@material-ui/core';
9
8
  import styles from './FacetFilterStyle';
10
9
  import FacetSectionView from './components/section/FacetSectionView';
11
10
  import FacetView from './components/facet/ReduxFacetView';
12
- import FilterItems from './components/inputs/FilterItems';
13
11
 
14
12
  const BentoFacetFilter = ({
15
13
  sideBarSections,
@@ -33,13 +31,7 @@ const BentoFacetFilter = ({
33
31
  <FacetView
34
32
  facet={facet}
35
33
  CustomView={CustomFacetView}
36
- >
37
- <List className={`List_${facet.label}`}>
38
- <FilterItems
39
- facet={facet}
40
- />
41
- </List>
42
- </FacetView>
34
+ />
43
35
  ))}
44
36
  </FacetSectionView>
45
37
  </>
@@ -92,7 +92,7 @@ const FacetView = ({
92
92
  </CustomAccordionSummary>
93
93
  )}
94
94
  {
95
- (facetValues.length === 0)
95
+ (facet.type === InputTypes.SLIDER || facetValues.length === 0)
96
96
  && (
97
97
  <div className={classes.NonSortGroup}>
98
98
  <span
@@ -152,13 +152,16 @@ const FacetView = ({
152
152
  </div>
153
153
  )
154
154
  }
155
- <FilterItems
156
- facet={facet}
157
- sortBy={sortBy}
158
- />
155
+ {(expand)
156
+ && (
157
+ <FilterItems
158
+ facet={facet}
159
+ sortBy={sortBy}
160
+ />
161
+ )}
159
162
  </Accordion>
160
163
  {
161
- (!expand && type === InputTypes.CHECKBOX) && (
164
+ (!expand && type === InputTypes.CHECKBOX && selectedItems.length > 0) && (
162
165
  <>
163
166
  <List id="filter_Items">
164
167
  <FilterItems
@@ -5,6 +5,8 @@
5
5
  /* eslint-disable object-curly-newline */
6
6
  /* eslint-disable object-shorthand */
7
7
  /* eslint-disable react/jsx-one-expression-per-line */
8
+ /* eslint-disable no-useless-escape */
9
+
8
10
  import React from 'react';
9
11
  import { withStyles } from '@material-ui/core/styles';
10
12
  import {
@@ -15,18 +17,13 @@ import {
15
17
  Tooltip,
16
18
  Box,
17
19
  Typography,
18
- Icon,
19
20
  } from '@material-ui/core';
20
21
  import clsx from 'clsx';
21
22
  import {
22
23
  CheckBox as CheckBoxIcon, CheckBoxOutlineBlank as CheckBoxBlankIcon,
23
24
  } from '@material-ui/icons';
24
- import emptyCheckBox from './assets/emptycheckbox.svg';
25
- import checkedBox from './assets/checkedbox.svg';
26
25
  import styles from './CheckboxStyle';
27
26
 
28
- const alignment = 'flex-start';
29
-
30
27
  const CheckBoxView = ({
31
28
  classes,
32
29
  checkboxItem,
@@ -35,16 +32,21 @@ const CheckBoxView = ({
35
32
  facet,
36
33
  }) => {
37
34
  const {
38
- name,
39
- subjects,
40
35
  isChecked = false,
41
36
  index,
42
37
  section,
43
38
  tooltip,
44
- label,
45
39
  } = checkboxItem;
40
+ const {
41
+ field = 'group',
42
+ count = 'subjects',
43
+ customCount = (text) => `(${text})`,
44
+ } = facet;
45
+
46
46
  const indexType = index % 2 === 0 ? 'Even' : 'Odd';
47
- const checkedSection = `${section}`.toLowerCase().replace(' ', '_');
47
+ const checkedSection = `${section}`.toLowerCase().replace(/\ /g, '_');
48
+
49
+ const name = checkboxItem[field] || 'N/A';
48
50
 
49
51
  const handleToggle = () => {
50
52
  const toggleCheckBoxItem = {
@@ -63,9 +65,9 @@ const CheckBoxView = ({
63
65
  [`${checkedSection}NameChecked`]: isChecked,
64
66
  })}
65
67
  >
66
- {label ? (
67
- <Typography className={classes.checkboxLabel}>{label}</Typography>
68
- ) : (<Typography className={classes.checkboxName}>{name}</Typography>)}
68
+ <Typography className={classes.checkboxName}>
69
+ {name}
70
+ </Typography>
69
71
  </Box>
70
72
  );
71
73
 
@@ -82,54 +84,43 @@ const CheckBoxView = ({
82
84
  <Checkbox
83
85
  id={`checkbox_${facet.label}_${name}`}
84
86
  icon={
85
- <Icon style={{
86
- fontSize: '18px',
87
- lineHeight: '22px',
88
- }}
89
- >
90
- <img
91
- src={emptyCheckBox}
92
- alt="checkbox-icon"
93
- />
94
- </Icon>
87
+ <CheckBoxBlankIcon
88
+ style={{ fontSize: 18 }}
89
+ className={checkedSection}
90
+ />
95
91
  }
96
92
  onClick={handleToggle}
97
93
  checked={isChecked}
98
94
  checkedIcon={(
99
- <Icon
95
+ <CheckBoxIcon
100
96
  style={{
101
- fontSize: '18px',
102
- lineHeight: '22px',
97
+ fontSize: 18,
103
98
  }}
104
99
  className={`${checkedSection}CheckedIcon`}
105
- >
106
- <img
107
- src={checkedBox}
108
- alt="checkedBox-icon"
109
- />
110
- </Icon>
100
+ />
111
101
  )}
112
102
  disableRipple
113
103
  color="secondary"
114
104
  classes={{ root: classes.checkboxRoot }}
105
+ inputProps={{ 'aria-label': 'Select' }}
115
106
  />
116
107
  { tooltip ? (
117
108
  <Tooltip id={datafield} title={tooltip}>
118
109
  <div className={datafield}>
119
- <LabelComponent />
110
+ {name}
120
111
  </div>
121
112
  </Tooltip>
122
113
  ) : (
123
114
  <LabelComponent />
124
115
  )}
125
- <ListItemText />
116
+ <ListItemText className={`${checkedSection}_md_space`} />
126
117
  <Typography
127
118
  className={clsx(`${checkedSection}Subjects`, {
128
119
  [`${checkedSection}SubjectUnChecked`]: !isChecked,
129
120
  [`${checkedSection}SubjectChecked`]: isChecked,
130
121
  })}
131
122
  >
132
- {`(${subjects})`}
123
+ {customCount(checkboxItem[count] || 0)}
133
124
  </Typography>
134
125
  </ListItem>
135
126
  <Divider
@@ -4,7 +4,7 @@
4
4
  /* eslint-disable object-curly-newline */
5
5
  import React, { useEffect, useState } from 'react';
6
6
  import { withStyles, Slider, Typography, Box } from '@material-ui/core';
7
- // import styles from './SliderStyle';
7
+ import styles from './SliderStyle';
8
8
  import { silderTypes } from '../Types';
9
9
  import InputMinMaxView from './InputMinMaxView';
10
10
 
@@ -93,7 +93,6 @@ const SliderView = ({
93
93
  min={minLowerBound}
94
94
  max={maxUpperBound}
95
95
  classes={{
96
- colorPrimary: classes.colorPrimary,
97
96
  rail: classes.rail,
98
97
  thumb: isValid() ? classes.thumb : classes.invalidThumb,
99
98
  track: isValid() ? classes.track : classes.invalidTrack,
@@ -114,7 +113,9 @@ const SliderView = ({
114
113
  (sliderValue[0] > minLowerBound || sliderValue[1] < maxUpperBound)
115
114
  && (
116
115
  <Typography
117
- className={isValid() ? classes.sliderText : classes.invalidSliderText}
116
+ className={isValid()
117
+ ? classes.sliderText
118
+ : classes.invalidSliderText}
118
119
  >
119
120
  {sliderValue[0]}
120
121
  {' - '}
@@ -128,161 +129,4 @@ const SliderView = ({
128
129
  );
129
130
  };
130
131
 
131
- const styles = () => ({
132
- colorPrimary: (props) => (props.facet.style && props.facet.style.colorPrimary
133
- ? props.facet.style.colorPrimary
134
- : {
135
- color: '#3f51b5',
136
- }),
137
- sliderRoot: (props) => (props.facet.style && props.facet.style.sliderRoot
138
- ? props.facet.style.sliderRoot
139
- : {
140
- marginTop: '10px',
141
- marginLeft: '20px',
142
- marginRight: 'Auto',
143
- paddingRight: '20px',
144
- }),
145
- minValue: (props) => (props.facet.style && props.facet.style.minValue
146
- ? props.facet.style.minValue
147
- : {
148
- fontFamily: 'Nunito',
149
- fontSize: '15px',
150
- color: '#000000',
151
- marginBottom: '0px',
152
- float: 'left',
153
- width: '75px',
154
- display: 'flex',
155
- }),
156
- maxValue: (props) => (props.facet.style && props.facet.style.maxValue
157
- ? props.facet.style.maxValue
158
- : {
159
- fontFamily: 'Nunito',
160
- fontSize: '15px',
161
- color: '#000000',
162
- float: 'right',
163
- marginBottom: '0px',
164
- display: 'flex',
165
- }),
166
- rail: (props) => (props.facet.style && props.facet.style.rail
167
- ? props.facet.style.rail
168
- : {
169
- borderRadius: 4,
170
- height: 6,
171
- background: '#142D64',
172
- }),
173
- minInputLabel: (props) => (props.facet.style && props.facet.style.minInputLabel
174
- ? props.facet.style.minInputLabel
175
- : {
176
- float: 'left',
177
- lineHeight: '34px',
178
- marginRight: '5px',
179
- }),
180
- maxInputLabel: (props) => (props.facet.style && props.facet.style.maxInputLabel
181
- ? props.facet.style.maxInputLabel
182
- : {
183
- float: 'left',
184
- lineHeight: '34px',
185
- marginRight: '5px',
186
- }),
187
- thumb: (props) => (props.facet.style && props.facet.style.thumb
188
- ? props.facet.style.thumb
189
- : {
190
- height: 16,
191
- width: 16,
192
- background: '#10A075',
193
- }),
194
- invalidThumb: (props) => (props.facet.style && props.facet.style.invalidThumb
195
- ? props.facet.style.invalidThumb
196
- : {
197
- height: 16,
198
- width: 16,
199
- background: '#F44336',
200
- }),
201
- track: (props) => (props.facet.style && props.facet.style.track
202
- ? props.facet.style.track
203
- : {
204
- borderRadius: 4,
205
- height: 6,
206
- background: '#10A075',
207
- '&~&': {
208
- background: '#142D64',
209
- },
210
- }),
211
- invalidTrack: (props) => (props.facet.style && props.facet.style.invalidTrack
212
- ? props.facet.style.invalidTrack
213
- : {
214
- borderRadius: 4,
215
- height: 6,
216
- background: '#F44336',
217
- '&~&': {
218
- background: '#142D64',
219
- },
220
- }),
221
- upperBound: (props) => (props.facet.style && props.facet.style.upperBound
222
- ? props.facet.style.upperBound
223
- : {
224
- fontFamily: 'Nunito',
225
- fontSize: '10px',
226
- color: '#000000',
227
- float: 'right',
228
- marginLeft: 'Auto',
229
- marginRight: 'Auto',
230
- marginBottom: '15px',
231
- }),
232
- lowerBound: (props) => (props.facet.style && props.facet.style.lowerBound
233
- ? props.facet.style.lowerBound
234
- : {
235
- fontFamily: 'Nunito',
236
- fontSize: '10px',
237
- color: '#000000',
238
- float: 'left',
239
- marginLeft: 'Auto',
240
- marginRight: 'Auto',
241
- marginBottom: '15px',
242
- }),
243
- sliderText: (props) => (props.facet.style && props.facet.style.sliderText
244
- ? props.facet.style.sliderText
245
- : {
246
- color: '#10a075',
247
- lineHeight: '120%',
248
- fontFamily: 'Nunito',
249
- fontSize: '14px',
250
- padding: '5px 15px 5px 0px',
251
- width: '100%',
252
- textAlign: 'right',
253
- background: '#f5fdee',
254
- marginTop: '10px',
255
- }),
256
- invalidSliderText: (props) => (props.facet.style && props.facet.style.invalidSliderText
257
- ? props.facet.style.invalidSliderText
258
- : {
259
- color: '#D32F2F',
260
- lineHeight: '120%',
261
- fontFamily: 'Nunito',
262
- fontSize: '14px',
263
- padding: '5px 15px 5px 0px',
264
- width: '100%',
265
- textAlign: 'right',
266
- background: '#E57373',
267
- marginTop: '10px',
268
- }),
269
- sliderListItem: (props) => (props.facet.style && props.facet.style.sliderListItem
270
- ? props.facet.style.sliderListItem
271
- : {
272
- height: '15px',
273
- }),
274
- listItemGutters: (props) => (props.facet.style && props.facet.style.listItemGutters
275
- ? props.facet.style.listItemGutters
276
- : {
277
- display: 'flex',
278
- justifyContent: 'space-between',
279
- padding: '2px 5px 2px 8px',
280
- }),
281
- lowerUpperBound: (props) => (props.facet.style && props.facet.style.lowerUpperBound
282
- ? props.facet.style.lowerUpperBound
283
- : {
284
- height: '15px',
285
- }),
286
- });
287
-
288
132
  export default withStyles(styles)(SliderView);
package/src/utils/Sort.js CHANGED
@@ -37,22 +37,28 @@ export const getNumberArray = (range) => {
37
37
  * @param {array} checkboxData
38
38
  * @return {array}
39
39
  */
40
- export const sortBySection = ({ facetValues, sort_type, sortBy }) => {
40
+ export const sortBySection = ({
41
+ facetValues,
42
+ sort_type,
43
+ sortBy,
44
+ field,
45
+ count = 'subjects',
46
+ }) => {
41
47
  const sortfacetValues = [...facetValues];
42
48
  if (!sortfacetValues) {
43
49
  return facetValues;
44
50
  }
45
51
  if (sortBy === sortType.NUMERIC) {
46
- sortfacetValues.sort((a, b) => b.subjects - a.subjects);
52
+ sortfacetValues.sort((a, b) => b[count] - a[count]);
47
53
  } else {
48
- sortfacetValues.sort(((a, b) => (lowerCaseString(a.name) > lowerCaseString(b.name)
49
- || -(lowerCaseString(a.name) < lowerCaseString(b.name)))));
54
+ sortfacetValues.sort(((a, b) => (lowerCaseString(a[field]) > lowerCaseString(b[field])
55
+ || -(lowerCaseString(a[field]) < lowerCaseString(b[field])))));
50
56
  }
51
57
 
52
58
  if (sort_type === sortType.CUSTOM_NUMBER && sortBy !== sortType.NUMERIC) {
53
59
  sortfacetValues.sort((a, b) => {
54
- const aNumbs = getNumberArray(a.name);
55
- const bNumbs = getNumberArray(b.name);
60
+ const aNumbs = getNumberArray(a[field]);
61
+ const bNumbs = getNumberArray(b[field]);
56
62
  const aNumb = Number(aNumbs[0]);
57
63
  const bNumb = Number(bNumbs[0]);
58
64
  return (aNumbs.length === bNumbs.length) ? aNumb > bNumb : -(aNumb <= bNumb);
@@ -60,8 +66,8 @@ export const sortBySection = ({ facetValues, sort_type, sortBy }) => {
60
66
  }
61
67
 
62
68
  if (sort_type === sortType.RANGE && sortBy !== sortType.NUMERIC) {
63
- sortfacetValues.sort(((a, b) => (startIndex(a.name) > startIndex(b.name)
64
- || -(startIndex(a.name) < startIndex(b.name)))));
69
+ sortfacetValues.sort(((a, b) => (startIndex(a[field]) > startIndex(b[field])
70
+ || -(startIndex(a[field]) < startIndex(b[field])))));
65
71
  }
66
72
  /**
67
73
  * Display checked item always on top
@@ -1,4 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#6D5F5B"/>
3
- <path d="M3 6.52174L4.95652 10L12 2" stroke="white" stroke-width="2"/>
4
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#6D5F5B"/>
3
- <rect width="14" height="14" fill="#6D5F5B"/>
4
- <rect x="0.5" y="0.5" width="13" height="13" fill="white" stroke="#6D5F5B"/>
5
- </svg>
@@ -1,4 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#6D5F5B"/>
3
- <path d="M3 6.52174L4.95652 10L12 2" stroke="white" stroke-width="2"/>
4
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#6D5F5B"/>
3
- <rect width="14" height="14" fill="#6D5F5B"/>
4
- <rect x="0.5" y="0.5" width="13" height="13" fill="white" stroke="#6D5F5B"/>
5
- </svg>