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

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