@revolist/revogrid 3.2.18 → 3.3.1

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.
@@ -229,9 +229,9 @@ var isArguments_1 = isArguments;
229
229
  * _.isArray(_.noop);
230
230
  * // => false
231
231
  */
232
- var isArray$1 = Array.isArray;
232
+ var isArray = Array.isArray;
233
233
 
234
- var isArray_1 = isArray$1;
234
+ var isArray_1 = isArray;
235
235
 
236
236
  /**
237
237
  * This method returns `false`.
@@ -5904,123 +5904,91 @@ const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
5904
5904
  const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
5905
5905
  const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
5906
5906
  const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
5907
+ const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
5907
5908
  const GROUP_EXPAND_BTN = `group-expand`;
5908
5909
  const GROUP_EXPAND_EVENT = `groupExpandClick`;
5909
5910
  const GROUPING_ROW_TYPE = 'rgRow';
5910
5911
 
5911
- /**
5912
- * Do actual grouping
5913
- * @param array - items to group
5914
- * @param f - function responsible for grouping, returns property to group by
5915
- */
5916
- function groupBy(array, f) {
5917
- const groupsOrder = [];
5918
- const itemsByGroup = {};
5919
- array.forEach((item, i) => {
5920
- // get grouping values
5921
- const groupKeys = JSON.stringify(f(item));
5922
- // new group identification
5923
- if (!itemsByGroup[groupKeys]) {
5924
- itemsByGroup[groupKeys] = new Map();
5925
- // create group parents
5926
- groupsOrder.push({
5927
- children: itemsByGroup[groupKeys],
5928
- id: groupKeys,
5929
- });
5930
- }
5931
- // save to group with previous index
5932
- itemsByGroup[groupKeys].set(i, item);
5933
- });
5934
- return groupsOrder;
5935
- }
5936
5912
  /**
5937
5913
  * Gather data for grouping
5938
5914
  * @param array - flat data array
5939
- * @param mapFunc - mapping function for stringify
5915
+ * @param groupIds - ids of groups
5940
5916
  * @param expanded - potentially expanded items if present
5941
5917
  */
