@linzjs/step-ag-grid 13.4.0 → 13.5.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/dist/src/utils/util.d.ts +7 -0
- package/dist/src/utils/util.test.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +151 -37
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +4 -3
- package/src/contexts/GridContextProvider.tsx +4 -1
- package/src/stories/grid/GridReadOnly.stories.tsx +1 -1
- package/src/utils/util.test.ts +8 -0
- package/src/utils/util.ts +10 -0
package/dist/src/utils/util.d.ts
CHANGED
|
@@ -5,3 +5,10 @@ export declare const findParentWithClass: (className: string, child: Node) => HT
|
|
|
5
5
|
export declare const hasParentClass: (className: string, child: Node) => boolean;
|
|
6
6
|
export declare const stringByteLengthIsInvalid: (str: string, maxBytes: number) => boolean;
|
|
7
7
|
export declare const fnOrVar: (fn: any, param: any) => any;
|
|
8
|
+
/**
|
|
9
|
+
* Trim filename and replaces troublesome characters.
|
|
10
|
+
*
|
|
11
|
+
* e.g. " LT 1235/543 &%//*$ " => "LT_1235-543_&%-$"
|
|
12
|
+
* e.g. " @filename here!!!" => "@filename_here!!!"
|
|
13
|
+
*/
|
|
14
|
+
export declare const sanitiseFileName: (filename: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -265,6 +265,144 @@ var GridUpdatingContext = createContext({
|
|
|
265
265
|
updatedDep: 0
|
|
266
266
|
});
|
|
267
267
|
|
|
268
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
269
|
+
|
|
270
|
+
function getDefaultExportFromCjs (x) {
|
|
271
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function getAugmentedNamespace(n) {
|
|
275
|
+
if (n.__esModule) return n;
|
|
276
|
+
var f = n.default;
|
|
277
|
+
if (typeof f == "function") {
|
|
278
|
+
var a = function a () {
|
|
279
|
+
if (this instanceof a) {
|
|
280
|
+
var args = [null];
|
|
281
|
+
args.push.apply(args, arguments);
|
|
282
|
+
var Ctor = Function.bind.apply(f, args);
|
|
283
|
+
return new Ctor();
|
|
284
|
+
}
|
|
285
|
+
return f.apply(this, arguments);
|
|
286
|
+
};
|
|
287
|
+
a.prototype = f.prototype;
|
|
288
|
+
} else a = {};
|
|
289
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
290
|
+
Object.keys(n).forEach(function (k) {
|
|
291
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
292
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function () {
|
|
295
|
+
return n[k];
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
return a;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function isHighSurrogate(codePoint) {
|
|
303
|
+
return codePoint >= 0xd800 && codePoint <= 0xdbff;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function isLowSurrogate(codePoint) {
|
|
307
|
+
return codePoint >= 0xdc00 && codePoint <= 0xdfff;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Truncate string by size in bytes
|
|
311
|
+
var truncate$2 = function truncate(getLength, string, byteLength) {
|
|
312
|
+
if (typeof string !== "string") {
|
|
313
|
+
throw new Error("Input must be string");
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
var charLength = string.length;
|
|
317
|
+
var curByteLength = 0;
|
|
318
|
+
var codePoint;
|
|
319
|
+
var segment;
|
|
320
|
+
|
|
321
|
+
for (var i = 0; i < charLength; i += 1) {
|
|
322
|
+
codePoint = string.charCodeAt(i);
|
|
323
|
+
segment = string[i];
|
|
324
|
+
|
|
325
|
+
if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {
|
|
326
|
+
i += 1;
|
|
327
|
+
segment += string[i];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
curByteLength += getLength(segment);
|
|
331
|
+
|
|
332
|
+
if (curByteLength === byteLength) {
|
|
333
|
+
return string.slice(0, i + 1);
|
|
334
|
+
}
|
|
335
|
+
else if (curByteLength > byteLength) {
|
|
336
|
+
return string.slice(0, i - segment.length + 1);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return string;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
var truncate$1 = truncate$2;
|
|
344
|
+
var getLength = Buffer.byteLength.bind(Buffer);
|
|
345
|
+
var truncateUtf8Bytes = truncate$1.bind(null, getLength);
|
|
346
|
+
|
|
347
|
+
/*jshint node:true*/
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Replaces characters in strings that are illegal/unsafe for filenames.
|
|
351
|
+
* Unsafe characters are either removed or replaced by a substitute set
|
|
352
|
+
* in the optional `options` object.
|
|
353
|
+
*
|
|
354
|
+
* Illegal Characters on Various Operating Systems
|
|
355
|
+
* / ? < > \ : * | "
|
|
356
|
+
* https://kb.acronis.com/content/39790
|
|
357
|
+
*
|
|
358
|
+
* Unicode Control codes
|
|
359
|
+
* C0 0x00-0x1f & C1 (0x80-0x9f)
|
|
360
|
+
* http://en.wikipedia.org/wiki/C0_and_C1_control_codes
|
|
361
|
+
*
|
|
362
|
+
* Reserved filenames on Unix-based systems (".", "..")
|
|
363
|
+
* Reserved filenames in Windows ("CON", "PRN", "AUX", "NUL", "COM1",
|
|
364
|
+
* "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
|
|
365
|
+
* "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", and
|
|
366
|
+
* "LPT9") case-insesitively and with or without filename extensions.
|
|
367
|
+
*
|
|
368
|
+
* Capped at 255 characters in length.
|
|
369
|
+
* http://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs
|
|
370
|
+
*
|
|
371
|
+
* @param {String} input Original filename
|
|
372
|
+
* @param {Object} options {replacement: String | Function }
|
|
373
|
+
* @return {String} Sanitized filename
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
var truncate = truncateUtf8Bytes;
|
|
377
|
+
|
|
378
|
+
var illegalRe = /[\/\?<>\\:\*\|"]/g;
|
|
379
|
+
var controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
|
380
|
+
var reservedRe = /^\.+$/;
|
|
381
|
+
var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
|
|
382
|
+
var windowsTrailingRe = /[\. ]+$/;
|
|
383
|
+
|
|
384
|
+
function sanitize(input, replacement) {
|
|
385
|
+
if (typeof input !== 'string') {
|
|
386
|
+
throw new Error('Input must be string');
|
|
387
|
+
}
|
|
388
|
+
var sanitized = input
|
|
389
|
+
.replace(illegalRe, replacement)
|
|
390
|
+
.replace(controlRe, replacement)
|
|
391
|
+
.replace(reservedRe, replacement)
|
|
392
|
+
.replace(windowsReservedRe, replacement)
|
|
393
|
+
.replace(windowsTrailingRe, replacement);
|
|
394
|
+
return truncate(sanitized, 255);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
var sanitizeFilename = function (input, options) {
|
|
398
|
+
var replacement = (options && options.replacement) || '';
|
|
399
|
+
var output = sanitize(input, replacement);
|
|
400
|
+
if (replacement === '') {
|
|
401
|
+
return output;
|
|
402
|
+
}
|
|
403
|
+
return sanitize(output, '');
|
|
404
|
+
};
|
|
405
|
+
|
|
268
406
|
var isNotEmpty = negate(isEmpty);
|
|
269
407
|
var wait$2 = function (timeoutMs) {
|
|
270
408
|
return new Promise(function (resolve) {
|
|
@@ -296,7 +434,16 @@ var hasParentClass = function (className, child) {
|
|
|
296
434
|
var stringByteLengthIsInvalid = function (str, maxBytes) {
|
|
297
435
|
return new TextEncoder().encode(str).length > maxBytes;
|
|
298
436
|
};
|
|
299
|
-
var fnOrVar = function (fn, param) { return (typeof fn === "function" ? fn(param) : fn); };
|
|
437
|
+
var fnOrVar = function (fn, param) { return (typeof fn === "function" ? fn(param) : fn); };
|
|
438
|
+
/**
|
|
439
|
+
* Trim filename and replaces troublesome characters.
|
|
440
|
+
*
|
|
441
|
+
* e.g. " LT 1235/543 &%//*$ " => "LT_1235-543_&%-$"
|
|
442
|
+
* e.g. " @filename here!!!" => "@filename_here!!!"
|
|
443
|
+
*/
|
|
444
|
+
var sanitiseFileName = function (filename) {
|
|
445
|
+
return sanitizeFilename(filename.trim().replaceAll(/(\/|\\)+/g, "-")).replaceAll(/\s+/g, "_");
|
|
446
|
+
};
|
|
300
447
|
|
|
301
448
|
var GridNoRowsOverlay = function (params) {
|
|
302
449
|
var _a;
|
|
@@ -2956,40 +3103,6 @@ var GridFilterDownloadCsvButton = function (csvExportParams) {
|
|
|
2956
3103
|
_a) })) : (jsx(GridFilterHeaderIconButton, { icon: "ic_save_download", title: "Download CSV", onClick: handleDownloadClick, disabled: downloading }));
|
|
2957
3104
|
};
|
|
2958
3105
|
|
|
2959
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2960
|
-
|
|
2961
|
-
function getDefaultExportFromCjs (x) {
|
|
2962
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
|
-
function getAugmentedNamespace(n) {
|
|
2966
|
-
if (n.__esModule) return n;
|
|
2967
|
-
var f = n.default;
|
|
2968
|
-
if (typeof f == "function") {
|
|
2969
|
-
var a = function a () {
|
|
2970
|
-
if (this instanceof a) {
|
|
2971
|
-
var args = [null];
|
|
2972
|
-
args.push.apply(args, arguments);
|
|
2973
|
-
var Ctor = Function.bind.apply(f, args);
|
|
2974
|
-
return new Ctor();
|
|
2975
|
-
}
|
|
2976
|
-
return f.apply(this, arguments);
|
|
2977
|
-
};
|
|
2978
|
-
a.prototype = f.prototype;
|
|
2979
|
-
} else a = {};
|
|
2980
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
2981
|
-
Object.keys(n).forEach(function (k) {
|
|
2982
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
2983
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
2984
|
-
enumerable: true,
|
|
2985
|
-
get: function () {
|
|
2986
|
-
return n[k];
|
|
2987
|
-
}
|
|
2988
|
-
});
|
|
2989
|
-
});
|
|
2990
|
-
return a;
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
3106
|
/* global setTimeout, clearTimeout */
|
|
2994
3107
|
|
|
2995
3108
|
var dist$1 = function debounce(fn) {
|
|
@@ -4794,8 +4907,9 @@ var GridContextProvider = function (props) {
|
|
|
4794
4907
|
var downloadCsv = useCallback(function (csvExportParams) {
|
|
4795
4908
|
if (!gridApi || !columnApi)
|
|
4796
4909
|
return;
|
|
4910
|
+
var fileName = (csvExportParams === null || csvExportParams === void 0 ? void 0 : csvExportParams.fileName) && sanitiseFileName(csvExportParams.fileName);
|
|
4797
4911
|
var columnKeys = columnApi === null || columnApi === void 0 ? void 0 : columnApi.getColumnState().filter(function (cs) { var _a, _b; return !cs.hide && ((_b = (_a = gridApi.getColumnDef(cs.colId)) === null || _a === void 0 ? void 0 : _a.headerComponentParams) === null || _b === void 0 ? void 0 : _b.exportable) !== false; }).map(function (cs) { return cs.colId; });
|
|
4798
|
-
gridApi.exportDataAsCsv(__assign({ columnKeys: columnKeys, processCellCallback: downloadCsvUseValueFormattersProcessCellCallback }, csvExportParams));
|
|
4912
|
+
gridApi.exportDataAsCsv(__assign(__assign({ columnKeys: columnKeys, processCellCallback: downloadCsvUseValueFormattersProcessCellCallback }, csvExportParams), { fileName: fileName }));
|
|
4799
4913
|
}, [columnApi, gridApi]);
|
|
4800
4914
|
return (jsx(GridContext.Provider, __assign({ value: {
|
|
4801
4915
|
getColumns: getColumns,
|
|
@@ -25088,5 +25202,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
|
|
|
25088
25202
|
});
|
|
25089
25203
|
}); };
|
|
25090
25204
|
|
|
25091
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, downloadCsvUseValueFormattersProcessCellCallback, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
|
|
25205
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, downloadCsvUseValueFormattersProcessCellCallback, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, sanitiseFileName, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
|
|
25092
25206
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|