@gridkitjs/react 0.0.0-dev-20261109131620 → 0.0.0-dev-20261109132710

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/dist/index.js CHANGED
@@ -2720,7 +2720,8 @@ import {
2720
2720
  describeColumnFilter,
2721
2721
  filterDraftChanged,
2722
2722
  filterEditorReducer,
2723
- initialFilterEditorDraft
2723
+ initialFilterEditorDraft,
2724
+ toValuesDraft
2724
2725
  } from "@gridkitjs/core";
2725
2726
  function openValues(filter, columnId, values) {
2726
2727
  const shape = describeColumnFilter(filter, columnId);
@@ -2731,7 +2732,7 @@ function openValues(filter, columnId, values) {
2731
2732
  };
2732
2733
  }
2733
2734
  function initialExcelEditorState(opened) {
2734
- return { opened, draft: opened.draft };
2735
+ return { opened, draft: toValuesDraft(opened.draft) };
2735
2736
  }
2736
2737
  function showsAlike(a, b) {
2737
2738
  return a.shape.kind === b.shape.kind && a.draft.options === b.draft.options && !filterDraftChanged(a.draft, b.draft);
@@ -2740,7 +2741,10 @@ function excelEditorReducer(state, action) {
2740
2741
  if (action.type === "filterChanged") {
2741
2742
  return showsAlike(state.opened, action.opened) ? { ...state, opened: action.opened } : initialExcelEditorState(action.opened);
2742
2743
  }
2743
- return { ...state, draft: filterEditorReducer(state.draft, action) };
2744
+ return {
2745
+ ...state,
2746
+ draft: toValuesDraft(filterEditorReducer(state.draft, action))
2747
+ };
2744
2748
  }
2745
2749
 
2746
2750
  // src/DataGrid/menu/useMenuButton.ts
@@ -2882,7 +2886,7 @@ import {
2882
2886
  conditionsFromRows as conditionsFromRows2,
2883
2887
  draftToFilter,
2884
2888
  filterDraftChanged as filterDraftChanged2,
2885
- filterEditorReducer as filterEditorReducer3
2889
+ filterEditorReducer as filterEditorReducer2
2886
2890
  } from "@gridkitjs/core";
2887
2891
 
2888
2892
  // src/DataGrid/filterMenu/ConditionRow.tsx
@@ -3008,7 +3012,6 @@ import {
3008
3012
  conditionRowsFrom,
3009
3013
  conditionsFromRows,
3010
3014
  describeColumnFilter as describeColumnFilter2,
3011
- filterEditorReducer as filterEditorReducer2,
3012
3015
  initialFilterEditorDraft as initialFilterEditorDraft2
3013
3016
  } from "@gridkitjs/core";
3014
3017
  var NO_ROWS = [];
@@ -3023,14 +3026,11 @@ function filterDraftShown(shape, rows, columnId, type) {
3023
3026
  ...NO_VALUES,
3024
3027
  columnType: type
3025
3028
  });
3026
- if (shape.kind !== "conditions") {
3029
+ if (draft.kind !== "conditions") {
3027
3030
  return draft;
3028
3031
  }
3029
3032
  const shown = conditionsFromRows(rows, columnId, type);
3030
- return shown.invalid.length > 0 ? draft : filterEditorReducer2(draft, {
3031
- type: "setConditions",
3032
- conditions: shown.conditions
3033
- });
3033
+ return shown.invalid.length > 0 ? draft : { ...draft, conditions: shown.conditions };
3034
3034
  }
3035
3035
  function openConditions(filter, columnId, operators, type, operator) {
3036
3036
  const shape = describeColumnFilter2(filter, columnId);
@@ -3051,14 +3051,14 @@ function openConditions(filter, columnId, operators, type, operator) {
3051
3051
  function initialSimpleEditorState(opened) {
3052
3052
  return { opened, draft: opened.draft, invalid: NO_ROWS };
3053
3053
  }
3054
- function sameConditionsDraft(a, b) {
3054
+ function sameConditionRows(a, b) {
3055
3055
  return a.combinator === b.combinator && a.rows.length === b.rows.length && a.rows.every((row, index) => {
3056
3056
  const other = b.rows[index];
3057
3057
  return other !== void 0 && row.operator === other.operator && row.text === other.text && row.textTo === other.textTo;
3058
3058
  });
3059
3059
  }
3060
3060
  function showsAlike2(a, b) {
3061
- return a.custom === b.custom && sameConditionsDraft(a.draft, b.draft);
3061
+ return a.custom === b.custom && sameConditionRows(a.draft, b.draft);
3062
3062
  }
3063
3063
  function simpleEditorReducer(state, action) {
3064
3064
  switch (action.type) {
@@ -3148,7 +3148,7 @@ function SimpleFilterEditor({
3148
3148
  const invalidMessageId = useId();
3149
3149
  const combinatorName = useId();
3150
3150
  function applyConditions(conditions) {
3151
- const applied = filterEditorReducer3(opened.filterDraft, {
3151
+ const applied = filterEditorReducer2(opened.filterDraft, {
3152
3152
  type: "setConditions",
3153
3153
  conditions,
3154
3154
  combinator: draft.combinator
@@ -3172,7 +3172,7 @@ function SimpleFilterEditor({
3172
3172
  applyConditions(parsed.conditions);
3173
3173
  return true;
3174
3174
  }
3175
- if (sameConditionsDraft(draft, opened.draft) && !unreadable.includes(true)) {
3175
+ if (sameConditionRows(draft, opened.draft) && !unreadable.includes(true)) {
3176
3176
  return true;
3177
3177
  }
3178
3178
  dispatch({ type: "markInvalid", rows: marked });