@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260923043912 → 0.8.1-dev.20260923103910
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/{CommentRendererClient-QC65XBT2.mjs → CommentRendererClient-OHYVSNU5.mjs} +17 -0
- package/dist/{CommentRendererClient-52UOUQAD.mjs → CommentRendererClient-TBATG5LD.mjs} +17 -0
- package/dist/DataBindingControls-SLNZLI3I.mjs +377 -0
- package/dist/DataBindingControls-UDRT7JFF.mjs +381 -0
- package/dist/{InputControlClient-H75UIZE3.mjs → InputControlClient-A3V5YRWH.mjs} +33 -29
- package/dist/{InputControlClient-QBBQP25W.mjs → InputControlClient-NHXG4QBU.mjs} +33 -29
- package/dist/{Pagination-3SOPLEQN.mjs → Pagination-GVFES3JQ.mjs} +1 -1
- package/dist/{Pagination-FEXY7ERI.mjs → Pagination-TCXNZ73R.mjs} +1 -1
- package/dist/{chunk-6MO2JRIT.mjs → chunk-HUCNBVQV.mjs} +7 -6
- package/dist/{chunk-SNDGEYWZ.mjs → chunk-PXALEYS6.mjs} +7 -6
- package/dist/{chunk-7VXZJ55M.mjs → chunk-XDTWUEVR.mjs} +1 -1
- package/dist/index.js +595 -460
- package/dist/index.mjs +302 -272
- package/dist/server.js +636 -501
- package/dist/server.mjs +135 -105
- package/package.json +1 -1
- package/dist/DataBindingControls-CVU43FTE.mjs +0 -298
- package/dist/DataBindingControls-KJIEP7WU.mjs +0 -294
|
@@ -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
|
+
};
|
|
@@ -188,20 +188,26 @@ var SelectWithSearchPanel = (props) => {
|
|
|
188
188
|
" ",
|
|
189
189
|
props?.attributes?.required && /* @__PURE__ */ jsx("span", { className: "bg-error-weak", children: "*" })
|
|
190
190
|
] }),
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
191
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"input",
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
name: props.name,
|
|
197
|
+
id: props.name,
|
|
198
|
+
value: searchTerm,
|
|
199
|
+
onChange: textChangeHandler,
|
|
200
|
+
onFocus: () => setIsOpen(true),
|
|
201
|
+
onKeyDown: handleKeyDown,
|
|
202
|
+
placeholder: props.attributes?.placeholder,
|
|
203
|
+
required: props.attributes?.required,
|
|
204
|
+
className: `peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
205
|
+
${isError ? "focus:border-red-300 focus:ring focus:ring-red-200 focus:ring-opacity-50" : "focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"}
|
|
202
206
|
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none`
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsx("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
210
|
+
] }),
|
|
205
211
|
/* @__PURE__ */ jsx("div", { ref: containerRef, children: isOpen && /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
206
212
|
/* @__PURE__ */ jsxs("div", { className: "fixed z-50 right-0 bg-white top-[62px] w-1/4 border-l border-gray-200", children: [
|
|
207
213
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col p-2 bg-accent-950 text-white", children: /* @__PURE__ */ jsxs("h5", { className: "text-md text-white font-medium", children: [
|
|
@@ -506,21 +512,18 @@ var SwitchInput = (props) => {
|
|
|
506
512
|
if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
|
|
507
513
|
value = true;
|
|
508
514
|
}
|
|
509
|
-
return /* @__PURE__ */ jsx3(React3.Fragment, { children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start justify-between gap-4 py-3", children: [
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
),
|
|
522
|
-
/* @__PURE__ */ jsx3("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
523
|
-
] }),
|
|
515
|
+
return /* @__PURE__ */ jsx3(React3.Fragment, { children: /* @__PURE__ */ jsxs3("div", { className: "relative flex items-start justify-between gap-4 py-3", children: [
|
|
516
|
+
/* @__PURE__ */ jsx3("div", { className: "min-w-0", children: props?.attributes?.label && /* @__PURE__ */ jsxs3(
|
|
517
|
+
"label",
|
|
518
|
+
{
|
|
519
|
+
htmlFor: props.name,
|
|
520
|
+
className: "inline-block text-sm font-semibold text-slate-800",
|
|
521
|
+
children: [
|
|
522
|
+
props.attributes.label,
|
|
523
|
+
props?.attributes?.required && /* @__PURE__ */ jsx3("span", { className: "bg-error-weak", children: "*" })
|
|
524
|
+
]
|
|
525
|
+
}
|
|
526
|
+
) }),
|
|
524
527
|
/* @__PURE__ */ jsxs3(
|
|
525
528
|
"label",
|
|
526
529
|
{
|
|
@@ -551,7 +554,8 @@ var SwitchInput = (props) => {
|
|
|
551
554
|
{
|
|
552
555
|
className: "absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-default shadow\n transition-transform duration-200 ease-in-out\n peer-checked:translate-x-5\n peer-disabled:bg-slate-50"
|
|
553
556
|
}
|
|
554
|
-
)
|
|
557
|
+
),
|
|
558
|
+
/* @__PURE__ */ jsx3("p", { className: "hidden group-[.validated]:peer-invalid:block absolute left-0 top-full mt-1 w-max max-w-[220px] whitespace-normal bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
555
559
|
]
|
|
556
560
|
}
|
|
557
561
|
)
|
|
@@ -1092,20 +1092,26 @@ var SelectWithSearchPanel = (props) => {
|
|
|
1092
1092
|
" ",
|
|
1093
1093
|
props?.attributes?.required && /* @__PURE__ */ jsx13("span", { className: "bg-error-weak", children: "*" })
|
|
1094
1094
|
] }),
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1095
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1096
|
+
/* @__PURE__ */ jsx13(
|
|
1097
|
+
"input",
|
|
1098
|
+
{
|
|
1099
|
+
type: "text",
|
|
1100
|
+
name: props.name,
|
|
1101
|
+
id: props.name,
|
|
1102
|
+
value: searchTerm,
|
|
1103
|
+
onChange: textChangeHandler,
|
|
1104
|
+
onFocus: () => setIsOpen(true),
|
|
1105
|
+
onKeyDown: handleKeyDown,
|
|
1106
|
+
placeholder: props.attributes?.placeholder,
|
|
1107
|
+
required: props.attributes?.required,
|
|
1108
|
+
className: `peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
1109
|
+
${isError ? "focus:border-red-300 focus:ring focus:ring-red-200 focus:ring-opacity-50" : "focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"}
|
|
1106
1110
|
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none`
|
|
1107
|
-
|
|
1108
|
-
|
|
1111
|
+
}
|
|
1112
|
+
),
|
|
1113
|
+
/* @__PURE__ */ jsx13("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
1114
|
+
] }),
|
|
1109
1115
|
/* @__PURE__ */ jsx13("div", { ref: containerRef, children: isOpen && /* @__PURE__ */ jsxs13(React13.Fragment, { children: [
|
|
1110
1116
|
/* @__PURE__ */ jsxs13("div", { className: "fixed z-50 right-0 bg-white top-[62px] w-1/4 border-l border-gray-200", children: [
|
|
1111
1117
|
/* @__PURE__ */ jsx13("div", { className: "flex flex-col p-2 bg-accent-950 text-white", children: /* @__PURE__ */ jsxs13("h5", { className: "text-md text-white font-medium", children: [
|
|
@@ -1509,21 +1515,18 @@ var SwitchInput = (props) => {
|
|
|
1509
1515
|
if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
|
|
1510
1516
|
value = true;
|
|
1511
1517
|
}
|
|
1512
|
-
return /* @__PURE__ */ jsx17(React17.Fragment, { children: /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-4 py-3", children: [
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
),
|
|
1525
|
-
/* @__PURE__ */ jsx17("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
1526
|
-
] }),
|
|
1518
|
+
return /* @__PURE__ */ jsx17(React17.Fragment, { children: /* @__PURE__ */ jsxs17("div", { className: "relative flex items-start justify-between gap-4 py-3", children: [
|
|
1519
|
+
/* @__PURE__ */ jsx17("div", { className: "min-w-0", children: props?.attributes?.label && /* @__PURE__ */ jsxs17(
|
|
1520
|
+
"label",
|
|
1521
|
+
{
|
|
1522
|
+
htmlFor: props.name,
|
|
1523
|
+
className: "inline-block text-sm font-semibold text-slate-800",
|
|
1524
|
+
children: [
|
|
1525
|
+
props.attributes.label,
|
|
1526
|
+
props?.attributes?.required && /* @__PURE__ */ jsx17("span", { className: "bg-error-weak", children: "*" })
|
|
1527
|
+
]
|
|
1528
|
+
}
|
|
1529
|
+
) }),
|
|
1527
1530
|
/* @__PURE__ */ jsxs17(
|
|
1528
1531
|
"label",
|
|
1529
1532
|
{
|
|
@@ -1554,7 +1557,8 @@ var SwitchInput = (props) => {
|
|
|
1554
1557
|
{
|
|
1555
1558
|
className: "absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-default shadow\n transition-transform duration-200 ease-in-out\n peer-checked:translate-x-5\n peer-disabled:bg-slate-50"
|
|
1556
1559
|
}
|
|
1557
|
-
)
|
|
1560
|
+
),
|
|
1561
|
+
/* @__PURE__ */ jsx17("p", { className: "hidden group-[.validated]:peer-invalid:block absolute left-0 top-full mt-1 w-max max-w-[220px] whitespace-normal bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
1558
1562
|
]
|
|
1559
1563
|
}
|
|
1560
1564
|
)
|
|
@@ -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.replace(/'/g, '"'));
|
|
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}`;
|