@linzjs/step-ag-grid 3.0.1 → 3.0.2
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 +120 -116
- package/dist/index.js.map +1 -1
- package/dist/src/index.d.ts +5 -2
- package/dist/step-ag-grid.esm.js +118 -118
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export * from "./react-menu3/index";
|
|
2
2
|
export * from "./react-menu3/types";
|
|
3
|
-
export * from "./contexts/GridUpdatingContext";
|
|
4
|
-
export * from "./contexts/GridUpdatingContextProvider";
|
|
5
3
|
export * from "./contexts/GridContext";
|
|
6
4
|
export * from "./contexts/GridContextProvider";
|
|
5
|
+
export * from "./contexts/GridUpdatingContext";
|
|
6
|
+
export * from "./contexts/GridUpdatingContextProvider";
|
|
7
|
+
export * from "./contexts/GridPopoverContext";
|
|
8
|
+
export * from "./contexts/GridPopoverContextProvider";
|
|
9
|
+
export * from "./contexts/GridSubComponentContext";
|
|
7
10
|
export type { GridBaseRow } from "./components/Grid";
|
|
8
11
|
export { Grid } from "./components/Grid";
|
|
9
12
|
export * from "./components/GridCell";
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useLayoutEffect, useEffect, createContext, memo, forwardRef, useRef, useContext, useState, useCallback, useReducer, cloneElement, useImperativeHandle, Fragment } from 'react';
|
|
2
2
|
import { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
3
|
-
import { findIndex, debounce, isEmpty,
|
|
3
|
+
import { findIndex, debounce, isEmpty, delay, sortBy, last, difference, castArray, remove, flatten, xorBy, fromPairs, omit, pick, toPairs, isEqual } from 'lodash-es';
|
|
4
4
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
5
5
|
import { AgGridReact } from 'ag-grid-react';
|
|
6
6
|
import { LuiMiniSpinner, LuiIcon, LuiCheckboxInput, LuiButton } from '@linzjs/lui';
|
|
@@ -1782,54 +1782,6 @@ var MenuRadioGroupFr = function (_a, externalRef) {
|
|
|
1782
1782
|
};
|
|
1783
1783
|
var MenuRadioGroup = forwardRef(MenuRadioGroupFr);
|
|
1784
1784
|
|
|
1785
|
-
var GridUpdatingContext = createContext({
|
|
1786
|
-
checkUpdating: function () {
|
|
1787
|
-
console.error("Missing GridUpdatingContext");
|
|
1788
|
-
return false;
|
|
1789
|
-
},
|
|
1790
|
-
modifyUpdating: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1791
|
-
return __generator(this, function (_a) {
|
|
1792
|
-
console.error("Missing GridUpdatingContext");
|
|
1793
|
-
return [2 /*return*/];
|
|
1794
|
-
});
|
|
1795
|
-
}); }
|
|
1796
|
-
});
|
|
1797
|
-
|
|
1798
|
-
var GridUpdatingContextProvider = function (props) {
|
|
1799
|
-
var updatingBlocks = useRef({});
|
|
1800
|
-
var updating = useRef({});
|
|
1801
|
-
var resetUpdating = function () {
|
|
1802
|
-
var mergedUpdatingBlocks = {};
|
|
1803
|
-
for (var key in updatingBlocks.current) {
|
|
1804
|
-
mergedUpdatingBlocks[key] = flatten(updatingBlocks.current[key]);
|
|
1805
|
-
}
|
|
1806
|
-
updating.current = mergedUpdatingBlocks;
|
|
1807
|
-
};
|
|
1808
|
-
var modifyUpdating = function (field, ids, fn) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1809
|
-
var fieldUpdatingIds, idRef;
|
|
1810
|
-
var _a;
|
|
1811
|
-
return __generator(this, function (_b) {
|
|
1812
|
-
switch (_b.label) {
|
|
1813
|
-
case 0:
|
|
1814
|
-
fieldUpdatingIds = (_a = updatingBlocks.current[field]) !== null && _a !== void 0 ? _a : (updatingBlocks.current[field] = []);
|
|
1815
|
-
idRef = __spreadArray([], ids, true);
|
|
1816
|
-
fieldUpdatingIds.push(idRef);
|
|
1817
|
-
resetUpdating();
|
|
1818
|
-
return [4 /*yield*/, fn()];
|
|
1819
|
-
case 1:
|
|
1820
|
-
_b.sent();
|
|
1821
|
-
remove(fieldUpdatingIds, function (idList) { return idList === idRef; });
|
|
1822
|
-
resetUpdating();
|
|
1823
|
-
return [2 /*return*/];
|
|
1824
|
-
}
|
|
1825
|
-
});
|
|
1826
|
-
}); };
|
|
1827
|
-
var checkUpdating = function (fields, id) {
|
|
1828
|
-
return castArray(fields).some(function (f) { var _a; return (_a = updating.current[f]) === null || _a === void 0 ? void 0 : _a.includes(id); });
|
|
1829
|
-
};
|
|
1830
|
-
return (jsx(GridUpdatingContext.Provider, __assign({ value: { modifyUpdating: modifyUpdating, checkUpdating: checkUpdating } }, { children: props.children })));
|
|
1831
|
-
};
|
|
1832
|
-
|
|
1833
1785
|
var GridContext = createContext({
|
|
1834
1786
|
gridReady: function () {
|
|
1835
1787
|
console.error("no context provider for gridReady");
|
|
@@ -1903,6 +1855,19 @@ var GridContext = createContext({
|
|
|
1903
1855
|
}
|
|
1904
1856
|
});
|
|
1905
1857
|
|
|
1858
|
+
var GridUpdatingContext = createContext({
|
|
1859
|
+
checkUpdating: function () {
|
|
1860
|
+
console.error("Missing GridUpdatingContext");
|
|
1861
|
+
return false;
|
|
1862
|
+
},
|
|
1863
|
+
modifyUpdating: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1864
|
+
return __generator(this, function (_a) {
|
|
1865
|
+
console.error("Missing GridUpdatingContext");
|
|
1866
|
+
return [2 /*return*/];
|
|
1867
|
+
});
|
|
1868
|
+
}); }
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1906
1871
|
/**
|
|
1907
1872
|
* Context for AgGrid operations.
|
|
1908
1873
|
* Make sure you wrap AgGrid in this.
|
|
@@ -2182,6 +2147,109 @@ var GridContextProvider = function (props) {
|
|
|
2182
2147
|
} }, { children: props.children })));
|
|
2183
2148
|
};
|
|
2184
2149
|
|
|
2150
|
+
var GridUpdatingContextProvider = function (props) {
|
|
2151
|
+
var updatingBlocks = useRef({});
|
|
2152
|
+
var updating = useRef({});
|
|
2153
|
+
var resetUpdating = function () {
|
|
2154
|
+
var mergedUpdatingBlocks = {};
|
|
2155
|
+
for (var key in updatingBlocks.current) {
|
|
2156
|
+
mergedUpdatingBlocks[key] = flatten(updatingBlocks.current[key]);
|
|
2157
|
+
}
|
|
2158
|
+
updating.current = mergedUpdatingBlocks;
|
|
2159
|
+
};
|
|
2160
|
+
var modifyUpdating = function (field, ids, fn) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2161
|
+
var fieldUpdatingIds, idRef;
|
|
2162
|
+
var _a;
|
|
2163
|
+
return __generator(this, function (_b) {
|
|
2164
|
+
switch (_b.label) {
|
|
2165
|
+
case 0:
|
|
2166
|
+
fieldUpdatingIds = (_a = updatingBlocks.current[field]) !== null && _a !== void 0 ? _a : (updatingBlocks.current[field] = []);
|
|
2167
|
+
idRef = __spreadArray([], ids, true);
|
|
2168
|
+
fieldUpdatingIds.push(idRef);
|
|
2169
|
+
resetUpdating();
|
|
2170
|
+
return [4 /*yield*/, fn()];
|
|
2171
|
+
case 1:
|
|
2172
|
+
_b.sent();
|
|
2173
|
+
remove(fieldUpdatingIds, function (idList) { return idList === idRef; });
|
|
2174
|
+
resetUpdating();
|
|
2175
|
+
return [2 /*return*/];
|
|
2176
|
+
}
|
|
2177
|
+
});
|
|
2178
|
+
}); };
|
|
2179
|
+
var checkUpdating = function (fields, id) {
|
|
2180
|
+
return castArray(fields).some(function (f) { var _a; return (_a = updating.current[f]) === null || _a === void 0 ? void 0 : _a.includes(id); });
|
|
2181
|
+
};
|
|
2182
|
+
return (jsx(GridUpdatingContext.Provider, __assign({ value: { modifyUpdating: modifyUpdating, checkUpdating: checkUpdating } }, { children: props.children })));
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2185
|
+
var GridPopoverContext = createContext({
|
|
2186
|
+
anchorRef: { current: null },
|
|
2187
|
+
saving: false,
|
|
2188
|
+
setSaving: function () { },
|
|
2189
|
+
field: "",
|
|
2190
|
+
value: null,
|
|
2191
|
+
data: {},
|
|
2192
|
+
selectedRows: [],
|
|
2193
|
+
updateValue: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
2194
|
+
return [2 /*return*/, false];
|
|
2195
|
+
}); }); }
|
|
2196
|
+
});
|
|
2197
|
+
var useGridPopoverContext = function () {
|
|
2198
|
+
return useContext(GridPopoverContext);
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
var GridPopoverContextProvider = function (_a) {
|
|
2202
|
+
var _b, _c, _d;
|
|
2203
|
+
var props = _a.props, children = _a.children;
|
|
2204
|
+
var _e = useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells;
|
|
2205
|
+
var anchorRef = useRef(props.eGridCell);
|
|
2206
|
+
var _f = useState(false), saving = _f[0], setSaving = _f[1];
|
|
2207
|
+
var colDef = props.colDef;
|
|
2208
|
+
var cellEditorParams = colDef.cellEditorParams;
|
|
2209
|
+
var multiEdit = (_b = cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.multiEdit) !== null && _b !== void 0 ? _b : false;
|
|
2210
|
+
// Then item that is clicked on will always be first in the list
|
|
2211
|
+
var selectedRows = useMemo(function () { return (multiEdit ? sortBy(getSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data]); }, [getSelectedRows, multiEdit, props.data]);
|
|
2212
|
+
var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
|
|
2213
|
+
var updateValue = useCallback(function (saveFn) { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
2214
|
+
switch (_b.label) {
|
|
2215
|
+
case 0:
|
|
2216
|
+
_a = !saving;
|
|
2217
|
+
if (!_a) return [3 /*break*/, 2];
|
|
2218
|
+
return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving)];
|
|
2219
|
+
case 1:
|
|
2220
|
+
_a = (_b.sent());
|
|
2221
|
+
_b.label = 2;
|
|
2222
|
+
case 2: return [2 /*return*/, _a];
|
|
2223
|
+
}
|
|
2224
|
+
}); }); }, [field, saving, selectedRows, updatingCells]);
|
|
2225
|
+
return (jsx(GridPopoverContext.Provider, __assign({ value: {
|
|
2226
|
+
anchorRef: anchorRef,
|
|
2227
|
+
saving: saving,
|
|
2228
|
+
setSaving: setSaving,
|
|
2229
|
+
selectedRows: selectedRows,
|
|
2230
|
+
field: field,
|
|
2231
|
+
data: props.data,
|
|
2232
|
+
value: props.value,
|
|
2233
|
+
updateValue: updateValue
|
|
2234
|
+
} }, { children: children })));
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2237
|
+
var GridSubComponentContext = createContext({
|
|
2238
|
+
value: "GridSubComponentContext value no context",
|
|
2239
|
+
setValue: function () {
|
|
2240
|
+
console.error("GridSubComponentContext setValue no context");
|
|
2241
|
+
},
|
|
2242
|
+
setValid: function () {
|
|
2243
|
+
console.error("GridSubComponentContext setValid no context");
|
|
2244
|
+
},
|
|
2245
|
+
triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2246
|
+
return __generator(this, function (_a) {
|
|
2247
|
+
console.error("GridSubComponentContext triggerSave no context");
|
|
2248
|
+
return [2 /*return*/];
|
|
2249
|
+
});
|
|
2250
|
+
}); }
|
|
2251
|
+
});
|
|
2252
|
+
|
|
2185
2253
|
function toVal(mix) {
|
|
2186
2254
|
var k, y, str='';
|
|
2187
2255
|
if (mix) {
|
|
@@ -2648,58 +2716,6 @@ var GridRendererGenericCell = function (props) {
|
|
|
2648
2716
|
return (jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((_c = (_b = colDef.field) !== null && _b !== void 0 ? _b : colDef.colId) !== null && _c !== void 0 ? _c : "", props.data.id) }, { children: jsxs(Fragment$1, { children: [typeof warningText === "string" && jsx(GridIcon, { icon: "ic_warning", title: warningText }), typeof infoText === "string" && jsx(GridIcon, { icon: "ic_info", title: infoText }), jsx("span", __assign({ title: formatted }, { children: formatted }))] }) })));
|
|
2649
2717
|
};
|
|
2650
2718
|
|
|
2651
|
-
var GridPopoverContext = createContext({
|
|
2652
|
-
anchorRef: { current: null },
|
|
2653
|
-
saving: false,
|
|
2654
|
-
setSaving: function () { },
|
|
2655
|
-
field: "",
|
|
2656
|
-
value: null,
|
|
2657
|
-
data: {},
|
|
2658
|
-
selectedRows: [],
|
|
2659
|
-
updateValue: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
2660
|
-
return [2 /*return*/, false];
|
|
2661
|
-
}); }); }
|
|
2662
|
-
});
|
|
2663
|
-
var useGridPopoverContext = function () {
|
|
2664
|
-
return useContext(GridPopoverContext);
|
|
2665
|
-
};
|
|
2666
|
-
|
|
2667
|
-
var GridPopoverContextProvider = function (_a) {
|
|
2668
|
-
var _b, _c, _d;
|
|
2669
|
-
var props = _a.props, children = _a.children;
|
|
2670
|
-
var _e = useContext(GridContext), getSelectedRows = _e.getSelectedRows, updatingCells = _e.updatingCells;
|
|
2671
|
-
var anchorRef = useRef(props.eGridCell);
|
|
2672
|
-
var _f = useState(false), saving = _f[0], setSaving = _f[1];
|
|
2673
|
-
var colDef = props.colDef;
|
|
2674
|
-
var cellEditorParams = colDef.cellEditorParams;
|
|
2675
|
-
var multiEdit = (_b = cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.multiEdit) !== null && _b !== void 0 ? _b : false;
|
|
2676
|
-
// Then item that is clicked on will always be first in the list
|
|
2677
|
-
var selectedRows = useMemo(function () { return (multiEdit ? sortBy(getSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data]); }, [getSelectedRows, multiEdit, props.data]);
|
|
2678
|
-
var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
|
|
2679
|
-
var updateValue = useCallback(function (saveFn) { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
2680
|
-
switch (_b.label) {
|
|
2681
|
-
case 0:
|
|
2682
|
-
_a = !saving;
|
|
2683
|
-
if (!_a) return [3 /*break*/, 2];
|
|
2684
|
-
return [4 /*yield*/, updatingCells({ selectedRows: selectedRows, field: field }, saveFn, setSaving)];
|
|
2685
|
-
case 1:
|
|
2686
|
-
_a = (_b.sent());
|
|
2687
|
-
_b.label = 2;
|
|
2688
|
-
case 2: return [2 /*return*/, _a];
|
|
2689
|
-
}
|
|
2690
|
-
}); }); }, [field, saving, selectedRows, updatingCells]);
|
|
2691
|
-
return (jsx(GridPopoverContext.Provider, __assign({ value: {
|
|
2692
|
-
anchorRef: anchorRef,
|
|
2693
|
-
saving: saving,
|
|
2694
|
-
setSaving: setSaving,
|
|
2695
|
-
selectedRows: selectedRows,
|
|
2696
|
-
field: field,
|
|
2697
|
-
data: props.data,
|
|
2698
|
-
value: props.value,
|
|
2699
|
-
updateValue: updateValue
|
|
2700
|
-
} }, { children: children })));
|
|
2701
|
-
};
|
|
2702
|
-
|
|
2703
2719
|
var GridCellRenderer = function (props) {
|
|
2704
2720
|
var _a, _b, _c;
|
|
2705
2721
|
var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
|
|
@@ -3111,22 +3127,6 @@ var GridFormDropDown = function (props) {
|
|
|
3111
3127
|
})] }) }))] }));
|
|
3112
3128
|
};
|
|
3113
3129
|
|
|
3114
|
-
var GridSubComponentContext = createContext({
|
|
3115
|
-
value: "GridSubComponentContext value no context",
|
|
3116
|
-
setValue: function () {
|
|
3117
|
-
console.error("GridSubComponentContext setValue no context");
|
|
3118
|
-
},
|
|
3119
|
-
setValid: function () {
|
|
3120
|
-
console.error("GridSubComponentContext setValid no context");
|
|
3121
|
-
},
|
|
3122
|
-
triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3123
|
-
return __generator(this, function (_a) {
|
|
3124
|
-
console.error("GridSubComponentContext triggerSave no context");
|
|
3125
|
-
return [2 /*return*/];
|
|
3126
|
-
});
|
|
3127
|
-
}); }
|
|
3128
|
-
});
|
|
3129
|
-
|
|
3130
3130
|
var GridFormMultiSelect = function (props) {
|
|
3131
3131
|
var selectedRows = useGridPopoverContext().selectedRows;
|
|
3132
3132
|
var initialiseValues = useMemo(function () {
|
|
@@ -4003,5 +4003,5 @@ var ActionButton = function (_a) {
|
|
|
4003
4003
|
} })) : (jsx(LuiIcon, { name: icon, alt: (_c = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : name) !== null && _c !== void 0 ? _c : "", size: size })), jsxs("span", __assign({ className: "ActionButton-minimalArea" }, { children: [jsx("span", __assign({ className: "ActionButton-minimalAreaDisplay" }, { children: (_d = (localInProgress ? inProgressName : name)) !== null && _d !== void 0 ? _d : name })), jsx("span", __assign({ className: "ActionButton-minimalAreaExpand" }, { children: name }))] }))] })));
|
|
4004
4004
|
};
|
|
4005
4005
|
|
|
4006
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentTextArea, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, convertDDToDMS, hasParentClass, isFloat, isNotEmpty, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
4006
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext, GridSubComponentTextArea, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, convertDDToDMS, hasParentClass, isFloat, isNotEmpty, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
4007
4007
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|