@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260818060820 → 0.8.1-dev.20260824072352
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-QZ7ES2AS.mjs +205 -0
- package/dist/DataBindingControls-XCAIDMDC.mjs +209 -0
- package/dist/{InputControlClient-XR37ZIQ2.mjs → InputControlClient-4M2BZXQO.mjs} +5 -3
- package/dist/InputControlClient-AORN4DRF.mjs +1921 -0
- package/dist/{LinkNodeButton-AOEDCCL7.mjs → LinkNodeButton-BEAX4I4C.mjs} +1 -1
- package/dist/LinkNodeButton-IT2CELKO.mjs +225 -0
- package/dist/{Pagination-YKNCYVXV.mjs → Pagination-GL6B4MNO.mjs} +5 -3
- package/dist/{Pagination-6OFACRMQ.mjs → Pagination-ZQO3EUKB.mjs} +27 -71
- package/dist/chunk-2R26M6CK.mjs +30 -0
- package/dist/{chunk-KL2YKXXS.mjs → chunk-4P4HO663.mjs} +30 -6
- package/dist/chunk-4R7F7LBL.mjs +36 -0
- package/dist/chunk-6PW2RLUJ.mjs +52 -0
- package/dist/chunk-E4VOFO5Q.mjs +39 -0
- package/dist/{chunk-YDPISYMP.mjs → chunk-GCG4OYDJ.mjs} +0 -34
- package/dist/{chunk-65QPOTZ4.mjs → chunk-GJOJX2O3.mjs} +1 -1
- package/dist/chunk-GKI42H4B.mjs +13 -0
- package/dist/{chunk-TVL6KVD5.mjs → chunk-Q46GMD3P.mjs} +31 -37
- package/dist/chunk-RHVNJMS4.mjs +251 -0
- package/dist/{chunk-WEV5U33G.mjs → chunk-TKDSRAM6.mjs} +36 -20
- package/dist/chunk-TQ6BXQ3A.mjs +24 -0
- package/dist/{chunk-3GWLDT7C.mjs → chunk-WXZMRMRS.mjs} +36 -20
- package/dist/index.d.mts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +616 -311
- package/dist/index.mjs +101 -54
- package/dist/server.d.mts +17 -6
- package/dist/server.d.ts +17 -6
- package/dist/server.js +2717 -298
- package/dist/server.mjs +86 -52
- package/package.json +1 -1
- package/dist/LinkNodeButton-KZRNRJRI.mjs +0 -467
package/dist/server.js
CHANGED
|
@@ -30,6 +30,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
+
// src/components/utilities/AssetUtility.tsx
|
|
34
|
+
var AssetUtility, AssetUtility_default;
|
|
35
|
+
var init_AssetUtility = __esm({
|
|
36
|
+
"src/components/utilities/AssetUtility.tsx"() {
|
|
37
|
+
"use strict";
|
|
38
|
+
AssetUtility = class {
|
|
39
|
+
constructor() {
|
|
40
|
+
}
|
|
41
|
+
static resolveUrl(assetBaseUrl, url) {
|
|
42
|
+
if (!url) return void 0;
|
|
43
|
+
if (url.startsWith("http")) return url;
|
|
44
|
+
if (!assetBaseUrl) return url;
|
|
45
|
+
return `${assetBaseUrl}/${url}`;
|
|
46
|
+
}
|
|
47
|
+
// // static getAssetUrl(apiBaseUrl: string) {
|
|
48
|
+
// // let domainName = apiBaseUrl.replace("https://", "");
|
|
49
|
+
// // return `https://cdn.g-assets.com/${domainName}`;
|
|
50
|
+
// // }
|
|
51
|
+
// static getAssetFullPath(apiBaseUrl: string, relativePath: string) {
|
|
52
|
+
// const domainName = apiBaseUrl.replace("https://", "");
|
|
53
|
+
// return `https://cdn.g-assets.com/${domainName}/${relativePath}`;
|
|
54
|
+
// }
|
|
55
|
+
};
|
|
56
|
+
AssetUtility_default = AssetUtility;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
33
60
|
// src/components/HlsPlayer.tsx
|
|
34
61
|
var HlsPlayer_exports = {};
|
|
35
62
|
__export(HlsPlayer_exports, {
|
|
@@ -1008,7 +1035,7 @@ var init_CacheManage = __esm({
|
|
|
1008
1035
|
});
|
|
1009
1036
|
|
|
1010
1037
|
// src/clients/ServiceClient.tsx
|
|
1011
|
-
var ServerApiError, ServiceClient, ServiceClient_default;
|
|
1038
|
+
var ServerApiError, _ServiceClient, ServiceClient, ServiceClient_default;
|
|
1012
1039
|
var init_ServiceClient = __esm({
|
|
1013
1040
|
"src/clients/ServiceClient.tsx"() {
|
|
1014
1041
|
"use strict";
|
|
@@ -1021,7 +1048,7 @@ var init_ServiceClient = __esm({
|
|
|
1021
1048
|
this.data.isSuccessful = false;
|
|
1022
1049
|
}
|
|
1023
1050
|
};
|
|
1024
|
-
|
|
1051
|
+
_ServiceClient = class _ServiceClient {
|
|
1025
1052
|
constructor(apiBaseUrl, session) {
|
|
1026
1053
|
this.cacheManager = CacheManager.getInstance();
|
|
1027
1054
|
this.baseUrl = apiBaseUrl;
|
|
@@ -1064,28 +1091,42 @@ var init_ServiceClient = __esm({
|
|
|
1064
1091
|
if (cachedData) {
|
|
1065
1092
|
return cachedData;
|
|
1066
1093
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
const apiErrorData = await response.json();
|
|
1071
|
-
throw new ServerApiError(apiErrorData, response.status);
|
|
1072
|
-
}
|
|
1073
|
-
const cacheControl = response.headers.get("Cache-Control");
|
|
1074
|
-
let revalidate = null;
|
|
1075
|
-
if (cacheControl) {
|
|
1076
|
-
const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
|
|
1077
|
-
if (maxAgeMatch && maxAgeMatch[1]) {
|
|
1078
|
-
const maxAge = parseInt(maxAgeMatch[1], 10);
|
|
1079
|
-
revalidate = maxAge * 1e3;
|
|
1080
|
-
}
|
|
1094
|
+
const existingRequest = _ServiceClient.inFlightGetRequests.get(cacheKey);
|
|
1095
|
+
if (existingRequest) {
|
|
1096
|
+
return existingRequest;
|
|
1081
1097
|
}
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1098
|
+
const request = (async () => {
|
|
1099
|
+
console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
|
|
1100
|
+
const response = await fetch(fullPath, { headers: config.headers });
|
|
1101
|
+
if (!response.ok) {
|
|
1102
|
+
const apiErrorData = await response.json();
|
|
1103
|
+
throw new ServerApiError(apiErrorData, response.status);
|
|
1104
|
+
}
|
|
1105
|
+
const cacheControl = response.headers.get("Cache-Control");
|
|
1106
|
+
let revalidate = null;
|
|
1107
|
+
if (cacheControl) {
|
|
1108
|
+
const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
|
|
1109
|
+
if (maxAgeMatch && maxAgeMatch[1]) {
|
|
1110
|
+
const maxAge = parseInt(maxAgeMatch[1], 10);
|
|
1111
|
+
revalidate = maxAge * 1e3;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
const data = await response.json();
|
|
1115
|
+
data.isSuccessful = true;
|
|
1116
|
+
if (revalidate !== null && revalidate > 0) {
|
|
1117
|
+
console.log("revalidate............I am caching:" + revalidate);
|
|
1118
|
+
this.cacheManager.set(cacheKey, data, revalidate);
|
|
1119
|
+
}
|
|
1120
|
+
return data;
|
|
1121
|
+
})();
|
|
1122
|
+
_ServiceClient.inFlightGetRequests.set(cacheKey, request);
|
|
1123
|
+
try {
|
|
1124
|
+
return await request;
|
|
1125
|
+
} finally {
|
|
1126
|
+
if (_ServiceClient.inFlightGetRequests.get(cacheKey) === request) {
|
|
1127
|
+
_ServiceClient.inFlightGetRequests.delete(cacheKey);
|
|
1128
|
+
}
|
|
1087
1129
|
}
|
|
1088
|
-
return data;
|
|
1089
1130
|
}
|
|
1090
1131
|
// private async refreshToken(): Promise<void> {
|
|
1091
1132
|
// console.log("*******************calling refresh token***********************");
|
|
@@ -1182,6 +1223,8 @@ var init_ServiceClient = __esm({
|
|
|
1182
1223
|
}
|
|
1183
1224
|
}
|
|
1184
1225
|
};
|
|
1226
|
+
_ServiceClient.inFlightGetRequests = /* @__PURE__ */ new Map();
|
|
1227
|
+
ServiceClient = _ServiceClient;
|
|
1185
1228
|
ServiceClient_default = ServiceClient;
|
|
1186
1229
|
}
|
|
1187
1230
|
});
|
|
@@ -1824,13 +1867,40 @@ var init_IframeClient = __esm({
|
|
|
1824
1867
|
});
|
|
1825
1868
|
|
|
1826
1869
|
// src/components/controls/edit/InputControlType.tsx
|
|
1827
|
-
var Constants;
|
|
1870
|
+
var Constants, InputControlType, InputControlType_default;
|
|
1828
1871
|
var init_InputControlType = __esm({
|
|
1829
1872
|
"src/components/controls/edit/InputControlType.tsx"() {
|
|
1830
1873
|
"use strict";
|
|
1831
1874
|
Constants = {
|
|
1832
1875
|
pagesize: 10
|
|
1833
1876
|
};
|
|
1877
|
+
InputControlType = {
|
|
1878
|
+
lineTextInput: "lineTextInput",
|
|
1879
|
+
multilineTextInput: "multilineTextInput",
|
|
1880
|
+
emailInput: "emailInput",
|
|
1881
|
+
moneyInput: "money",
|
|
1882
|
+
select: "select",
|
|
1883
|
+
percentageInput: "percentage",
|
|
1884
|
+
asset: "asset",
|
|
1885
|
+
assetUpload: "assetUpload",
|
|
1886
|
+
phoneInput: "phone",
|
|
1887
|
+
numberInput: "numberInput",
|
|
1888
|
+
checkboxInput: "checkboxInput",
|
|
1889
|
+
otpInput: "otp",
|
|
1890
|
+
datetimeInput: "datetimeInput",
|
|
1891
|
+
timeInput: "time",
|
|
1892
|
+
colorInput: "colorInput",
|
|
1893
|
+
selectWithSearchInput: "selectWithSearchInput",
|
|
1894
|
+
selectWithSearchPanel: "selectWithSearchPanel",
|
|
1895
|
+
booleanSelect: "booleanSelect",
|
|
1896
|
+
switchInput: "switchInput",
|
|
1897
|
+
dateInput: "dateInput",
|
|
1898
|
+
radioInput: "radioInput",
|
|
1899
|
+
switcher: "switcher",
|
|
1900
|
+
videoInput: "videoInput",
|
|
1901
|
+
referenceInput: "referenceInput"
|
|
1902
|
+
};
|
|
1903
|
+
InputControlType_default = InputControlType;
|
|
1834
1904
|
}
|
|
1835
1905
|
});
|
|
1836
1906
|
|
|
@@ -1875,6 +1945,12 @@ var init_OdataBuilder = __esm({
|
|
|
1875
1945
|
if (key == "searchCols") {
|
|
1876
1946
|
this.searchCols = odata[key];
|
|
1877
1947
|
}
|
|
1948
|
+
if (key == "filter") {
|
|
1949
|
+
this.apiFilter = odata[key];
|
|
1950
|
+
}
|
|
1951
|
+
if (key == "orderBy") {
|
|
1952
|
+
this.apiOrderBy = odata[key];
|
|
1953
|
+
}
|
|
1878
1954
|
}
|
|
1879
1955
|
}
|
|
1880
1956
|
}
|
|
@@ -1901,6 +1977,12 @@ var init_OdataBuilder = __esm({
|
|
|
1901
1977
|
if (obj?.["searchCols"] && obj["searchCols"].trim() !== "") {
|
|
1902
1978
|
queryString += `&searchCols=${encodeURIComponent(obj["searchCols"])}`;
|
|
1903
1979
|
}
|
|
1980
|
+
if (obj?.["filter"] && obj["filter"].trim() !== "") {
|
|
1981
|
+
queryString += `&filter=${encodeURIComponent(obj["filter"])}`;
|
|
1982
|
+
}
|
|
1983
|
+
if (obj?.["orderBy"] && obj["orderBy"].trim() !== "") {
|
|
1984
|
+
queryString += `&orderBy=${encodeURIComponent(obj["orderBy"])}`;
|
|
1985
|
+
}
|
|
1904
1986
|
if (obj) {
|
|
1905
1987
|
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
1906
1988
|
queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
|
|
@@ -1948,6 +2030,18 @@ var init_OdataBuilder = __esm({
|
|
|
1948
2030
|
}
|
|
1949
2031
|
return pageNumber;
|
|
1950
2032
|
}
|
|
2033
|
+
appendApiQueryParameters(url) {
|
|
2034
|
+
if (this.searchTerm) {
|
|
2035
|
+
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
2036
|
+
}
|
|
2037
|
+
if (this.apiFilter) {
|
|
2038
|
+
url += `&filter=${encodeURIComponent(this.apiFilter)}`;
|
|
2039
|
+
}
|
|
2040
|
+
if (this.apiOrderBy) {
|
|
2041
|
+
url += `&orderBy=${encodeURIComponent(this.apiOrderBy)}`;
|
|
2042
|
+
}
|
|
2043
|
+
return url;
|
|
2044
|
+
}
|
|
1951
2045
|
getUrl() {
|
|
1952
2046
|
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
1953
2047
|
if (this.filterBy !== null && this.filterBy !== "") {
|
|
@@ -1963,7 +2057,7 @@ var init_OdataBuilder = __esm({
|
|
|
1963
2057
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
1964
2058
|
}
|
|
1965
2059
|
console.log(url);
|
|
1966
|
-
return url;
|
|
2060
|
+
return this.appendApiQueryParameters(url);
|
|
1967
2061
|
}
|
|
1968
2062
|
getNewOrderByUrl(orderBy) {
|
|
1969
2063
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
@@ -1977,7 +2071,7 @@ var init_OdataBuilder = __esm({
|
|
|
1977
2071
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
1978
2072
|
}
|
|
1979
2073
|
url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
|
|
1980
|
-
return url;
|
|
2074
|
+
return this.appendApiQueryParameters(url);
|
|
1981
2075
|
}
|
|
1982
2076
|
getNewFilterUrl(filterBy) {
|
|
1983
2077
|
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
@@ -1993,7 +2087,7 @@ var init_OdataBuilder = __esm({
|
|
|
1993
2087
|
if (this.searchCols) {
|
|
1994
2088
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
1995
2089
|
}
|
|
1996
|
-
return url;
|
|
2090
|
+
return this.appendApiQueryParameters(url);
|
|
1997
2091
|
}
|
|
1998
2092
|
getNewPageUrl(page) {
|
|
1999
2093
|
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
@@ -2010,7 +2104,7 @@ var init_OdataBuilder = __esm({
|
|
|
2010
2104
|
if (this.searchCols) {
|
|
2011
2105
|
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
2012
2106
|
}
|
|
2013
|
-
return url;
|
|
2107
|
+
return this.appendApiQueryParameters(url);
|
|
2014
2108
|
}
|
|
2015
2109
|
getNewPageSizeUrl(pageSize) {
|
|
2016
2110
|
const currentPage = this.getPageNumber(
|
|
@@ -2024,7 +2118,7 @@ var init_OdataBuilder = __esm({
|
|
|
2024
2118
|
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2025
2119
|
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
2026
2120
|
}
|
|
2027
|
-
return url;
|
|
2121
|
+
return this.appendApiQueryParameters(url);
|
|
2028
2122
|
}
|
|
2029
2123
|
getOrderBy() {
|
|
2030
2124
|
return this.orderBy;
|
|
@@ -2104,206 +2198,2498 @@ var init_Icons = __esm({
|
|
|
2104
2198
|
}
|
|
2105
2199
|
});
|
|
2106
2200
|
|
|
2107
|
-
// src/svg/Icon.tsx
|
|
2108
|
-
var import_jsx_runtime52, Icon, Icon_default;
|
|
2109
|
-
var init_Icon = __esm({
|
|
2110
|
-
"src/svg/Icon.tsx"() {
|
|
2201
|
+
// src/svg/Icon.tsx
|
|
2202
|
+
var import_jsx_runtime52, Icon, Icon_default;
|
|
2203
|
+
var init_Icon = __esm({
|
|
2204
|
+
"src/svg/Icon.tsx"() {
|
|
2205
|
+
"use strict";
|
|
2206
|
+
init_Icons();
|
|
2207
|
+
import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2208
|
+
Icon = ({ name, className, ...props }) => {
|
|
2209
|
+
const IconComponent = Icons_default[name];
|
|
2210
|
+
if (!IconComponent) {
|
|
2211
|
+
console.error(`Icon "${name}" not found.`);
|
|
2212
|
+
return null;
|
|
2213
|
+
}
|
|
2214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(IconComponent, { ...props, className });
|
|
2215
|
+
};
|
|
2216
|
+
Icon_default = Icon;
|
|
2217
|
+
}
|
|
2218
|
+
});
|
|
2219
|
+
|
|
2220
|
+
// src/components/Pagination.tsx
|
|
2221
|
+
var Pagination_exports = {};
|
|
2222
|
+
__export(Pagination_exports, {
|
|
2223
|
+
default: () => Pagination_default
|
|
2224
|
+
});
|
|
2225
|
+
var import_react32, import_jsx_runtime53, Pagination, Pagination_default;
|
|
2226
|
+
var init_Pagination = __esm({
|
|
2227
|
+
"src/components/Pagination.tsx"() {
|
|
2228
|
+
"use strict";
|
|
2229
|
+
"use client";
|
|
2230
|
+
import_react32 = require("react");
|
|
2231
|
+
init_OdataBuilder();
|
|
2232
|
+
init_Icon();
|
|
2233
|
+
init_StyleTypes();
|
|
2234
|
+
init_InputControlType();
|
|
2235
|
+
init_Hyperlink();
|
|
2236
|
+
import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2237
|
+
Pagination = (props) => {
|
|
2238
|
+
const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
|
|
2239
|
+
const builder = (0, import_react32.useMemo)(() => {
|
|
2240
|
+
const b = new OdataBuilder(path);
|
|
2241
|
+
if (query) b.setQuery(query);
|
|
2242
|
+
return b;
|
|
2243
|
+
}, [path, query]);
|
|
2244
|
+
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
2245
|
+
const totalItems = dataset?.count || 0;
|
|
2246
|
+
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
2247
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
2248
|
+
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
2249
|
+
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
2250
|
+
const getPaginationRange = () => {
|
|
2251
|
+
const delta = 1;
|
|
2252
|
+
const range = [];
|
|
2253
|
+
if (totalPages <= 7) {
|
|
2254
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
2255
|
+
}
|
|
2256
|
+
range.push(1);
|
|
2257
|
+
let start = Math.max(2, activePageNumber - delta);
|
|
2258
|
+
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
2259
|
+
if (activePageNumber - delta <= 2) {
|
|
2260
|
+
end = Math.min(totalPages - 1, 4);
|
|
2261
|
+
}
|
|
2262
|
+
if (activePageNumber + delta >= totalPages - 1) {
|
|
2263
|
+
start = Math.max(2, totalPages - 4);
|
|
2264
|
+
}
|
|
2265
|
+
if (start > 2) {
|
|
2266
|
+
range.push("...");
|
|
2267
|
+
}
|
|
2268
|
+
for (let i = start; i <= end; i++) {
|
|
2269
|
+
range.push(i);
|
|
2270
|
+
}
|
|
2271
|
+
if (end < totalPages - 1) {
|
|
2272
|
+
range.push("...");
|
|
2273
|
+
}
|
|
2274
|
+
if (totalPages > 1) {
|
|
2275
|
+
range.push(totalPages);
|
|
2276
|
+
}
|
|
2277
|
+
return range;
|
|
2278
|
+
};
|
|
2279
|
+
const paginationRange = getPaginationRange();
|
|
2280
|
+
const PageButton = ({ page, children }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2281
|
+
Hyperlink,
|
|
2282
|
+
{
|
|
2283
|
+
linkType: "Link" /* Link */,
|
|
2284
|
+
className: `
|
|
2285
|
+
min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
|
|
2286
|
+
border text-sm font-medium transition-colors duration-150
|
|
2287
|
+
${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
|
|
2288
|
+
`,
|
|
2289
|
+
href: builder.getNewPageUrl(page),
|
|
2290
|
+
children
|
|
2291
|
+
}
|
|
2292
|
+
);
|
|
2293
|
+
const NavigationButton = ({ page, disabled, children }) => {
|
|
2294
|
+
if (disabled) {
|
|
2295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
|
|
2296
|
+
}
|
|
2297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2298
|
+
Hyperlink,
|
|
2299
|
+
{
|
|
2300
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
|
|
2301
|
+
href: builder.getNewPageUrl(page),
|
|
2302
|
+
children
|
|
2303
|
+
}
|
|
2304
|
+
);
|
|
2305
|
+
};
|
|
2306
|
+
if (totalPages <= 1 && totalItems === 0) return null;
|
|
2307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "py-6 border-t bg-default", children: [
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
2309
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "text-sm", children: [
|
|
2310
|
+
"Showing ",
|
|
2311
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-semibold", children: [
|
|
2312
|
+
startItem,
|
|
2313
|
+
"-",
|
|
2314
|
+
endItem
|
|
2315
|
+
] }),
|
|
2316
|
+
" ",
|
|
2317
|
+
"out of ",
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
|
|
2319
|
+
" results"
|
|
2320
|
+
] }),
|
|
2321
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center space-x-1", children: [
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2323
|
+
NavigationButton,
|
|
2324
|
+
{
|
|
2325
|
+
page: activePageNumber - 1,
|
|
2326
|
+
disabled: activePageNumber === 1,
|
|
2327
|
+
children: [
|
|
2328
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "Prev" })
|
|
2330
|
+
]
|
|
2331
|
+
}
|
|
2332
|
+
),
|
|
2333
|
+
paginationRange.map((item, index) => {
|
|
2334
|
+
if (item === "...") {
|
|
2335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2336
|
+
"span",
|
|
2337
|
+
{
|
|
2338
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
|
|
2339
|
+
children: "..."
|
|
2340
|
+
},
|
|
2341
|
+
`ellipsis-${index}`
|
|
2342
|
+
);
|
|
2343
|
+
}
|
|
2344
|
+
const page = item;
|
|
2345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PageButton, { page, children: page }, page);
|
|
2346
|
+
}),
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2348
|
+
NavigationButton,
|
|
2349
|
+
{
|
|
2350
|
+
page: activePageNumber + 1,
|
|
2351
|
+
disabled: activePageNumber === totalPages,
|
|
2352
|
+
children: [
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "Next" }),
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
|
|
2355
|
+
]
|
|
2356
|
+
}
|
|
2357
|
+
)
|
|
2358
|
+
] }),
|
|
2359
|
+
showJumpToPage && totalPages > 5 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
2360
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "Go to:" }),
|
|
2361
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2362
|
+
"input",
|
|
2363
|
+
{
|
|
2364
|
+
type: "number",
|
|
2365
|
+
min: "1",
|
|
2366
|
+
max: totalPages,
|
|
2367
|
+
defaultValue: activePageNumber,
|
|
2368
|
+
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
2369
|
+
onKeyDown: (e) => {
|
|
2370
|
+
if (e.key === "Enter") {
|
|
2371
|
+
const input = e.target;
|
|
2372
|
+
const page = parseInt(input.value);
|
|
2373
|
+
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
2374
|
+
window.location.href = builder.getNewPageUrl(page);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
) })
|
|
2380
|
+
] })
|
|
2381
|
+
] }),
|
|
2382
|
+
showPageSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
2383
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "Show:" }),
|
|
2384
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2385
|
+
Hyperlink,
|
|
2386
|
+
{
|
|
2387
|
+
className: `
|
|
2388
|
+
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
2389
|
+
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
2390
|
+
`,
|
|
2391
|
+
href: builder.getNewPageSizeUrl(size),
|
|
2392
|
+
children: size
|
|
2393
|
+
},
|
|
2394
|
+
size
|
|
2395
|
+
)) }),
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "per page" })
|
|
2397
|
+
] }) })
|
|
2398
|
+
] });
|
|
2399
|
+
};
|
|
2400
|
+
Pagination_default = Pagination;
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2403
|
+
|
|
2404
|
+
// src/components/controls/edit/MultilineTextInput.tsx
|
|
2405
|
+
var import_react33, import_jsx_runtime54, MultilineTextInput, MultilineTextInput_default;
|
|
2406
|
+
var init_MultilineTextInput = __esm({
|
|
2407
|
+
"src/components/controls/edit/MultilineTextInput.tsx"() {
|
|
2408
|
+
"use strict";
|
|
2409
|
+
import_react33 = __toESM(require("react"));
|
|
2410
|
+
import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2411
|
+
MultilineTextInput = (props) => {
|
|
2412
|
+
const textChangeHandler = (event) => {
|
|
2413
|
+
const text = event.target.value;
|
|
2414
|
+
if (props.callback !== void 0) {
|
|
2415
|
+
props.callback(
|
|
2416
|
+
{
|
|
2417
|
+
name: props.name,
|
|
2418
|
+
value: text,
|
|
2419
|
+
index: props.index,
|
|
2420
|
+
groupKey: props.groupKey
|
|
2421
|
+
}
|
|
2422
|
+
);
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
let value = "";
|
|
2426
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2427
|
+
value = props.value;
|
|
2428
|
+
}
|
|
2429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react33.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "block mb-1", children: [
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
2431
|
+
" ",
|
|
2432
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2434
|
+
"textarea",
|
|
2435
|
+
{
|
|
2436
|
+
name: props.name,
|
|
2437
|
+
id: props.name,
|
|
2438
|
+
value,
|
|
2439
|
+
onChange: textChangeHandler,
|
|
2440
|
+
onBlur: props?.onBlur,
|
|
2441
|
+
rows: 4,
|
|
2442
|
+
required: props?.attributes?.required,
|
|
2443
|
+
placeholder: props?.attributes?.placeholder,
|
|
2444
|
+
maxLength: props?.attributes?.maxLength,
|
|
2445
|
+
disabled: props?.attributes?.readOnly,
|
|
2446
|
+
minLength: props?.attributes?.minLength,
|
|
2447
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm input"
|
|
2448
|
+
}
|
|
2449
|
+
),
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2451
|
+
] }) });
|
|
2452
|
+
};
|
|
2453
|
+
MultilineTextInput_default = MultilineTextInput;
|
|
2454
|
+
}
|
|
2455
|
+
});
|
|
2456
|
+
|
|
2457
|
+
// src/components/controls/edit/LineTextInput.tsx
|
|
2458
|
+
var import_react34, import_jsx_runtime55, LineTextInput, LineTextInput_default;
|
|
2459
|
+
var init_LineTextInput = __esm({
|
|
2460
|
+
"src/components/controls/edit/LineTextInput.tsx"() {
|
|
2461
|
+
"use strict";
|
|
2462
|
+
import_react34 = __toESM(require("react"));
|
|
2463
|
+
import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2464
|
+
LineTextInput = (props) => {
|
|
2465
|
+
const textChangeHandler = (event) => {
|
|
2466
|
+
const text = event.target.value;
|
|
2467
|
+
if (props.callback !== void 0) {
|
|
2468
|
+
props.callback(
|
|
2469
|
+
{
|
|
2470
|
+
name: props.name,
|
|
2471
|
+
value: text,
|
|
2472
|
+
index: props.index,
|
|
2473
|
+
groupKey: props.groupKey
|
|
2474
|
+
}
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
let value = "";
|
|
2479
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2480
|
+
value = props.value;
|
|
2481
|
+
}
|
|
2482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react34.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("label", { className: "block", children: [
|
|
2483
|
+
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
2484
|
+
" ",
|
|
2485
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "bg-error-weak !bg-transparent", children: "*" }),
|
|
2486
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2487
|
+
"input",
|
|
2488
|
+
{
|
|
2489
|
+
type: "text",
|
|
2490
|
+
name: props.name,
|
|
2491
|
+
id: props.name,
|
|
2492
|
+
value,
|
|
2493
|
+
onChange: textChangeHandler,
|
|
2494
|
+
onBlur: props?.onBlur,
|
|
2495
|
+
required: props?.attributes?.required,
|
|
2496
|
+
placeholder: props?.attributes?.placeholder,
|
|
2497
|
+
maxLength: props?.attributes?.maxLength,
|
|
2498
|
+
pattern: props?.attributes?.pattern,
|
|
2499
|
+
disabled: props?.attributes?.readOnly,
|
|
2500
|
+
minLength: props?.attributes?.minLength,
|
|
2501
|
+
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm transition-all duration-500 ease-in-out
|
|
2502
|
+
${props?.inputClasses ? props.inputClasses : ``}
|
|
2503
|
+
`
|
|
2504
|
+
}
|
|
2505
|
+
),
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2507
|
+
] }) });
|
|
2508
|
+
};
|
|
2509
|
+
LineTextInput_default = LineTextInput;
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
|
|
2513
|
+
// src/components/controls/edit/MoneyInput.tsx
|
|
2514
|
+
var import_react35, import_jsx_runtime56, MoneyInput, MoneyInput_default;
|
|
2515
|
+
var init_MoneyInput = __esm({
|
|
2516
|
+
"src/components/controls/edit/MoneyInput.tsx"() {
|
|
2517
|
+
"use strict";
|
|
2518
|
+
import_react35 = __toESM(require("react"));
|
|
2519
|
+
import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2520
|
+
MoneyInput = (props) => {
|
|
2521
|
+
const textChangeHandler = (event) => {
|
|
2522
|
+
const rawValue = event.target.value;
|
|
2523
|
+
const numericValue = parseFloat(rawValue);
|
|
2524
|
+
if (rawValue === "" || !isNaN(numericValue) && numericValue >= 0) {
|
|
2525
|
+
if (props.callback !== void 0) {
|
|
2526
|
+
props.callback({
|
|
2527
|
+
name: props.name,
|
|
2528
|
+
value: rawValue,
|
|
2529
|
+
index: props.index,
|
|
2530
|
+
groupKey: props.groupKey
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
};
|
|
2535
|
+
const handleWheel = (event) => {
|
|
2536
|
+
event.preventDefault();
|
|
2537
|
+
event.target.blur();
|
|
2538
|
+
};
|
|
2539
|
+
let value;
|
|
2540
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2541
|
+
value = props.value;
|
|
2542
|
+
}
|
|
2543
|
+
const preventNegative = (e) => {
|
|
2544
|
+
if (e.key === "-") {
|
|
2545
|
+
e.preventDefault();
|
|
2546
|
+
}
|
|
2547
|
+
};
|
|
2548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react35.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("label", { className: "block mb-1", children: [
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
2550
|
+
" ",
|
|
2551
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2553
|
+
"input",
|
|
2554
|
+
{
|
|
2555
|
+
type: "number",
|
|
2556
|
+
name: props.name,
|
|
2557
|
+
id: props.name,
|
|
2558
|
+
value,
|
|
2559
|
+
min: 0,
|
|
2560
|
+
onChange: textChangeHandler,
|
|
2561
|
+
onWheel: handleWheel,
|
|
2562
|
+
onKeyDown: preventNegative,
|
|
2563
|
+
required: props?.attributes?.required,
|
|
2564
|
+
placeholder: props?.attributes?.placeholder,
|
|
2565
|
+
maxLength: props?.attributes?.maxLength,
|
|
2566
|
+
pattern: props?.attributes?.pattern,
|
|
2567
|
+
disabled: props?.attributes?.readOnly,
|
|
2568
|
+
minLength: props?.attributes?.minLength,
|
|
2569
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm number-input"
|
|
2570
|
+
}
|
|
2571
|
+
),
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2573
|
+
] }) });
|
|
2574
|
+
};
|
|
2575
|
+
MoneyInput_default = MoneyInput;
|
|
2576
|
+
}
|
|
2577
|
+
});
|
|
2578
|
+
|
|
2579
|
+
// src/components/controls/edit/Select.tsx
|
|
2580
|
+
var import_react36, import_jsx_runtime57, Select, Select_default;
|
|
2581
|
+
var init_Select = __esm({
|
|
2582
|
+
"src/components/controls/edit/Select.tsx"() {
|
|
2583
|
+
"use strict";
|
|
2584
|
+
import_react36 = require("react");
|
|
2585
|
+
import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2586
|
+
Select = (props) => {
|
|
2587
|
+
const [list, setList] = (0, import_react36.useState)();
|
|
2588
|
+
const getSafeValue = (val) => {
|
|
2589
|
+
if (val === null || val === void 0) return "";
|
|
2590
|
+
if (typeof val === "boolean") return val ? "1" : "0";
|
|
2591
|
+
return val;
|
|
2592
|
+
};
|
|
2593
|
+
const textChangeHandler = (event) => {
|
|
2594
|
+
let rawValue = event.target.value;
|
|
2595
|
+
if (rawValue === "") rawValue = null;
|
|
2596
|
+
let finalValue = rawValue;
|
|
2597
|
+
if (list && props.dataKeyFieldName) {
|
|
2598
|
+
const key = props.dataKeyFieldName;
|
|
2599
|
+
const selectedItem = list.find(
|
|
2600
|
+
(item) => String(item[key]) === String(rawValue)
|
|
2601
|
+
);
|
|
2602
|
+
if (selectedItem) {
|
|
2603
|
+
const keyValue = selectedItem[key];
|
|
2604
|
+
if (typeof keyValue === "number") {
|
|
2605
|
+
finalValue = Number(rawValue);
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
props.callback?.({
|
|
2610
|
+
name: props.name,
|
|
2611
|
+
value: finalValue,
|
|
2612
|
+
index: props.index,
|
|
2613
|
+
groupKey: props.groupKey
|
|
2614
|
+
});
|
|
2615
|
+
};
|
|
2616
|
+
const inputChangeHandler = (event) => {
|
|
2617
|
+
props.callback?.({
|
|
2618
|
+
name: props.name,
|
|
2619
|
+
value: event.target.value,
|
|
2620
|
+
index: props.index,
|
|
2621
|
+
groupKey: props.groupKey
|
|
2622
|
+
});
|
|
2623
|
+
};
|
|
2624
|
+
(0, import_react36.useEffect)(() => {
|
|
2625
|
+
async function fetchData() {
|
|
2626
|
+
if (props.dataset) {
|
|
2627
|
+
setList(props.dataset);
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
if (props.dataSource && props.serviceClient) {
|
|
2631
|
+
let dataSource = props.dataSource;
|
|
2632
|
+
let response;
|
|
2633
|
+
if (props.dataSourceDependsOn) {
|
|
2634
|
+
if (!props.dependentValue) {
|
|
2635
|
+
setList([]);
|
|
2636
|
+
return;
|
|
2637
|
+
}
|
|
2638
|
+
dataSource = dataSource.replace(
|
|
2639
|
+
`{${props.dataSourceDependsOn}}`,
|
|
2640
|
+
props.dependentValue
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
response = await props.serviceClient.get(dataSource);
|
|
2644
|
+
setList(response.result ?? []);
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2647
|
+
setList([]);
|
|
2648
|
+
}
|
|
2649
|
+
fetchData();
|
|
2650
|
+
}, [
|
|
2651
|
+
props.dataset,
|
|
2652
|
+
props.dataSource,
|
|
2653
|
+
props.dependentValue,
|
|
2654
|
+
props.dataSourceDependsOn
|
|
2655
|
+
]);
|
|
2656
|
+
const value = getSafeValue(props.value);
|
|
2657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("label", { className: "block", children: [
|
|
2658
|
+
props.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "text-sm font-medium inline-block pb-1", children: props.attributes?.label }),
|
|
2659
|
+
" ",
|
|
2660
|
+
props.attributes?.label && props.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2661
|
+
list && list.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2662
|
+
"input",
|
|
2663
|
+
{
|
|
2664
|
+
type: "text",
|
|
2665
|
+
name: props.name,
|
|
2666
|
+
id: props.name,
|
|
2667
|
+
value,
|
|
2668
|
+
onChange: inputChangeHandler,
|
|
2669
|
+
required: props.attributes?.required,
|
|
2670
|
+
placeholder: props.attributes?.placeholder,
|
|
2671
|
+
maxLength: props.attributes?.maxLength,
|
|
2672
|
+
pattern: props.attributes?.pattern,
|
|
2673
|
+
disabled: props.attributes?.readOnly,
|
|
2674
|
+
minLength: props.attributes?.minLength,
|
|
2675
|
+
className: `peer input select mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
|
|
2676
|
+
}
|
|
2677
|
+
),
|
|
2678
|
+
list && list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
2679
|
+
"select",
|
|
2680
|
+
{
|
|
2681
|
+
name: props.name,
|
|
2682
|
+
id: props.name,
|
|
2683
|
+
value,
|
|
2684
|
+
onChange: textChangeHandler,
|
|
2685
|
+
required: props.attributes?.required,
|
|
2686
|
+
disabled: props.attributes?.readOnly,
|
|
2687
|
+
className: `peer select py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
2688
|
+
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
2689
|
+
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none ${props.inputClasses ?? ""}`,
|
|
2690
|
+
children: [
|
|
2691
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: "", children: props.attributes?.placeholder || "Select" }),
|
|
2692
|
+
list.map((item, index) => {
|
|
2693
|
+
const keyField = props.dataKeyFieldName;
|
|
2694
|
+
const textField = props.dataTextFieldName;
|
|
2695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("option", { value: item[keyField], children: item[textField] }, index);
|
|
2696
|
+
})
|
|
2697
|
+
]
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 text-alert text-sm", children: props.attributes?.errorMessage || "" })
|
|
2701
|
+
] });
|
|
2702
|
+
};
|
|
2703
|
+
Select_default = Select;
|
|
2704
|
+
}
|
|
2705
|
+
});
|
|
2706
|
+
|
|
2707
|
+
// src/components/controls/edit/PercentageInput.tsx
|
|
2708
|
+
var import_react37, import_jsx_runtime58, PercentageInput, PercentageInput_default;
|
|
2709
|
+
var init_PercentageInput = __esm({
|
|
2710
|
+
"src/components/controls/edit/PercentageInput.tsx"() {
|
|
2711
|
+
"use strict";
|
|
2712
|
+
import_react37 = __toESM(require("react"));
|
|
2713
|
+
import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2714
|
+
PercentageInput = (props) => {
|
|
2715
|
+
const textChangeHandler = (event) => {
|
|
2716
|
+
const rawValue = event.target.value;
|
|
2717
|
+
const numericValue = parseFloat(rawValue);
|
|
2718
|
+
if (rawValue === "" || !isNaN(numericValue) && numericValue >= 0) {
|
|
2719
|
+
if (props.callback !== void 0) {
|
|
2720
|
+
props.callback({
|
|
2721
|
+
name: props.name,
|
|
2722
|
+
value: rawValue,
|
|
2723
|
+
index: props.index,
|
|
2724
|
+
groupKey: props.groupKey
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
const handleWheel = (event) => {
|
|
2730
|
+
event.preventDefault();
|
|
2731
|
+
event.target.blur();
|
|
2732
|
+
};
|
|
2733
|
+
let value;
|
|
2734
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2735
|
+
value = props.value;
|
|
2736
|
+
}
|
|
2737
|
+
const preventNegative = (e) => {
|
|
2738
|
+
if (e.key === "-") {
|
|
2739
|
+
e.preventDefault();
|
|
2740
|
+
}
|
|
2741
|
+
};
|
|
2742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react37.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("label", { className: "block mb-1", children: [
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label ? props?.attributes?.label + " %" : "" }),
|
|
2744
|
+
" ",
|
|
2745
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2746
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2747
|
+
"input",
|
|
2748
|
+
{
|
|
2749
|
+
type: "number",
|
|
2750
|
+
name: props.name,
|
|
2751
|
+
id: props.name,
|
|
2752
|
+
value,
|
|
2753
|
+
min: 0,
|
|
2754
|
+
onChange: textChangeHandler,
|
|
2755
|
+
onKeyDown: preventNegative,
|
|
2756
|
+
onWheel: handleWheel,
|
|
2757
|
+
required: props?.attributes?.required,
|
|
2758
|
+
placeholder: props?.attributes?.placeholder,
|
|
2759
|
+
pattern: props?.attributes?.pattern,
|
|
2760
|
+
disabled: props?.attributes?.readOnly,
|
|
2761
|
+
max: "100",
|
|
2762
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm number-input"
|
|
2763
|
+
}
|
|
2764
|
+
),
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2766
|
+
] }) });
|
|
2767
|
+
};
|
|
2768
|
+
PercentageInput_default = PercentageInput;
|
|
2769
|
+
}
|
|
2770
|
+
});
|
|
2771
|
+
|
|
2772
|
+
// src/components/controls/edit/PhoneInput.tsx
|
|
2773
|
+
var import_react38, import_jsx_runtime59, PhoneInput, PhoneInput_default;
|
|
2774
|
+
var init_PhoneInput = __esm({
|
|
2775
|
+
"src/components/controls/edit/PhoneInput.tsx"() {
|
|
2776
|
+
"use strict";
|
|
2777
|
+
import_react38 = __toESM(require("react"));
|
|
2778
|
+
import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2779
|
+
PhoneInput = (props) => {
|
|
2780
|
+
const textChangeHandler = (event) => {
|
|
2781
|
+
const text = event.target.value;
|
|
2782
|
+
if (props.callback !== void 0) {
|
|
2783
|
+
props.callback(
|
|
2784
|
+
{
|
|
2785
|
+
name: props.name,
|
|
2786
|
+
value: text,
|
|
2787
|
+
index: props.index,
|
|
2788
|
+
groupKey: props.groupKey
|
|
2789
|
+
}
|
|
2790
|
+
);
|
|
2791
|
+
}
|
|
2792
|
+
};
|
|
2793
|
+
let value = "";
|
|
2794
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2795
|
+
value = props.value;
|
|
2796
|
+
}
|
|
2797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react38.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "block mb-1", children: [
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
2799
|
+
" ",
|
|
2800
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2801
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center rounded border ", children: [
|
|
2802
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "px-3", children: props.prefix }),
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2804
|
+
"input",
|
|
2805
|
+
{
|
|
2806
|
+
type: "text",
|
|
2807
|
+
name: props.name,
|
|
2808
|
+
id: props.name,
|
|
2809
|
+
value,
|
|
2810
|
+
onChange: textChangeHandler,
|
|
2811
|
+
required: props?.attributes?.required,
|
|
2812
|
+
placeholder: props?.attributes?.placeholder,
|
|
2813
|
+
maxLength: props?.attributes?.maxLength,
|
|
2814
|
+
pattern: props?.attributes?.pattern,
|
|
2815
|
+
disabled: props?.attributes?.readOnly,
|
|
2816
|
+
minLength: props?.attributes?.minLength,
|
|
2817
|
+
className: "py-1.5 block w-full outline-none border-0 mr-0.5"
|
|
2818
|
+
}
|
|
2819
|
+
)
|
|
2820
|
+
] }),
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2822
|
+
] }) });
|
|
2823
|
+
};
|
|
2824
|
+
PhoneInput_default = PhoneInput;
|
|
2825
|
+
}
|
|
2826
|
+
});
|
|
2827
|
+
|
|
2828
|
+
// src/components/controls/edit/NumberInput.tsx
|
|
2829
|
+
var import_react39, import_jsx_runtime60, NumberInput, NumberInput_default;
|
|
2830
|
+
var init_NumberInput = __esm({
|
|
2831
|
+
"src/components/controls/edit/NumberInput.tsx"() {
|
|
2832
|
+
"use strict";
|
|
2833
|
+
import_react39 = __toESM(require("react"));
|
|
2834
|
+
import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2835
|
+
NumberInput = (props) => {
|
|
2836
|
+
const textChangeHandler = (event) => {
|
|
2837
|
+
const text = event.target.value;
|
|
2838
|
+
if (props.callback !== void 0) {
|
|
2839
|
+
props.callback(
|
|
2840
|
+
{
|
|
2841
|
+
name: props.name,
|
|
2842
|
+
value: text,
|
|
2843
|
+
index: props.index,
|
|
2844
|
+
groupKey: props.groupKey
|
|
2845
|
+
}
|
|
2846
|
+
);
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
const handleWheel = (event) => {
|
|
2850
|
+
event.preventDefault();
|
|
2851
|
+
event.target.blur();
|
|
2852
|
+
};
|
|
2853
|
+
let value;
|
|
2854
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2855
|
+
value = props.value;
|
|
2856
|
+
}
|
|
2857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react39.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("label", { className: "block", children: [
|
|
2858
|
+
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
|
|
2859
|
+
" ",
|
|
2860
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
2862
|
+
"input",
|
|
2863
|
+
{
|
|
2864
|
+
type: "number",
|
|
2865
|
+
name: props.name,
|
|
2866
|
+
id: props.name,
|
|
2867
|
+
value,
|
|
2868
|
+
onChange: textChangeHandler,
|
|
2869
|
+
onWheel: handleWheel,
|
|
2870
|
+
required: props?.attributes?.required,
|
|
2871
|
+
placeholder: props?.attributes?.placeholder,
|
|
2872
|
+
onBlur: props?.onBlur,
|
|
2873
|
+
pattern: props?.attributes?.pattern,
|
|
2874
|
+
disabled: props?.attributes?.readOnly,
|
|
2875
|
+
max: props?.attributes?.maxValue,
|
|
2876
|
+
min: props?.attributes?.minValue,
|
|
2877
|
+
className: "peer py-1.5 block w-full rounded shadow-sm number-input input\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
2878
|
+
}
|
|
2879
|
+
),
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2881
|
+
] }) });
|
|
2882
|
+
};
|
|
2883
|
+
NumberInput_default = NumberInput;
|
|
2884
|
+
}
|
|
2885
|
+
});
|
|
2886
|
+
|
|
2887
|
+
// src/components/controls/edit/CheckboxInput.tsx
|
|
2888
|
+
var import_react40, import_jsx_runtime61, CheckboxInput, CheckboxInput_default;
|
|
2889
|
+
var init_CheckboxInput = __esm({
|
|
2890
|
+
"src/components/controls/edit/CheckboxInput.tsx"() {
|
|
2891
|
+
"use strict";
|
|
2892
|
+
import_react40 = __toESM(require("react"));
|
|
2893
|
+
import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2894
|
+
CheckboxInput = (props) => {
|
|
2895
|
+
const textChangeHandler = (event) => {
|
|
2896
|
+
let text = event.target.checked;
|
|
2897
|
+
if (props.callback !== void 0) {
|
|
2898
|
+
props.callback({
|
|
2899
|
+
name: props.name,
|
|
2900
|
+
value: text,
|
|
2901
|
+
index: props.index,
|
|
2902
|
+
groupKey: props.groupKey
|
|
2903
|
+
});
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
let value = false;
|
|
2907
|
+
if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
|
|
2908
|
+
value = true;
|
|
2909
|
+
}
|
|
2910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_react40.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "mb-1", children: [
|
|
2911
|
+
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
2913
|
+
"label",
|
|
2914
|
+
{
|
|
2915
|
+
htmlFor: props.name,
|
|
2916
|
+
className: "inline-block text-sm font-medium",
|
|
2917
|
+
children: props.attributes.label
|
|
2918
|
+
}
|
|
2919
|
+
),
|
|
2920
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
2921
|
+
] }),
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
2923
|
+
"input",
|
|
2924
|
+
{
|
|
2925
|
+
type: "checkbox",
|
|
2926
|
+
name: props.name,
|
|
2927
|
+
id: props.name,
|
|
2928
|
+
checked: value,
|
|
2929
|
+
onChange: textChangeHandler,
|
|
2930
|
+
required: props?.attributes?.required,
|
|
2931
|
+
placeholder: props?.attributes?.placeholder,
|
|
2932
|
+
maxLength: props?.attributes?.maxLength,
|
|
2933
|
+
pattern: props?.attributes?.pattern,
|
|
2934
|
+
disabled: props?.attributes?.readOnly,
|
|
2935
|
+
minLength: props?.attributes?.minLength,
|
|
2936
|
+
className: "peer mt-1 py-1.5 block rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
2937
|
+
}
|
|
2938
|
+
),
|
|
2939
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
2940
|
+
] }) });
|
|
2941
|
+
};
|
|
2942
|
+
CheckboxInput_default = CheckboxInput;
|
|
2943
|
+
}
|
|
2944
|
+
});
|
|
2945
|
+
|
|
2946
|
+
// src/components/controls/edit/OtpInput.tsx
|
|
2947
|
+
var import_react41, import_jsx_runtime62, OtpInput, OtpInput_default;
|
|
2948
|
+
var init_OtpInput = __esm({
|
|
2949
|
+
"src/components/controls/edit/OtpInput.tsx"() {
|
|
2950
|
+
"use strict";
|
|
2951
|
+
import_react41 = __toESM(require("react"));
|
|
2952
|
+
import_jsx_runtime62 = require("react/jsx-runtime");
|
|
2953
|
+
OtpInput = (props) => {
|
|
2954
|
+
const textChangeHandler = (event) => {
|
|
2955
|
+
const text = event.target.value;
|
|
2956
|
+
if (props.callback !== void 0) {
|
|
2957
|
+
props.callback(
|
|
2958
|
+
{
|
|
2959
|
+
name: props.name,
|
|
2960
|
+
value: text,
|
|
2961
|
+
index: props.index,
|
|
2962
|
+
groupKey: props.groupKey
|
|
2963
|
+
}
|
|
2964
|
+
);
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2967
|
+
const handleWheel = (event) => {
|
|
2968
|
+
event.preventDefault();
|
|
2969
|
+
};
|
|
2970
|
+
let value;
|
|
2971
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
2972
|
+
value = props.value;
|
|
2973
|
+
}
|
|
2974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react41.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("label", { htmlFor: props.name, className: "block mb-1 w-full", children: [
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
2976
|
+
" ",
|
|
2977
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
2978
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2979
|
+
"input",
|
|
2980
|
+
{
|
|
2981
|
+
type: "text",
|
|
2982
|
+
name: props.name,
|
|
2983
|
+
id: props.name,
|
|
2984
|
+
value,
|
|
2985
|
+
onChange: textChangeHandler,
|
|
2986
|
+
autoComplete: "off",
|
|
2987
|
+
required: props?.attributes?.required,
|
|
2988
|
+
placeholder: props?.attributes?.placeholder,
|
|
2989
|
+
maxLength: 4,
|
|
2990
|
+
pattern: props?.attributes?.pattern,
|
|
2991
|
+
disabled: props?.attributes?.readOnly,
|
|
2992
|
+
minLength: props?.attributes?.minLength,
|
|
2993
|
+
autoFocus: props?.attributes?.autoFocus,
|
|
2994
|
+
onWheel: handleWheel,
|
|
2995
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm tracking-[1.25em] text-center"
|
|
2996
|
+
}
|
|
2997
|
+
),
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
2999
|
+
] }) });
|
|
3000
|
+
};
|
|
3001
|
+
OtpInput_default = OtpInput;
|
|
3002
|
+
}
|
|
3003
|
+
});
|
|
3004
|
+
|
|
3005
|
+
// src/components/controls/edit/DateTimeInput.tsx
|
|
3006
|
+
var import_react42, import_jsx_runtime63, DateTimeInput, DateTimeInput_default;
|
|
3007
|
+
var init_DateTimeInput = __esm({
|
|
3008
|
+
"src/components/controls/edit/DateTimeInput.tsx"() {
|
|
3009
|
+
"use strict";
|
|
3010
|
+
import_react42 = __toESM(require("react"));
|
|
3011
|
+
import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3012
|
+
DateTimeInput = (props) => {
|
|
3013
|
+
const textChangeHandler = (event) => {
|
|
3014
|
+
const localDate = new Date(event.target.value);
|
|
3015
|
+
if (props.callback !== void 0) {
|
|
3016
|
+
const utcISOString = localDate.toISOString();
|
|
3017
|
+
props.callback({
|
|
3018
|
+
name: props.name,
|
|
3019
|
+
value: utcISOString,
|
|
3020
|
+
index: props.index,
|
|
3021
|
+
groupKey: props.groupKey
|
|
3022
|
+
});
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
let value;
|
|
3026
|
+
let localvalue;
|
|
3027
|
+
let timeZoneAbbr;
|
|
3028
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
3029
|
+
value = props.value;
|
|
3030
|
+
const now = /* @__PURE__ */ new Date();
|
|
3031
|
+
const offsetMinutes = now.getTimezoneOffset();
|
|
3032
|
+
const offsetMilliseconds = offsetMinutes * 60 * 1e3;
|
|
3033
|
+
const valDate = value.toString().includes("Z") ? new Date(value) : /* @__PURE__ */ new Date(value + "Z");
|
|
3034
|
+
const localDate = new Date(valDate.getTime() - offsetMilliseconds);
|
|
3035
|
+
timeZoneAbbr = now.toLocaleTimeString("en", { timeZoneName: "short" }).split(" ")[2];
|
|
3036
|
+
localvalue = localDate?.toISOString()?.slice(0, 16);
|
|
3037
|
+
}
|
|
3038
|
+
const handleKeyDown = (e) => {
|
|
3039
|
+
if (e.key === "Backspace") {
|
|
3040
|
+
e.preventDefault();
|
|
3041
|
+
}
|
|
3042
|
+
};
|
|
3043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react42.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("label", { className: "block mb-1", children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
3045
|
+
" ",
|
|
3046
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
3049
|
+
"input",
|
|
3050
|
+
{
|
|
3051
|
+
type: "datetime-local",
|
|
3052
|
+
name: props.name,
|
|
3053
|
+
id: props.name,
|
|
3054
|
+
value: localvalue,
|
|
3055
|
+
onChange: textChangeHandler,
|
|
3056
|
+
onKeyDown: handleKeyDown,
|
|
3057
|
+
required: props?.attributes?.required,
|
|
3058
|
+
placeholder: props?.attributes?.placeholder,
|
|
3059
|
+
maxLength: props?.attributes?.maxLength,
|
|
3060
|
+
pattern: props?.attributes?.pattern,
|
|
3061
|
+
disabled: props?.attributes?.readOnly,
|
|
3062
|
+
minLength: props?.attributes?.minLength,
|
|
3063
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
3064
|
+
}
|
|
3065
|
+
),
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: timeZoneAbbr })
|
|
3067
|
+
] }),
|
|
3068
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
3069
|
+
] }) });
|
|
3070
|
+
};
|
|
3071
|
+
DateTimeInput_default = DateTimeInput;
|
|
3072
|
+
}
|
|
3073
|
+
});
|
|
3074
|
+
|
|
3075
|
+
// src/components/controls/edit/ColorInput.tsx
|
|
3076
|
+
var import_react43, import_jsx_runtime64, ColorInput, ColorInput_default;
|
|
3077
|
+
var init_ColorInput = __esm({
|
|
3078
|
+
"src/components/controls/edit/ColorInput.tsx"() {
|
|
3079
|
+
"use strict";
|
|
3080
|
+
import_react43 = __toESM(require("react"));
|
|
3081
|
+
import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3082
|
+
ColorInput = (props) => {
|
|
3083
|
+
const [color, setColor] = import_react43.default.useState("#3b82f6");
|
|
3084
|
+
(0, import_react43.useEffect)(() => {
|
|
3085
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
3086
|
+
if (typeof props.value === "string") {
|
|
3087
|
+
setColor(props.value);
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
}, [props.value]);
|
|
3091
|
+
const handleColorChange = (event) => {
|
|
3092
|
+
const newColor = event.target.value;
|
|
3093
|
+
setColor(newColor);
|
|
3094
|
+
if (props.callback) {
|
|
3095
|
+
props.callback({
|
|
3096
|
+
name: props.name,
|
|
3097
|
+
value: newColor,
|
|
3098
|
+
index: props.index,
|
|
3099
|
+
groupKey: props.groupKey
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "block mb-1", children: [
|
|
3104
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "text-sm font-medium", children: props?.attributes?.label }),
|
|
3105
|
+
" ",
|
|
3106
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3107
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
3108
|
+
"input",
|
|
3109
|
+
{
|
|
3110
|
+
type: "color",
|
|
3111
|
+
name: props.name,
|
|
3112
|
+
title: color,
|
|
3113
|
+
id: props.name,
|
|
3114
|
+
value: color,
|
|
3115
|
+
onChange: handleColorChange,
|
|
3116
|
+
required: props?.attributes?.required,
|
|
3117
|
+
className: `w-[78px] h-12 block cursor-pointer`
|
|
3118
|
+
}
|
|
3119
|
+
),
|
|
3120
|
+
props?.attributes?.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "mt-1 bg-error-weak text-sm", children: props.attributes.errorMessage })
|
|
3121
|
+
] });
|
|
3122
|
+
};
|
|
3123
|
+
ColorInput_default = ColorInput;
|
|
3124
|
+
}
|
|
3125
|
+
});
|
|
3126
|
+
|
|
3127
|
+
// src/components/controls/edit/SelectWithSearchInput.tsx
|
|
3128
|
+
var import_react44, import_jsx_runtime65, SelectWithSearchInput, SelectWithSearchInput_default;
|
|
3129
|
+
var init_SelectWithSearchInput = __esm({
|
|
3130
|
+
"src/components/controls/edit/SelectWithSearchInput.tsx"() {
|
|
3131
|
+
"use strict";
|
|
3132
|
+
"use client";
|
|
3133
|
+
import_react44 = __toESM(require("react"));
|
|
3134
|
+
import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3135
|
+
SelectWithSearchInput = (props) => {
|
|
3136
|
+
const [isOpen, setIsOpen] = (0, import_react44.useState)(false);
|
|
3137
|
+
const [searchTerm, setSearchTerm] = (0, import_react44.useState)("");
|
|
3138
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react44.useState)(-1);
|
|
3139
|
+
const [selectedItem, setSelectedItem] = (0, import_react44.useState)(
|
|
3140
|
+
null
|
|
3141
|
+
);
|
|
3142
|
+
const [list, setList] = (0, import_react44.useState)([]);
|
|
3143
|
+
const loadData = import_react44.default.useCallback(async () => {
|
|
3144
|
+
if (props.dataset) {
|
|
3145
|
+
setList(props.dataset);
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3148
|
+
if (props.dataSource && props.serviceClient) {
|
|
3149
|
+
let url = props.dataSource;
|
|
3150
|
+
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
3151
|
+
url = url.replace(
|
|
3152
|
+
`{${props.dataSourceDependsOn}}`,
|
|
3153
|
+
props.dependentValue
|
|
3154
|
+
);
|
|
3155
|
+
}
|
|
3156
|
+
const response = await props.serviceClient.get(url);
|
|
3157
|
+
if (response?.result) {
|
|
3158
|
+
setList(response.result);
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
}, [
|
|
3162
|
+
props.dataset,
|
|
3163
|
+
props.dataSource,
|
|
3164
|
+
props.serviceClient,
|
|
3165
|
+
props.dataSourceDependsOn,
|
|
3166
|
+
props.dependentValue
|
|
3167
|
+
]);
|
|
3168
|
+
(0, import_react44.useEffect)(() => {
|
|
3169
|
+
loadData();
|
|
3170
|
+
}, [loadData]);
|
|
3171
|
+
(0, import_react44.useEffect)(() => {
|
|
3172
|
+
if (props.value && list.length && props.dataKeyFieldName && props.dataTextFieldName) {
|
|
3173
|
+
const selected = list.find(
|
|
3174
|
+
(x) => x[props.dataKeyFieldName] == props.value
|
|
3175
|
+
);
|
|
3176
|
+
if (selected) {
|
|
3177
|
+
setSearchTerm(selected[props.dataTextFieldName]);
|
|
3178
|
+
setSelectedItem(selected);
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
}, [props.value, list]);
|
|
3182
|
+
const filteredItems = list.filter((item) => {
|
|
3183
|
+
const text = item[props.dataTextFieldName] ?? "";
|
|
3184
|
+
return text.toString().toLowerCase().includes(searchTerm.toLowerCase());
|
|
3185
|
+
});
|
|
3186
|
+
const handleSelect = (event, item) => {
|
|
3187
|
+
event.preventDefault();
|
|
3188
|
+
setSearchTerm(item[props.dataTextFieldName]);
|
|
3189
|
+
setSelectedItem(item);
|
|
3190
|
+
setIsOpen(false);
|
|
3191
|
+
setHighlightedIndex(-1);
|
|
3192
|
+
const selectedValue = item[props.dataKeyFieldName];
|
|
3193
|
+
if (props.onChange) {
|
|
3194
|
+
props.onChange(selectedValue);
|
|
3195
|
+
}
|
|
3196
|
+
if (props.callback) {
|
|
3197
|
+
props.callback({
|
|
3198
|
+
name: props.name,
|
|
3199
|
+
value: selectedValue,
|
|
3200
|
+
index: props.index,
|
|
3201
|
+
groupKey: props.groupKey
|
|
3202
|
+
});
|
|
3203
|
+
}
|
|
3204
|
+
};
|
|
3205
|
+
const handleKeyDown = (e) => {
|
|
3206
|
+
if (e.key === "ArrowDown") {
|
|
3207
|
+
setHighlightedIndex(
|
|
3208
|
+
(prev) => prev < filteredItems.length - 1 ? prev + 1 : 0
|
|
3209
|
+
);
|
|
3210
|
+
} else if (e.key === "ArrowUp") {
|
|
3211
|
+
setHighlightedIndex(
|
|
3212
|
+
(prev) => prev > 0 ? prev - 1 : filteredItems.length - 1
|
|
3213
|
+
);
|
|
3214
|
+
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
|
3215
|
+
handleSelect(e, filteredItems[highlightedIndex]);
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
const dropdownRef = (0, import_react44.useRef)(null);
|
|
3219
|
+
(0, import_react44.useEffect)(() => {
|
|
3220
|
+
if (highlightedIndex >= 0 && dropdownRef.current) {
|
|
3221
|
+
const highlightedItem = dropdownRef.current.children[highlightedIndex];
|
|
3222
|
+
highlightedItem?.scrollIntoView({
|
|
3223
|
+
behavior: "smooth",
|
|
3224
|
+
block: "nearest"
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
}, [highlightedIndex]);
|
|
3228
|
+
const isReadOnly = props.attributes?.readOnly || props.disable || props.attributes?.disable;
|
|
3229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative", children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "pb-1", children: [
|
|
3231
|
+
props.attributes?.label,
|
|
3232
|
+
" ",
|
|
3233
|
+
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
3234
|
+
] }),
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative", children: [
|
|
3236
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3237
|
+
"input",
|
|
3238
|
+
{
|
|
3239
|
+
type: "text",
|
|
3240
|
+
value: searchTerm,
|
|
3241
|
+
onChange: (e) => {
|
|
3242
|
+
setSearchTerm(e.target.value);
|
|
3243
|
+
setIsOpen(true);
|
|
3244
|
+
setHighlightedIndex(-1);
|
|
3245
|
+
},
|
|
3246
|
+
onFocus: () => setIsOpen(true),
|
|
3247
|
+
onKeyDown: handleKeyDown,
|
|
3248
|
+
placeholder: props.attributes?.placeholder ?? "Search...",
|
|
3249
|
+
readOnly: isReadOnly,
|
|
3250
|
+
disabled: props.disable || props.attributes?.disable,
|
|
3251
|
+
className: `peer mt-2 py-1.5 select block w-full text-black rounded border-gray-300 shadow-sm
|
|
3252
|
+
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
3253
|
+
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none
|
|
3254
|
+
${isReadOnly ? "bg-neutral-soft opacity-50 cursor-not-allowed" : "bg-default"}
|
|
3255
|
+
`
|
|
3256
|
+
}
|
|
3257
|
+
),
|
|
3258
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3259
|
+
"button",
|
|
3260
|
+
{
|
|
3261
|
+
type: "button",
|
|
3262
|
+
disabled: isReadOnly,
|
|
3263
|
+
onClick: () => {
|
|
3264
|
+
if (!isReadOnly) {
|
|
3265
|
+
setIsOpen(!isOpen);
|
|
3266
|
+
}
|
|
3267
|
+
},
|
|
3268
|
+
className: "absolute right-2 top-3 h-5 w-5 text-gray-500 focus:outline-none",
|
|
3269
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3270
|
+
"svg",
|
|
3271
|
+
{
|
|
3272
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3273
|
+
fill: "none",
|
|
3274
|
+
viewBox: "0 0 24 24",
|
|
3275
|
+
strokeWidth: 1.5,
|
|
3276
|
+
stroke: "currentColor",
|
|
3277
|
+
className: "w-full h-full",
|
|
3278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3279
|
+
"path",
|
|
3280
|
+
{
|
|
3281
|
+
strokeLinecap: "round",
|
|
3282
|
+
strokeLinejoin: "round",
|
|
3283
|
+
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
3284
|
+
}
|
|
3285
|
+
)
|
|
3286
|
+
}
|
|
3287
|
+
)
|
|
3288
|
+
}
|
|
3289
|
+
)
|
|
3290
|
+
] }),
|
|
3291
|
+
!isReadOnly && isOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3292
|
+
"div",
|
|
3293
|
+
{
|
|
3294
|
+
ref: dropdownRef,
|
|
3295
|
+
className: "absolute z-10 w-full bg-default border border-gray-200 shadow-lg max-h-48 overflow-y-auto",
|
|
3296
|
+
children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
3297
|
+
"button",
|
|
3298
|
+
{
|
|
3299
|
+
onClick: (e) => handleSelect(e, item),
|
|
3300
|
+
className: `w-full px-4 py-2 flex items-center space-x-2 text-left ${index === highlightedIndex ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
3301
|
+
role: "option",
|
|
3302
|
+
tabIndex: -1,
|
|
3303
|
+
onMouseEnter: () => setHighlightedIndex(index),
|
|
3304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: item[props.dataTextFieldName] })
|
|
3305
|
+
},
|
|
3306
|
+
item[props.dataKeyFieldName]
|
|
3307
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
|
|
3308
|
+
}
|
|
3309
|
+
)
|
|
3310
|
+
] });
|
|
3311
|
+
};
|
|
3312
|
+
SelectWithSearchInput_default = SelectWithSearchInput;
|
|
3313
|
+
}
|
|
3314
|
+
});
|
|
3315
|
+
|
|
3316
|
+
// src/components/controls/edit/SelectWithSearchPanel.tsx
|
|
3317
|
+
var import_react45, import_jsx_runtime66, SelectWithSearchPanel, SelectWithSearchPanel_default;
|
|
3318
|
+
var init_SelectWithSearchPanel = __esm({
|
|
3319
|
+
"src/components/controls/edit/SelectWithSearchPanel.tsx"() {
|
|
3320
|
+
"use strict";
|
|
3321
|
+
"use client";
|
|
3322
|
+
init_Button();
|
|
3323
|
+
import_react45 = __toESM(require("react"));
|
|
3324
|
+
import_jsx_runtime66 = require("react/jsx-runtime");
|
|
3325
|
+
SelectWithSearchPanel = (props) => {
|
|
3326
|
+
const [isOpen, setIsOpen] = (0, import_react45.useState)(false);
|
|
3327
|
+
const [searchTerm, setSearchTerm] = (0, import_react45.useState)("");
|
|
3328
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react45.useState)(0);
|
|
3329
|
+
const [list, setList] = (0, import_react45.useState)([]);
|
|
3330
|
+
const listRef = (0, import_react45.useRef)(null);
|
|
3331
|
+
const [isError, setIsError] = (0, import_react45.useState)(false);
|
|
3332
|
+
const containerRef = (0, import_react45.useRef)(null);
|
|
3333
|
+
const [isCreateOpen, setIsCreateOpen] = (0, import_react45.useState)(false);
|
|
3334
|
+
const [formData, setFormData] = (0, import_react45.useState)({});
|
|
3335
|
+
const getNestedValue7 = (obj, path) => {
|
|
3336
|
+
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
3337
|
+
};
|
|
3338
|
+
(0, import_react45.useEffect)(() => {
|
|
3339
|
+
const handleClickOutside = (event) => {
|
|
3340
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
3341
|
+
setIsOpen(false);
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
3345
|
+
return () => {
|
|
3346
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
3347
|
+
};
|
|
3348
|
+
}, []);
|
|
3349
|
+
(0, import_react45.useEffect)(() => {
|
|
3350
|
+
async function fetchData() {
|
|
3351
|
+
if (props.dataset) {
|
|
3352
|
+
setList(props.dataset);
|
|
3353
|
+
} else if (props.dataSource && props.serviceClient) {
|
|
3354
|
+
let dataSource = props.dataSource;
|
|
3355
|
+
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
3356
|
+
dataSource = dataSource.replace(
|
|
3357
|
+
`{${props.dataSourceDependsOn}}`,
|
|
3358
|
+
props.dependentValue
|
|
3359
|
+
);
|
|
3360
|
+
}
|
|
3361
|
+
const response = await props.serviceClient.get(dataSource);
|
|
3362
|
+
if (response?.result) setList(response.result);
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
fetchData();
|
|
3366
|
+
}, [
|
|
3367
|
+
props.dataSource,
|
|
3368
|
+
props.dependentValue,
|
|
3369
|
+
props.dataset,
|
|
3370
|
+
props.dataSourceDependsOn
|
|
3371
|
+
]);
|
|
3372
|
+
const filteredItems = list?.filter((item) => {
|
|
3373
|
+
const value = getNestedValue7(item, props.dataTextFieldName);
|
|
3374
|
+
return value?.toLowerCase().includes(searchTerm?.toLowerCase());
|
|
3375
|
+
});
|
|
3376
|
+
const playBeep = () => {
|
|
3377
|
+
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
3378
|
+
const oscillator = audioCtx.createOscillator();
|
|
3379
|
+
const gainNode = audioCtx.createGain();
|
|
3380
|
+
oscillator.type = "square";
|
|
3381
|
+
oscillator.frequency.setValueAtTime(300, audioCtx.currentTime);
|
|
3382
|
+
gainNode.gain.setValueAtTime(0.02, audioCtx.currentTime);
|
|
3383
|
+
oscillator.connect(gainNode);
|
|
3384
|
+
gainNode.connect(audioCtx.destination);
|
|
3385
|
+
oscillator.start();
|
|
3386
|
+
setTimeout(() => {
|
|
3387
|
+
oscillator.stop();
|
|
3388
|
+
audioCtx.close();
|
|
3389
|
+
}, 250);
|
|
3390
|
+
};
|
|
3391
|
+
(0, import_react45.useEffect)(() => {
|
|
3392
|
+
const filteredItems2 = list?.filter(
|
|
3393
|
+
(item) => item[props?.dataTextFieldName]?.toLowerCase().includes(searchTerm?.toLowerCase())
|
|
3394
|
+
);
|
|
3395
|
+
if (searchTerm.length > 0 && filteredItems2.length === 0) {
|
|
3396
|
+
playBeep();
|
|
3397
|
+
setIsError(true);
|
|
3398
|
+
} else {
|
|
3399
|
+
setIsError(false);
|
|
3400
|
+
}
|
|
3401
|
+
}, [searchTerm]);
|
|
3402
|
+
const handleSelect = (event, item) => {
|
|
3403
|
+
event.preventDefault();
|
|
3404
|
+
setSearchTerm(getNestedValue7(item, props.dataTextFieldName));
|
|
3405
|
+
if (props.callback) {
|
|
3406
|
+
const val = {};
|
|
3407
|
+
props.callback({
|
|
3408
|
+
name: props.name,
|
|
3409
|
+
value: item[props.dataKeyFieldName],
|
|
3410
|
+
index: props.index,
|
|
3411
|
+
groupKey: props.groupKey
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
setHighlightedIndex(0);
|
|
3415
|
+
setIsOpen(false);
|
|
3416
|
+
};
|
|
3417
|
+
const handleKeyDown = (e) => {
|
|
3418
|
+
if (e.key === "Escape") {
|
|
3419
|
+
setIsOpen(false);
|
|
3420
|
+
setHighlightedIndex(-1);
|
|
3421
|
+
} else if (e.key === "ArrowDown") {
|
|
3422
|
+
e.preventDefault();
|
|
3423
|
+
setHighlightedIndex((prev) => {
|
|
3424
|
+
const nextIndex = prev < filteredItems.length - 1 ? prev + 1 : prev;
|
|
3425
|
+
scrollIntoView(nextIndex);
|
|
3426
|
+
return nextIndex;
|
|
3427
|
+
});
|
|
3428
|
+
} else if (e.key === "ArrowUp") {
|
|
3429
|
+
e.preventDefault();
|
|
3430
|
+
setHighlightedIndex((prev) => {
|
|
3431
|
+
const prevIndex = prev > 0 ? prev - 1 : prev;
|
|
3432
|
+
scrollIntoView(prevIndex);
|
|
3433
|
+
return prevIndex;
|
|
3434
|
+
});
|
|
3435
|
+
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
|
3436
|
+
handleSelect(e, filteredItems[highlightedIndex]);
|
|
3437
|
+
}
|
|
3438
|
+
};
|
|
3439
|
+
const scrollIntoView = (index) => {
|
|
3440
|
+
if (listRef.current) {
|
|
3441
|
+
const item = listRef.current.children[index];
|
|
3442
|
+
if (item) {
|
|
3443
|
+
item.scrollIntoView();
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
};
|
|
3447
|
+
const textChangeHandler = (event) => {
|
|
3448
|
+
const newSearchTerm = event.target.value;
|
|
3449
|
+
setSearchTerm(newSearchTerm);
|
|
3450
|
+
setIsOpen(true);
|
|
3451
|
+
setHighlightedIndex(0);
|
|
3452
|
+
};
|
|
3453
|
+
const handleInputChange = (event, field) => {
|
|
3454
|
+
setFormData((prev) => ({ ...prev, [field]: event.target.value }));
|
|
3455
|
+
};
|
|
3456
|
+
const handleSaveModal = (0, import_react45.useCallback)(async () => {
|
|
3457
|
+
console.log("Form Data:", formData);
|
|
3458
|
+
return formData;
|
|
3459
|
+
}, []);
|
|
3460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative", children: [
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("label", { className: "text-sm mb-1 font-medium", children: [
|
|
3462
|
+
props.attributes?.label,
|
|
3463
|
+
" ",
|
|
3464
|
+
" ",
|
|
3465
|
+
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
3466
|
+
] }),
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3468
|
+
"input",
|
|
3469
|
+
{
|
|
3470
|
+
type: "text",
|
|
3471
|
+
value: searchTerm,
|
|
3472
|
+
onChange: textChangeHandler,
|
|
3473
|
+
onFocus: () => setIsOpen(true),
|
|
3474
|
+
onKeyDown: handleKeyDown,
|
|
3475
|
+
placeholder: props.attributes?.placeholder,
|
|
3476
|
+
className: `peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
3477
|
+
${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"}
|
|
3478
|
+
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none`
|
|
3479
|
+
}
|
|
3480
|
+
) }),
|
|
3481
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref: containerRef, children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_react45.default.Fragment, { children: [
|
|
3482
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "fixed z-50 right-0 bg-white top-[62px] w-1/4 border-l border-gray-200", children: [
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex flex-col p-2 bg-accent-950 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("h5", { className: "text-md text-white font-medium", children: [
|
|
3484
|
+
"Select a",
|
|
3485
|
+
" ",
|
|
3486
|
+
props.attributes?.label || props.attributes?.heading
|
|
3487
|
+
] }) }),
|
|
3488
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex justify-end px-4 border-b py-2 border-gray-200 h-10", children: props.createFields && props.createFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3489
|
+
"button",
|
|
3490
|
+
{
|
|
3491
|
+
type: "button",
|
|
3492
|
+
className: "text-primary hover:text-primary-800",
|
|
3493
|
+
onMouseDown: (e) => {
|
|
3494
|
+
e.preventDefault();
|
|
3495
|
+
setIsCreateOpen(true);
|
|
3496
|
+
},
|
|
3497
|
+
children: "Create"
|
|
3498
|
+
}
|
|
3499
|
+
) })
|
|
3500
|
+
] }),
|
|
3501
|
+
isCreateOpen && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "fixed right-0 w-1/4 h-full top-[62px] bg-white shadow-lg border-l border-gray-200 z-50", children: [
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex flex-col p-2 bg-accent-950", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("h5", { className: "text-md font-medium text-white", children: [
|
|
3503
|
+
"Create New ",
|
|
3504
|
+
props.attributes?.label
|
|
3505
|
+
] }) }),
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex justify-end px-4 border-b py-2 border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3507
|
+
"button",
|
|
3508
|
+
{
|
|
3509
|
+
type: "button",
|
|
3510
|
+
onClick: () => setIsCreateOpen(false),
|
|
3511
|
+
className: "text-red-600 hover:text-red-800",
|
|
3512
|
+
children: "Close"
|
|
3513
|
+
}
|
|
3514
|
+
) }),
|
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "p-4", children: [
|
|
3516
|
+
props.createFields?.map((field) => /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "mb-4", children: [
|
|
3517
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("label", { className: "text-sm mb-1 font-medium block", children: field.label }),
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3519
|
+
"input",
|
|
3520
|
+
{
|
|
3521
|
+
type: field.type,
|
|
3522
|
+
value: formData[field.name] || "",
|
|
3523
|
+
onChange: (e) => handleInputChange(e, field.name),
|
|
3524
|
+
placeholder: field.placeholder,
|
|
3525
|
+
required: field.required,
|
|
3526
|
+
disabled: field.disabled,
|
|
3527
|
+
pattern: field.pattern,
|
|
3528
|
+
minLength: field.minLength,
|
|
3529
|
+
maxLength: field.maxLength,
|
|
3530
|
+
className: "peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
|
|
3531
|
+
}
|
|
3532
|
+
)
|
|
3533
|
+
] }, field.name)),
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Button_default, { onClick: async () => {
|
|
3535
|
+
handleSaveModal();
|
|
3536
|
+
return { isSuccessful: true };
|
|
3537
|
+
}, className: "w-full", children: [
|
|
3538
|
+
"Save ",
|
|
3539
|
+
props.attributes?.label
|
|
3540
|
+
] })
|
|
3541
|
+
] })
|
|
3542
|
+
] }),
|
|
3543
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3544
|
+
"div",
|
|
3545
|
+
{
|
|
3546
|
+
ref: listRef,
|
|
3547
|
+
className: "fixed z-10 right-0 mt-[130px] top-0 w-1/4 bg-white border-l border-gray-200 shadow-lg overflow-y-auto",
|
|
3548
|
+
style: { height: "calc(100vh - 130px)" },
|
|
3549
|
+
children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3550
|
+
"button",
|
|
3551
|
+
{
|
|
3552
|
+
onClick: (e) => {
|
|
3553
|
+
handleSelect(e, item);
|
|
3554
|
+
},
|
|
3555
|
+
className: `w-full px-4 py-2 flex items-center space-x-2 text-left border-b border-gray-200 ${index === highlightedIndex ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
3556
|
+
role: "option",
|
|
3557
|
+
tabIndex: -1,
|
|
3558
|
+
onMouseEnter: () => setHighlightedIndex(index),
|
|
3559
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { children: getNestedValue7(item, props.dataTextFieldName) })
|
|
3560
|
+
}
|
|
3561
|
+
) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
|
|
3562
|
+
}
|
|
3563
|
+
)
|
|
3564
|
+
] }) })
|
|
3565
|
+
] });
|
|
3566
|
+
};
|
|
3567
|
+
SelectWithSearchPanel_default = SelectWithSearchPanel;
|
|
3568
|
+
}
|
|
3569
|
+
});
|
|
3570
|
+
|
|
3571
|
+
// src/components/controls/edit/BooleanSelect.tsx
|
|
3572
|
+
var import_react46, import_jsx_runtime67, BooleanSelect, BooleanSelect_default;
|
|
3573
|
+
var init_BooleanSelect = __esm({
|
|
3574
|
+
"src/components/controls/edit/BooleanSelect.tsx"() {
|
|
3575
|
+
"use strict";
|
|
3576
|
+
import_react46 = __toESM(require("react"));
|
|
3577
|
+
import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3578
|
+
BooleanSelect = (props) => {
|
|
3579
|
+
const [list, setList] = (0, import_react46.useState)();
|
|
3580
|
+
const textChangeHandler = (event) => {
|
|
3581
|
+
const text = event.target.value;
|
|
3582
|
+
const boolValue = text?.toLowerCase() === "true" || text === "1";
|
|
3583
|
+
if (props.callback !== void 0) {
|
|
3584
|
+
props.callback({
|
|
3585
|
+
name: props.name,
|
|
3586
|
+
value: boolValue,
|
|
3587
|
+
index: props.index,
|
|
3588
|
+
groupKey: props.groupKey
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3591
|
+
};
|
|
3592
|
+
(0, import_react46.useEffect)(() => {
|
|
3593
|
+
async function fetchData() {
|
|
3594
|
+
console.log("in select");
|
|
3595
|
+
if (props.dataset) {
|
|
3596
|
+
setList(props.dataset);
|
|
3597
|
+
} else if (props.dataSource && props.dataSource != "" && props.serviceClient) {
|
|
3598
|
+
let dataSource = props.dataSource;
|
|
3599
|
+
let response;
|
|
3600
|
+
if (props.dataSourceDependsOn) {
|
|
3601
|
+
if (props.dependentValue) {
|
|
3602
|
+
dataSource = dataSource.replace(
|
|
3603
|
+
`{${props.dataSourceDependsOn}}`,
|
|
3604
|
+
props.dependentValue
|
|
3605
|
+
);
|
|
3606
|
+
response = await props.serviceClient.get(dataSource);
|
|
3607
|
+
setList(response.result);
|
|
3608
|
+
}
|
|
3609
|
+
} else {
|
|
3610
|
+
response = await props.serviceClient.get(dataSource);
|
|
3611
|
+
setList(response.result);
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
fetchData();
|
|
3616
|
+
}, [
|
|
3617
|
+
props.dataSource,
|
|
3618
|
+
props.dependentValue,
|
|
3619
|
+
props.dataset,
|
|
3620
|
+
props.dataSourceDependsOn
|
|
3621
|
+
]);
|
|
3622
|
+
let value;
|
|
3623
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
3624
|
+
value = props.value;
|
|
3625
|
+
}
|
|
3626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react46.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("label", { className: "block", children: [
|
|
3627
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
|
|
3628
|
+
" ",
|
|
3629
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3630
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
3631
|
+
"select",
|
|
3632
|
+
{
|
|
3633
|
+
name: props.name,
|
|
3634
|
+
id: props.name,
|
|
3635
|
+
value,
|
|
3636
|
+
onChange: textChangeHandler,
|
|
3637
|
+
required: props?.attributes?.required,
|
|
3638
|
+
placeholder: props?.attributes?.placeholder,
|
|
3639
|
+
disabled: props?.attributes?.readOnly,
|
|
3640
|
+
className: "peer mt-1 py-1.5 block w-full text-black rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n ",
|
|
3641
|
+
children: [
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { className: "", value: "", children: props.attributes?.placeholder || "Select" }),
|
|
3643
|
+
list && list.map((item, i) => {
|
|
3644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
3645
|
+
"option",
|
|
3646
|
+
{
|
|
3647
|
+
className: "fac-select-option",
|
|
3648
|
+
value: item[props.dataKeyFieldName],
|
|
3649
|
+
children: item[props.dataTextFieldName]
|
|
3650
|
+
},
|
|
3651
|
+
item[props.dataKeyFieldName]
|
|
3652
|
+
);
|
|
3653
|
+
})
|
|
3654
|
+
]
|
|
3655
|
+
}
|
|
3656
|
+
),
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
3658
|
+
] }) });
|
|
3659
|
+
};
|
|
3660
|
+
BooleanSelect_default = BooleanSelect;
|
|
3661
|
+
}
|
|
3662
|
+
});
|
|
3663
|
+
|
|
3664
|
+
// src/components/controls/edit/EmailInput.tsx
|
|
3665
|
+
var import_react47, import_jsx_runtime68, EmailInput, EmailInput_default;
|
|
3666
|
+
var init_EmailInput = __esm({
|
|
3667
|
+
"src/components/controls/edit/EmailInput.tsx"() {
|
|
3668
|
+
"use strict";
|
|
3669
|
+
import_react47 = __toESM(require("react"));
|
|
3670
|
+
import_jsx_runtime68 = require("react/jsx-runtime");
|
|
3671
|
+
EmailInput = (props) => {
|
|
3672
|
+
const textChangeHandler = (event) => {
|
|
3673
|
+
const text = event.target.value;
|
|
3674
|
+
if (text) {
|
|
3675
|
+
const atIndex = text.indexOf("@");
|
|
3676
|
+
const dotIndex = text.indexOf(".", atIndex);
|
|
3677
|
+
if (dotIndex < atIndex || text.length - dotIndex <= 2) {
|
|
3678
|
+
event.target.setCustomValidity("invaild-value");
|
|
3679
|
+
} else {
|
|
3680
|
+
event.target.setCustomValidity("");
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
if (props.callback !== void 0) {
|
|
3684
|
+
props.callback({
|
|
3685
|
+
name: props.name,
|
|
3686
|
+
value: text,
|
|
3687
|
+
index: props.index
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
};
|
|
3691
|
+
let value = "";
|
|
3692
|
+
if (props.value !== void 0 && props.value !== null) {
|
|
3693
|
+
value = props.value;
|
|
3694
|
+
}
|
|
3695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react47.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("label", { className: "block mb-1", children: [
|
|
3696
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "text-sm font-medium text-slate-700", children: props?.attributes?.label }),
|
|
3697
|
+
" ",
|
|
3698
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3699
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
3700
|
+
"input",
|
|
3701
|
+
{
|
|
3702
|
+
type: "email",
|
|
3703
|
+
name: props.name,
|
|
3704
|
+
id: props.name,
|
|
3705
|
+
value,
|
|
3706
|
+
onChange: textChangeHandler,
|
|
3707
|
+
required: props?.attributes?.required,
|
|
3708
|
+
placeholder: props?.attributes?.placeholder,
|
|
3709
|
+
maxLength: props?.attributes?.maxLength,
|
|
3710
|
+
disabled: props?.attributes?.readOnly,
|
|
3711
|
+
minLength: props?.attributes?.minLength,
|
|
3712
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n transition-all duration-500 ease-in-out"
|
|
3713
|
+
}
|
|
3714
|
+
),
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 mb-0 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
3716
|
+
] }) });
|
|
3717
|
+
};
|
|
3718
|
+
EmailInput_default = EmailInput;
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
|
|
3722
|
+
// src/components/controls/edit/TimeInput.tsx
|
|
3723
|
+
var import_react48, import_jsx_runtime69, TimeInput, TimeInput_default;
|
|
3724
|
+
var init_TimeInput = __esm({
|
|
3725
|
+
"src/components/controls/edit/TimeInput.tsx"() {
|
|
3726
|
+
"use strict";
|
|
3727
|
+
"use client";
|
|
3728
|
+
import_react48 = __toESM(require("react"));
|
|
3729
|
+
import_jsx_runtime69 = require("react/jsx-runtime");
|
|
3730
|
+
TimeInput = (props) => {
|
|
3731
|
+
const timeChangeHandler = (event) => {
|
|
3732
|
+
const timeValue = event.target.value;
|
|
3733
|
+
if (props.callback) {
|
|
3734
|
+
props.callback({
|
|
3735
|
+
name: props.name,
|
|
3736
|
+
value: timeValue,
|
|
3737
|
+
index: props.index,
|
|
3738
|
+
groupKey: props.groupKey
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
3741
|
+
};
|
|
3742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react48.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("label", { className: "block mb-1", children: [
|
|
3743
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-sm font-medium", children: props?.attributes?.label }),
|
|
3744
|
+
" ",
|
|
3745
|
+
props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
3746
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
3747
|
+
"input",
|
|
3748
|
+
{
|
|
3749
|
+
type: "time",
|
|
3750
|
+
name: props.name,
|
|
3751
|
+
id: props.name,
|
|
3752
|
+
value: typeof props.value === "boolean" ? "" : props.value ?? "",
|
|
3753
|
+
onChange: timeChangeHandler,
|
|
3754
|
+
required: props?.attributes?.required,
|
|
3755
|
+
disabled: props?.attributes?.readOnly,
|
|
3756
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none"
|
|
3757
|
+
}
|
|
3758
|
+
) }),
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ?? "" })
|
|
3760
|
+
] }) });
|
|
3761
|
+
};
|
|
3762
|
+
TimeInput_default = TimeInput;
|
|
3763
|
+
}
|
|
3764
|
+
});
|
|
3765
|
+
|
|
3766
|
+
// src/components/controls/edit/AssetUpload.tsx
|
|
3767
|
+
var import_react49, import_jsx_runtime70, AssetUpload, AssetUpload_default;
|
|
3768
|
+
var init_AssetUpload = __esm({
|
|
3769
|
+
"src/components/controls/edit/AssetUpload.tsx"() {
|
|
3770
|
+
"use strict";
|
|
3771
|
+
"use client";
|
|
3772
|
+
import_react49 = __toESM(require("react"));
|
|
3773
|
+
init_ClientButton();
|
|
3774
|
+
init_StyleTypes();
|
|
3775
|
+
init_AssetUtility();
|
|
3776
|
+
init_Hyperlink();
|
|
3777
|
+
init_Icon();
|
|
3778
|
+
import_jsx_runtime70 = require("react/jsx-runtime");
|
|
3779
|
+
AssetUpload = (props) => {
|
|
3780
|
+
const isDisabled = props.attributes?.disable ?? false;
|
|
3781
|
+
let allValues = [];
|
|
3782
|
+
if (props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
3783
|
+
try {
|
|
3784
|
+
allValues = JSON.parse(props.value.toString());
|
|
3785
|
+
} catch (error) {
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
const getInitialTab = () => {
|
|
3789
|
+
if (allValues.length > 0) {
|
|
3790
|
+
const asset = allValues[0];
|
|
3791
|
+
if (asset.posterUrl) {
|
|
3792
|
+
return "video";
|
|
3793
|
+
} else if (asset.assetUrl) {
|
|
3794
|
+
return "image";
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
return "image";
|
|
3798
|
+
};
|
|
3799
|
+
const [assetType, setAssetType] = import_react49.default.useState(getInitialTab);
|
|
3800
|
+
(0, import_react49.useEffect)(() => {
|
|
3801
|
+
setAssetType(getInitialTab());
|
|
3802
|
+
}, [props.value]);
|
|
3803
|
+
const assetUploadCallback = (newAsset) => {
|
|
3804
|
+
if (isDisabled) return;
|
|
3805
|
+
let updated = [];
|
|
3806
|
+
updated.push({
|
|
3807
|
+
assetUrl: newAsset.assetUrl,
|
|
3808
|
+
title: newAsset.title,
|
|
3809
|
+
posterUrl: newAsset.posterUrl,
|
|
3810
|
+
intrinsicHeight: newAsset.intrinsicHeight,
|
|
3811
|
+
intrinsicWidth: newAsset.intrinsicWidth
|
|
3812
|
+
});
|
|
3813
|
+
props.callback?.({
|
|
3814
|
+
name: props.name,
|
|
3815
|
+
value: JSON.stringify(updated),
|
|
3816
|
+
index: props.index,
|
|
3817
|
+
groupKey: props.groupKey
|
|
3818
|
+
});
|
|
3819
|
+
};
|
|
3820
|
+
const deleteFile = (index) => {
|
|
3821
|
+
if (isDisabled) return;
|
|
3822
|
+
let existingValue = [];
|
|
3823
|
+
if (props.value) {
|
|
3824
|
+
try {
|
|
3825
|
+
existingValue = JSON.parse(props.value.toString());
|
|
3826
|
+
} catch (error) {
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
if (existingValue.length > index) {
|
|
3830
|
+
existingValue.splice(index, 1);
|
|
3831
|
+
props.callback?.({
|
|
3832
|
+
name: props.name,
|
|
3833
|
+
value: JSON.stringify(existingValue),
|
|
3834
|
+
index: props.index,
|
|
3835
|
+
groupKey: props.groupKey
|
|
3836
|
+
});
|
|
3837
|
+
}
|
|
3838
|
+
};
|
|
3839
|
+
const textChangeHandler = (index, event) => {
|
|
3840
|
+
if (isDisabled) return;
|
|
3841
|
+
let existingValue = [];
|
|
3842
|
+
if (props.value) {
|
|
3843
|
+
try {
|
|
3844
|
+
existingValue = JSON.parse(props.value.toString());
|
|
3845
|
+
} catch (error) {
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
const text = event.target.value;
|
|
3849
|
+
if (existingValue.length > index) {
|
|
3850
|
+
const updatedArray = [...existingValue];
|
|
3851
|
+
updatedArray[index] = { ...updatedArray[index], title: text };
|
|
3852
|
+
props.callback?.({
|
|
3853
|
+
name: props.name,
|
|
3854
|
+
value: JSON.stringify(updatedArray),
|
|
3855
|
+
index: props.index,
|
|
3856
|
+
groupKey: props.groupKey
|
|
3857
|
+
});
|
|
3858
|
+
}
|
|
3859
|
+
};
|
|
3860
|
+
const getAssetType = (asset) => {
|
|
3861
|
+
if (asset.assetUrl?.endsWith(".m3u8") || asset.posterUrl) return "video";
|
|
3862
|
+
return "image";
|
|
3863
|
+
};
|
|
3864
|
+
const shouldShowDetails = () => {
|
|
3865
|
+
if (allValues.length === 0) return false;
|
|
3866
|
+
const asset = allValues[0];
|
|
3867
|
+
if (assetType === "video") {
|
|
3868
|
+
return Boolean(asset.posterUrl && asset.assetUrl && asset.assetUrl.endsWith(".m3u8"));
|
|
3869
|
+
}
|
|
3870
|
+
if (assetType === "image") {
|
|
3871
|
+
return Boolean(asset.assetUrl && !asset.assetUrl.endsWith(".m3u8"));
|
|
3872
|
+
}
|
|
3873
|
+
return false;
|
|
3874
|
+
};
|
|
3875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react49.default.Fragment, { children: [
|
|
3876
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { className: "block mb-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm font-medium", children: props?.attributes?.label }) }),
|
|
3877
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-6 bg-neutral-100 rounded p-2", children: [
|
|
3878
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3879
|
+
ClientButton_default,
|
|
3880
|
+
{
|
|
3881
|
+
className: assetType === "image" ? "px-2 py-1 rounded bg-body-200 scale-95" : "text-neutral-700",
|
|
3882
|
+
ButtonType: "Link" /* Link */,
|
|
3883
|
+
onClick: () => setAssetType("image"),
|
|
3884
|
+
disabled: isDisabled,
|
|
3885
|
+
children: "Image Upload"
|
|
3886
|
+
}
|
|
3887
|
+
),
|
|
3888
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3889
|
+
ClientButton_default,
|
|
3890
|
+
{
|
|
3891
|
+
className: assetType === "video" ? "bg-body-200 px-2 py-1 rounded-md scale-95" : "text-neutral-700",
|
|
3892
|
+
ButtonType: "Link" /* Link */,
|
|
3893
|
+
onClick: () => setAssetType("video"),
|
|
3894
|
+
disabled: isDisabled,
|
|
3895
|
+
children: "Video Upload"
|
|
3896
|
+
}
|
|
3897
|
+
)
|
|
3898
|
+
] }),
|
|
3899
|
+
shouldShowDetails() && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "relative mt-4 rounded-md p-4 border-2 border-dotted border-gray-300 bg-gray-50", children: [
|
|
3900
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "absolute -top-2.5 left-3 bg-primary-600 text-white text-xs px-2 py-0.5 rounded-full", children: getAssetType(allValues[0]) === "video" ? "Video" : "Image" }),
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex flex-col gap-3", children: allValues.map((digitalAsset, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex justify-between items-start gap-5", children: [
|
|
3902
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm w-full", children: [
|
|
3903
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
3904
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-gray-500", children: "Title" }),
|
|
3905
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3906
|
+
"input",
|
|
3907
|
+
{
|
|
3908
|
+
type: "text",
|
|
3909
|
+
value: digitalAsset.title,
|
|
3910
|
+
onChange: (event) => textChangeHandler(index, event),
|
|
3911
|
+
placeholder: "title",
|
|
3912
|
+
disabled: isDisabled,
|
|
3913
|
+
className: "w-full mt-1 py-1.5 block rounded border-gray-300 shadow-sm bg-white\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed"
|
|
3914
|
+
}
|
|
3915
|
+
)
|
|
3916
|
+
] }),
|
|
3917
|
+
digitalAsset.intrinsicWidth && digitalAsset.intrinsicHeight && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-gray-500", children: "Resolution" }),
|
|
3919
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("p", { className: "font-medium text-gray-900 mt-3", children: [
|
|
3920
|
+
digitalAsset.intrinsicWidth,
|
|
3921
|
+
"\xD7",
|
|
3922
|
+
digitalAsset.intrinsicHeight
|
|
3923
|
+
] })
|
|
3924
|
+
] }),
|
|
3925
|
+
(digitalAsset.assetUrl || digitalAsset.posterUrl) && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-gray-500", children: "Image / Poster" }),
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex-shrink-0 flex flex-col gap-3 mt-1", children: [
|
|
3928
|
+
getAssetType(digitalAsset) === "video" && digitalAsset.posterUrl && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3929
|
+
"img",
|
|
3930
|
+
{
|
|
3931
|
+
src: AssetUtility_default.resolveUrl(props.serviceClient?.baseUrl, digitalAsset.posterUrl),
|
|
3932
|
+
alt: digitalAsset.title || "Video poster",
|
|
3933
|
+
className: "w-32 h-auto object-cover rounded border p-1"
|
|
3934
|
+
}
|
|
3935
|
+
),
|
|
3936
|
+
getAssetType(digitalAsset) === "image" && digitalAsset.assetUrl && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3937
|
+
"img",
|
|
3938
|
+
{
|
|
3939
|
+
src: AssetUtility_default.resolveUrl(props.serviceClient?.baseUrl, digitalAsset.assetUrl),
|
|
3940
|
+
alt: digitalAsset.title || "Uploaded image",
|
|
3941
|
+
className: "w-32 h-auto object-cover rounded border p-1"
|
|
3942
|
+
}
|
|
3943
|
+
)
|
|
3944
|
+
] })
|
|
3945
|
+
] }),
|
|
3946
|
+
digitalAsset.assetUrl?.endsWith(".m3u8") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "col-span-2", children: [
|
|
3947
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-gray-500", children: "HLS Link" }),
|
|
3948
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3949
|
+
Hyperlink,
|
|
3950
|
+
{
|
|
3951
|
+
href: digitalAsset.assetUrl,
|
|
3952
|
+
className: "text-primary-600 underline mt-1 break-all",
|
|
3953
|
+
title: digitalAsset.assetUrl,
|
|
3954
|
+
children: digitalAsset.assetUrl
|
|
3955
|
+
}
|
|
3956
|
+
)
|
|
3957
|
+
] })
|
|
3958
|
+
] }),
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3960
|
+
"span",
|
|
3961
|
+
{
|
|
3962
|
+
onClick: () => !isDisabled && deleteFile(index),
|
|
3963
|
+
className: isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
3964
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Icon_default, { className: "w-4 h-4 text-primary", name: "delete" })
|
|
3965
|
+
}
|
|
3966
|
+
)
|
|
3967
|
+
] }, index)) })
|
|
3968
|
+
] })
|
|
3969
|
+
] });
|
|
3970
|
+
};
|
|
3971
|
+
AssetUpload_default = AssetUpload;
|
|
3972
|
+
}
|
|
3973
|
+
});
|
|
3974
|
+
|
|
3975
|
+
// src/components/controls/edit/SwitchInput.tsx
|
|
3976
|
+
var import_react50, import_jsx_runtime71, SwitchInput, SwitchInput_default;
|
|
3977
|
+
var init_SwitchInput = __esm({
|
|
3978
|
+
"src/components/controls/edit/SwitchInput.tsx"() {
|
|
3979
|
+
"use strict";
|
|
3980
|
+
import_react50 = __toESM(require("react"));
|
|
3981
|
+
import_jsx_runtime71 = require("react/jsx-runtime");
|
|
3982
|
+
SwitchInput = (props) => {
|
|
3983
|
+
const textChangeHandler = (event) => {
|
|
3984
|
+
let text = event.target.checked;
|
|
3985
|
+
if (props.callback !== void 0) {
|
|
3986
|
+
props.callback({
|
|
3987
|
+
name: props.name,
|
|
3988
|
+
value: text,
|
|
3989
|
+
index: props.index,
|
|
3990
|
+
groupKey: props.groupKey
|
|
3991
|
+
});
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3994
|
+
let value = false;
|
|
3995
|
+
if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
|
|
3996
|
+
value = true;
|
|
3997
|
+
}
|
|
3998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-start justify-between gap-4 py-3", children: [
|
|
3999
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "min-w-0", children: [
|
|
4000
|
+
props?.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
4001
|
+
"label",
|
|
4002
|
+
{
|
|
4003
|
+
htmlFor: props.name,
|
|
4004
|
+
className: "inline-block text-sm font-semibold text-slate-800",
|
|
4005
|
+
children: [
|
|
4006
|
+
props.attributes.label,
|
|
4007
|
+
props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "bg-error-weak", children: "*" })
|
|
4008
|
+
]
|
|
4009
|
+
}
|
|
4010
|
+
),
|
|
4011
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
4012
|
+
] }),
|
|
4013
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
4014
|
+
"label",
|
|
4015
|
+
{
|
|
4016
|
+
htmlFor: props.name,
|
|
4017
|
+
className: "relative inline-flex shrink-0 cursor-pointer items-center peer-disabled:cursor-not-allowed",
|
|
4018
|
+
children: [
|
|
4019
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4020
|
+
"input",
|
|
4021
|
+
{
|
|
4022
|
+
type: "checkbox",
|
|
4023
|
+
name: props.name,
|
|
4024
|
+
id: props.name,
|
|
4025
|
+
checked: value,
|
|
4026
|
+
onChange: textChangeHandler,
|
|
4027
|
+
required: props?.attributes?.required,
|
|
4028
|
+
disabled: props?.attributes?.readOnly,
|
|
4029
|
+
className: "peer sr-only"
|
|
4030
|
+
}
|
|
4031
|
+
),
|
|
4032
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4033
|
+
"div",
|
|
4034
|
+
{
|
|
4035
|
+
className: "h-6 w-11 rounded-full bg-slate-200 shadow-inner\n transition-colors duration-200 ease-in-out\n peer-checked:bg-blue-600\n peer-focus-visible:ring-2 peer-focus-visible:ring-blue-300 peer-focus-visible:ring-offset-2\n peer-disabled:bg-slate-100"
|
|
4036
|
+
}
|
|
4037
|
+
),
|
|
4038
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4039
|
+
"div",
|
|
4040
|
+
{
|
|
4041
|
+
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"
|
|
4042
|
+
}
|
|
4043
|
+
)
|
|
4044
|
+
]
|
|
4045
|
+
}
|
|
4046
|
+
)
|
|
4047
|
+
] }) });
|
|
4048
|
+
};
|
|
4049
|
+
SwitchInput_default = SwitchInput;
|
|
4050
|
+
}
|
|
4051
|
+
});
|
|
4052
|
+
|
|
4053
|
+
// src/components/utilities/DateTimeUtility.tsx
|
|
4054
|
+
var DateTimeUtility, DateTimeUtility_default;
|
|
4055
|
+
var init_DateTimeUtility = __esm({
|
|
4056
|
+
"src/components/utilities/DateTimeUtility.tsx"() {
|
|
4057
|
+
"use strict";
|
|
4058
|
+
DateTimeUtility = class {
|
|
4059
|
+
constructor() {
|
|
4060
|
+
}
|
|
4061
|
+
static formatDate(date) {
|
|
4062
|
+
if (!date) {
|
|
4063
|
+
throw new Error("Invalid date");
|
|
4064
|
+
}
|
|
4065
|
+
const pad = (num) => num.toString().padStart(2, "0");
|
|
4066
|
+
const year = date.getFullYear();
|
|
4067
|
+
const month = pad(date.getMonth() + 1);
|
|
4068
|
+
const day = pad(date.getDate());
|
|
4069
|
+
const hours = pad(date.getHours());
|
|
4070
|
+
const minutes = pad(date.getMinutes());
|
|
4071
|
+
const seconds = pad(date.getSeconds());
|
|
4072
|
+
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
|
|
4073
|
+
}
|
|
4074
|
+
static getMonthShortNameCustom(month) {
|
|
4075
|
+
const monthNames = [
|
|
4076
|
+
"Jan",
|
|
4077
|
+
"Feb",
|
|
4078
|
+
"Mar",
|
|
4079
|
+
"Apr",
|
|
4080
|
+
"May",
|
|
4081
|
+
"Jun",
|
|
4082
|
+
"Jul",
|
|
4083
|
+
"Aug",
|
|
4084
|
+
"Sep",
|
|
4085
|
+
"Oct",
|
|
4086
|
+
"Nov",
|
|
4087
|
+
"Dec"
|
|
4088
|
+
];
|
|
4089
|
+
if (month < 1 || month > 12) {
|
|
4090
|
+
throw new Error(
|
|
4091
|
+
"Invalid month. Please provide a value between 1 and 12."
|
|
4092
|
+
);
|
|
4093
|
+
}
|
|
4094
|
+
return monthNames[month - 1];
|
|
4095
|
+
}
|
|
4096
|
+
static getCurrentWeekRange() {
|
|
4097
|
+
const today = /* @__PURE__ */ new Date();
|
|
4098
|
+
const day = today.getDay();
|
|
4099
|
+
const diffToMonday = (day === 0 ? -6 : 1) - day;
|
|
4100
|
+
const monday = new Date(today);
|
|
4101
|
+
monday.setDate(today.getDate() + diffToMonday);
|
|
4102
|
+
monday.setHours(0, 0, 0, 0);
|
|
4103
|
+
const sunday = new Date(monday);
|
|
4104
|
+
sunday.setDate(monday.getDate() + 6);
|
|
4105
|
+
sunday.setHours(23, 59, 59, 999);
|
|
4106
|
+
return { start: monday, end: sunday };
|
|
4107
|
+
}
|
|
4108
|
+
static getCurrentMonthRange() {
|
|
4109
|
+
const now = /* @__PURE__ */ new Date();
|
|
4110
|
+
const start = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
4111
|
+
const end = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
|
4112
|
+
return { start, end };
|
|
4113
|
+
}
|
|
4114
|
+
static formatShortDate(date) {
|
|
4115
|
+
const day = date.getDate();
|
|
4116
|
+
const month = this.getMonthShortNameCustom(date.getMonth() + 1);
|
|
4117
|
+
return `${day} ${month}`;
|
|
4118
|
+
}
|
|
4119
|
+
static formatIndianCurrencyShort(value) {
|
|
4120
|
+
if (value >= 1e7) {
|
|
4121
|
+
return `${(value / 1e7).toFixed(2)} Cr`;
|
|
4122
|
+
} else if (value >= 1e5) {
|
|
4123
|
+
return `${(value / 1e5).toFixed(2)} L`;
|
|
4124
|
+
} else if (value >= 1e3) {
|
|
4125
|
+
return `${(value / 1e3).toFixed(2)} K`;
|
|
4126
|
+
} else {
|
|
4127
|
+
return `${value}`;
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
};
|
|
4131
|
+
DateTimeUtility_default = DateTimeUtility;
|
|
4132
|
+
}
|
|
4133
|
+
});
|
|
4134
|
+
|
|
4135
|
+
// src/components/controls/edit/DateInput.tsx
|
|
4136
|
+
var import_react51, import_jsx_runtime72, DateInput, DateInput_default;
|
|
4137
|
+
var init_DateInput = __esm({
|
|
4138
|
+
"src/components/controls/edit/DateInput.tsx"() {
|
|
4139
|
+
"use strict";
|
|
4140
|
+
import_react51 = require("react");
|
|
4141
|
+
init_DateTimeUtility();
|
|
4142
|
+
import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4143
|
+
DateInput = (props) => {
|
|
4144
|
+
const value = (0, import_react51.useMemo)(() => {
|
|
4145
|
+
if (props.value === void 0 || props.value === null || props.value === "") {
|
|
4146
|
+
return "";
|
|
4147
|
+
}
|
|
4148
|
+
try {
|
|
4149
|
+
const rawValue = String(props.value);
|
|
4150
|
+
const utcDate = new Date(rawValue.endsWith("Z") ? rawValue : `${rawValue}Z`);
|
|
4151
|
+
const localDate = new Date(
|
|
4152
|
+
utcDate.getTime() - utcDate.getTimezoneOffset() * 6e4
|
|
4153
|
+
);
|
|
4154
|
+
return localDate.toISOString().slice(0, 10);
|
|
4155
|
+
} catch {
|
|
4156
|
+
return String(props.value);
|
|
4157
|
+
}
|
|
4158
|
+
}, [props.value]);
|
|
4159
|
+
const changeHandler = (event) => {
|
|
4160
|
+
const dateValue = event.target.value;
|
|
4161
|
+
let callbackValue = dateValue;
|
|
4162
|
+
const parsedDate = new Date(dateValue);
|
|
4163
|
+
if (dateValue && !Number.isNaN(parsedDate.getTime())) {
|
|
4164
|
+
const adjustedDate = new Date(
|
|
4165
|
+
parsedDate.getTime() + 2 * parsedDate.getTimezoneOffset() * 6e4
|
|
4166
|
+
);
|
|
4167
|
+
callbackValue = DateTimeUtility_default.formatDate(adjustedDate);
|
|
4168
|
+
}
|
|
4169
|
+
props.callback?.({
|
|
4170
|
+
name: props.name,
|
|
4171
|
+
value: callbackValue,
|
|
4172
|
+
index: props.index,
|
|
4173
|
+
groupKey: props.groupKey
|
|
4174
|
+
});
|
|
4175
|
+
};
|
|
4176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("label", { className: "block mb-1", children: [
|
|
4177
|
+
props.attributes?.label && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "text-sm font-medium", children: props.attributes.label }),
|
|
4178
|
+
" ",
|
|
4179
|
+
props.attributes?.label && props.attributes.required && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "bg-error-weak", children: "*" }),
|
|
4180
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4181
|
+
"input",
|
|
4182
|
+
{
|
|
4183
|
+
type: "date",
|
|
4184
|
+
name: props.name,
|
|
4185
|
+
id: props.name,
|
|
4186
|
+
value,
|
|
4187
|
+
onChange: changeHandler,
|
|
4188
|
+
required: props.attributes?.required,
|
|
4189
|
+
disabled: props.attributes?.readOnly,
|
|
4190
|
+
max: String(props.attributes?.maxValue ?? "9999-12-31"),
|
|
4191
|
+
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
|
|
4192
|
+
}
|
|
4193
|
+
),
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
4195
|
+
] });
|
|
4196
|
+
};
|
|
4197
|
+
DateInput_default = DateInput;
|
|
4198
|
+
}
|
|
4199
|
+
});
|
|
4200
|
+
|
|
4201
|
+
// src/components/controls/edit/RadioInput.tsx
|
|
4202
|
+
var import_react52, import_jsx_runtime73, RadioInput, RadioInput_default;
|
|
4203
|
+
var init_RadioInput = __esm({
|
|
4204
|
+
"src/components/controls/edit/RadioInput.tsx"() {
|
|
4205
|
+
"use strict";
|
|
4206
|
+
import_react52 = require("react");
|
|
4207
|
+
init_Icon();
|
|
4208
|
+
import_jsx_runtime73 = require("react/jsx-runtime");
|
|
4209
|
+
RadioInput = (props) => {
|
|
4210
|
+
const [list, setList] = (0, import_react52.useState)([]);
|
|
4211
|
+
(0, import_react52.useEffect)(() => {
|
|
4212
|
+
async function loadData() {
|
|
4213
|
+
if (props.dataset) {
|
|
4214
|
+
setList(props.dataset);
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4217
|
+
if (!props.dataSource || !props.serviceClient) {
|
|
4218
|
+
setList([]);
|
|
4219
|
+
return;
|
|
4220
|
+
}
|
|
4221
|
+
let dataSource = props.dataSource;
|
|
4222
|
+
if (props.dataSourceDependsOn) {
|
|
4223
|
+
if (!props.dependentValue) {
|
|
4224
|
+
setList([]);
|
|
4225
|
+
return;
|
|
4226
|
+
}
|
|
4227
|
+
dataSource = dataSource.replace(
|
|
4228
|
+
`{${props.dataSourceDependsOn}}`,
|
|
4229
|
+
props.dependentValue
|
|
4230
|
+
);
|
|
4231
|
+
}
|
|
4232
|
+
const response = await props.serviceClient.get(dataSource);
|
|
4233
|
+
setList(response.result ?? []);
|
|
4234
|
+
}
|
|
4235
|
+
loadData();
|
|
4236
|
+
}, [
|
|
4237
|
+
props.dataSource,
|
|
4238
|
+
props.dataSourceDependsOn,
|
|
4239
|
+
props.dataset,
|
|
4240
|
+
props.dependentValue,
|
|
4241
|
+
props.serviceClient
|
|
4242
|
+
]);
|
|
4243
|
+
const changeHandler = (event) => {
|
|
4244
|
+
if (!props.attributes?.readOnly) {
|
|
4245
|
+
props.callback?.({
|
|
4246
|
+
name: props.name,
|
|
4247
|
+
value: event.target.value,
|
|
4248
|
+
index: props.index,
|
|
4249
|
+
groupKey: props.groupKey
|
|
4250
|
+
});
|
|
4251
|
+
}
|
|
4252
|
+
};
|
|
4253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "block", children: [
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "text-sm font-medium", children: props.attributes?.label }),
|
|
4255
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "flex flex-col gap-3", children: list.map((item, index) => {
|
|
4256
|
+
const itemValue = item[props.dataKeyFieldName];
|
|
4257
|
+
const isSelected = String(itemValue) === String(props.value ?? "");
|
|
4258
|
+
const isRecommended = props.dataRecommendedValue !== void 0 && String(itemValue) === String(props.dataRecommendedValue);
|
|
4259
|
+
const resultClassName = isSelected ? isRecommended ? "bg-success" : props.dataRecommendedValue ? "bg-alert" : "border-transparent" : "border-transparent";
|
|
4260
|
+
const iconName = isSelected && props.dataRecommendedValue ? isRecommended ? "checkCircle" : "xCircle" : void 0;
|
|
4261
|
+
const inputId = `${props.name}-${props.index ?? 0}-id-${index}`;
|
|
4262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
4263
|
+
"div",
|
|
4264
|
+
{
|
|
4265
|
+
className: `font-normal flex items-center justify-between gap-4 cursor-pointer border rounded p-2 ${resultClassName}`,
|
|
4266
|
+
children: [
|
|
4267
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex gap-4 items-start", children: [
|
|
4268
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
4269
|
+
"input",
|
|
4270
|
+
{
|
|
4271
|
+
type: "radio",
|
|
4272
|
+
className: "form-radio mt-1.5 focus:outline-none",
|
|
4273
|
+
name: `${props.name}-${props.index ?? 0}`,
|
|
4274
|
+
id: inputId,
|
|
4275
|
+
value: itemValue,
|
|
4276
|
+
checked: isSelected,
|
|
4277
|
+
readOnly: props.attributes?.readOnly,
|
|
4278
|
+
onChange: changeHandler,
|
|
4279
|
+
required: props.attributes?.required
|
|
4280
|
+
}
|
|
4281
|
+
),
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("label", { className: "text-body-950 pr-2", htmlFor: inputId, children: item[props.dataTextFieldName] })
|
|
4283
|
+
] }),
|
|
4284
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon_default, { className: "w-5 h-5 text-success", name: iconName })
|
|
4285
|
+
]
|
|
4286
|
+
},
|
|
4287
|
+
String(itemValue)
|
|
4288
|
+
);
|
|
4289
|
+
}) }),
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
4291
|
+
] });
|
|
4292
|
+
};
|
|
4293
|
+
RadioInput_default = RadioInput;
|
|
4294
|
+
}
|
|
4295
|
+
});
|
|
4296
|
+
|
|
4297
|
+
// src/components/controls/edit/Switcher.tsx
|
|
4298
|
+
var import_react53, import_jsx_runtime74, Switcher, Switcher_default;
|
|
4299
|
+
var init_Switcher = __esm({
|
|
4300
|
+
"src/components/controls/edit/Switcher.tsx"() {
|
|
4301
|
+
"use strict";
|
|
4302
|
+
import_react53 = require("react");
|
|
4303
|
+
import_jsx_runtime74 = require("react/jsx-runtime");
|
|
4304
|
+
Switcher = (props) => {
|
|
4305
|
+
const [list, setList] = (0, import_react53.useState)([]);
|
|
4306
|
+
(0, import_react53.useEffect)(() => {
|
|
4307
|
+
async function loadData() {
|
|
4308
|
+
if (props.dataset) {
|
|
4309
|
+
setList(props.dataset);
|
|
4310
|
+
return;
|
|
4311
|
+
}
|
|
4312
|
+
if (!props.dataSource || !props.serviceClient) {
|
|
4313
|
+
setList([]);
|
|
4314
|
+
return;
|
|
4315
|
+
}
|
|
4316
|
+
let dataSource = props.dataSource;
|
|
4317
|
+
if (props.dataSourceDependsOn) {
|
|
4318
|
+
if (!props.dependentValue) {
|
|
4319
|
+
setList([]);
|
|
4320
|
+
return;
|
|
4321
|
+
}
|
|
4322
|
+
dataSource = dataSource.replace(
|
|
4323
|
+
`{${props.dataSourceDependsOn}}`,
|
|
4324
|
+
props.dependentValue
|
|
4325
|
+
);
|
|
4326
|
+
}
|
|
4327
|
+
const response = await props.serviceClient.get(dataSource);
|
|
4328
|
+
setList(response.result ?? []);
|
|
4329
|
+
}
|
|
4330
|
+
loadData();
|
|
4331
|
+
}, [
|
|
4332
|
+
props.dataSource,
|
|
4333
|
+
props.dataSourceDependsOn,
|
|
4334
|
+
props.dataset,
|
|
4335
|
+
props.dependentValue,
|
|
4336
|
+
props.serviceClient
|
|
4337
|
+
]);
|
|
4338
|
+
const changeHandler = (event) => {
|
|
4339
|
+
props.callback?.({
|
|
4340
|
+
name: props.name,
|
|
4341
|
+
value: event.target.value,
|
|
4342
|
+
index: props.index,
|
|
4343
|
+
groupKey: props.groupKey
|
|
4344
|
+
});
|
|
4345
|
+
};
|
|
4346
|
+
const value = props.value === void 0 || props.value === null ? "" : String(props.value);
|
|
4347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("label", { className: "block mb-1", children: [
|
|
4348
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "text-sm font-medium", children: props.attributes?.label }),
|
|
4349
|
+
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4350
|
+
"input",
|
|
4351
|
+
{
|
|
4352
|
+
type: "text",
|
|
4353
|
+
name: props.name,
|
|
4354
|
+
id: props.name,
|
|
4355
|
+
value,
|
|
4356
|
+
onChange: changeHandler,
|
|
4357
|
+
required: props.attributes?.required,
|
|
4358
|
+
placeholder: props.attributes?.placeholder,
|
|
4359
|
+
disabled: props.attributes?.readOnly,
|
|
4360
|
+
className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
|
|
4361
|
+
}
|
|
4362
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
4363
|
+
"select",
|
|
4364
|
+
{
|
|
4365
|
+
name: props.name,
|
|
4366
|
+
id: props.name,
|
|
4367
|
+
value,
|
|
4368
|
+
onChange: changeHandler,
|
|
4369
|
+
required: props.attributes?.required,
|
|
4370
|
+
disabled: props.attributes?.readOnly,
|
|
4371
|
+
className: `peer select my-1 py-1 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`,
|
|
4372
|
+
children: [
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("option", { value: "", children: props.attributes?.placeholder || "Select" }),
|
|
4374
|
+
list.map((item) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4375
|
+
"option",
|
|
4376
|
+
{
|
|
4377
|
+
value: item[props.dataKeyFieldName],
|
|
4378
|
+
children: item[props.dataTextFieldName]
|
|
4379
|
+
},
|
|
4380
|
+
String(item[props.dataKeyFieldName])
|
|
4381
|
+
))
|
|
4382
|
+
]
|
|
4383
|
+
}
|
|
4384
|
+
),
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
|
|
4386
|
+
] });
|
|
4387
|
+
};
|
|
4388
|
+
Switcher_default = Switcher;
|
|
4389
|
+
}
|
|
4390
|
+
});
|
|
4391
|
+
|
|
4392
|
+
// src/components/controls/edit/ReferenceInput.tsx
|
|
4393
|
+
var import_jsx_runtime75, ReferenceInput, ReferenceInput_default;
|
|
4394
|
+
var init_ReferenceInput = __esm({
|
|
4395
|
+
"src/components/controls/edit/ReferenceInput.tsx"() {
|
|
4396
|
+
"use strict";
|
|
4397
|
+
init_SelectWithSearchInput();
|
|
4398
|
+
import_jsx_runtime75 = require("react/jsx-runtime");
|
|
4399
|
+
ReferenceInput = (props) => {
|
|
4400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(SelectWithSearchInput_default, { ...props });
|
|
4401
|
+
};
|
|
4402
|
+
ReferenceInput_default = ReferenceInput;
|
|
4403
|
+
}
|
|
4404
|
+
});
|
|
4405
|
+
|
|
4406
|
+
// src/components/controls/edit/InputControlClient.tsx
|
|
4407
|
+
var InputControlClient_exports = {};
|
|
4408
|
+
__export(InputControlClient_exports, {
|
|
4409
|
+
default: () => InputControlClient_default
|
|
4410
|
+
});
|
|
4411
|
+
var import_react54, import_jsx_runtime76, InputControl, InputControlClient_default;
|
|
4412
|
+
var init_InputControlClient = __esm({
|
|
4413
|
+
"src/components/controls/edit/InputControlClient.tsx"() {
|
|
4414
|
+
"use strict";
|
|
4415
|
+
"use client";
|
|
4416
|
+
import_react54 = __toESM(require("react"));
|
|
4417
|
+
init_MultilineTextInput();
|
|
4418
|
+
init_LineTextInput();
|
|
4419
|
+
init_MoneyInput();
|
|
4420
|
+
init_InputControlType();
|
|
4421
|
+
init_Select();
|
|
4422
|
+
init_PercentageInput();
|
|
4423
|
+
init_PhoneInput();
|
|
4424
|
+
init_NumberInput();
|
|
4425
|
+
init_CheckboxInput();
|
|
4426
|
+
init_OtpInput();
|
|
4427
|
+
init_DateTimeInput();
|
|
4428
|
+
init_ColorInput();
|
|
4429
|
+
init_SelectWithSearchInput();
|
|
4430
|
+
init_SelectWithSearchPanel();
|
|
4431
|
+
init_BooleanSelect();
|
|
4432
|
+
init_EmailInput();
|
|
4433
|
+
init_TimeInput();
|
|
4434
|
+
init_AssetUpload();
|
|
4435
|
+
init_SwitchInput();
|
|
4436
|
+
init_DateInput();
|
|
4437
|
+
init_RadioInput();
|
|
4438
|
+
init_Switcher();
|
|
4439
|
+
init_ReferenceInput();
|
|
4440
|
+
import_jsx_runtime76 = require("react/jsx-runtime");
|
|
4441
|
+
InputControl = import_react54.default.forwardRef(
|
|
4442
|
+
(props, ref) => {
|
|
4443
|
+
const ControlComponents = {
|
|
4444
|
+
[InputControlType_default.lineTextInput]: LineTextInput_default,
|
|
4445
|
+
[InputControlType_default.emailInput]: EmailInput_default,
|
|
4446
|
+
[InputControlType_default.multilineTextInput]: MultilineTextInput_default,
|
|
4447
|
+
[InputControlType_default.moneyInput]: MoneyInput_default,
|
|
4448
|
+
[InputControlType_default.select]: Select_default,
|
|
4449
|
+
[InputControlType_default.percentageInput]: PercentageInput_default,
|
|
4450
|
+
[InputControlType_default.phoneInput]: PhoneInput_default,
|
|
4451
|
+
[InputControlType_default.numberInput]: NumberInput_default,
|
|
4452
|
+
[InputControlType_default.checkboxInput]: CheckboxInput_default,
|
|
4453
|
+
[InputControlType_default.otpInput]: OtpInput_default,
|
|
4454
|
+
[InputControlType_default.datetimeInput]: DateTimeInput_default,
|
|
4455
|
+
[InputControlType_default.colorInput]: ColorInput_default,
|
|
4456
|
+
[InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
|
|
4457
|
+
[InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
|
|
4458
|
+
[InputControlType_default.booleanSelect]: BooleanSelect_default,
|
|
4459
|
+
[InputControlType_default.timeInput]: TimeInput_default,
|
|
4460
|
+
[InputControlType_default.asset]: AssetUpload_default,
|
|
4461
|
+
[InputControlType_default.assetUpload]: AssetUpload_default,
|
|
4462
|
+
[InputControlType_default.switchInput]: SwitchInput_default,
|
|
4463
|
+
[InputControlType_default.dateInput]: DateInput_default,
|
|
4464
|
+
[InputControlType_default.radioInput]: RadioInput_default,
|
|
4465
|
+
[InputControlType_default.switcher]: Switcher_default,
|
|
4466
|
+
[InputControlType_default.referenceInput]: ReferenceInput_default
|
|
4467
|
+
};
|
|
4468
|
+
const SelectedControlComponent = ControlComponents[props.controlType];
|
|
4469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_react54.default.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectedControlComponent, { ...props }) : "Control not found:" + props.controlType });
|
|
4470
|
+
}
|
|
4471
|
+
);
|
|
4472
|
+
InputControl.displayName = "InputControl";
|
|
4473
|
+
InputControlClient_default = InputControl;
|
|
4474
|
+
}
|
|
4475
|
+
});
|
|
4476
|
+
|
|
4477
|
+
// src/components/controls/edit/InputControl.tsx
|
|
4478
|
+
var import_dynamic11, InputControl2, InputControl_default;
|
|
4479
|
+
var init_InputControl = __esm({
|
|
4480
|
+
"src/components/controls/edit/InputControl.tsx"() {
|
|
2111
4481
|
"use strict";
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
console.error(`Icon "${name}" not found.`);
|
|
2118
|
-
return null;
|
|
2119
|
-
}
|
|
2120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(IconComponent, { ...props, className });
|
|
2121
|
-
};
|
|
2122
|
-
Icon_default = Icon;
|
|
4482
|
+
import_dynamic11 = __toESM(require("next/dynamic"));
|
|
4483
|
+
InputControl2 = (0, import_dynamic11.default)(() => Promise.resolve().then(() => (init_InputControlClient(), InputControlClient_exports)), {
|
|
4484
|
+
ssr: false
|
|
4485
|
+
});
|
|
4486
|
+
InputControl_default = InputControl2;
|
|
2123
4487
|
}
|
|
2124
4488
|
});
|
|
2125
4489
|
|
|
2126
|
-
// src/components/
|
|
2127
|
-
var
|
|
2128
|
-
__export(
|
|
2129
|
-
default: () =>
|
|
4490
|
+
// src/components/pageRenderingEngine/nodes/DataBindingControls.tsx
|
|
4491
|
+
var DataBindingControls_exports = {};
|
|
4492
|
+
__export(DataBindingControls_exports, {
|
|
4493
|
+
default: () => DataBindingControls_default
|
|
2130
4494
|
});
|
|
2131
|
-
var
|
|
2132
|
-
var
|
|
2133
|
-
"src/components/
|
|
4495
|
+
var import_react55, import_navigation, import_jsx_runtime77, humanize, escapeODataString, normalizeSortOption, DUMMY_FACETS, DUMMY_SORT_OPTIONS, DataBindingControls, DataBindingControls_default;
|
|
4496
|
+
var init_DataBindingControls = __esm({
|
|
4497
|
+
"src/components/pageRenderingEngine/nodes/DataBindingControls.tsx"() {
|
|
2134
4498
|
"use strict";
|
|
2135
4499
|
"use client";
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
init_StyleTypes();
|
|
4500
|
+
import_react55 = require("react");
|
|
4501
|
+
import_navigation = require("next/navigation");
|
|
4502
|
+
init_InputControl();
|
|
2140
4503
|
init_InputControlType();
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
}, [path, query]);
|
|
2150
|
-
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
2151
|
-
const totalItems = dataset?.count || 0;
|
|
2152
|
-
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
2153
|
-
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
2154
|
-
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
2155
|
-
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
2156
|
-
const getPaginationRange = () => {
|
|
2157
|
-
const delta = 1;
|
|
2158
|
-
const range = [];
|
|
2159
|
-
if (totalPages <= 7) {
|
|
2160
|
-
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
2161
|
-
}
|
|
2162
|
-
range.push(1);
|
|
2163
|
-
let start = Math.max(2, activePageNumber - delta);
|
|
2164
|
-
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
2165
|
-
if (activePageNumber - delta <= 2) {
|
|
2166
|
-
end = Math.min(totalPages - 1, 4);
|
|
2167
|
-
}
|
|
2168
|
-
if (activePageNumber + delta >= totalPages - 1) {
|
|
2169
|
-
start = Math.max(2, totalPages - 4);
|
|
2170
|
-
}
|
|
2171
|
-
if (start > 2) {
|
|
2172
|
-
range.push("...");
|
|
2173
|
-
}
|
|
2174
|
-
for (let i = start; i <= end; i++) {
|
|
2175
|
-
range.push(i);
|
|
2176
|
-
}
|
|
2177
|
-
if (end < totalPages - 1) {
|
|
2178
|
-
range.push("...");
|
|
2179
|
-
}
|
|
2180
|
-
if (totalPages > 1) {
|
|
2181
|
-
range.push(totalPages);
|
|
2182
|
-
}
|
|
2183
|
-
return range;
|
|
4504
|
+
import_jsx_runtime77 = require("react/jsx-runtime");
|
|
4505
|
+
humanize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim();
|
|
4506
|
+
escapeODataString = (value) => value.replace(/'/g, "''");
|
|
4507
|
+
normalizeSortOption = (option) => {
|
|
4508
|
+
const direction = option.direction.trim();
|
|
4509
|
+
return {
|
|
4510
|
+
label: option.title || humanize(option.name),
|
|
4511
|
+
value: [option.name, direction].filter(Boolean).join(" ")
|
|
2184
4512
|
};
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
{
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
4513
|
+
};
|
|
4514
|
+
DUMMY_FACETS = {
|
|
4515
|
+
CategoryTitle: [
|
|
4516
|
+
{ value: "Career Readiness", count: 2 },
|
|
4517
|
+
{ value: "Student Learning", count: 2 }
|
|
4518
|
+
],
|
|
4519
|
+
Author: [
|
|
4520
|
+
{ value: "John Smith", count: 2 },
|
|
4521
|
+
{ value: "Sarah Jones", count: 1 },
|
|
4522
|
+
{ value: "Emily Brown", count: 1 }
|
|
4523
|
+
]
|
|
4524
|
+
};
|
|
4525
|
+
DUMMY_SORT_OPTIONS = [
|
|
4526
|
+
{ name: "createdDate", title: "Newest First", direction: "desc" },
|
|
4527
|
+
{ name: "createdDate", title: "Oldest First", direction: "asc" },
|
|
4528
|
+
{ name: "title", title: "Title A-Z", direction: "asc" },
|
|
4529
|
+
{ name: "title", title: "Title Z-A", direction: "desc" }
|
|
4530
|
+
];
|
|
4531
|
+
DataBindingControls = ({
|
|
4532
|
+
path,
|
|
4533
|
+
query,
|
|
4534
|
+
facets,
|
|
4535
|
+
sortOptions,
|
|
4536
|
+
showFacets,
|
|
4537
|
+
showSortOptions,
|
|
4538
|
+
showSearchBar,
|
|
4539
|
+
mode = "toolbar"
|
|
4540
|
+
}) => {
|
|
4541
|
+
const router = (0, import_navigation.useRouter)();
|
|
4542
|
+
const apiFacetGroups = Object.entries(facets ?? {}).filter(
|
|
4543
|
+
([, values]) => Array.isArray(values) && values.length > 0
|
|
2198
4544
|
);
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2201
|
-
|
|
4545
|
+
const facetGroups = apiFacetGroups.length > 0 ? apiFacetGroups : Object.entries(DUMMY_FACETS);
|
|
4546
|
+
const apiSortOptions = (sortOptions ?? []).filter(
|
|
4547
|
+
(option) => option?.name && option?.direction
|
|
4548
|
+
);
|
|
4549
|
+
const resolvedSortOptions = apiSortOptions.length > 0 ? apiSortOptions : DUMMY_SORT_OPTIONS;
|
|
4550
|
+
const normalizedSortOptions = resolvedSortOptions.map(normalizeSortOption).filter((option) => option.value);
|
|
4551
|
+
const currentFilter = query?.["$filter"] ?? query?.filter ?? "";
|
|
4552
|
+
const currentSort = query?.["$orderby"] ?? query?.orderBy ?? "";
|
|
4553
|
+
const currentSearch = query?.searchTerm ?? query?.searchText ?? "";
|
|
4554
|
+
const [searchText, setSearchText] = (0, import_react55.useState)(currentSearch);
|
|
4555
|
+
const lastNavigationUrl = (0, import_react55.useRef)(null);
|
|
4556
|
+
(0, import_react55.useEffect)(() => {
|
|
4557
|
+
setSearchText(currentSearch);
|
|
4558
|
+
}, [currentSearch]);
|
|
4559
|
+
const getQueryUrl = (0, import_react55.useCallback)(
|
|
4560
|
+
(updates) => {
|
|
4561
|
+
const params = new URLSearchParams(query ?? {});
|
|
4562
|
+
Object.entries(updates).forEach(([key, value]) => {
|
|
4563
|
+
if (value) {
|
|
4564
|
+
params.set(key, value);
|
|
4565
|
+
} else {
|
|
4566
|
+
params.delete(key);
|
|
4567
|
+
}
|
|
4568
|
+
});
|
|
4569
|
+
params.delete("$skip");
|
|
4570
|
+
params.delete("skip");
|
|
4571
|
+
const queryString = params.toString();
|
|
4572
|
+
return queryString ? `${path}?${queryString}` : path;
|
|
4573
|
+
},
|
|
4574
|
+
[path, query]
|
|
4575
|
+
);
|
|
4576
|
+
const getFacetUrl = (field, value) => getQueryUrl({
|
|
4577
|
+
$filter: value ? `${field} eq '${escapeODataString(value)}'` : void 0,
|
|
4578
|
+
filter: void 0
|
|
4579
|
+
});
|
|
4580
|
+
const navigateWithoutReload = (0, import_react55.useCallback)(
|
|
4581
|
+
(url) => {
|
|
4582
|
+
if (lastNavigationUrl.current === url) {
|
|
4583
|
+
return;
|
|
4584
|
+
}
|
|
4585
|
+
if (typeof window !== "undefined") {
|
|
4586
|
+
const targetUrl = new URL(url, window.location.origin);
|
|
4587
|
+
if (targetUrl.pathname === window.location.pathname && targetUrl.search === window.location.search) {
|
|
4588
|
+
return;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
lastNavigationUrl.current = url;
|
|
4592
|
+
router.push(url, { scroll: false });
|
|
4593
|
+
},
|
|
4594
|
+
[router]
|
|
4595
|
+
);
|
|
4596
|
+
(0, import_react55.useEffect)(() => {
|
|
4597
|
+
const trimmedSearchText = searchText.trim();
|
|
4598
|
+
if (trimmedSearchText === currentSearch.trim()) {
|
|
4599
|
+
return;
|
|
2202
4600
|
}
|
|
2203
|
-
|
|
2204
|
-
|
|
4601
|
+
const timeout = window.setTimeout(() => {
|
|
4602
|
+
navigateWithoutReload(
|
|
4603
|
+
getQueryUrl({
|
|
4604
|
+
searchTerm: trimmedSearchText || void 0,
|
|
4605
|
+
searchText: void 0
|
|
4606
|
+
})
|
|
4607
|
+
);
|
|
4608
|
+
}, 500);
|
|
4609
|
+
return () => window.clearTimeout(timeout);
|
|
4610
|
+
}, [currentSearch, getQueryUrl, navigateWithoutReload, searchText]);
|
|
4611
|
+
const hasFacetControls = showFacets && facetGroups.length > 0;
|
|
4612
|
+
const hasSortControls = showSortOptions && normalizedSortOptions.length > 0;
|
|
4613
|
+
const shouldShowToolbar = mode === "toolbar" && (showSearchBar || hasSortControls);
|
|
4614
|
+
const shouldShowFacets = mode === "facets" && hasFacetControls;
|
|
4615
|
+
if (!shouldShowToolbar && !shouldShowFacets) {
|
|
4616
|
+
return null;
|
|
4617
|
+
}
|
|
4618
|
+
const renderFacetLinks = (field, values, stacked = false) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: stacked ? "flex flex-col gap-1" : "flex flex-wrap gap-2", children: [
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4620
|
+
"button",
|
|
2205
4621
|
{
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
4622
|
+
type: "button",
|
|
4623
|
+
onClick: () => navigateWithoutReload(getFacetUrl(field)),
|
|
4624
|
+
"aria-pressed": !currentFilter,
|
|
4625
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${currentFilter ? "" : "bg-primary-base font-semibold"}`,
|
|
4626
|
+
children: "All"
|
|
2209
4627
|
}
|
|
2210
|
-
)
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
"-"
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
);
|
|
2249
|
-
}
|
|
2250
|
-
const page = item;
|
|
2251
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PageButton, { page, children: page }, page);
|
|
2252
|
-
}),
|
|
2253
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2254
|
-
NavigationButton,
|
|
4628
|
+
),
|
|
4629
|
+
values.map((facet) => {
|
|
4630
|
+
const filter = `${field} eq '${escapeODataString(facet.value)}'`;
|
|
4631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
4632
|
+
"button",
|
|
4633
|
+
{
|
|
4634
|
+
type: "button",
|
|
4635
|
+
onClick: () => navigateWithoutReload(getFacetUrl(field, facet.value)),
|
|
4636
|
+
"aria-pressed": currentFilter === filter,
|
|
4637
|
+
className: `px-3 py-2 text-left text-sm ${stacked ? "w-full" : "border"} ${currentFilter === filter ? "bg-primary-base font-semibold" : ""}`,
|
|
4638
|
+
children: [
|
|
4639
|
+
facet.value,
|
|
4640
|
+
" (",
|
|
4641
|
+
facet.count,
|
|
4642
|
+
")"
|
|
4643
|
+
]
|
|
4644
|
+
},
|
|
4645
|
+
`${field}-${facet.value}`
|
|
4646
|
+
);
|
|
4647
|
+
})
|
|
4648
|
+
] });
|
|
4649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: mode === "toolbar" ? "mb-6" : "flex flex-col gap-2", children: [
|
|
4650
|
+
shouldShowToolbar && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
4651
|
+
showSearchBar && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "w-full max-w-xl", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4652
|
+
InputControl_default,
|
|
4653
|
+
{
|
|
4654
|
+
name: "searchText",
|
|
4655
|
+
controlType: InputControlType_default.lineTextInput,
|
|
4656
|
+
value: searchText,
|
|
4657
|
+
callback: (updatedValues) => setSearchText(updatedValues.value),
|
|
4658
|
+
attributes: { placeholder: "Search" },
|
|
4659
|
+
inputClasses: "!mt-0"
|
|
4660
|
+
}
|
|
4661
|
+
) }),
|
|
4662
|
+
hasSortControls && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "font-medium", children: "Sort by" }),
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
4665
|
+
InputControl_default,
|
|
2255
4666
|
{
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
4667
|
+
name: "sortOptions",
|
|
4668
|
+
controlType: InputControlType_default.select,
|
|
4669
|
+
value: currentSort,
|
|
4670
|
+
dataset: normalizedSortOptions,
|
|
4671
|
+
dataKeyFieldName: "value",
|
|
4672
|
+
dataTextFieldName: "label",
|
|
4673
|
+
callback: (updatedValues) => navigateWithoutReload(
|
|
4674
|
+
getQueryUrl({
|
|
4675
|
+
$orderby: updatedValues.value || void 0,
|
|
4676
|
+
orderBy: void 0
|
|
4677
|
+
})
|
|
4678
|
+
),
|
|
4679
|
+
attributes: { placeholder: "Default" },
|
|
4680
|
+
inputClasses: "!mt-0 min-w-44"
|
|
2262
4681
|
}
|
|
2263
4682
|
)
|
|
2264
|
-
] }),
|
|
2265
|
-
showJumpToPage && totalPages > 5 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
2266
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "Go to:" }),
|
|
2267
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2268
|
-
"input",
|
|
2269
|
-
{
|
|
2270
|
-
type: "number",
|
|
2271
|
-
min: "1",
|
|
2272
|
-
max: totalPages,
|
|
2273
|
-
defaultValue: activePageNumber,
|
|
2274
|
-
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
2275
|
-
onKeyDown: (e) => {
|
|
2276
|
-
if (e.key === "Enter") {
|
|
2277
|
-
const input = e.target;
|
|
2278
|
-
const page = parseInt(input.value);
|
|
2279
|
-
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
2280
|
-
window.location.href = builder.getNewPageUrl(page);
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
) })
|
|
2286
4683
|
] })
|
|
2287
4684
|
] }),
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
className: `
|
|
2294
|
-
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
2295
|
-
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
2296
|
-
`,
|
|
2297
|
-
href: builder.getNewPageSizeUrl(size),
|
|
2298
|
-
children: size
|
|
2299
|
-
},
|
|
2300
|
-
size
|
|
2301
|
-
)) }),
|
|
2302
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-sm", children: "per page" })
|
|
2303
|
-
] }) })
|
|
4685
|
+
shouldShowFacets && facetGroups.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("nav", { "aria-label": `${humanize(facetGroups[0][0])} filters`, children: renderFacetLinks(facetGroups[0][0], facetGroups[0][1]) }),
|
|
4686
|
+
shouldShowFacets && facetGroups.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "flex flex-col gap-2", children: facetGroups.map(([field, values]) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("details", { className: "border-b", open: true, children: [
|
|
4687
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("summary", { className: "cursor-pointer font-semibold", children: humanize(field) }),
|
|
4688
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "p-2", children: renderFacetLinks(field, values, true) })
|
|
4689
|
+
] }, field)) })
|
|
2304
4690
|
] });
|
|
2305
4691
|
};
|
|
2306
|
-
|
|
4692
|
+
DataBindingControls_default = DataBindingControls;
|
|
2307
4693
|
}
|
|
2308
4694
|
});
|
|
2309
4695
|
|
|
@@ -2312,13 +4698,13 @@ var Slider_exports = {};
|
|
|
2312
4698
|
__export(Slider_exports, {
|
|
2313
4699
|
default: () => Slider_default
|
|
2314
4700
|
});
|
|
2315
|
-
var
|
|
4701
|
+
var import_react56, import_jsx_runtime78, Slider, ArrowButton, ProgressPill, Slider_default;
|
|
2316
4702
|
var init_Slider = __esm({
|
|
2317
4703
|
"src/components/Slider.tsx"() {
|
|
2318
4704
|
"use strict";
|
|
2319
4705
|
"use client";
|
|
2320
|
-
|
|
2321
|
-
|
|
4706
|
+
import_react56 = __toESM(require("react"));
|
|
4707
|
+
import_jsx_runtime78 = require("react/jsx-runtime");
|
|
2322
4708
|
Slider = ({
|
|
2323
4709
|
children,
|
|
2324
4710
|
slidesToShow = 4,
|
|
@@ -2336,13 +4722,13 @@ var init_Slider = __esm({
|
|
|
2336
4722
|
pillStyle = "cumulative",
|
|
2337
4723
|
progressPosition = "bottom"
|
|
2338
4724
|
}) => {
|
|
2339
|
-
const [currentSlide, setCurrentSlide] = (0,
|
|
2340
|
-
const [transition, setTransition] = (0,
|
|
2341
|
-
const [slidesToShowState, setSlidesToShowState] = (0,
|
|
4725
|
+
const [currentSlide, setCurrentSlide] = (0, import_react56.useState)(0);
|
|
4726
|
+
const [transition, setTransition] = (0, import_react56.useState)(true);
|
|
4727
|
+
const [slidesToShowState, setSlidesToShowState] = (0, import_react56.useState)(
|
|
2342
4728
|
typeof slidesToShow === "number" ? slidesToShow : slidesToShow.large
|
|
2343
4729
|
);
|
|
2344
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
2345
|
-
(0,
|
|
4730
|
+
const [isPlaying, setIsPlaying] = (0, import_react56.useState)(autoplay);
|
|
4731
|
+
(0, import_react56.useEffect)(() => {
|
|
2346
4732
|
if (typeof slidesToShow === "number") return;
|
|
2347
4733
|
const handleResize = () => {
|
|
2348
4734
|
if (window.innerWidth >= 1024) {
|
|
@@ -2357,7 +4743,7 @@ var init_Slider = __esm({
|
|
|
2357
4743
|
window.addEventListener("resize", handleResize);
|
|
2358
4744
|
return () => window.removeEventListener("resize", handleResize);
|
|
2359
4745
|
}, [slidesToShow]);
|
|
2360
|
-
(0,
|
|
4746
|
+
(0, import_react56.useEffect)(() => {
|
|
2361
4747
|
if (!autoplay) return;
|
|
2362
4748
|
const timer = setInterval(() => {
|
|
2363
4749
|
if (isPlaying) {
|
|
@@ -2366,7 +4752,7 @@ var init_Slider = __esm({
|
|
|
2366
4752
|
}, autoplay_speed);
|
|
2367
4753
|
return () => clearInterval(timer);
|
|
2368
4754
|
}, [autoplay, autoplay_speed, currentSlide, isPlaying]);
|
|
2369
|
-
const totalSlides =
|
|
4755
|
+
const totalSlides = import_react56.Children.count(children);
|
|
2370
4756
|
const maxSlide = totalSlides - slidesToShowState;
|
|
2371
4757
|
const nextSlide = () => {
|
|
2372
4758
|
if (currentSlide >= maxSlide) {
|
|
@@ -2411,16 +4797,16 @@ var init_Slider = __esm({
|
|
|
2411
4797
|
}
|
|
2412
4798
|
};
|
|
2413
4799
|
const translateX = -currentSlide * (100 / slidesToShowState);
|
|
2414
|
-
const slides =
|
|
2415
|
-
if (!
|
|
4800
|
+
const slides = import_react56.Children.map(children, (child, index) => {
|
|
4801
|
+
if (!import_react56.default.isValidElement(child)) return null;
|
|
2416
4802
|
const childProps = child.props;
|
|
2417
4803
|
const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
|
|
2418
|
-
return /* @__PURE__ */ (0,
|
|
4804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2419
4805
|
"div",
|
|
2420
4806
|
{
|
|
2421
4807
|
className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
|
|
2422
4808
|
style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
|
|
2423
|
-
children: (0,
|
|
4809
|
+
children: (0, import_react56.cloneElement)(child, {
|
|
2424
4810
|
className: mergedClassName
|
|
2425
4811
|
})
|
|
2426
4812
|
},
|
|
@@ -2438,14 +4824,14 @@ var init_Slider = __esm({
|
|
|
2438
4824
|
return "bottom-4";
|
|
2439
4825
|
}
|
|
2440
4826
|
};
|
|
2441
|
-
return /* @__PURE__ */ (0,
|
|
4827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
2442
4828
|
"div",
|
|
2443
4829
|
{
|
|
2444
4830
|
className: `relative w-full overflow-hidden ${className}`,
|
|
2445
4831
|
onMouseEnter: handleMouseEnter,
|
|
2446
4832
|
onMouseLeave: handleMouseLeave,
|
|
2447
4833
|
children: [
|
|
2448
|
-
/* @__PURE__ */ (0,
|
|
4834
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2449
4835
|
"div",
|
|
2450
4836
|
{
|
|
2451
4837
|
className: "flex h-full",
|
|
@@ -2456,18 +4842,18 @@ var init_Slider = __esm({
|
|
|
2456
4842
|
children: slides
|
|
2457
4843
|
}
|
|
2458
4844
|
),
|
|
2459
|
-
show_arrows && /* @__PURE__ */ (0,
|
|
2460
|
-
/* @__PURE__ */ (0,
|
|
4845
|
+
show_arrows && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
4846
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2461
4847
|
ArrowButton,
|
|
2462
4848
|
{
|
|
2463
4849
|
direction: "left",
|
|
2464
4850
|
onClick: prevSlide,
|
|
2465
4851
|
visible: infinite_scroll || currentSlide > 0,
|
|
2466
4852
|
className: arrowClassName,
|
|
2467
|
-
children: /* @__PURE__ */ (0,
|
|
4853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
|
|
2468
4854
|
}
|
|
2469
4855
|
),
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
4856
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
2471
4857
|
ArrowButton,
|
|
2472
4858
|
{
|
|
2473
4859
|
direction: "right",
|
|
@@ -2475,13 +4861,13 @@ var init_Slider = __esm({
|
|
|
2475
4861
|
visible: infinite_scroll || currentSlide < maxSlide,
|
|
2476
4862
|
className: arrowClassName,
|
|
2477
4863
|
children: [
|
|
2478
|
-
/* @__PURE__ */ (0,
|
|
4864
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) }),
|
|
2479
4865
|
" "
|
|
2480
4866
|
]
|
|
2481
4867
|
}
|
|
2482
4868
|
)
|
|
2483
4869
|
] }),
|
|
2484
|
-
show_dots && /* @__PURE__ */ (0,
|
|
4870
|
+
show_dots && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: `absolute left-1/2 -translate-x-1/2 flex justify-center space-x-1.5 ${getProgressPositionClass()}`, children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2485
4871
|
ProgressPill,
|
|
2486
4872
|
{
|
|
2487
4873
|
active: index === currentSlide,
|
|
@@ -2507,7 +4893,7 @@ var init_Slider = __esm({
|
|
|
2507
4893
|
visible,
|
|
2508
4894
|
children,
|
|
2509
4895
|
className = ""
|
|
2510
|
-
}) => /* @__PURE__ */ (0,
|
|
4896
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2511
4897
|
"button",
|
|
2512
4898
|
{
|
|
2513
4899
|
className: `
|
|
@@ -2533,13 +4919,13 @@ var init_Slider = __esm({
|
|
|
2533
4919
|
currentSlide,
|
|
2534
4920
|
totalSlides
|
|
2535
4921
|
}) => {
|
|
2536
|
-
const [progress, setProgress] = (0,
|
|
2537
|
-
(0,
|
|
4922
|
+
const [progress, setProgress] = (0, import_react56.useState)(0);
|
|
4923
|
+
(0, import_react56.useEffect)(() => {
|
|
2538
4924
|
if (active) {
|
|
2539
4925
|
setProgress(0);
|
|
2540
4926
|
}
|
|
2541
4927
|
}, [active, index]);
|
|
2542
|
-
(0,
|
|
4928
|
+
(0, import_react56.useEffect)(() => {
|
|
2543
4929
|
if (!active || !isPlaying) {
|
|
2544
4930
|
if (!active) {
|
|
2545
4931
|
setProgress(0);
|
|
@@ -2594,7 +4980,7 @@ var init_Slider = __esm({
|
|
|
2594
4980
|
const renderProgressBar = () => {
|
|
2595
4981
|
if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
|
|
2596
4982
|
const displayProgress = style === "cumulative" && isFilled ? 100 : progress;
|
|
2597
|
-
return /* @__PURE__ */ (0,
|
|
4983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2598
4984
|
"div",
|
|
2599
4985
|
{
|
|
2600
4986
|
className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
|
|
@@ -2606,7 +4992,7 @@ var init_Slider = __esm({
|
|
|
2606
4992
|
};
|
|
2607
4993
|
const renderCumulativeFill = () => {
|
|
2608
4994
|
if (style === "cumulative" && isFilled && !isActive) {
|
|
2609
|
-
return /* @__PURE__ */ (0,
|
|
4995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
2610
4996
|
"div",
|
|
2611
4997
|
{
|
|
2612
4998
|
className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
|
|
@@ -2616,7 +5002,7 @@ var init_Slider = __esm({
|
|
|
2616
5002
|
}
|
|
2617
5003
|
return null;
|
|
2618
5004
|
};
|
|
2619
|
-
return /* @__PURE__ */ (0,
|
|
5005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
2620
5006
|
"button",
|
|
2621
5007
|
{
|
|
2622
5008
|
className: `${baseClasses} ${getStyleClasses()}`,
|
|
@@ -2644,7 +5030,7 @@ __export(server_exports, {
|
|
|
2644
5030
|
module.exports = __toCommonJS(server_exports);
|
|
2645
5031
|
|
|
2646
5032
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
2647
|
-
var
|
|
5033
|
+
var import_react58 = __toESM(require("react"));
|
|
2648
5034
|
|
|
2649
5035
|
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2650
5036
|
var import_react22 = __toESM(require("react"));
|
|
@@ -2731,32 +5117,13 @@ var LineBreakNode_default = LineBreakNode;
|
|
|
2731
5117
|
// src/components/pageRenderingEngine/nodes/LinkNode.tsx
|
|
2732
5118
|
var import_react6 = __toESM(require("react"));
|
|
2733
5119
|
|
|
2734
|
-
// src/components/utilities/AssetUtility.tsx
|
|
2735
|
-
var AssetUtility = class {
|
|
2736
|
-
constructor() {
|
|
2737
|
-
}
|
|
2738
|
-
static resolveUrl(assetBaseUrl, url) {
|
|
2739
|
-
if (!url) return void 0;
|
|
2740
|
-
if (url.startsWith("http")) return url;
|
|
2741
|
-
if (!assetBaseUrl) return url;
|
|
2742
|
-
return `${assetBaseUrl}/${url}`;
|
|
2743
|
-
}
|
|
2744
|
-
// // static getAssetUrl(apiBaseUrl: string) {
|
|
2745
|
-
// // let domainName = apiBaseUrl.replace("https://", "");
|
|
2746
|
-
// // return `https://cdn.g-assets.com/${domainName}`;
|
|
2747
|
-
// // }
|
|
2748
|
-
// static getAssetFullPath(apiBaseUrl: string, relativePath: string) {
|
|
2749
|
-
// const domainName = apiBaseUrl.replace("https://", "");
|
|
2750
|
-
// return `https://cdn.g-assets.com/${domainName}/${relativePath}`;
|
|
2751
|
-
// }
|
|
2752
|
-
};
|
|
2753
|
-
var AssetUtility_default = AssetUtility;
|
|
2754
|
-
|
|
2755
5120
|
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
5121
|
+
init_AssetUtility();
|
|
2756
5122
|
var import_dynamic2 = __toESM(require("next/dynamic"));
|
|
2757
5123
|
|
|
2758
5124
|
// src/components/DeviceAssetSelector.tsx
|
|
2759
5125
|
var import_dynamic = __toESM(require("next/dynamic"));
|
|
5126
|
+
init_AssetUtility();
|
|
2760
5127
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2761
5128
|
var HlsPlayer2 = (0, import_dynamic.default)(() => Promise.resolve().then(() => (init_HlsPlayer(), HlsPlayer_exports)), { ssr: false });
|
|
2762
5129
|
var FORMAT_CLASSES = {
|
|
@@ -3808,8 +6175,8 @@ var WidgetNode = (props) => {
|
|
|
3808
6175
|
var WidgetNode_default = WidgetNode;
|
|
3809
6176
|
|
|
3810
6177
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
3811
|
-
var
|
|
3812
|
-
var
|
|
6178
|
+
var import_dynamic12 = __toESM(require("next/dynamic"));
|
|
6179
|
+
var import_react57 = __toESM(require("react"));
|
|
3813
6180
|
|
|
3814
6181
|
// src/components/pageRenderingEngine/nodes/EmbedNode.tsx
|
|
3815
6182
|
var import_dynamic8 = __toESM(require("next/dynamic"));
|
|
@@ -3831,6 +6198,7 @@ var EmbedNode = (props) => {
|
|
|
3831
6198
|
var EmbedNode_default = EmbedNode;
|
|
3832
6199
|
|
|
3833
6200
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
6201
|
+
init_AssetUtility();
|
|
3834
6202
|
init_ServiceClient();
|
|
3835
6203
|
|
|
3836
6204
|
// src/components/utilities/AnimationUtility.tsx
|
|
@@ -4054,6 +6422,7 @@ var NoDataFound = () => {
|
|
|
4054
6422
|
var NoDataFound_default = NoDataFound;
|
|
4055
6423
|
|
|
4056
6424
|
// src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
|
|
6425
|
+
init_AssetUtility();
|
|
4057
6426
|
var import_dynamic9 = __toESM(require("next/dynamic"));
|
|
4058
6427
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4059
6428
|
var HlsPlayer4 = (0, import_dynamic9.default)(() => Promise.resolve().then(() => (init_HlsPlayer(), HlsPlayer_exports)), { ssr: false });
|
|
@@ -4450,6 +6819,7 @@ var shouldRenderContainer = (node, dataItem, session) => {
|
|
|
4450
6819
|
};
|
|
4451
6820
|
|
|
4452
6821
|
// src/components/pageRenderingEngine/nodes/DocumentNode.tsx
|
|
6822
|
+
init_AssetUtility();
|
|
4453
6823
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4454
6824
|
var getNestedValue5 = (obj, path) => {
|
|
4455
6825
|
if (!obj || !path) return void 0;
|
|
@@ -4921,9 +7291,12 @@ var GoogleMapNode = (props) => {
|
|
|
4921
7291
|
var GoogleMapNode_default = GoogleMapNode;
|
|
4922
7292
|
|
|
4923
7293
|
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
4924
|
-
var
|
|
4925
|
-
var Pagination2 = (0,
|
|
4926
|
-
var
|
|
7294
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
7295
|
+
var Pagination2 = (0, import_dynamic12.default)(() => Promise.resolve().then(() => (init_Pagination(), Pagination_exports)), { ssr: true });
|
|
7296
|
+
var DataBindingControls2 = (0, import_dynamic12.default)(() => Promise.resolve().then(() => (init_DataBindingControls(), DataBindingControls_exports)), {
|
|
7297
|
+
ssr: true
|
|
7298
|
+
});
|
|
7299
|
+
var Slider2 = (0, import_dynamic12.default)(() => Promise.resolve().then(() => (init_Slider(), Slider_exports)), {
|
|
4927
7300
|
ssr: false
|
|
4928
7301
|
});
|
|
4929
7302
|
function toCamelCase(str) {
|
|
@@ -5177,7 +7550,7 @@ var DivContainer = async (props) => {
|
|
|
5177
7550
|
response = await serviceClient.get(endpoint);
|
|
5178
7551
|
result = response?.result;
|
|
5179
7552
|
if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
|
|
5180
|
-
return /* @__PURE__ */ (0,
|
|
7553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(NoDataFound_default, {});
|
|
5181
7554
|
}
|
|
5182
7555
|
if (dataBindingProperties.childCollectionName && props.dataitem) {
|
|
5183
7556
|
childCollectionData = getNestedValue6(
|
|
@@ -5197,7 +7570,7 @@ var DivContainer = async (props) => {
|
|
|
5197
7570
|
}
|
|
5198
7571
|
const SelectedNode = NodeTypes2[node.type];
|
|
5199
7572
|
if (!SelectedNode) return null;
|
|
5200
|
-
return /* @__PURE__ */ (0,
|
|
7573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react57.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
5201
7574
|
SelectedNode,
|
|
5202
7575
|
{
|
|
5203
7576
|
node,
|
|
@@ -5330,45 +7703,91 @@ var DivContainer = async (props) => {
|
|
|
5330
7703
|
noLinkColor && "no-link-color",
|
|
5331
7704
|
!!props.node.enterAnimation && "enter-animation"
|
|
5332
7705
|
].filter(Boolean).join(" ");
|
|
5333
|
-
|
|
5334
|
-
|
|
7706
|
+
const showDataBindingControls = Boolean(
|
|
7707
|
+
dataBindingProperties?.showFacets || dataBindingProperties?.showSortOptions || dataBindingProperties?.showSearchBar
|
|
7708
|
+
);
|
|
7709
|
+
const WrapperComponent = Wrapper;
|
|
7710
|
+
const renderedContainer = /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
7711
|
+
WrapperComponent,
|
|
7712
|
+
{
|
|
7713
|
+
id: guid,
|
|
7714
|
+
style: combinedStyles,
|
|
7715
|
+
className: classNames || void 0,
|
|
7716
|
+
...wrapperProps,
|
|
7717
|
+
children: dataToRender.map(
|
|
7718
|
+
(item, idx) => item?.links?.view && renderLink ? renderChildren(
|
|
7719
|
+
props.node.children,
|
|
7720
|
+
props,
|
|
7721
|
+
item,
|
|
7722
|
+
idx,
|
|
7723
|
+
props.href ? void 0 : item?.links?.view
|
|
7724
|
+
)?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react57.default.Fragment, { children: child }, i)) : renderChildren(props.node.children, props, item, idx)
|
|
7725
|
+
)
|
|
7726
|
+
}
|
|
7727
|
+
);
|
|
7728
|
+
const paginationControl = dataBindingProperties?.enablePagination ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
7729
|
+
Pagination2,
|
|
7730
|
+
{
|
|
7731
|
+
path: props.path,
|
|
7732
|
+
query: props.query,
|
|
7733
|
+
dataset: response
|
|
7734
|
+
}
|
|
7735
|
+
) : null;
|
|
7736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_react57.default.Fragment, { children: [
|
|
7737
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
5335
7738
|
"style",
|
|
5336
7739
|
{
|
|
5337
7740
|
dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS }
|
|
5338
7741
|
}
|
|
5339
7742
|
),
|
|
5340
|
-
/* @__PURE__ */ (0,
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
7743
|
+
showDataBindingControls ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_react57.default.Fragment, { children: [
|
|
7744
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
7745
|
+
DataBindingControls2,
|
|
7746
|
+
{
|
|
7747
|
+
mode: "toolbar",
|
|
7748
|
+
path: props.path,
|
|
7749
|
+
query: props.query,
|
|
7750
|
+
facets: response?.facets,
|
|
7751
|
+
sortOptions: response?.sortOptions,
|
|
7752
|
+
showSortOptions: dataBindingProperties?.showSortOptions,
|
|
7753
|
+
showSearchBar: dataBindingProperties?.showSearchBar
|
|
7754
|
+
}
|
|
7755
|
+
),
|
|
7756
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
7757
|
+
"div",
|
|
7758
|
+
{
|
|
7759
|
+
className: dataBindingProperties?.showFacets ? "grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]" : void 0,
|
|
7760
|
+
children: [
|
|
7761
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "min-w-0", children: [
|
|
7762
|
+
renderedContainer,
|
|
7763
|
+
paginationControl
|
|
7764
|
+
] }),
|
|
7765
|
+
dataBindingProperties?.showFacets && /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("aside", { className: "border bg-default p-3 lg:sticky lg:top-[90px] lg:self-start", children: [
|
|
7766
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("h2", { className: "mb-2 text-lg font-semibold", children: "Filters" }),
|
|
7767
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
7768
|
+
DataBindingControls2,
|
|
7769
|
+
{
|
|
7770
|
+
mode: "facets",
|
|
7771
|
+
path: props.path,
|
|
7772
|
+
query: props.query,
|
|
7773
|
+
facets: response?.facets,
|
|
7774
|
+
showFacets: dataBindingProperties.showFacets
|
|
7775
|
+
}
|
|
7776
|
+
)
|
|
7777
|
+
] })
|
|
7778
|
+
]
|
|
7779
|
+
}
|
|
7780
|
+
)
|
|
7781
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_react57.default.Fragment, { children: [
|
|
7782
|
+
renderedContainer,
|
|
7783
|
+
paginationControl && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: paginationControl })
|
|
7784
|
+
] })
|
|
5366
7785
|
] });
|
|
5367
7786
|
};
|
|
5368
7787
|
var DivContainer_default = DivContainer;
|
|
5369
7788
|
|
|
5370
7789
|
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
5371
|
-
var
|
|
7790
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5372
7791
|
var NodeTypes = {
|
|
5373
7792
|
["paragraph"]: ParagraphNode_default,
|
|
5374
7793
|
["heading"]: HeadingNode_default,
|
|
@@ -5406,14 +7825,14 @@ var PageBodyRenderer = (props) => {
|
|
|
5406
7825
|
}
|
|
5407
7826
|
return true;
|
|
5408
7827
|
};
|
|
5409
|
-
return /* @__PURE__ */ (0,
|
|
7828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react58.default.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
|
|
5410
7829
|
{
|
|
5411
7830
|
}
|
|
5412
7831
|
const SelectedNode = NodeTypes[node.type];
|
|
5413
7832
|
if (!shouldRenderNode(node)) {
|
|
5414
7833
|
return null;
|
|
5415
7834
|
}
|
|
5416
|
-
return /* @__PURE__ */ (0,
|
|
7835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react58.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react58.default.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react58.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5417
7836
|
SelectedNode,
|
|
5418
7837
|
{
|
|
5419
7838
|
node,
|
|
@@ -5429,7 +7848,7 @@ var PageBodyRenderer = (props) => {
|
|
|
5429
7848
|
device: props.device,
|
|
5430
7849
|
widgetRenderer: props.widgetRenderer
|
|
5431
7850
|
}
|
|
5432
|
-
) }) : /* @__PURE__ */ (0,
|
|
7851
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react58.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5433
7852
|
SelectedNode,
|
|
5434
7853
|
{
|
|
5435
7854
|
node,
|