@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260824095913 → 0.8.1-dev.20260824111228
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/{DataBindingControls-AT7I4FSN.mjs → DataBindingControls-M73B2SGY.mjs} +38 -10
- package/dist/{DataBindingControls-GHWIJ5N7.mjs → DataBindingControls-P4DW3BMK.mjs} +38 -10
- package/dist/{Pagination-2KVND6JU.mjs → Pagination-7RE7DCJ6.mjs} +1 -1
- package/dist/{Pagination-PDU7V3HY.mjs → Pagination-SP2IOZHJ.mjs} +1 -1
- package/dist/{chunk-4OH67SPF.mjs → chunk-HKIDEYYN.mjs} +14 -14
- package/dist/{chunk-TKJDEJSU.mjs → chunk-URWEMJUF.mjs} +14 -14
- package/dist/index.js +53 -25
- package/dist/index.mjs +3 -3
- package/dist/server.js +53 -25
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
|
@@ -18,6 +18,24 @@ var InputControl_default = InputControl;
|
|
|
18
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
19
|
var humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
20
20
|
var escapeODataString = (value) => value.replace(/'/g, "''");
|
|
21
|
+
var parseFacetSelections = (filter) => {
|
|
22
|
+
const selections = /* @__PURE__ */ new Map();
|
|
23
|
+
const groupedExpression = /\(\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*\)/gi;
|
|
24
|
+
for (const match of filter.matchAll(groupedExpression)) {
|
|
25
|
+
selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
|
|
26
|
+
}
|
|
27
|
+
if (selections.size === 0) {
|
|
28
|
+
const ungroupedExpression = /(?:^|\s+and\s+)\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*(?=\s+and\s+|$)/gi;
|
|
29
|
+
for (const match of filter.matchAll(ungroupedExpression)) {
|
|
30
|
+
selections.set(
|
|
31
|
+
match[1].trim(),
|
|
32
|
+
match[2].replace(/''/g, "'")
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return selections;
|
|
37
|
+
};
|
|
38
|
+
var buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
|
|
21
39
|
var parseODataSearch = (value) => {
|
|
22
40
|
if (!value) return "";
|
|
23
41
|
const trimmedValue = value.trim();
|
|
@@ -71,6 +89,7 @@ var DataBindingControls = ({
|
|
|
71
89
|
const resolvedSortOptions = apiSortOptions.length > 0 ? apiSortOptions : DUMMY_SORT_OPTIONS;
|
|
72
90
|
const normalizedSortOptions = resolvedSortOptions.map(normalizeSortOption).filter((option) => option.value);
|
|
73
91
|
const currentFilter = query?.["$filter"] ?? query?.filter ?? "";
|
|
92
|
+
const selectedFacetValues = parseFacetSelections(currentFilter);
|
|
74
93
|
const currentSort = query?.["$orderby"] ?? query?.orderBy ?? "";
|
|
75
94
|
const currentSearch = parseODataSearch(query?.["$Search"]);
|
|
76
95
|
const [searchText, setSearchText] = useState(currentSearch);
|
|
@@ -95,10 +114,19 @@ var DataBindingControls = ({
|
|
|
95
114
|
},
|
|
96
115
|
[path, query]
|
|
97
116
|
);
|
|
98
|
-
const getFacetUrl = (field, value) =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
117
|
+
const getFacetUrl = (field, value) => {
|
|
118
|
+
const updatedSelections = new Map(selectedFacetValues);
|
|
119
|
+
if (value) {
|
|
120
|
+
updatedSelections.set(field, value);
|
|
121
|
+
} else {
|
|
122
|
+
updatedSelections.delete(field);
|
|
123
|
+
}
|
|
124
|
+
const updatedFilter = buildFacetFilter(updatedSelections);
|
|
125
|
+
return getQueryUrl({
|
|
126
|
+
$filter: updatedFilter || void 0,
|
|
127
|
+
filter: void 0
|
|
128
|
+
});
|
|
129
|
+
};
|
|
102
130
|
const navigateWithoutReload = useCallback(
|
|
103
131
|
(url) => {
|
|
104
132
|
if (lastNavigationUrl.current === url) {
|
|
@@ -123,7 +151,7 @@ var DataBindingControls = ({
|
|
|
123
151
|
const timeout = window.setTimeout(() => {
|
|
124
152
|
navigateWithoutReload(
|
|
125
153
|
getQueryUrl({
|
|
126
|
-
"$Search": trimmedSearchText
|
|
154
|
+
"$Search": trimmedSearchText || void 0
|
|
127
155
|
})
|
|
128
156
|
);
|
|
129
157
|
}, 500);
|
|
@@ -142,20 +170,20 @@ var DataBindingControls = ({
|
|
|
142
170
|
{
|
|
143
171
|
type: "button",
|
|
144
172
|
onClick: () => navigateWithoutReload(getFacetUrl(field)),
|
|
145
|
-
"aria-pressed": !
|
|
146
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
173
|
+
"aria-pressed": !selectedFacetValues.has(field),
|
|
174
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${selectedFacetValues.has(field) ? "" : "bg-primary-base font-semibold"}`,
|
|
147
175
|
children: "All"
|
|
148
176
|
}
|
|
149
177
|
),
|
|
150
178
|
values.map((facet) => {
|
|
151
|
-
const
|
|
179
|
+
const isSelected = selectedFacetValues.get(field) === facet.value;
|
|
152
180
|
return /* @__PURE__ */ jsxs(
|
|
153
181
|
"button",
|
|
154
182
|
{
|
|
155
183
|
type: "button",
|
|
156
184
|
onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
|
|
157
|
-
"aria-pressed":
|
|
158
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
185
|
+
"aria-pressed": isSelected,
|
|
186
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${isSelected ? "bg-primary-base font-semibold" : ""}`,
|
|
159
187
|
children: [
|
|
160
188
|
facet.value,
|
|
161
189
|
" (",
|
|
@@ -14,6 +14,24 @@ import { useRouter } from "next/navigation";
|
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
var humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
16
16
|
var escapeODataString = (value) => value.replace(/'/g, "''");
|
|
17
|
+
var parseFacetSelections = (filter) => {
|
|
18
|
+
const selections = /* @__PURE__ */ new Map();
|
|
19
|
+
const groupedExpression = /\(\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*\)/gi;
|
|
20
|
+
for (const match of filter.matchAll(groupedExpression)) {
|
|
21
|
+
selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
|
|
22
|
+
}
|
|
23
|
+
if (selections.size === 0) {
|
|
24
|
+
const ungroupedExpression = /(?:^|\s+and\s+)\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*(?=\s+and\s+|$)/gi;
|
|
25
|
+
for (const match of filter.matchAll(ungroupedExpression)) {
|
|
26
|
+
selections.set(
|
|
27
|
+
match[1].trim(),
|
|
28
|
+
match[2].replace(/''/g, "'")
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return selections;
|
|
33
|
+
};
|
|
34
|
+
var buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
|
|
17
35
|
var parseODataSearch = (value) => {
|
|
18
36
|
if (!value) return "";
|
|
19
37
|
const trimmedValue = value.trim();
|
|
@@ -67,6 +85,7 @@ var DataBindingControls = ({
|
|
|
67
85
|
const resolvedSortOptions = apiSortOptions.length > 0 ? apiSortOptions : DUMMY_SORT_OPTIONS;
|
|
68
86
|
const normalizedSortOptions = resolvedSortOptions.map(normalizeSortOption).filter((option) => option.value);
|
|
69
87
|
const currentFilter = query?.["$filter"] ?? query?.filter ?? "";
|
|
88
|
+
const selectedFacetValues = parseFacetSelections(currentFilter);
|
|
70
89
|
const currentSort = query?.["$orderby"] ?? query?.orderBy ?? "";
|
|
71
90
|
const currentSearch = parseODataSearch(query?.["$Search"]);
|
|
72
91
|
const [searchText, setSearchText] = useState(currentSearch);
|
|
@@ -91,10 +110,19 @@ var DataBindingControls = ({
|
|
|
91
110
|
},
|
|
92
111
|
[path, query]
|
|
93
112
|
);
|
|
94
|
-
const getFacetUrl = (field, value) =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
const getFacetUrl = (field, value) => {
|
|
114
|
+
const updatedSelections = new Map(selectedFacetValues);
|
|
115
|
+
if (value) {
|
|
116
|
+
updatedSelections.set(field, value);
|
|
117
|
+
} else {
|
|
118
|
+
updatedSelections.delete(field);
|
|
119
|
+
}
|
|
120
|
+
const updatedFilter = buildFacetFilter(updatedSelections);
|
|
121
|
+
return getQueryUrl({
|
|
122
|
+
$filter: updatedFilter || void 0,
|
|
123
|
+
filter: void 0
|
|
124
|
+
});
|
|
125
|
+
};
|
|
98
126
|
const navigateWithoutReload = useCallback(
|
|
99
127
|
(url) => {
|
|
100
128
|
if (lastNavigationUrl.current === url) {
|
|
@@ -119,7 +147,7 @@ var DataBindingControls = ({
|
|
|
119
147
|
const timeout = window.setTimeout(() => {
|
|
120
148
|
navigateWithoutReload(
|
|
121
149
|
getQueryUrl({
|
|
122
|
-
"$Search": trimmedSearchText
|
|
150
|
+
"$Search": trimmedSearchText || void 0
|
|
123
151
|
})
|
|
124
152
|
);
|
|
125
153
|
}, 500);
|
|
@@ -138,20 +166,20 @@ var DataBindingControls = ({
|
|
|
138
166
|
{
|
|
139
167
|
type: "button",
|
|
140
168
|
onClick: () => navigateWithoutReload(getFacetUrl(field)),
|
|
141
|
-
"aria-pressed": !
|
|
142
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
169
|
+
"aria-pressed": !selectedFacetValues.has(field),
|
|
170
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${selectedFacetValues.has(field) ? "" : "bg-primary-base font-semibold"}`,
|
|
143
171
|
children: "All"
|
|
144
172
|
}
|
|
145
173
|
),
|
|
146
174
|
values.map((facet) => {
|
|
147
|
-
const
|
|
175
|
+
const isSelected = selectedFacetValues.get(field) === facet.value;
|
|
148
176
|
return /* @__PURE__ */ jsxs(
|
|
149
177
|
"button",
|
|
150
178
|
{
|
|
151
179
|
type: "button",
|
|
152
180
|
onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
|
|
153
|
-
"aria-pressed":
|
|
154
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
181
|
+
"aria-pressed": isSelected,
|
|
182
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${isSelected ? "bg-primary-base font-semibold" : ""}`,
|
|
155
183
|
children: [
|
|
156
184
|
facet.value,
|
|
157
185
|
" (",
|
|
@@ -84,16 +84,16 @@ var OdataBuilder = class {
|
|
|
84
84
|
}
|
|
85
85
|
if (obj) {
|
|
86
86
|
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
87
|
-
queryString = queryString + `&$filter=${
|
|
87
|
+
queryString = queryString + `&$filter=${obj["$filter"]}`;
|
|
88
88
|
}
|
|
89
89
|
if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
|
|
90
|
-
queryString = queryString + `&$orderby=${
|
|
90
|
+
queryString = queryString + `&$orderby=${obj["$orderby"]}`;
|
|
91
91
|
} else if (defaultOrder) {
|
|
92
|
-
queryString = queryString + `&$orderby=${
|
|
92
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
93
93
|
}
|
|
94
94
|
} else {
|
|
95
95
|
if (defaultOrder) {
|
|
96
|
-
queryString = queryString + `&$orderby=${
|
|
96
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
return queryString;
|
|
@@ -144,10 +144,10 @@ var OdataBuilder = class {
|
|
|
144
144
|
getUrl() {
|
|
145
145
|
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
146
146
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
147
|
-
url = url + `&$filter=${
|
|
147
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
148
148
|
}
|
|
149
149
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
150
|
-
url = url + `&$orderby=${
|
|
150
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
151
151
|
}
|
|
152
152
|
if (this.searchTerm) {
|
|
153
153
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -161,7 +161,7 @@ var OdataBuilder = class {
|
|
|
161
161
|
getNewOrderByUrl(orderBy) {
|
|
162
162
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
163
163
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
164
|
-
url = url + `&$filter=${
|
|
164
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
165
165
|
}
|
|
166
166
|
if (this.searchTerm) {
|
|
167
167
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -169,16 +169,16 @@ var OdataBuilder = class {
|
|
|
169
169
|
if (this.searchCols) {
|
|
170
170
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
171
171
|
}
|
|
172
|
-
url = url + `&$orderby=${
|
|
172
|
+
url = url + `&$orderby=${orderBy}`;
|
|
173
173
|
return this.appendApiQueryParameters(url);
|
|
174
174
|
}
|
|
175
175
|
getNewFilterUrl(filterBy) {
|
|
176
176
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
177
177
|
if (filterBy !== null && filterBy !== "") {
|
|
178
|
-
url = url + `&$filter=${
|
|
178
|
+
url = url + `&$filter=${filterBy}`;
|
|
179
179
|
}
|
|
180
180
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
181
|
-
url = url + `&$orderby=${
|
|
181
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
182
182
|
}
|
|
183
183
|
if (this.searchTerm) {
|
|
184
184
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -192,10 +192,10 @@ var OdataBuilder = class {
|
|
|
192
192
|
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
193
193
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
194
194
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
195
|
-
url = url + `&$filter=${
|
|
195
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
196
196
|
}
|
|
197
197
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
198
|
-
url = url + `&$orderby=${
|
|
198
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
199
199
|
}
|
|
200
200
|
if (this.searchTerm) {
|
|
201
201
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -212,10 +212,10 @@ var OdataBuilder = class {
|
|
|
212
212
|
const skip = (currentPage - 1) * pageSize;
|
|
213
213
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
|
|
214
214
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
215
|
-
url = url + `&$filter=${
|
|
215
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
216
216
|
}
|
|
217
217
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
218
|
-
url = url + `&$orderby=${
|
|
218
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
219
219
|
}
|
|
220
220
|
if (this.searchTerm) {
|
|
221
221
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -86,16 +86,16 @@ var OdataBuilder = class {
|
|
|
86
86
|
}
|
|
87
87
|
if (obj) {
|
|
88
88
|
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
89
|
-
queryString = queryString + `&$filter=${
|
|
89
|
+
queryString = queryString + `&$filter=${obj["$filter"]}`;
|
|
90
90
|
}
|
|
91
91
|
if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
|
|
92
|
-
queryString = queryString + `&$orderby=${
|
|
92
|
+
queryString = queryString + `&$orderby=${obj["$orderby"]}`;
|
|
93
93
|
} else if (defaultOrder) {
|
|
94
|
-
queryString = queryString + `&$orderby=${
|
|
94
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
95
95
|
}
|
|
96
96
|
} else {
|
|
97
97
|
if (defaultOrder) {
|
|
98
|
-
queryString = queryString + `&$orderby=${
|
|
98
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
return queryString;
|
|
@@ -146,10 +146,10 @@ var OdataBuilder = class {
|
|
|
146
146
|
getUrl() {
|
|
147
147
|
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
148
148
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
149
|
-
url = url + `&$filter=${
|
|
149
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
150
150
|
}
|
|
151
151
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
152
|
-
url = url + `&$orderby=${
|
|
152
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
153
153
|
}
|
|
154
154
|
if (this.searchTerm) {
|
|
155
155
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -163,7 +163,7 @@ var OdataBuilder = class {
|
|
|
163
163
|
getNewOrderByUrl(orderBy) {
|
|
164
164
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
165
165
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
166
|
-
url = url + `&$filter=${
|
|
166
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
167
167
|
}
|
|
168
168
|
if (this.searchTerm) {
|
|
169
169
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -171,16 +171,16 @@ var OdataBuilder = class {
|
|
|
171
171
|
if (this.searchCols) {
|
|
172
172
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
173
173
|
}
|
|
174
|
-
url = url + `&$orderby=${
|
|
174
|
+
url = url + `&$orderby=${orderBy}`;
|
|
175
175
|
return this.appendApiQueryParameters(url);
|
|
176
176
|
}
|
|
177
177
|
getNewFilterUrl(filterBy) {
|
|
178
178
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
179
179
|
if (filterBy !== null && filterBy !== "") {
|
|
180
|
-
url = url + `&$filter=${
|
|
180
|
+
url = url + `&$filter=${filterBy}`;
|
|
181
181
|
}
|
|
182
182
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
183
|
-
url = url + `&$orderby=${
|
|
183
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
184
184
|
}
|
|
185
185
|
if (this.searchTerm) {
|
|
186
186
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -194,10 +194,10 @@ var OdataBuilder = class {
|
|
|
194
194
|
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
195
195
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
196
196
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
197
|
-
url = url + `&$filter=${
|
|
197
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
198
198
|
}
|
|
199
199
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
200
|
-
url = url + `&$orderby=${
|
|
200
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
201
201
|
}
|
|
202
202
|
if (this.searchTerm) {
|
|
203
203
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -214,10 +214,10 @@ var OdataBuilder = class {
|
|
|
214
214
|
const skip = (currentPage - 1) * pageSize;
|
|
215
215
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
|
|
216
216
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
217
|
-
url = url + `&$filter=${
|
|
217
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
218
218
|
}
|
|
219
219
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
220
|
-
url = url + `&$orderby=${
|
|
220
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
221
221
|
}
|
|
222
222
|
if (this.searchTerm) {
|
|
223
223
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
package/dist/index.js
CHANGED
|
@@ -4169,16 +4169,16 @@ var init_OdataBuilder = __esm({
|
|
|
4169
4169
|
}
|
|
4170
4170
|
if (obj) {
|
|
4171
4171
|
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
4172
|
-
queryString = queryString + `&$filter=${
|
|
4172
|
+
queryString = queryString + `&$filter=${obj["$filter"]}`;
|
|
4173
4173
|
}
|
|
4174
4174
|
if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
|
|
4175
|
-
queryString = queryString + `&$orderby=${
|
|
4175
|
+
queryString = queryString + `&$orderby=${obj["$orderby"]}`;
|
|
4176
4176
|
} else if (defaultOrder) {
|
|
4177
|
-
queryString = queryString + `&$orderby=${
|
|
4177
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
4178
4178
|
}
|
|
4179
4179
|
} else {
|
|
4180
4180
|
if (defaultOrder) {
|
|
4181
|
-
queryString = queryString + `&$orderby=${
|
|
4181
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
4182
4182
|
}
|
|
4183
4183
|
}
|
|
4184
4184
|
return queryString;
|
|
@@ -4229,10 +4229,10 @@ var init_OdataBuilder = __esm({
|
|
|
4229
4229
|
getUrl() {
|
|
4230
4230
|
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
4231
4231
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
4232
|
-
url = url + `&$filter=${
|
|
4232
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
4233
4233
|
}
|
|
4234
4234
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
4235
|
-
url = url + `&$orderby=${
|
|
4235
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
4236
4236
|
}
|
|
4237
4237
|
if (this.searchTerm) {
|
|
4238
4238
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -4246,7 +4246,7 @@ var init_OdataBuilder = __esm({
|
|
|
4246
4246
|
getNewOrderByUrl(orderBy) {
|
|
4247
4247
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
4248
4248
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
4249
|
-
url = url + `&$filter=${
|
|
4249
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
4250
4250
|
}
|
|
4251
4251
|
if (this.searchTerm) {
|
|
4252
4252
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -4254,16 +4254,16 @@ var init_OdataBuilder = __esm({
|
|
|
4254
4254
|
if (this.searchCols) {
|
|
4255
4255
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
4256
4256
|
}
|
|
4257
|
-
url = url + `&$orderby=${
|
|
4257
|
+
url = url + `&$orderby=${orderBy}`;
|
|
4258
4258
|
return this.appendApiQueryParameters(url);
|
|
4259
4259
|
}
|
|
4260
4260
|
getNewFilterUrl(filterBy) {
|
|
4261
4261
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
4262
4262
|
if (filterBy !== null && filterBy !== "") {
|
|
4263
|
-
url = url + `&$filter=${
|
|
4263
|
+
url = url + `&$filter=${filterBy}`;
|
|
4264
4264
|
}
|
|
4265
4265
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
4266
|
-
url = url + `&$orderby=${
|
|
4266
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
4267
4267
|
}
|
|
4268
4268
|
if (this.searchTerm) {
|
|
4269
4269
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -4277,10 +4277,10 @@ var init_OdataBuilder = __esm({
|
|
|
4277
4277
|
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
4278
4278
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
4279
4279
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
4280
|
-
url = url + `&$filter=${
|
|
4280
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
4281
4281
|
}
|
|
4282
4282
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
4283
|
-
url = url + `&$orderby=${
|
|
4283
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
4284
4284
|
}
|
|
4285
4285
|
if (this.searchTerm) {
|
|
4286
4286
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -4297,10 +4297,10 @@ var init_OdataBuilder = __esm({
|
|
|
4297
4297
|
const skip = (currentPage - 1) * pageSize;
|
|
4298
4298
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
|
|
4299
4299
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
4300
|
-
url = url + `&$filter=${
|
|
4300
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
4301
4301
|
}
|
|
4302
4302
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
4303
|
-
url = url + `&$orderby=${
|
|
4303
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
4304
4304
|
}
|
|
4305
4305
|
if (this.searchTerm) {
|
|
4306
4306
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -4506,7 +4506,7 @@ var DataBindingControls_exports = {};
|
|
|
4506
4506
|
__export(DataBindingControls_exports, {
|
|
4507
4507
|
default: () => DataBindingControls_default
|
|
4508
4508
|
});
|
|
4509
|
-
var import_react55, import_navigation, import_jsx_runtime77, humanize, escapeODataString, parseODataSearch, normalizeSortOption, DUMMY_FACETS, DUMMY_SORT_OPTIONS, DataBindingControls, DataBindingControls_default;
|
|
4509
|
+
var import_react55, import_navigation, import_jsx_runtime77, humanize, escapeODataString, parseFacetSelections, buildFacetFilter, parseODataSearch, normalizeSortOption, DUMMY_FACETS, DUMMY_SORT_OPTIONS, DataBindingControls, DataBindingControls_default;
|
|
4510
4510
|
var init_DataBindingControls = __esm({
|
|
4511
4511
|
"src/components/pageRenderingEngine/nodes/DataBindingControls.tsx"() {
|
|
4512
4512
|
"use strict";
|
|
@@ -4518,6 +4518,24 @@ var init_DataBindingControls = __esm({
|
|
|
4518
4518
|
import_jsx_runtime77 = require("react/jsx-runtime");
|
|
4519
4519
|
humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
4520
4520
|
escapeODataString = (value) => value.replace(/'/g, "''");
|
|
4521
|
+
parseFacetSelections = (filter) => {
|
|
4522
|
+
const selections = /* @__PURE__ */ new Map();
|
|
4523
|
+
const groupedExpression = /\(\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*\)/gi;
|
|
4524
|
+
for (const match of filter.matchAll(groupedExpression)) {
|
|
4525
|
+
selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
|
|
4526
|
+
}
|
|
4527
|
+
if (selections.size === 0) {
|
|
4528
|
+
const ungroupedExpression = /(?:^|\s+and\s+)\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*(?=\s+and\s+|$)/gi;
|
|
4529
|
+
for (const match of filter.matchAll(ungroupedExpression)) {
|
|
4530
|
+
selections.set(
|
|
4531
|
+
match[1].trim(),
|
|
4532
|
+
match[2].replace(/''/g, "'")
|
|
4533
|
+
);
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
return selections;
|
|
4537
|
+
};
|
|
4538
|
+
buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
|
|
4521
4539
|
parseODataSearch = (value) => {
|
|
4522
4540
|
if (!value) return "";
|
|
4523
4541
|
const trimmedValue = value.trim();
|
|
@@ -4571,6 +4589,7 @@ var init_DataBindingControls = __esm({
|
|
|
4571
4589
|
const resolvedSortOptions = apiSortOptions.length > 0 ? apiSortOptions : DUMMY_SORT_OPTIONS;
|
|
4572
4590
|
const normalizedSortOptions = resolvedSortOptions.map(normalizeSortOption).filter((option) => option.value);
|
|
4573
4591
|
const currentFilter = query?.["$filter"] ?? query?.filter ?? "";
|
|
4592
|
+
const selectedFacetValues = parseFacetSelections(currentFilter);
|
|
4574
4593
|
const currentSort = query?.["$orderby"] ?? query?.orderBy ?? "";
|
|
4575
4594
|
const currentSearch = parseODataSearch(query?.["$Search"]);
|
|
4576
4595
|
const [searchText, setSearchText] = (0, import_react55.useState)(currentSearch);
|
|
@@ -4595,10 +4614,19 @@ var init_DataBindingControls = __esm({
|
|
|
4595
4614
|
},
|
|
4596
4615
|
[path, query]
|
|
4597
4616
|
);
|
|
4598
|
-
const getFacetUrl = (field, value) =>
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4617
|
+
const getFacetUrl = (field, value) => {
|
|
4618
|
+
const updatedSelections = new Map(selectedFacetValues);
|
|
4619
|
+
if (value) {
|
|
4620
|
+
updatedSelections.set(field, value);
|
|
4621
|
+
} else {
|
|
4622
|
+
updatedSelections.delete(field);
|
|
4623
|
+
}
|
|
4624
|
+
const updatedFilter = buildFacetFilter(updatedSelections);
|
|
4625
|
+
return getQueryUrl({
|
|
4626
|
+
$filter: updatedFilter || void 0,
|
|
4627
|
+
filter: void 0
|
|
4628
|
+
});
|
|
4629
|
+
};
|
|
4602
4630
|
const navigateWithoutReload = (0, import_react55.useCallback)(
|
|
4603
4631
|
(url) => {
|
|
4604
4632
|
if (lastNavigationUrl.current === url) {
|
|
@@ -4623,7 +4651,7 @@ var init_DataBindingControls = __esm({
|
|
|
4623
4651
|
const timeout = window.setTimeout(() => {
|
|
4624
4652
|
navigateWithoutReload(
|
|
4625
4653
|
getQueryUrl({
|
|
4626
|
-
"$Search": trimmedSearchText
|
|
4654
|
+
"$Search": trimmedSearchText || void 0
|
|
4627
4655
|
})
|
|
4628
4656
|
);
|
|
4629
4657
|
}, 500);
|
|
@@ -4642,20 +4670,20 @@ var init_DataBindingControls = __esm({
|
|
|
4642
4670
|
{
|
|
4643
4671
|
type: "button",
|
|
4644
4672
|
onClick: () => navigateWithoutReload(getFacetUrl(field)),
|
|
4645
|
-
"aria-pressed": !
|
|
4646
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
4673
|
+
"aria-pressed": !selectedFacetValues.has(field),
|
|
4674
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${selectedFacetValues.has(field) ? "" : "bg-primary-base font-semibold"}`,
|
|
4647
4675
|
children: "All"
|
|
4648
4676
|
}
|
|
4649
4677
|
),
|
|
4650
4678
|
values.map((facet) => {
|
|
4651
|
-
const
|
|
4679
|
+
const isSelected = selectedFacetValues.get(field) === facet.value;
|
|
4652
4680
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
4653
4681
|
"button",
|
|
4654
4682
|
{
|
|
4655
4683
|
type: "button",
|
|
4656
4684
|
onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
|
|
4657
|
-
"aria-pressed":
|
|
4658
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
4685
|
+
"aria-pressed": isSelected,
|
|
4686
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${isSelected ? "bg-primary-base font-semibold" : ""}`,
|
|
4659
4687
|
children: [
|
|
4660
4688
|
facet.value,
|
|
4661
4689
|
" (",
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
OdataBuilder
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-URWEMJUF.mjs";
|
|
6
6
|
import {
|
|
7
7
|
InputControl_default
|
|
8
8
|
} from "./chunk-GKI42H4B.mjs";
|
|
@@ -2295,8 +2295,8 @@ var GoogleMapNode_default = GoogleMapNode;
|
|
|
2295
2295
|
|
|
2296
2296
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
2297
2297
|
import { jsx as jsx35, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2298
|
-
var Pagination = dynamic11(() => import("./Pagination-
|
|
2299
|
-
var DataBindingControls = dynamic11(() => import("./DataBindingControls-
|
|
2298
|
+
var Pagination = dynamic11(() => import("./Pagination-7RE7DCJ6.mjs"), { ssr: true });
|
|
2299
|
+
var DataBindingControls = dynamic11(() => import("./DataBindingControls-P4DW3BMK.mjs"), {
|
|
2300
2300
|
ssr: true
|
|
2301
2301
|
});
|
|
2302
2302
|
var Slider = dynamic11(() => import("./Slider-554BKC7N.mjs"), {
|
package/dist/server.js
CHANGED
|
@@ -1991,16 +1991,16 @@ var init_OdataBuilder = __esm({
|
|
|
1991
1991
|
}
|
|
1992
1992
|
if (obj) {
|
|
1993
1993
|
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
1994
|
-
queryString = queryString + `&$filter=${
|
|
1994
|
+
queryString = queryString + `&$filter=${obj["$filter"]}`;
|
|
1995
1995
|
}
|
|
1996
1996
|
if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
|
|
1997
|
-
queryString = queryString + `&$orderby=${
|
|
1997
|
+
queryString = queryString + `&$orderby=${obj["$orderby"]}`;
|
|
1998
1998
|
} else if (defaultOrder) {
|
|
1999
|
-
queryString = queryString + `&$orderby=${
|
|
1999
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
2000
2000
|
}
|
|
2001
2001
|
} else {
|
|
2002
2002
|
if (defaultOrder) {
|
|
2003
|
-
queryString = queryString + `&$orderby=${
|
|
2003
|
+
queryString = queryString + `&$orderby=${defaultOrder}`;
|
|
2004
2004
|
}
|
|
2005
2005
|
}
|
|
2006
2006
|
return queryString;
|
|
@@ -2051,10 +2051,10 @@ var init_OdataBuilder = __esm({
|
|
|
2051
2051
|
getUrl() {
|
|
2052
2052
|
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
2053
2053
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
2054
|
-
url = url + `&$filter=${
|
|
2054
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
2055
2055
|
}
|
|
2056
2056
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2057
|
-
url = url + `&$orderby=${
|
|
2057
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
2058
2058
|
}
|
|
2059
2059
|
if (this.searchTerm) {
|
|
2060
2060
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -2068,7 +2068,7 @@ var init_OdataBuilder = __esm({
|
|
|
2068
2068
|
getNewOrderByUrl(orderBy) {
|
|
2069
2069
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
2070
2070
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
2071
|
-
url = url + `&$filter=${
|
|
2071
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
2072
2072
|
}
|
|
2073
2073
|
if (this.searchTerm) {
|
|
2074
2074
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -2076,16 +2076,16 @@ var init_OdataBuilder = __esm({
|
|
|
2076
2076
|
if (this.searchCols) {
|
|
2077
2077
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
2078
2078
|
}
|
|
2079
|
-
url = url + `&$orderby=${
|
|
2079
|
+
url = url + `&$orderby=${orderBy}`;
|
|
2080
2080
|
return this.appendApiQueryParameters(url);
|
|
2081
2081
|
}
|
|
2082
2082
|
getNewFilterUrl(filterBy) {
|
|
2083
2083
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
2084
2084
|
if (filterBy !== null && filterBy !== "") {
|
|
2085
|
-
url = url + `&$filter=${
|
|
2085
|
+
url = url + `&$filter=${filterBy}`;
|
|
2086
2086
|
}
|
|
2087
2087
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2088
|
-
url = url + `&$orderby=${
|
|
2088
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
2089
2089
|
}
|
|
2090
2090
|
if (this.searchTerm) {
|
|
2091
2091
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -2099,10 +2099,10 @@ var init_OdataBuilder = __esm({
|
|
|
2099
2099
|
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
2100
2100
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
2101
2101
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
2102
|
-
url = url + `&$filter=${
|
|
2102
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
2103
2103
|
}
|
|
2104
2104
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2105
|
-
url = url + `&$orderby=${
|
|
2105
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
2106
2106
|
}
|
|
2107
2107
|
if (this.searchTerm) {
|
|
2108
2108
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -2119,10 +2119,10 @@ var init_OdataBuilder = __esm({
|
|
|
2119
2119
|
const skip = (currentPage - 1) * pageSize;
|
|
2120
2120
|
let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
|
|
2121
2121
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
2122
|
-
url = url + `&$filter=${
|
|
2122
|
+
url = url + `&$filter=${this.filterBy}`;
|
|
2123
2123
|
}
|
|
2124
2124
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2125
|
-
url = url + `&$orderby=${
|
|
2125
|
+
url = url + `&$orderby=${this.orderBy}`;
|
|
2126
2126
|
}
|
|
2127
2127
|
if (this.searchTerm) {
|
|
2128
2128
|
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
@@ -4504,7 +4504,7 @@ var DataBindingControls_exports = {};
|
|
|
4504
4504
|
__export(DataBindingControls_exports, {
|
|
4505
4505
|
default: () => DataBindingControls_default
|
|
4506
4506
|
});
|
|
4507
|
-
var import_react55, import_navigation, import_jsx_runtime77, humanize, escapeODataString, parseODataSearch, normalizeSortOption, DUMMY_FACETS, DUMMY_SORT_OPTIONS, DataBindingControls, DataBindingControls_default;
|
|
4507
|
+
var import_react55, import_navigation, import_jsx_runtime77, humanize, escapeODataString, parseFacetSelections, buildFacetFilter, parseODataSearch, normalizeSortOption, DUMMY_FACETS, DUMMY_SORT_OPTIONS, DataBindingControls, DataBindingControls_default;
|
|
4508
4508
|
var init_DataBindingControls = __esm({
|
|
4509
4509
|
"src/components/pageRenderingEngine/nodes/DataBindingControls.tsx"() {
|
|
4510
4510
|
"use strict";
|
|
@@ -4516,6 +4516,24 @@ var init_DataBindingControls = __esm({
|
|
|
4516
4516
|
import_jsx_runtime77 = require("react/jsx-runtime");
|
|
4517
4517
|
humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
4518
4518
|
escapeODataString = (value) => value.replace(/'/g, "''");
|
|
4519
|
+
parseFacetSelections = (filter) => {
|
|
4520
|
+
const selections = /* @__PURE__ */ new Map();
|
|
4521
|
+
const groupedExpression = /\(\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*\)/gi;
|
|
4522
|
+
for (const match of filter.matchAll(groupedExpression)) {
|
|
4523
|
+
selections.set(match[1].trim(), match[2].replace(/''/g, "'"));
|
|
4524
|
+
}
|
|
4525
|
+
if (selections.size === 0) {
|
|
4526
|
+
const ungroupedExpression = /(?:^|\s+and\s+)\s*([^()]+?)\s+eq\s+'((?:''|[^'])*)'\s*(?=\s+and\s+|$)/gi;
|
|
4527
|
+
for (const match of filter.matchAll(ungroupedExpression)) {
|
|
4528
|
+
selections.set(
|
|
4529
|
+
match[1].trim(),
|
|
4530
|
+
match[2].replace(/''/g, "'")
|
|
4531
|
+
);
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
return selections;
|
|
4535
|
+
};
|
|
4536
|
+
buildFacetFilter = (selections) => Array.from(selections.entries()).map(([field, value]) => `${field} eq '${escapeODataString(value)}'`).join(" and ");
|
|
4519
4537
|
parseODataSearch = (value) => {
|
|
4520
4538
|
if (!value) return "";
|
|
4521
4539
|
const trimmedValue = value.trim();
|
|
@@ -4569,6 +4587,7 @@ var init_DataBindingControls = __esm({
|
|
|
4569
4587
|
const resolvedSortOptions = apiSortOptions.length > 0 ? apiSortOptions : DUMMY_SORT_OPTIONS;
|
|
4570
4588
|
const normalizedSortOptions = resolvedSortOptions.map(normalizeSortOption).filter((option) => option.value);
|
|
4571
4589
|
const currentFilter = query?.["$filter"] ?? query?.filter ?? "";
|
|
4590
|
+
const selectedFacetValues = parseFacetSelections(currentFilter);
|
|
4572
4591
|
const currentSort = query?.["$orderby"] ?? query?.orderBy ?? "";
|
|
4573
4592
|
const currentSearch = parseODataSearch(query?.["$Search"]);
|
|
4574
4593
|
const [searchText, setSearchText] = (0, import_react55.useState)(currentSearch);
|
|
@@ -4593,10 +4612,19 @@ var init_DataBindingControls = __esm({
|
|
|
4593
4612
|
},
|
|
4594
4613
|
[path, query]
|
|
4595
4614
|
);
|
|
4596
|
-
const getFacetUrl = (field, value) =>
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4615
|
+
const getFacetUrl = (field, value) => {
|
|
4616
|
+
const updatedSelections = new Map(selectedFacetValues);
|
|
4617
|
+
if (value) {
|
|
4618
|
+
updatedSelections.set(field, value);
|
|
4619
|
+
} else {
|
|
4620
|
+
updatedSelections.delete(field);
|
|
4621
|
+
}
|
|
4622
|
+
const updatedFilter = buildFacetFilter(updatedSelections);
|
|
4623
|
+
return getQueryUrl({
|
|
4624
|
+
$filter: updatedFilter || void 0,
|
|
4625
|
+
filter: void 0
|
|
4626
|
+
});
|
|
4627
|
+
};
|
|
4600
4628
|
const navigateWithoutReload = (0, import_react55.useCallback)(
|
|
4601
4629
|
(url) => {
|
|
4602
4630
|
if (lastNavigationUrl.current === url) {
|
|
@@ -4621,7 +4649,7 @@ var init_DataBindingControls = __esm({
|
|
|
4621
4649
|
const timeout = window.setTimeout(() => {
|
|
4622
4650
|
navigateWithoutReload(
|
|
4623
4651
|
getQueryUrl({
|
|
4624
|
-
"$Search": trimmedSearchText
|
|
4652
|
+
"$Search": trimmedSearchText || void 0
|
|
4625
4653
|
})
|
|
4626
4654
|
);
|
|
4627
4655
|
}, 500);
|
|
@@ -4640,20 +4668,20 @@ var init_DataBindingControls = __esm({
|
|
|
4640
4668
|
{
|
|
4641
4669
|
type: "button",
|
|
4642
4670
|
onClick: () => navigateWithoutReload(getFacetUrl(field)),
|
|
4643
|
-
"aria-pressed": !
|
|
4644
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
4671
|
+
"aria-pressed": !selectedFacetValues.has(field),
|
|
4672
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${selectedFacetValues.has(field) ? "" : "bg-primary-base font-semibold"}`,
|
|
4645
4673
|
children: "All"
|
|
4646
4674
|
}
|
|
4647
4675
|
),
|
|
4648
4676
|
values.map((facet) => {
|
|
4649
|
-
const
|
|
4677
|
+
const isSelected = selectedFacetValues.get(field) === facet.value;
|
|
4650
4678
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
4651
4679
|
"button",
|
|
4652
4680
|
{
|
|
4653
4681
|
type: "button",
|
|
4654
4682
|
onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
|
|
4655
|
-
"aria-pressed":
|
|
4656
|
-
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${
|
|
4683
|
+
"aria-pressed": isSelected,
|
|
4684
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${isSelected ? "bg-primary-base font-semibold" : ""}`,
|
|
4657
4685
|
children: [
|
|
4658
4686
|
facet.value,
|
|
4659
4687
|
" (",
|
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OdataBuilder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HKIDEYYN.mjs";
|
|
4
4
|
import {
|
|
5
5
|
AssetUtility_default
|
|
6
6
|
} from "./chunk-TQ6BXQ3A.mjs";
|
|
@@ -2263,8 +2263,8 @@ var GoogleMapNode_default = GoogleMapNode;
|
|
|
2263
2263
|
|
|
2264
2264
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
2265
2265
|
import { jsx as jsx35, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2266
|
-
var Pagination = dynamic11(() => import("./Pagination-
|
|
2267
|
-
var DataBindingControls = dynamic11(() => import("./DataBindingControls-
|
|
2266
|
+
var Pagination = dynamic11(() => import("./Pagination-SP2IOZHJ.mjs"), { ssr: true });
|
|
2267
|
+
var DataBindingControls = dynamic11(() => import("./DataBindingControls-M73B2SGY.mjs"), {
|
|
2268
2268
|
ssr: true
|
|
2269
2269
|
});
|
|
2270
2270
|
var Slider = dynamic11(() => import("./Slider-PEIVH6A5.mjs"), {
|