@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260923102653 → 0.8.1-dev.20260923125229

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.
@@ -0,0 +1,381 @@
1
+ "use client";
2
+ import {
3
+ InputControlType_default
4
+ } from "./chunk-HRDHAIZF.mjs";
5
+ import {
6
+ Button_default
7
+ } from "./chunk-4WMSS6CE.mjs";
8
+ import "./chunk-56HSDML5.mjs";
9
+
10
+ // src/components/pageRenderingEngine/nodes/DataBindingControls.tsx
11
+ import { useCallback, useEffect, useRef, useState } from "react";
12
+ import { useRouter } from "next/navigation";
13
+
14
+ // src/components/controls/edit/InputControl.tsx
15
+ import dynamic from "next/dynamic";
16
+ var InputControl = dynamic(() => import("./InputControlClient-NHXG4QBU.mjs"), {
17
+ ssr: false
18
+ });
19
+ var InputControl_default = InputControl;
20
+
21
+ // src/components/pageRenderingEngine/nodes/DataBindingControls.tsx
22
+ import { jsx, jsxs } from "react/jsx-runtime";
23
+ var ACTIVE_QUERY_CONTROLS_EVENT = "data-binding-active-query-controls";
24
+ var humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
25
+ var escapeODataString = (value) => value.replace(/'/g, "''");
26
+ var parseFacetSelections = (filter) => {
27
+ const selections = /* @__PURE__ */ new Map();
28
+ const groupedExpression = /\(\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*\)/gi;
29
+ for (const match of filter.matchAll(groupedExpression)) {
30
+ selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
31
+ }
32
+ if (selections.size === 0) {
33
+ const ungroupedExpression = /(?:^|\s+and\s+)\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*(?=\s+and\s+|$)/gi;
34
+ for (const match of filter.matchAll(ungroupedExpression)) {
35
+ selections.set(
36
+ match[1].trim(),
37
+ match[2].replace(/''/g, "'")
38
+ );
39
+ }
40
+ }
41
+ return selections;
42
+ };
43
+ var buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
44
+ var parseODataSearch = (value) => {
45
+ if (!value) return "";
46
+ const trimmedValue = value.trim();
47
+ if (trimmedValue.startsWith("'") && trimmedValue.endsWith("'")) {
48
+ return trimmedValue.slice(1, -1).replace(/''/g, "'");
49
+ }
50
+ return trimmedValue;
51
+ };
52
+ var SearchIcon = ({ className = "" }) => /* @__PURE__ */ jsxs(
53
+ "svg",
54
+ {
55
+ "aria-hidden": "true",
56
+ className,
57
+ fill: "none",
58
+ viewBox: "0 0 24 24",
59
+ stroke: "currentColor",
60
+ strokeWidth: "2",
61
+ children: [
62
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
63
+ /* @__PURE__ */ jsx("path", { strokeLinecap: "round", d: "m20 20-4-4" })
64
+ ]
65
+ }
66
+ );
67
+ var ResetIcon = ({ className = "" }) => /* @__PURE__ */ jsxs(
68
+ "svg",
69
+ {
70
+ "aria-hidden": "true",
71
+ className,
72
+ fill: "none",
73
+ viewBox: "0 0 24 24",
74
+ stroke: "currentColor",
75
+ strokeWidth: "2",
76
+ children: [
77
+ /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v6h6" }),
78
+ /* @__PURE__ */ jsx(
79
+ "path",
80
+ {
81
+ strokeLinecap: "round",
82
+ strokeLinejoin: "round",
83
+ d: "M5.5 15a8 8 0 1 0 .6-7.8L4 10"
84
+ }
85
+ )
86
+ ]
87
+ }
88
+ );
89
+ var normalizeSortOption = (option) => {
90
+ const direction = option.direction.trim();
91
+ return {
92
+ label: option.title || humanize(option.name),
93
+ value: [option.name, direction].filter(Boolean).join(" ")
94
+ };
95
+ };
96
+ var DataBindingControls = ({
97
+ path,
98
+ query,
99
+ facets,
100
+ sortOptions,
101
+ showFacets,
102
+ showSortOptions,
103
+ showSearchBar,
104
+ mode = "toolbar"
105
+ }) => {
106
+ const router = useRouter();
107
+ const facetGroups = Object.entries(facets ?? {}).filter(
108
+ ([, values]) => Array.isArray(values) && values.length > 0
109
+ );
110
+ const normalizedSortOptions = (sortOptions ?? []).filter((option) => option?.name && option?.direction).map(normalizeSortOption).filter((option) => option.value);
111
+ const queryFilter = query?.["$filter"] ?? query?.filter ?? "";
112
+ const querySort = query?.["$orderby"] ?? query?.orderBy ?? "";
113
+ const [currentFilter, setCurrentFilter] = useState(queryFilter);
114
+ const [currentSort, setCurrentSort] = useState(querySort);
115
+ const selectedFacetValues = parseFacetSelections(currentFilter);
116
+ const currentSearch = parseODataSearch(query?.["$search"]);
117
+ const [searchText, setSearchText] = useState(currentSearch);
118
+ const lastNavigationUrl = useRef(null);
119
+ useEffect(() => {
120
+ setSearchText(currentSearch);
121
+ }, [currentSearch]);
122
+ useEffect(() => {
123
+ setCurrentFilter(queryFilter);
124
+ }, [queryFilter]);
125
+ useEffect(() => {
126
+ setCurrentSort(querySort);
127
+ }, [querySort]);
128
+ useEffect(() => {
129
+ const syncActiveQueryControls2 = (event) => {
130
+ const { filter, sort } = event.detail;
131
+ if (filter !== void 0) {
132
+ setCurrentFilter(filter);
133
+ }
134
+ if (sort !== void 0) {
135
+ setCurrentSort(sort);
136
+ }
137
+ };
138
+ window.addEventListener(
139
+ ACTIVE_QUERY_CONTROLS_EVENT,
140
+ syncActiveQueryControls2
141
+ );
142
+ return () => window.removeEventListener(
143
+ ACTIVE_QUERY_CONTROLS_EVENT,
144
+ syncActiveQueryControls2
145
+ );
146
+ }, []);
147
+ const syncActiveQueryControls = useCallback(
148
+ (updates) => {
149
+ window.dispatchEvent(
150
+ new CustomEvent(ACTIVE_QUERY_CONTROLS_EVENT, {
151
+ detail: updates
152
+ })
153
+ );
154
+ },
155
+ []
156
+ );
157
+ const getQueryUrl = useCallback(
158
+ (updates) => {
159
+ const params = new URLSearchParams(query ?? {});
160
+ Object.entries(updates).forEach(([key, value]) => {
161
+ if (value) {
162
+ params.set(key, value);
163
+ } else {
164
+ params.delete(key);
165
+ }
166
+ });
167
+ params.delete("$skip");
168
+ params.delete("skip");
169
+ const queryString = Array.from(params.entries()).map(
170
+ ([key, value]) => key === "$filter" || key === "filter" ? `${key}=${encodeURIComponent(value)}` : `${key}=${value}`
171
+ ).join("&");
172
+ return queryString ? `${path}?${queryString}` : path;
173
+ },
174
+ [path, query]
175
+ );
176
+ const getFacetUrl = (field, value) => {
177
+ const updatedSelections = new Map(selectedFacetValues);
178
+ if (value) {
179
+ updatedSelections.set(field, value);
180
+ } else {
181
+ updatedSelections.delete(field);
182
+ }
183
+ const updatedFilter = buildFacetFilter(updatedSelections);
184
+ syncActiveQueryControls({ filter: updatedFilter });
185
+ return getQueryUrl({
186
+ $filter: updatedFilter || void 0,
187
+ filter: void 0
188
+ });
189
+ };
190
+ const navigateWithoutReload = useCallback(
191
+ (url) => {
192
+ if (lastNavigationUrl.current === url) {
193
+ return;
194
+ }
195
+ if (typeof window !== "undefined") {
196
+ const targetUrl = new URL(url, window.location.origin);
197
+ if (targetUrl.pathname === window.location.pathname && targetUrl.search === window.location.search) {
198
+ return;
199
+ }
200
+ }
201
+ lastNavigationUrl.current = url;
202
+ router.push(url, { scroll: false });
203
+ },
204
+ [router]
205
+ );
206
+ const handleSearch = useCallback(async () => {
207
+ const trimmedSearchText = searchText.trim();
208
+ if (trimmedSearchText === currentSearch.trim()) {
209
+ return { isSuccessful: true };
210
+ }
211
+ navigateWithoutReload(
212
+ getQueryUrl({
213
+ "$search": trimmedSearchText || void 0
214
+ })
215
+ );
216
+ return { isSuccessful: true };
217
+ }, [currentSearch, getQueryUrl, navigateWithoutReload, searchText]);
218
+ const handleClearAll = useCallback(async () => {
219
+ syncActiveQueryControls({ filter: "", sort: "" });
220
+ navigateWithoutReload(
221
+ getQueryUrl({
222
+ $filter: void 0,
223
+ filter: void 0,
224
+ $orderby: void 0,
225
+ orderBy: void 0
226
+ })
227
+ );
228
+ return { isSuccessful: true };
229
+ }, [getQueryUrl, navigateWithoutReload, syncActiveQueryControls]);
230
+ const hasFacetControls = showFacets && facetGroups.length > 0;
231
+ const hasSortControls = showSortOptions && normalizedSortOptions.length > 0;
232
+ const hasActiveFiltersOrSort = Boolean(
233
+ currentFilter.trim() || currentSort.trim()
234
+ );
235
+ const shouldShowToolbarClearAll = hasActiveFiltersOrSort && !hasFacetControls;
236
+ const shouldShowToolbar = mode === "toolbar" && (showSearchBar || hasSortControls || shouldShowToolbarClearAll);
237
+ const shouldShowFacets = mode === "facets" && hasFacetControls;
238
+ if (!shouldShowToolbar && !shouldShowFacets) {
239
+ return null;
240
+ }
241
+ const renderFacetLinks = (field, values, stacked = false) => /* @__PURE__ */ jsxs("div", { className: stacked ? "flex flex-col gap-0.5" : "flex flex-wrap gap-1.5", children: [
242
+ /* @__PURE__ */ jsx(
243
+ "button",
244
+ {
245
+ type: "button",
246
+ onClick: () => navigateWithoutReload(getFacetUrl(field)),
247
+ "aria-pressed": !selectedFacetValues.has(field),
248
+ className: `cursor-pointer px-3 py-1.5 text-left text-sm transition-all duration-150 ease-out hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${stacked ? "w-full" : "border"} ${selectedFacetValues.has(field) ? "hover:bg-info-soft" : "bg-primary-base font-semibold hover:brightness-95"}`,
249
+ children: "All"
250
+ }
251
+ ),
252
+ values.map((facet) => {
253
+ const isSelected = selectedFacetValues.get(field) === facet.value;
254
+ return /* @__PURE__ */ jsxs(
255
+ "button",
256
+ {
257
+ type: "button",
258
+ onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
259
+ "aria-pressed": isSelected,
260
+ className: `cursor-pointer px-3 py-1.5 text-left text-sm transition-all duration-150 ease-out hover:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${stacked ? "w-full" : "border"} ${isSelected ? "bg-primary-base font-semibold hover:brightness-95" : "hover:bg-info-soft"}`,
261
+ children: [
262
+ facet.value,
263
+ " (",
264
+ facet.count,
265
+ ")"
266
+ ]
267
+ },
268
+ `${field}-${facet.value}`
269
+ );
270
+ })
271
+ ] });
272
+ return /* @__PURE__ */ jsxs(
273
+ "div",
274
+ {
275
+ className: mode === "toolbar" ? "my-6" : "flex flex-col gap-2 border bg-default rounded-[5px] p-3",
276
+ children: [
277
+ shouldShowToolbar && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
278
+ showSearchBar && /* @__PURE__ */ jsxs(
279
+ "form",
280
+ {
281
+ role: "search",
282
+ className: "flex w-full flex-col gap-3 rounded-xl border border-info bg-info-soft p-3 sm:flex-row sm:items-center md:min-w-0 md:flex-1",
283
+ onSubmit: (event) => {
284
+ event.preventDefault();
285
+ void handleSearch();
286
+ },
287
+ children: [
288
+ /* @__PURE__ */ jsxs("div", { className: "relative bg-default rounded-xl min-w-0 flex-1", children: [
289
+ /* @__PURE__ */ jsx(SearchIcon, { className: "pointer-events-none absolute left-4 top-1/2 z-10 h-5 w-5 -translate-y-1/2" }),
290
+ /* @__PURE__ */ jsx(
291
+ InputControl_default,
292
+ {
293
+ name: "searchText",
294
+ controlType: InputControlType_default.lineTextInput,
295
+ value: searchText,
296
+ callback: (updatedValues) => setSearchText(updatedValues.value),
297
+ attributes: {
298
+ placeholder: "Search discussions, topics, or keywords..."
299
+ },
300
+ inputClasses: "!mt-0 !rounded-xl !py-3 !pl-11 !pr-4 !shadow-sm"
301
+ }
302
+ )
303
+ ] }),
304
+ /* @__PURE__ */ jsxs(
305
+ Button_default,
306
+ {
307
+ ButtonType: "Primary" /* Solid */,
308
+ onClick: handleSearch,
309
+ className: "!rounded-xl !px-6 !py-3 sm:self-stretch",
310
+ children: [
311
+ /* @__PURE__ */ jsx(SearchIcon, { className: "h-5 w-5" }),
312
+ /* @__PURE__ */ jsx("span", { children: "Search" })
313
+ ]
314
+ }
315
+ )
316
+ ]
317
+ }
318
+ ),
319
+ hasSortControls && /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-3 rounded-2xl border border-info bg-info-soft p-3 text-sm md:ml-auto md:w-auto md:min-w-72 md:self-stretch", children: [
320
+ /* @__PURE__ */ jsx(
321
+ "label",
322
+ {
323
+ htmlFor: "sortOptions",
324
+ className: "shrink-0 whitespace-nowrap font-medium",
325
+ children: "Sort by"
326
+ }
327
+ ),
328
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 rounded-xl bg-default md:min-w-48", children: /* @__PURE__ */ jsx(
329
+ InputControl_default,
330
+ {
331
+ name: "sortOptions",
332
+ controlType: InputControlType_default.select,
333
+ value: currentSort,
334
+ dataset: normalizedSortOptions,
335
+ dataKeyFieldName: "value",
336
+ dataTextFieldName: "label",
337
+ callback: (updatedValues) => {
338
+ const updatedSort = updatedValues.value || "";
339
+ syncActiveQueryControls({ sort: updatedSort });
340
+ navigateWithoutReload(
341
+ getQueryUrl({
342
+ $orderby: updatedSort || void 0,
343
+ orderBy: void 0
344
+ })
345
+ );
346
+ },
347
+ attributes: { placeholder: "Default" },
348
+ inputClasses: "!mt-0 !rounded-xl !border-info !bg-default !px-4 !py-3 !text-body !shadow-sm focus:!border-primary focus:!ring-primary-base"
349
+ }
350
+ ) })
351
+ ] })
352
+ ] }),
353
+ shouldShowFacets && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b pb-2", children: [
354
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: "Filters" }),
355
+ hasActiveFiltersOrSort && /* @__PURE__ */ jsxs(
356
+ "button",
357
+ {
358
+ type: "button",
359
+ onClick: () => void handleClearAll(),
360
+ className: "group inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-primary transition-colors duration-150 hover:bg-info-soft hover:text-primary-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
361
+ "aria-label": "Clear all filters and sorting",
362
+ children: [
363
+ /* @__PURE__ */ jsx(ResetIcon, { className: "h-3.5 w-3.5 transition-transform duration-200 group-hover:-rotate-45" }),
364
+ /* @__PURE__ */ jsx("span", { children: "Clear all" })
365
+ ]
366
+ }
367
+ )
368
+ ] }),
369
+ shouldShowFacets && facetGroups.length === 1 && /* @__PURE__ */ jsx("nav", { "aria-label": `${humanize(facetGroups[0][0])} filters`, children: renderFacetLinks(facetGroups[0][0], facetGroups[0][1]) }),
370
+ shouldShowFacets && facetGroups.length > 1 && /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: facetGroups.map(([field, values]) => /* @__PURE__ */ jsxs("details", { className: "border-b py-1 last:border-b-0", open: true, children: [
371
+ /* @__PURE__ */ jsx("summary", { className: "cursor-pointer rounded-md px-2 py-1.5 font-semibold transition-colors duration-150 hover:bg-info-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary", children: humanize(field) }),
372
+ /* @__PURE__ */ jsx("div", { className: "px-1 pb-1 pt-0.5", children: renderFacetLinks(field, values, true) })
373
+ ] }, field)) })
374
+ ]
375
+ }
376
+ );
377
+ };
378
+ var DataBindingControls_default = DataBindingControls;
379
+ export {
380
+ DataBindingControls_default as default
381
+ };
@@ -3,7 +3,7 @@
3
3
  "use client";
