@mikevar/data-grid 0.2.0 → 0.3.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/index.cjs +18 -5
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +17 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ARR_IN_STRING_SEPARATOR: () => ARR_IN_STRING_SEPARATOR,
|
|
23
24
|
COL_DIRECTION_SEPARATOR: () => COL_DIRECTION_SEPARATOR,
|
|
24
25
|
COL_OPERATOR_SEPARATOR: () => COL_OPERATOR_SEPARATOR,
|
|
25
26
|
DEFAULT_CURSOR: () => DEFAULT_CURSOR,
|
|
@@ -51,8 +52,9 @@ __export(index_exports, {
|
|
|
51
52
|
module.exports = __toCommonJS(index_exports);
|
|
52
53
|
|
|
53
54
|
// src/consts.ts
|
|
55
|
+
var ARR_IN_STRING_SEPARATOR = ",";
|
|
54
56
|
var COL_DIRECTION_SEPARATOR = ":";
|
|
55
|
-
var COL_OPERATOR_SEPARATOR = "
|
|
57
|
+
var COL_OPERATOR_SEPARATOR = ":";
|
|
56
58
|
var DEFAULT_FILTER_MODE_KEY = "filterMode";
|
|
57
59
|
var DEFAULT_SEARCH_KEY = "search";
|
|
58
60
|
var DEFAULT_PAGINATION_MODE_KEY = "paginationMode";
|
|
@@ -68,14 +70,24 @@ var DEFAULT_FILTER_MODE = "search";
|
|
|
68
70
|
var DEFAULT_SEARCH = "";
|
|
69
71
|
var FILTER_OPERATORS = [
|
|
70
72
|
"eq",
|
|
73
|
+
"ne",
|
|
71
74
|
"gt",
|
|
72
75
|
"gte",
|
|
73
76
|
"lt",
|
|
74
77
|
"lte",
|
|
75
|
-
"between",
|
|
76
|
-
"iLike",
|
|
77
78
|
"isNull",
|
|
78
|
-
"
|
|
79
|
+
"isNotNull",
|
|
80
|
+
"inArray",
|
|
81
|
+
"notInArray",
|
|
82
|
+
"between",
|
|
83
|
+
"notBetween",
|
|
84
|
+
"like",
|
|
85
|
+
"ilike",
|
|
86
|
+
"notILike",
|
|
87
|
+
"not",
|
|
88
|
+
"arrayContains",
|
|
89
|
+
"arrayContained",
|
|
90
|
+
"arrayOverlaps"
|
|
79
91
|
];
|
|
80
92
|
|
|
81
93
|
// src/utils.ts
|
|
@@ -210,7 +222,7 @@ function normalizeParsedQueryObject({
|
|
|
210
222
|
cursor,
|
|
211
223
|
limit
|
|
212
224
|
};
|
|
213
|
-
const explodedOrders = parsedQuery.sorting.orders?.split(
|
|
225
|
+
const explodedOrders = parsedQuery.sorting.orders?.split(ARR_IN_STRING_SEPARATOR) || [];
|
|
214
226
|
const orders = explodedOrders.map((order) => {
|
|
215
227
|
const [column, direction] = order.split(COL_DIRECTION_SEPARATOR).map((s) => s.trim());
|
|
216
228
|
if (!column) return null;
|
|
@@ -265,6 +277,7 @@ function parseAndNormalize(options) {
|
|
|
265
277
|
}
|
|
266
278
|
// Annotate the CommonJS export names for ESM import in node:
|
|
267
279
|
0 && (module.exports = {
|
|
280
|
+
ARR_IN_STRING_SEPARATOR,
|
|
268
281
|
COL_DIRECTION_SEPARATOR,
|
|
269
282
|
COL_OPERATOR_SEPARATOR,
|
|
270
283
|
DEFAULT_CURSOR,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
declare const ARR_IN_STRING_SEPARATOR = ",";
|
|
1
2
|
declare const COL_DIRECTION_SEPARATOR = ":";
|
|
2
|
-
declare const COL_OPERATOR_SEPARATOR = "
|
|
3
|
+
declare const COL_OPERATOR_SEPARATOR = ":";
|
|
3
4
|
declare const DEFAULT_FILTER_MODE_KEY = "filterMode";
|
|
4
5
|
declare const DEFAULT_SEARCH_KEY = "search";
|
|
5
6
|
declare const DEFAULT_PAGINATION_MODE_KEY = "paginationMode";
|
|
@@ -13,7 +14,7 @@ declare const DEFAULT_LIMIT = 10;
|
|
|
13
14
|
declare const DEFAULT_CURSOR = "";
|
|
14
15
|
declare const DEFAULT_FILTER_MODE: FilterMode;
|
|
15
16
|
declare const DEFAULT_SEARCH = "";
|
|
16
|
-
declare const FILTER_OPERATORS: readonly ["eq", "gt", "gte", "lt", "lte", "between", "
|
|
17
|
+
declare const FILTER_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "isNull", "isNotNull", "inArray", "notInArray", "between", "notBetween", "like", "ilike", "notILike", "not", "arrayContains", "arrayContained", "arrayOverlaps"];
|
|
17
18
|
|
|
18
19
|
type QueryKeysOptions = {
|
|
19
20
|
filterMode?: string;
|
|
@@ -160,4 +161,4 @@ declare function parseAndNormalize(options: ParseAndNormalizeQueryObjectOptions)
|
|
|
160
161
|
normalized: NormalizedQueryObject;
|
|
161
162
|
};
|
|
162
163
|
|
|
163
|
-
export { COL_DIRECTION_SEPARATOR, COL_OPERATOR_SEPARATOR, type CursorPaginationObject, DEFAULT_CURSOR, DEFAULT_CURSOR_KEY, DEFAULT_FILTER_MODE, DEFAULT_FILTER_MODE_KEY, DEFAULT_LIMIT, DEFAULT_LIMIT_KEY, DEFAULT_ORDERS_KEY, DEFAULT_PAGE, DEFAULT_PAGE_KEY, DEFAULT_PAGINATION_MODE, DEFAULT_PAGINATION_MODE_KEY, DEFAULT_SEARCH, DEFAULT_SEARCH_KEY, type DefaultQueryValuesOptions, FILTER_OPERATORS, type FieldSchema, type FieldSchemaColumn, type FieldSchemaObject, type FieldSchemaObjectType, type FilterMode, type FilterObject, type FilterOperator, type NormalizedQueryObject, type OffsetPaginationObject, type OrderDirection, type OrderObject, type PaginationMode, type ParsedQueryObject, type QueryKeysOptions, type QueryPlanObject, isFilterMode, isFilterOperator, isOrderDirection, isPaginationMode, mergeDefaultAndCustomQueryKeys, mergeDefaultQueryValues, normalizeParsedQueryObject, parseAndNormalize, parseAndNormalizeQueryObject, parseQueryObject, toPositiveInt };
|
|
164
|
+
export { ARR_IN_STRING_SEPARATOR, COL_DIRECTION_SEPARATOR, COL_OPERATOR_SEPARATOR, type CursorPaginationObject, DEFAULT_CURSOR, DEFAULT_CURSOR_KEY, DEFAULT_FILTER_MODE, DEFAULT_FILTER_MODE_KEY, DEFAULT_LIMIT, DEFAULT_LIMIT_KEY, DEFAULT_ORDERS_KEY, DEFAULT_PAGE, DEFAULT_PAGE_KEY, DEFAULT_PAGINATION_MODE, DEFAULT_PAGINATION_MODE_KEY, DEFAULT_SEARCH, DEFAULT_SEARCH_KEY, type DefaultQueryValuesOptions, FILTER_OPERATORS, type FieldSchema, type FieldSchemaColumn, type FieldSchemaObject, type FieldSchemaObjectType, type FilterMode, type FilterObject, type FilterOperator, type NormalizedQueryObject, type OffsetPaginationObject, type OrderDirection, type OrderObject, type PaginationMode, type ParsedQueryObject, type QueryKeysOptions, type QueryPlanObject, isFilterMode, isFilterOperator, isOrderDirection, isPaginationMode, mergeDefaultAndCustomQueryKeys, mergeDefaultQueryValues, normalizeParsedQueryObject, parseAndNormalize, parseAndNormalizeQueryObject, parseQueryObject, toPositiveInt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
declare const ARR_IN_STRING_SEPARATOR = ",";
|
|
1
2
|
declare const COL_DIRECTION_SEPARATOR = ":";
|
|
2
|
-
declare const COL_OPERATOR_SEPARATOR = "
|
|
3
|
+
declare const COL_OPERATOR_SEPARATOR = ":";
|
|
3
4
|
declare const DEFAULT_FILTER_MODE_KEY = "filterMode";
|
|
4
5
|
declare const DEFAULT_SEARCH_KEY = "search";
|
|
5
6
|
declare const DEFAULT_PAGINATION_MODE_KEY = "paginationMode";
|
|
@@ -13,7 +14,7 @@ declare const DEFAULT_LIMIT = 10;
|
|
|
13
14
|
declare const DEFAULT_CURSOR = "";
|
|
14
15
|
declare const DEFAULT_FILTER_MODE: FilterMode;
|
|
15
16
|
declare const DEFAULT_SEARCH = "";
|
|
16
|
-
declare const FILTER_OPERATORS: readonly ["eq", "gt", "gte", "lt", "lte", "between", "
|
|
17
|
+
declare const FILTER_OPERATORS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "isNull", "isNotNull", "inArray", "notInArray", "between", "notBetween", "like", "ilike", "notILike", "not", "arrayContains", "arrayContained", "arrayOverlaps"];
|
|
17
18
|
|
|
18
19
|
type QueryKeysOptions = {
|
|
19
20
|
filterMode?: string;
|
|
@@ -160,4 +161,4 @@ declare function parseAndNormalize(options: ParseAndNormalizeQueryObjectOptions)
|
|
|
160
161
|
normalized: NormalizedQueryObject;
|
|
161
162
|
};
|
|
162
163
|
|
|
163
|
-
export { COL_DIRECTION_SEPARATOR, COL_OPERATOR_SEPARATOR, type CursorPaginationObject, DEFAULT_CURSOR, DEFAULT_CURSOR_KEY, DEFAULT_FILTER_MODE, DEFAULT_FILTER_MODE_KEY, DEFAULT_LIMIT, DEFAULT_LIMIT_KEY, DEFAULT_ORDERS_KEY, DEFAULT_PAGE, DEFAULT_PAGE_KEY, DEFAULT_PAGINATION_MODE, DEFAULT_PAGINATION_MODE_KEY, DEFAULT_SEARCH, DEFAULT_SEARCH_KEY, type DefaultQueryValuesOptions, FILTER_OPERATORS, type FieldSchema, type FieldSchemaColumn, type FieldSchemaObject, type FieldSchemaObjectType, type FilterMode, type FilterObject, type FilterOperator, type NormalizedQueryObject, type OffsetPaginationObject, type OrderDirection, type OrderObject, type PaginationMode, type ParsedQueryObject, type QueryKeysOptions, type QueryPlanObject, isFilterMode, isFilterOperator, isOrderDirection, isPaginationMode, mergeDefaultAndCustomQueryKeys, mergeDefaultQueryValues, normalizeParsedQueryObject, parseAndNormalize, parseAndNormalizeQueryObject, parseQueryObject, toPositiveInt };
|
|
164
|
+
export { ARR_IN_STRING_SEPARATOR, COL_DIRECTION_SEPARATOR, COL_OPERATOR_SEPARATOR, type CursorPaginationObject, DEFAULT_CURSOR, DEFAULT_CURSOR_KEY, DEFAULT_FILTER_MODE, DEFAULT_FILTER_MODE_KEY, DEFAULT_LIMIT, DEFAULT_LIMIT_KEY, DEFAULT_ORDERS_KEY, DEFAULT_PAGE, DEFAULT_PAGE_KEY, DEFAULT_PAGINATION_MODE, DEFAULT_PAGINATION_MODE_KEY, DEFAULT_SEARCH, DEFAULT_SEARCH_KEY, type DefaultQueryValuesOptions, FILTER_OPERATORS, type FieldSchema, type FieldSchemaColumn, type FieldSchemaObject, type FieldSchemaObjectType, type FilterMode, type FilterObject, type FilterOperator, type NormalizedQueryObject, type OffsetPaginationObject, type OrderDirection, type OrderObject, type PaginationMode, type ParsedQueryObject, type QueryKeysOptions, type QueryPlanObject, isFilterMode, isFilterOperator, isOrderDirection, isPaginationMode, mergeDefaultAndCustomQueryKeys, mergeDefaultQueryValues, normalizeParsedQueryObject, parseAndNormalize, parseAndNormalizeQueryObject, parseQueryObject, toPositiveInt };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/consts.ts
|
|
2
|
+
var ARR_IN_STRING_SEPARATOR = ",";
|
|
2
3
|
var COL_DIRECTION_SEPARATOR = ":";
|
|
3
|
-
var COL_OPERATOR_SEPARATOR = "
|
|
4
|
+
var COL_OPERATOR_SEPARATOR = ":";
|
|
4
5
|
var DEFAULT_FILTER_MODE_KEY = "filterMode";
|
|
5
6
|
var DEFAULT_SEARCH_KEY = "search";
|
|
6
7
|
var DEFAULT_PAGINATION_MODE_KEY = "paginationMode";
|
|
@@ -16,14 +17,24 @@ var DEFAULT_FILTER_MODE = "search";
|
|
|
16
17
|
var DEFAULT_SEARCH = "";
|
|
17
18
|
var FILTER_OPERATORS = [
|
|
18
19
|
"eq",
|
|
20
|
+
"ne",
|
|
19
21
|
"gt",
|
|
20
22
|
"gte",
|
|
21
23
|
"lt",
|
|
22
24
|
"lte",
|
|
23
|
-
"between",
|
|
24
|
-
"iLike",
|
|
25
25
|
"isNull",
|
|
26
|
-
"
|
|
26
|
+
"isNotNull",
|
|
27
|
+
"inArray",
|
|
28
|
+
"notInArray",
|
|
29
|
+
"between",
|
|
30
|
+
"notBetween",
|
|
31
|
+
"like",
|
|
32
|
+
"ilike",
|
|
33
|
+
"notILike",
|
|
34
|
+
"not",
|
|
35
|
+
"arrayContains",
|
|
36
|
+
"arrayContained",
|
|
37
|
+
"arrayOverlaps"
|
|
27
38
|
];
|
|
28
39
|
|
|
29
40
|
// src/utils.ts
|
|
@@ -158,7 +169,7 @@ function normalizeParsedQueryObject({
|
|
|
158
169
|
cursor,
|
|
159
170
|
limit
|
|
160
171
|
};
|
|
161
|
-
const explodedOrders = parsedQuery.sorting.orders?.split(
|
|
172
|
+
const explodedOrders = parsedQuery.sorting.orders?.split(ARR_IN_STRING_SEPARATOR) || [];
|
|
162
173
|
const orders = explodedOrders.map((order) => {
|
|
163
174
|
const [column, direction] = order.split(COL_DIRECTION_SEPARATOR).map((s) => s.trim());
|
|
164
175
|
if (!column) return null;
|
|
@@ -212,6 +223,7 @@ function parseAndNormalize(options) {
|
|
|
212
223
|
return parseAndNormalizeQueryObject(options);
|
|
213
224
|
}
|
|
214
225
|
export {
|
|
226
|
+
ARR_IN_STRING_SEPARATOR,
|
|
215
227
|
COL_DIRECTION_SEPARATOR,
|
|
216
228
|
COL_OPERATOR_SEPARATOR,
|
|
217
229
|
DEFAULT_CURSOR,
|