5942
- function gatherGrouping(array, mapFunc, { prevExpanded, expandedAll }) {
5943
- // build groups
5944
- const groupsOrder = groupBy(array, mapFunc);
5945
- const itemsMirror = []; // grouped source
5946
- const pseudoGroupTest = {}; // check if group header exists
5947
- // item index in source
5948
- let itemIndex = 0;
5949
- // to save max group depth
5950
- let groupingDepth = 0;
5918
+ function gatherGrouping(array, groupIds, { prevExpanded, expandedAll }) {
5919
+ const groupedItems = new Map();
5920
+ array.forEach((item, originalIndex) => {
5921
+ const groupLevelValues = groupIds.map((groupId) => item[groupId] || null);
5922
+ const lastLevelValue = groupLevelValues.pop();
5923
+ let currentGroupLevel = groupedItems;
5924
+ groupLevelValues.forEach((value) => {
5925
+ if (!currentGroupLevel.has(value)) {
5926
+ currentGroupLevel.set(value, new Map());
5927
+ }
5928
+ currentGroupLevel = currentGroupLevel.get(value);
5929
+ });
5930
+ if (!currentGroupLevel.has(lastLevelValue)) {
5931
+ currentGroupLevel.set(lastLevelValue, []);
5932
+ }
5933
+ item[GROUP_ORIGINAL_INDEX] = originalIndex;
5934
+ const lastLevelItems = currentGroupLevel.get(lastLevelValue);
5935
+ lastLevelItems.push(item);
5936
+ });
5937
+ let itemIndex = -1;
5938
+ const groupingDepth = groupIds.length;
5951
5939
  // collapse all groups in the beginning
5952
5940
  const trimmed = {};
5953
5941
  // index mapping
5954
5942
  const oldNewIndexMap = {};
5955
- // go through groups
5956
- groupsOrder.forEach(group => {
5957
- const parseGroup = getParsedGroup(group.id);
5958
- // extra precaution and type safe guard
5959
- if (!parseGroup) {
5960
- return;
5961
- }
5962
- let depth = 0;
5963
- let skipTrim = !!expandedAll;
5964
- let isExpanded = skipTrim;
5965
- const children = [];
5966
- // add group headers
5967
- parseGroup.reduce((prevVal, groupValue) => {
5968
- prevVal.push(groupValue);
5969
- const newVal = prevVal.join(',');
5970
- // if header not added, add new header
5971
- if (!pseudoGroupTest[newVal]) {
5972
- isExpanded = expandedAll || (prevExpanded && prevExpanded[newVal]);
5973
- itemsMirror.push(getPseudoGroup(groupValue, newVal, depth, group.id, isExpanded));
5974
- // if not first level auto collapse
5975
- if (depth && !isExpanded && !skipTrim) {
5976
- // check if parent expanded, expand this layer too
5977
- const parent = prevVal.slice(0, prevVal.length - 1);
5978
- if (!(prevExpanded && parent.length && prevExpanded[parent.join(',')])) {
5943
+ // check if group header exists
5944
+ const pseudoGroupTest = {};
5945
+ const sourceWithGroups = [];
5946
+ function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
5947
+ const depth = parentIds.length;
5948
+ groupedValues.forEach((innerGroupedValues, groupId) => {
5949
+ const levelIds = [...parentIds, groupId];
5950
+ const mergedIds = levelIds.join(',');
5951
+ const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
5952
+ sourceWithGroups.push({
5953
+ [PSEUDO_GROUP_ITEM]: groupId,
5954
+ [GROUP_DEPTH]: depth,
5955
+ [PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
5956
+ [PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
5957
+ [GROUP_EXPANDED]: isGroupExpanded,
5958
+ });
5959
+ itemIndex += 1;
5960
+ if (!isGroupExpanded && depth) {
5961
+ trimmed[itemIndex] = true;
5962
+ }
5963
+ if (Array.isArray(innerGroupedValues)) {
5964
+ innerGroupedValues.forEach((value) => {
5965
+ itemIndex += 1;
5966
+ if (!isGroupExpanded) {
5979
5967
  trimmed[itemIndex] = true;
5980
5968
  }
5981
- }
5982
- itemIndex++;
5983
- pseudoGroupTest[newVal] = children;
5969
+ oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
5970
+ const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
5971
+ pseudoGroupTestIds.forEach((pseudoGroupTestId) => {
5972
+ if (!pseudoGroupTest[pseudoGroupTestId]) {
5973
+ pseudoGroupTest[pseudoGroupTestId] = [];
5974
+ }
5975
+ pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
5976
+ });
5977
+ });
5978
+ sourceWithGroups.push(...innerGroupedValues);
5984
5979
  }
5985
- // calculate depth
5986
- depth++;
5987
- groupingDepth = depth;
5988
- return prevVal;
5989
- }, []);
5990
- // add regular items
5991
- group.children.forEach((item, oldIndex) => {
5992
- // hide items if group colapsed
5993
- if (!isExpanded && !skipTrim) {
5994
- // collapse rgRow
5995
- trimmed[itemIndex] = true;
5980
+ else {
5981
+ flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
5996
5982
  }
5997
- // add items to new source
5998
- itemsMirror.push(item);
5999
- oldNewIndexMap[oldIndex] = itemIndex;
6000
- children.push(itemIndex);
6001
- itemIndex++;
6002
5983
  });
6003
- });
5984
+ }
5985
+ flattenGroupMaps(groupedItems, [], true);
6004
5986
  return {
6005
- // updates source mirror
6006
- sourceWithGroups: itemsMirror,
6007
- // largest depth for grouping
5987
+ sourceWithGroups,
6008
5988
  depth: groupingDepth,
6009
- // used for expand/collapse grouping values
6010
5989
  trimmed,
6011
- // used for mapping old values to new
6012
5990
  oldNewIndexMap,
6013
- // used to get child items in group
6014
- childrenByGroup: pseudoGroupTest,
6015
- };
6016
- }
6017
- function getPseudoGroup(groupValue, value, depth, id, isExpanded = false) {
6018
- return {
6019
- [PSEUDO_GROUP_ITEM]: groupValue,
6020
- [GROUP_DEPTH]: depth,
6021
- [PSEUDO_GROUP_ITEM_ID]: id,
6022
- [PSEUDO_GROUP_ITEM_VALUE]: value,
6023
- [GROUP_EXPANDED]: isExpanded,
5991
+ childrenByGroup: pseudoGroupTest, // used to get child items in group
6024
5992
  };
6025
5993
  }
6026
5994
  function getGroupingName(rgRow) {
@@ -6032,9 +6000,6 @@ function isGrouping(rgRow) {
6032
6000
  function isGroupingColumn(column) {
6033
6001
  return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
6034
6002
  }
6035
- function isArray(data) {
6036
- return typeof data.push !== 'undefined';
6037
- }
6038
6003
  function measureEqualDepth(groupA, groupB) {
6039
6004
  const ln = groupA.length;
6040
6005
  let i = 0;
@@ -6048,7 +6013,7 @@ function measureEqualDepth(groupA, groupB) {
6048
6013
  function getParsedGroup(id) {
6049
6014
  const parseGroup = JSON.parse(id);
6050
6015
  // extra precaution and type safe guard
6051
- if (!isArray(parseGroup)) {
6016
+ if (!Array.isArray(parseGroup)) {
6052
6017
  return null;
6053
6018
  }
6054
6019
  return parseGroup;
@@ -6295,19 +6260,18 @@ class ExportFilePlugin extends BasePlugin {
6295
6260
  // provide collapse data
6296
6261
  function doCollapse(pIndex, source) {
6297
6262
  const model = source[pIndex];
6298
- const currentId = model[PSEUDO_GROUP_ITEM_ID];
6263
+ const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];
6299
6264
  const trimmed = {};
6300
6265
  let i = pIndex + 1;
6301
6266
  const total = source.length;
6302
6267
  while (i < total) {
6303
6268
  const currentModel = source[i];
6304
6269
  if (isGrouping(currentModel)) {
6305
- if (currentId !== currentModel[PSEUDO_GROUP_ITEM_ID]) {
6270
+ const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];
6271
+ if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
6306
6272
  break;
6307
6273
  }
6308
- else {
6309
- currentModel[GROUP_EXPANDED] = false;
6310
- }
6274
+ currentModel[GROUP_EXPANDED] = false;
6311
6275
  }
6312
6276
  trimmed[i++] = true;
6313
6277
  }
@@ -6547,7 +6511,7 @@ class GroupingRowPlugin extends BasePlugin {
6547
6511
  * sorting applied need to clear grouping and apply again
6548
6512
  * based on new results whole grouping order will changed
6549
6513
  */
6550
- this.addEventListener('afterSortingApply', () => this.doSourceUpdate());
6514
+ this.addEventListener('afterSortingApply', () => this.doSourceUpdate(Object.assign({}, this.options)));
6551
6515
  /**
6552
6516
  * Apply logic for focus inside of grouping
6553
6517
  * We can't focus on grouping rows, navigation only inside of groups for now
@@ -6567,6 +6531,7 @@ class GroupingRowPlugin extends BasePlugin {
6567
6531
  * Initiated when need to reapply grouping
6568
6532
  */
6569
6533
  doSourceUpdate(options) {
6534
+ var _a;
6570
6535
  if (!this.hasProps) {
6571
6536
  return;
6572
6537
  }
@@ -6579,11 +6544,9 @@ class GroupingRowPlugin extends BasePlugin {
6579
6544
  * Group again
6580
6545
  * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
6581
6546
  */
6582
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source,
6583
- // filter
6584
- item => { var _a; return (_a = this.options) === null || _a === void 0 ? void 0 : _a.props.map(key => item[key]); }, Object.assign({ prevExpanded }, options));
6547
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({ prevExpanded }, options));
6585
6548
  // setup source
6586
- this.providers.dataProvider.setData(sourceWithGroups, GROUPING_ROW_TYPE, { depth, customRenderer: options.groupLabelTemplate }, true);
6549
+ this.providers.dataProvider.setData(sourceWithGroups, GROUPING_ROW_TYPE, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
6587
6550
  this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes, oldNewIndexMap);
6588
6551
  }
6589
6552
  /**
@@ -6592,14 +6555,13 @@ class GroupingRowPlugin extends BasePlugin {
6592
6555
  * If source came from other plugin
6593
6556
  */
6594
6557
  onDataSet(data) {
6558
+ var _a;
6595
6559
  if (!this.hasProps || !(data === null || data === void 0 ? void 0 : data.source) || !data.source.length) {
6596
6560
  return;
6597
6561
  }
6598
6562
  const source = data.source.filter(s => !isGrouping(s));
6599
6563
  const expanded = this.revogrid.grouping || {};
6600
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source,
6601
- // filter
6602
- item => { var _a; return (_a = this.options) === null || _a === void 0 ? void 0 : _a.props.map(key => item[key]); }, Object.assign({}, (expanded || {})));
6564
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({}, (expanded || {})));
6603
6565
  data.source = sourceWithGroups;
6604
6566
  this.providers.dataProvider.setGrouping({ depth });
6605
6567
  this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
@@ -25054,7 +25016,8 @@ const RevoGridComponent = class {
25054
25016
  return;
25055
25017
  }
25056
25018
  await timeout();
25057
- (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, 'rgCol'), rgCol.pin || 'rgCol', rowSource);
25019
+ const colGroup = rgCol.pin || 'rgCol';
25020
+ (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, colGroup), colGroup, rowSource);
25058
25021
  }
25059
25022
  /**
25060
25023
  * Register new virtual node inside of grid
@@ -25732,11 +25695,15 @@ const GroupingRowRenderer = (props) => {
25732
25695
  if (!hasExpand) {
25733
25696
  return index.h(RowRenderer, Object.assign({}, props, { rowClass: "groupingRow", depth: depth }));
25734
25697
  }
25698
+ if (groupingCustomRenderer) {
25699
+ return (index.h(RowRenderer, Object.assign({}, props, { rowClass: "groupingRow", depth: depth }),
25700
+ index.h("div", { onClick: e => expandEvent(e, model, itemIndex) }, groupingCustomRenderer(index.h, { name, itemIndex, expanded, depth }))));
25701
+ }
25735
25702
  return (index.h(RowRenderer, Object.assign({}, props, { rowClass: "groupingRow", depth: depth }),
25736
25703
  index.h("button", { class: { [GROUP_EXPAND_BTN]: true }, onClick: e => expandEvent(e, model, itemIndex) },
25737
25704
  index.h("svg", { "aria-hidden": "true", style: { transform: `rotate(${!expanded ? -90 : 0}deg)` }, focusable: "false", viewBox: "0 0 448 512" },
25738
25705
  index.h("path", { fill: "currentColor", d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }))),
25739
- groupingCustomRenderer ? groupingCustomRenderer(index.h, { name, itemIndex, expanded, depth }) : name));
25706
+ name));
25740
25707
  };
25741
25708
 
25742
25709
  const revogrDataStyleCss = ".revo-drag-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 438 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M421.875,70.40625 C426.432292,70.40625 430.175781,68.9414062 433.105469,66.0117188 C436.035156,63.0820312 437.5,59.3385417 437.5,54.78125 L437.5,54.78125 L437.5,15.71875 C437.5,11.1614583 436.035156,7.41796875 433.105469,4.48828125 C430.175781,1.55859375 426.432292,0.09375 421.875,0.09375 L421.875,0.09375 L15.625,0.09375 C11.0677083,0.09375 7.32421875,1.55859375 4.39453125,4.48828125 C1.46484375,7.41796875 0,11.1614583 0,15.71875 L0,15.71875 L0,54.78125 C0,59.3385417 1.46484375,63.0820312 4.39453125,66.0117188 C7.32421875,68.9414062 11.0677083,70.40625 15.625,70.40625 L15.625,70.40625 L421.875,70.40625 Z M421.875,226.65625 C426.432292,226.65625 430.175781,225.191406 433.105469,222.261719 C436.035156,219.332031 437.5,215.588542 437.5,211.03125 L437.5,211.03125 L437.5,171.96875 C437.5,167.411458 436.035156,163.667969 433.105469,160.738281 C430.175781,157.808594 426.432292,156.34375 421.875,156.34375 L421.875,156.34375 L15.625,156.34375 C11.0677083,156.34375 7.32421875,157.808594 4.39453125,160.738281 C1.46484375,163.667969 0,167.411458 0,171.96875 L0,171.96875 L0,211.03125 C0,215.588542 1.46484375,219.332031 4.39453125,222.261719 C7.32421875,225.191406 11.0677083,226.65625 15.625,226.65625 L15.625,226.65625 L421.875,226.65625 Z M421.875,382.90625 C426.432292,382.90625 430.175781,381.441406 433.105469,378.511719 C436.035156,375.582031 437.5,371.838542 437.5,367.28125 L437.5,367.28125 L437.5,328.21875 C437.5,323.661458 436.035156,319.917969 433.105469,316.988281 C430.175781,314.058594 426.432292,312.59375 421.875,312.59375 L421.875,312.59375 L15.625,312.59375 C11.0677083,312.59375 7.32421875,314.058594 4.39453125,316.988281 C1.46484375,319.917969 0,323.661458 0,328.21875 L0,328.21875 L0,367.28125 C0,371.838542 1.46484375,375.582031 4.39453125,378.511719 C7.32421875,381.441406 11.0677083,382.90625 15.625,382.90625 L15.625,382.90625 L421.875,382.90625 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 438 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M421.875,70.40625 C426.432292,70.40625 430.175781,68.9414062 433.105469,66.0117188 C436.035156,63.0820312 437.5,59.3385417 437.5,54.78125 L437.5,54.78125 L437.5,15.71875 C437.5,11.1614583 436.035156,7.41796875 433.105469,4.48828125 C430.175781,1.55859375 426.432292,0.09375 421.875,0.09375 L421.875,0.09375 L15.625,0.09375 C11.0677083,0.09375 7.32421875,1.55859375 4.39453125,4.48828125 C1.46484375,7.41796875 0,11.1614583 0,15.71875 L0,15.71875 L0,54.78125 C0,59.3385417 1.46484375,63.0820312 4.39453125,66.0117188 C7.32421875,68.9414062 11.0677083,70.40625 15.625,70.40625 L15.625,70.40625 L421.875,70.40625 Z M421.875,226.65625 C426.432292,226.65625 430.175781,225.191406 433.105469,222.261719 C436.035156,219.332031 437.5,215.588542 437.5,211.03125 L437.5,211.03125 L437.5,171.96875 C437.5,167.411458 436.035156,163.667969 433.105469,160.738281 C430.175781,157.808594 426.432292,156.34375 421.875,156.34375 L421.875,156.34375 L15.625,156.34375 C11.0677083,156.34375 7.32421875,157.808594 4.39453125,160.738281 C1.46484375,163.667969 0,167.411458 0,171.96875 L0,171.96875 L0,211.03125 C0,215.588542 1.46484375,219.332031 4.39453125,222.261719 C7.32421875,225.191406 11.0677083,226.65625 15.625,226.65625 L15.625,226.65625 L421.875,226.65625 Z M421.875,382.90625 C426.432292,382.90625 430.175781,381.441406 433.105469,378.511719 C436.035156,375.582031 437.5,371.838542 437.5,367.28125 L437.5,367.28125 L437.5,328.21875 C437.5,323.661458 436.035156,319.917969 433.105469,316.988281 C430.175781,314.058594 426.432292,312.59375 421.875,312.59375 L421.875,312.59375 L15.625,312.59375 C11.0677083,312.59375 7.32421875,314.058594 4.39453125,316.988281 C1.46484375,319.917969 0,323.661458 0,328.21875 L0,328.21875 L0,367.28125 C0,371.838542 1.46484375,375.582031 4.39453125,378.511719 C7.32421875,381.441406 11.0677083,382.90625 15.625,382.90625 L15.625,382.90625 L421.875,382.90625 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:7px;background-size:cover;background-repeat:no-repeat}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#2ee072;border:1px solid #20d565}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:2px solid #cedefa;line-height:32px;background:none;color:#4876ca;box-shadow:none}revogr-data{display:block;width:100%;position:relative}revogr-data .rgRow{position:absolute;width:100%;left:0}revogr-data .rgRow.groupingRow{font-weight:600}revogr-data .rgRow.groupingRow .group-expand{width:25px;height:100%;max-height:25px;margin-right:2px;background-color:transparent;border-color:transparent}revogr-data .rgRow.groupingRow .group-expand svg{width:7px}revogr-data .revo-draggable{border:none;height:32px;display:inline-flex;outline:0;padding:0;font-size:0.8125rem;box-sizing:border-box;align-items:center;white-space:nowrap;vertical-align:middle;justify-content:center;text-decoration:none;width:24px;height:100%;cursor:pointer}revogr-data .revo-draggable>.revo-drag-icon{vertical-align:middle;display:inline-block;pointer-events:none;transition:background-color 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}revogr-data .rgCell{top:0;position:absolute;box-sizing:border-box;height:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}revogr-data .rgCell.align-center{text-align:center}revogr-data .rgCell.align-left{text-align:left}revogr-data .rgCell.align-right{text-align:right}";
@@ -203,7 +203,8 @@ export class RevoGridComponent {
203
203
  return;
204
204
  }
205
205
  await timeout();
206
- (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, 'rgCol'), rgCol.pin || 'rgCol', rowSource);
206
+ const colGroup = rgCol.pin || 'rgCol';
207
+ (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, colGroup), colGroup, rowSource);
207
208
  }
208
209
  /**
209
210
  * Register new virtual node inside of grid
@@ -8,6 +8,7 @@ export const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
8
8
  export const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
9
9
  export const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
10
10
  export const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
11
+ export const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
11
12
  export const GROUP_EXPAND_BTN = `group-expand`;
12
13
  export const GROUP_EXPAND_EVENT = `groupExpandClick`;
13
14
  export const GROUPING_ROW_TYPE = 'rgRow';
@@ -1,24 +1,23 @@
1
1
  /*!
2
2
  * Built by Revolist
3
3
  */
4
- import { PSEUDO_GROUP_ITEM_ID, GROUP_EXPANDED, GROUP_DEPTH } from './grouping.const';
4
+ import { PSEUDO_GROUP_ITEM_ID, PSEUDO_GROUP_ITEM_VALUE, GROUP_EXPANDED, GROUP_DEPTH } from './grouping.const';
5
5
  import { isGrouping, getParsedGroup, isSameGroup } from './grouping.service';
6
6
  // provide collapse data
7
7
  export function doCollapse(pIndex, source) {
8
8
  const model = source[pIndex];
9
- const currentId = model[PSEUDO_GROUP_ITEM_ID];
9
+ const collapseValue = model[PSEUDO_GROUP_ITEM_VALUE];
10
10
  const trimmed = {};
11
11
  let i = pIndex + 1;
12
12
  const total = source.length;
13
13
  while (i < total) {
14
14
  const currentModel = source[i];
15
15
  if (isGrouping(currentModel)) {
16
- if (currentId !== currentModel[PSEUDO_GROUP_ITEM_ID]) {
16
+ const currentValue = currentModel[PSEUDO_GROUP_ITEM_VALUE];
17
+ if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
17
18
  break;
18
19
  }
19
- else {
20
- currentModel[GROUP_EXPANDED] = false;
21
- }
20
+ currentModel[GROUP_EXPANDED] = false;
22
21
  }
23
22
  trimmed[i++] = true;
24
23
  }
@@ -144,7 +144,7 @@ export default class GroupingRowPlugin extends BasePlugin {
144
144
  * sorting applied need to clear grouping and apply again
145
145
  * based on new results whole grouping order will changed
146
146
  */
147
- this.addEventListener('afterSortingApply', () => this.doSourceUpdate());
147
+ this.addEventListener('afterSortingApply', () => this.doSourceUpdate(Object.assign({}, this.options)));
148
148
  /**
149
149
  * Apply logic for focus inside of grouping
150
150
  * We can't focus on grouping rows, navigation only inside of groups for now
@@ -164,6 +164,7 @@ export default class GroupingRowPlugin extends BasePlugin {
164
164
  * Initiated when need to reapply grouping
165
165
  */
166
166
  doSourceUpdate(options) {
167
+ var _a;
167
168
  if (!this.hasProps) {
168
169
  return;
169
170
  }
@@ -176,11 +177,9 @@ export default class GroupingRowPlugin extends BasePlugin {
176
177
  * Group again
177
178
  * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
178
179
  */
179
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source,
180
- // filter
181
- item => { var _a; return (_a = this.options) === null || _a === void 0 ? void 0 : _a.props.map(key => item[key]); }, Object.assign({ prevExpanded }, options));
180
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({ prevExpanded }, options));
182
181
  // setup source
183
- this.providers.dataProvider.setData(sourceWithGroups, GROUPING_ROW_TYPE, { depth, customRenderer: options.groupLabelTemplate }, true);
182
+ this.providers.dataProvider.setData(sourceWithGroups, GROUPING_ROW_TYPE, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
184
183
  this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes, oldNewIndexMap);
185
184
  }
186
185
  /**
@@ -189,14 +188,13 @@ export default class GroupingRowPlugin extends BasePlugin {
189
188
  * If source came from other plugin
190
189
  */
191
190
  onDataSet(data) {
191
+ var _a;
192
192
  if (!this.hasProps || !(data === null || data === void 0 ? void 0 : data.source) || !data.source.length) {
193
193
  return;
194
194
  }
195
195
  const source = data.source.filter(s => !isGrouping(s));
196
196
  const expanded = this.revogrid.grouping || {};
197
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source,
198
- // filter
199
- item => { var _a; return (_a = this.options) === null || _a === void 0 ? void 0 : _a.props.map(key => item[key]); }, Object.assign({}, (expanded || {})));
197
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({}, (expanded || {})));
200
198
  data.source = sourceWithGroups;
201
199
  this.providers.dataProvider.setGrouping({ depth });
202
200
  this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
@@ -23,10 +23,14 @@ const GroupingRowRenderer = (props) => {
23
23
  if (!hasExpand) {
24
24
  return h(RowRenderer, Object.assign({}, props, { rowClass: "groupingRow", depth: depth }));
25
25
  }
26
+ if (groupingCustomRenderer) {
27
+ return (h(RowRenderer, Object.assign({}, props, { rowClass: "groupingRow", depth: depth }),
28
+ h("div", { onClick: e => expandEvent(e, model, itemIndex) }, groupingCustomRenderer(h, { name, itemIndex, expanded, depth }))));
29
+ }
26
30
  return (h(RowRenderer, Object.assign({}, props, { rowClass: "groupingRow", depth: depth }),
27
31
  h("button", { class: { [GROUP_EXPAND_BTN]: true }, onClick: e => expandEvent(e, model, itemIndex) },
28
32
  h("svg", { "aria-hidden": "true", style: { transform: `rotate(${!expanded ? -90 : 0}deg)` }, focusable: "false", viewBox: "0 0 448 512" },
29
33
  h("path", { fill: "currentColor", d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }))),
30
- groupingCustomRenderer ? groupingCustomRenderer(h, { name, itemIndex, expanded, depth }) : name));
34
+ name));
31
35
  };
32
36
  export default GroupingRowRenderer;