4
4
  import {
5
5
  OdataBuilder
6
- } from "./chunk-SNDGEYWZ.mjs";
6
+ } from "./chunk-K6GGVJCI.mjs";
7
7
  import {
8
8
  Hyperlink,
9
9
  Icon_default
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-6PW2RLUJ.mjs";
5
5
  import {
6
6
  OdataBuilder
7
- } from "./chunk-6MO2JRIT.mjs";
7
+ } from "./chunk-I3ND2ZRE.mjs";
8
8
  import {
9
9
  Hyperlink
10
10
  } from "./chunk-2R26M6CK.mjs";
@@ -3,6 +3,7 @@ import {
3
3
  } from "./chunk-HRDHAIZF.mjs";
4
4
 
5
5
  // src/clients/OdataBuilder.tsx
6
+ var encodeFilter = (filter) => encodeURIComponent(filter);
6
7
  var OdataBuilder = class {
7
8
  constructor(url) {
8
9
  this.baseUrl = url;
@@ -84,7 +85,7 @@ var OdataBuilder = class {
84
85
  }
85
86
  if (obj) {
86
87
  if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
87
- queryString = queryString + `&$filter=${obj["$filter"]}`;
88
+ queryString = queryString + `&$filter=${encodeFilter(obj["$filter"])}`;
88
89
  }
89
90
  if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
90
91
  queryString = queryString + `&$orderby=${obj["$orderby"]}`;
@@ -144,7 +145,7 @@ var OdataBuilder = class {
144
145
  getUrl() {
145
146
  let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
146
147
  if (this.filterBy !== null && this.filterBy !== "") {
147
- url = url + `&$filter=${this.filterBy}`;
148
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
148
149
  }
149
150
  if (this.orderBy !== null && this.orderBy !== "") {
150
151
  url = url + `&$orderby=${this.orderBy}`;
@@ -161,7 +162,7 @@ var OdataBuilder = class {
161
162
  getNewOrderByUrl(orderBy) {
162
163
  let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
163
164
  if (this.filterBy !== null && this.filterBy !== "") {
164
- url = url + `&$filter=${this.filterBy}`;
165
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
165
166
  }
166
167
  if (this.searchTerm) {
167
168
  url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
@@ -175,7 +176,7 @@ var OdataBuilder = class {
175
176
  getNewFilterUrl(filterBy) {
176
177
  let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
177
178
  if (filterBy !== null && filterBy !== "") {
178
- url = url + `&$filter=${filterBy}`;
179
+ url = url + `&$filter=${encodeFilter(filterBy)}`;
179
180
  }
180
181
  if (this.orderBy !== null && this.orderBy !== "") {
181
182
  url = url + `&$orderby=${this.orderBy}`;
@@ -192,7 +193,7 @@ var OdataBuilder = class {
192
193
  let skip = page * Constants.pagesize - Constants.pagesize;
193
194
  let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
194
195
  if (this.filterBy !== null && this.filterBy !== "") {
195
- url = url + `&$filter=${this.filterBy}`;
196
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
196
197
  }
197
198
  if (this.orderBy !== null && this.orderBy !== "") {
198
199
  url = url + `&$orderby=${this.orderBy}`;
@@ -212,7 +213,7 @@ var OdataBuilder = class {
212
213
  const skip = (currentPage - 1) * pageSize;
213
214
  let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
214
215
  if (this.filterBy !== null && this.filterBy !== "") {
215
- url = url + `&$filter=${this.filterBy}`;
216
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
216
217
  }
217
218
  if (this.orderBy !== null && this.orderBy !== "") {
218
219
  url = url + `&$orderby=${this.orderBy}`;
@@ -5,6 +5,7 @@ import {
5
5
  } from "./chunk-F4DNLPFN.mjs";
6
6
 
7
7
  // src/clients/OdataBuilder.tsx
8
+ var encodeFilter = (filter) => encodeURIComponent(filter);
8
9
  var OdataBuilder = class {
9
10
  constructor(url) {
10
11
  this.baseUrl = url;
@@ -86,7 +87,7 @@ var OdataBuilder = class {
86
87
  }
87
88
  if (obj) {
88
89
  if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
89
- queryString = queryString + `&$filter=${obj["$filter"]}`;
90
+ queryString = queryString + `&$filter=${encodeFilter(obj["$filter"])}`;
90
91
  }
91
92
  if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
92
93
  queryString = queryString + `&$orderby=${obj["$orderby"]}`;
@@ -146,7 +147,7 @@ var OdataBuilder = class {
146
147
  getUrl() {
147
148
  let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
148
149
  if (this.filterBy !== null && this.filterBy !== "") {
149
- url = url + `&$filter=${this.filterBy}`;
150
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
150
151
  }
151
152
  if (this.orderBy !== null && this.orderBy !== "") {
152
153
  url = url + `&$orderby=${this.orderBy}`;
@@ -163,7 +164,7 @@ var OdataBuilder = class {
163
164
  getNewOrderByUrl(orderBy) {
164
165
  let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
165
166
  if (this.filterBy !== null && this.filterBy !== "") {
166
- url = url + `&$filter=${this.filterBy}`;
167
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
167
168
  }
168
169
  if (this.searchTerm) {
169
170
  url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
@@ -177,7 +178,7 @@ var OdataBuilder = class {
177
178
  getNewFilterUrl(filterBy) {
178
179
  let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
179
180
  if (filterBy !== null && filterBy !== "") {
180
- url = url + `&$filter=${filterBy}`;
181
+ url = url + `&$filter=${encodeFilter(filterBy)}`;
181
182
  }
182
183
  if (this.orderBy !== null && this.orderBy !== "") {
183
184
  url = url + `&$orderby=${this.orderBy}`;
@@ -194,7 +195,7 @@ var OdataBuilder = class {
194
195
  let skip = page * Constants.pagesize - Constants.pagesize;
195
196
  let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
196
197
  if (this.filterBy !== null && this.filterBy !== "") {
197
- url = url + `&$filter=${this.filterBy}`;
198
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
198
199
  }
199
200
  if (this.orderBy !== null && this.orderBy !== "") {
200
201
  url = url + `&$orderby=${this.orderBy}`;
@@ -214,7 +215,7 @@ var OdataBuilder = class {
214
215
  const skip = (currentPage - 1) * pageSize;
215
216
  let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
216
217
  if (this.filterBy !== null && this.filterBy !== "") {
217
- url = url + `&$filter=${this.filterBy}`;
218
+ url = url + `&$filter=${encodeFilter(this.filterBy)}`;
218
219
  }
219
220
  if (this.orderBy !== null && this.orderBy !== "") {
220
221
  url = url + `&$orderby=${this.orderBy}`;