@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260216102916 → 0.8.1-dev.20260218092649
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +684 -1
- package/dist/index.mjs +683 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
DataList: () => DataList_default,
|
|
33
34
|
InputControl: () => InputControl_default,
|
|
34
35
|
InputControlType: () => InputControlType_default,
|
|
35
36
|
ViewControl: () => ViewControl_default,
|
|
@@ -406,6 +407,9 @@ var MoneyInput = (props) => {
|
|
|
406
407
|
var MoneyInput_default = MoneyInput;
|
|
407
408
|
|
|
408
409
|
// src/components/controls/edit/InputControlType.tsx
|
|
410
|
+
var Constants = {
|
|
411
|
+
pagesize: 10
|
|
412
|
+
};
|
|
409
413
|
var InputControlType = {
|
|
410
414
|
lineTextInput: "text",
|
|
411
415
|
multilineTextInput: "multilinetext",
|
|
@@ -1135,7 +1139,7 @@ var ToastService_default = ToastService;
|
|
|
1135
1139
|
var buttonClasses = /* @__PURE__ */ new Map([
|
|
1136
1140
|
[
|
|
1137
1141
|
"Primary" /* Primary */,
|
|
1138
|
-
"relative inline-flex items-center justify-center bg-primary rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg hover:bg-primary-strong focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-
|
|
1142
|
+
"relative inline-flex items-center justify-center bg-primary rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg hover:bg-primary-strong focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-black"
|
|
1139
1143
|
],
|
|
1140
1144
|
[
|
|
1141
1145
|
"Secondary" /* Secondary */,
|
|
@@ -1843,8 +1847,687 @@ var InputControl = import_react31.default.forwardRef(
|
|
|
1843
1847
|
);
|
|
1844
1848
|
InputControl.displayName = "InputControl";
|
|
1845
1849
|
var InputControl_default = InputControl;
|
|
1850
|
+
|
|
1851
|
+
// src/components/dataForm/DataList.tsx
|
|
1852
|
+
var import_react35 = __toESM(require("react"));
|
|
1853
|
+
var import_navigation = require("next/navigation");
|
|
1854
|
+
|
|
1855
|
+
// src/components/dataForm/NoContentView.tsx
|
|
1856
|
+
var import_react32 = __toESM(require("react"));
|
|
1857
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1858
|
+
var NoContentView = (props) => {
|
|
1859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react32.default.Fragment, { children: props.isDataFound === false && props.children });
|
|
1860
|
+
};
|
|
1861
|
+
var NoContentView_default = NoContentView;
|
|
1862
|
+
|
|
1863
|
+
// src/components/dataForm/ContentView.tsx
|
|
1864
|
+
var import_react33 = __toESM(require("react"));
|
|
1865
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1866
|
+
var ContentView = (props) => {
|
|
1867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react33.default.Fragment, { children: [
|
|
1868
|
+
props.isDataFound == null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "bg-gray-200 rounded-md p-4 animate-pulse", children: [
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center mb-4", children: [
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
|
|
1871
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "ml-2", children: [
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
|
|
1874
|
+
] })
|
|
1875
|
+
] }),
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
|
|
1877
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "animate-pulse", children: [
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
1883
|
+
] }),
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "animate-pulse", children: [
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
1890
|
+
] }),
|
|
1891
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "animate-pulse", children: [
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
1897
|
+
] })
|
|
1898
|
+
] })
|
|
1899
|
+
] }) }),
|
|
1900
|
+
props.isDataFound === true && props.children
|
|
1901
|
+
] });
|
|
1902
|
+
};
|
|
1903
|
+
var ContentView_default = ContentView;
|
|
1904
|
+
|
|
1905
|
+
// src/components/dataForm/Hyperlink.tsx
|
|
1906
|
+
var import_link = __toESM(require("next/link"));
|
|
1907
|
+
var import_react34 = __toESM(require("react"));
|
|
1908
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1909
|
+
function Hyperlink(props) {
|
|
1910
|
+
let linkClass = props.linkType ? buttonClasses.get(props.linkType) : buttonClasses.get("Link" /* Link */);
|
|
1911
|
+
const target = props.href?.startsWith("https://") ? "_blank" : "_self";
|
|
1912
|
+
const additionalProps = target === "_blank" ? { rel: "noopener noreferrer" } : {};
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react34.default.Fragment, { children: [
|
|
1914
|
+
props.href && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1915
|
+
import_link.default,
|
|
1916
|
+
{
|
|
1917
|
+
href: props.href,
|
|
1918
|
+
prefetch: false,
|
|
1919
|
+
className: linkClass + " " + props.className,
|
|
1920
|
+
title: props.title,
|
|
1921
|
+
target,
|
|
1922
|
+
...additionalProps,
|
|
1923
|
+
children: props.children
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
!props.href && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: props.className, children: props.children })
|
|
1927
|
+
] });
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
// src/clients/OdataBuilder.tsx
|
|
1931
|
+
var OdataBuilder = class {
|
|
1932
|
+
constructor(url) {
|
|
1933
|
+
this.baseUrl = url;
|
|
1934
|
+
this.top = Constants.pagesize.toString();
|
|
1935
|
+
this.skip = "0";
|
|
1936
|
+
this.filterBy = "";
|
|
1937
|
+
this.orderBy = "";
|
|
1938
|
+
}
|
|
1939
|
+
setQuery(odata) {
|
|
1940
|
+
if (!odata) return this;
|
|
1941
|
+
if (odata["$skip"]) this.skip = odata["$skip"];
|
|
1942
|
+
if (odata["$top"]) this.top = odata["$top"];
|
|
1943
|
+
if (odata["$filter"]) this.filterBy = odata["$filter"];
|
|
1944
|
+
if (odata["$orderby"]) this.orderBy = odata["$orderby"];
|
|
1945
|
+
return this;
|
|
1946
|
+
}
|
|
1947
|
+
getPageNumber(pageSize) {
|
|
1948
|
+
const skip = parseInt(this.skip);
|
|
1949
|
+
const top = parseInt(this.top);
|
|
1950
|
+
if (!isNaN(skip) && !isNaN(top)) {
|
|
1951
|
+
return skip / pageSize + 1;
|
|
1952
|
+
}
|
|
1953
|
+
return 1;
|
|
1954
|
+
}
|
|
1955
|
+
getNewOrderByUrl(orderBy) {
|
|
1956
|
+
let url = `${this.baseUrl}?$skip=0&$top=${this.top}&$count=true`;
|
|
1957
|
+
if (this.filterBy) {
|
|
1958
|
+
url += `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
1959
|
+
}
|
|
1960
|
+
url += `&$orderby=${encodeURIComponent(orderBy)}`;
|
|
1961
|
+
return url;
|
|
1962
|
+
}
|
|
1963
|
+
getNewFilterUrl(filterBy) {
|
|
1964
|
+
let url = `${this.baseUrl}?$skip=0&$top=${this.top}&$count=true`;
|
|
1965
|
+
if (filterBy) {
|
|
1966
|
+
url += `&$filter=${encodeURIComponent(filterBy)}`;
|
|
1967
|
+
}
|
|
1968
|
+
if (this.orderBy) {
|
|
1969
|
+
url += `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
1970
|
+
}
|
|
1971
|
+
return url;
|
|
1972
|
+
}
|
|
1973
|
+
getNewPageUrl(page) {
|
|
1974
|
+
const skip = page * Constants.pagesize - Constants.pagesize;
|
|
1975
|
+
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
1976
|
+
if (this.filterBy) {
|
|
1977
|
+
url += `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
1978
|
+
}
|
|
1979
|
+
if (this.orderBy) {
|
|
1980
|
+
url += `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
1981
|
+
}
|
|
1982
|
+
return url;
|
|
1983
|
+
}
|
|
1984
|
+
getOrderBy() {
|
|
1985
|
+
return this.orderBy;
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
// src/svg/chevron-updown.tsx
|
|
1990
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1991
|
+
var ChevronUpDown = (props) => {
|
|
1992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) });
|
|
1993
|
+
};
|
|
1994
|
+
var chevron_updown_default = ChevronUpDown;
|
|
1995
|
+
|
|
1996
|
+
// src/svg/chevron-down.tsx
|
|
1997
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1998
|
+
var ChevronDown = (props) => {
|
|
1999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) });
|
|
2000
|
+
};
|
|
2001
|
+
var chevron_down_default = ChevronDown;
|
|
2002
|
+
|
|
2003
|
+
// src/svg/chevron-up.tsx
|
|
2004
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2005
|
+
var ChevronUp = (props) => {
|
|
2006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) });
|
|
2007
|
+
};
|
|
2008
|
+
var chevron_up_default = ChevronUp;
|
|
2009
|
+
|
|
2010
|
+
// src/svg/plus.tsx
|
|
2011
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2012
|
+
var Plus = (props) => {
|
|
2013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) });
|
|
2014
|
+
};
|
|
2015
|
+
var plus_default = Plus;
|
|
2016
|
+
|
|
2017
|
+
// src/svg/Icons.tsx
|
|
2018
|
+
var Icons = {
|
|
2019
|
+
chevronUpDown: chevron_updown_default,
|
|
2020
|
+
chevronDown: chevron_down_default,
|
|
2021
|
+
chevronUp: chevron_up_default,
|
|
2022
|
+
plus: plus_default
|
|
2023
|
+
};
|
|
2024
|
+
var Icons_default = Icons;
|
|
2025
|
+
|
|
2026
|
+
// src/svg/Icon.tsx
|
|
2027
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2028
|
+
var Icon = ({ name, className, ...props }) => {
|
|
2029
|
+
const IconComponent = Icons_default[name];
|
|
2030
|
+
if (!IconComponent) {
|
|
2031
|
+
console.error(`Icon "${name}" not found.`);
|
|
2032
|
+
return null;
|
|
2033
|
+
}
|
|
2034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(IconComponent, { ...props, className });
|
|
2035
|
+
};
|
|
2036
|
+
var Icon_default = Icon;
|
|
2037
|
+
|
|
2038
|
+
// src/FormReducer.tsx
|
|
2039
|
+
var FORM_INPUT_UPDATE = "FORM_INPUT_UPDATE";
|
|
2040
|
+
function setNestedProperty(obj, path, value) {
|
|
2041
|
+
if (path.includes(".")) {
|
|
2042
|
+
const keys = path.split(".");
|
|
2043
|
+
const lastKey = keys.pop();
|
|
2044
|
+
const newObj = { ...obj };
|
|
2045
|
+
let current = newObj;
|
|
2046
|
+
keys.forEach((key) => {
|
|
2047
|
+
current[key] = { ...current[key] };
|
|
2048
|
+
current = current[key];
|
|
2049
|
+
});
|
|
2050
|
+
current[lastKey] = value;
|
|
2051
|
+
return newObj;
|
|
2052
|
+
}
|
|
2053
|
+
return {
|
|
2054
|
+
...obj,
|
|
2055
|
+
[path]: value
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
function FormReducer(state, action) {
|
|
2059
|
+
switch (action.type) {
|
|
2060
|
+
case FORM_INPUT_UPDATE:
|
|
2061
|
+
if (!action.name) return state;
|
|
2062
|
+
return {
|
|
2063
|
+
inputValues: setNestedProperty(
|
|
2064
|
+
state.inputValues,
|
|
2065
|
+
action.name.toString(),
|
|
2066
|
+
action.value
|
|
2067
|
+
),
|
|
2068
|
+
lastPropertyChanged: action.name.toString()
|
|
2069
|
+
};
|
|
2070
|
+
default:
|
|
2071
|
+
return state;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
var FormReducer_default = FormReducer;
|
|
2075
|
+
|
|
2076
|
+
// src/components/dataForm/DataList.tsx
|
|
2077
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2078
|
+
var DataList = (props) => {
|
|
2079
|
+
console.log(props.dataset, "datasetssssss");
|
|
2080
|
+
const router = (0, import_navigation.useRouter)();
|
|
2081
|
+
let builder = new OdataBuilder(props.path);
|
|
2082
|
+
let orderBy = "";
|
|
2083
|
+
let activePageNumber = 0;
|
|
2084
|
+
let pages = 0;
|
|
2085
|
+
console.log(props.addLinkText);
|
|
2086
|
+
const [isDataFound, setIsDataFound] = (0, import_react35.useState)(null);
|
|
2087
|
+
(0, import_react35.useEffect)(() => {
|
|
2088
|
+
if (props?.dataset) {
|
|
2089
|
+
if (props?.dataset.result && props.dataset.result.length > 0) {
|
|
2090
|
+
setIsDataFound(true);
|
|
2091
|
+
} else {
|
|
2092
|
+
setIsDataFound(false);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}, [props.dataset]);
|
|
2096
|
+
function getNestedProperty(obj, path) {
|
|
2097
|
+
if (path.includes(".")) {
|
|
2098
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
2099
|
+
} else if (Array.isArray(obj[path])) {
|
|
2100
|
+
return obj[path].map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: item }, index));
|
|
2101
|
+
} else {
|
|
2102
|
+
return obj[path];
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
const initialState = {
|
|
2106
|
+
inputValues: {},
|
|
2107
|
+
lastPropertyChanged: ""
|
|
2108
|
+
};
|
|
2109
|
+
const [formState, dispatch] = (0, import_react35.useReducer)(FormReducer_default, initialState);
|
|
2110
|
+
const handleFilterChange = (0, import_react35.useCallback)(
|
|
2111
|
+
(updatedValues) => {
|
|
2112
|
+
dispatch({
|
|
2113
|
+
type: FORM_INPUT_UPDATE,
|
|
2114
|
+
name: updatedValues.name,
|
|
2115
|
+
value: updatedValues.value
|
|
2116
|
+
});
|
|
2117
|
+
let builder2 = new OdataBuilder(props.path);
|
|
2118
|
+
builder2 = builder2.setQuery(props.query);
|
|
2119
|
+
if (updatedValues.value != "") {
|
|
2120
|
+
const filter = props.filters?.find((x) => x.name == updatedValues.name);
|
|
2121
|
+
if (filter?.dataTypeCode == "number") {
|
|
2122
|
+
router.push(
|
|
2123
|
+
builder2.getNewFilterUrl(
|
|
2124
|
+
updatedValues.name.toString() + " eq " + updatedValues.value
|
|
2125
|
+
)
|
|
2126
|
+
);
|
|
2127
|
+
} else {
|
|
2128
|
+
router.push(
|
|
2129
|
+
builder2.getNewFilterUrl(
|
|
2130
|
+
updatedValues.name.toString() + " eq '" + updatedValues.value + "'"
|
|
2131
|
+
)
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2134
|
+
} else {
|
|
2135
|
+
router.push(builder2.getNewFilterUrl(""));
|
|
2136
|
+
}
|
|
2137
|
+
},
|
|
2138
|
+
[dispatch, props, router]
|
|
2139
|
+
);
|
|
2140
|
+
builder = builder.setQuery(props.query);
|
|
2141
|
+
orderBy = builder.getOrderBy();
|
|
2142
|
+
activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
2143
|
+
let label = "";
|
|
2144
|
+
if (props.dataset && props.dataset.count) {
|
|
2145
|
+
pages = Math.ceil(props.dataset.count / Constants.pagesize);
|
|
2146
|
+
label = `Showing ${(activePageNumber - 1) * Constants.pagesize + 1} - `;
|
|
2147
|
+
if (activePageNumber * Constants.pagesize > props.dataset.count) {
|
|
2148
|
+
label = label + `${props.dataset.count} of ${props.dataset.count} results`;
|
|
2149
|
+
} else {
|
|
2150
|
+
label = label + `${activePageNumber * Constants.pagesize} of ${props.dataset.count} results`;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
const renderPageNumbers = () => {
|
|
2154
|
+
if (pages <= 10) {
|
|
2155
|
+
return Array.from({ length: pages }, (_, index) => index + 1).map(
|
|
2156
|
+
(page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react35.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2157
|
+
Hyperlink,
|
|
2158
|
+
{
|
|
2159
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2160
|
+
href: builder.getNewPageUrl(page),
|
|
2161
|
+
children: page
|
|
2162
|
+
}
|
|
2163
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)
|
|
2164
|
+
);
|
|
2165
|
+
} else {
|
|
2166
|
+
const showFirstPages = activePageNumber <= 5;
|
|
2167
|
+
const showLastPages = activePageNumber > pages - 5;
|
|
2168
|
+
if (showFirstPages) {
|
|
2169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2170
|
+
Array.from({ length: 8 }, (_, index) => index + 1).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react35.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2171
|
+
Hyperlink,
|
|
2172
|
+
{
|
|
2173
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2174
|
+
href: builder.getNewPageUrl(page),
|
|
2175
|
+
children: page
|
|
2176
|
+
}
|
|
2177
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)),
|
|
2178
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2180
|
+
Hyperlink,
|
|
2181
|
+
{
|
|
2182
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2183
|
+
href: builder.getNewPageUrl(pages - 1),
|
|
2184
|
+
children: pages - 1
|
|
2185
|
+
}
|
|
2186
|
+
),
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2188
|
+
Hyperlink,
|
|
2189
|
+
{
|
|
2190
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2191
|
+
href: builder.getNewPageUrl(pages),
|
|
2192
|
+
children: pages
|
|
2193
|
+
}
|
|
2194
|
+
),
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "relative inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2196
|
+
"select",
|
|
2197
|
+
{
|
|
2198
|
+
className: " py-1 border border-gray-300 bg-white text-gray-700 appearance-none rounded-none",
|
|
2199
|
+
value: activePageNumber > 8 && activePageNumber < pages - 1 ? activePageNumber : "",
|
|
2200
|
+
onChange: (e) => {
|
|
2201
|
+
const page = parseInt(e.target.value);
|
|
2202
|
+
if (page) {
|
|
2203
|
+
router.push(builder.getNewPageUrl(page));
|
|
2204
|
+
}
|
|
2205
|
+
},
|
|
2206
|
+
children: [
|
|
2207
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { className: "", value: "", children: "Jump to" }),
|
|
2208
|
+
Array.from(
|
|
2209
|
+
{ length: Math.max(0, pages - 10) },
|
|
2210
|
+
(_, index) => index + 9
|
|
2211
|
+
).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: page, children: page }, page))
|
|
2212
|
+
]
|
|
2213
|
+
}
|
|
2214
|
+
) })
|
|
2215
|
+
] });
|
|
2216
|
+
} else if (showLastPages) {
|
|
2217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2219
|
+
Hyperlink,
|
|
2220
|
+
{
|
|
2221
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2222
|
+
href: builder.getNewPageUrl(1),
|
|
2223
|
+
children: "1"
|
|
2224
|
+
}
|
|
2225
|
+
),
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2227
|
+
Hyperlink,
|
|
2228
|
+
{
|
|
2229
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2230
|
+
href: builder.getNewPageUrl(2),
|
|
2231
|
+
children: "2"
|
|
2232
|
+
}
|
|
2233
|
+
),
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2235
|
+
Array.from({ length: 8 }, (_, index) => pages - 7 + index).map(
|
|
2236
|
+
(page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react35.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2237
|
+
Hyperlink,
|
|
2238
|
+
{
|
|
2239
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2240
|
+
href: builder.getNewPageUrl(page),
|
|
2241
|
+
children: page
|
|
2242
|
+
}
|
|
2243
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)
|
|
2244
|
+
)
|
|
2245
|
+
] });
|
|
2246
|
+
} else {
|
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2248
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2249
|
+
Hyperlink,
|
|
2250
|
+
{
|
|
2251
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2252
|
+
href: builder.getNewPageUrl(1),
|
|
2253
|
+
children: "1"
|
|
2254
|
+
}
|
|
2255
|
+
),
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2257
|
+
Hyperlink,
|
|
2258
|
+
{
|
|
2259
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2260
|
+
href: builder.getNewPageUrl(2),
|
|
2261
|
+
children: "2"
|
|
2262
|
+
}
|
|
2263
|
+
),
|
|
2264
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2265
|
+
Array.from(
|
|
2266
|
+
{ length: 5 },
|
|
2267
|
+
(_, index) => activePageNumber - 2 + index
|
|
2268
|
+
).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react35.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2269
|
+
Hyperlink,
|
|
2270
|
+
{
|
|
2271
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2272
|
+
href: builder.getNewPageUrl(page),
|
|
2273
|
+
children: page
|
|
2274
|
+
}
|
|
2275
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)),
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2277
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2278
|
+
Hyperlink,
|
|
2279
|
+
{
|
|
2280
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2281
|
+
href: builder.getNewPageUrl(pages - 1),
|
|
2282
|
+
children: pages - 1
|
|
2283
|
+
}
|
|
2284
|
+
),
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2286
|
+
Hyperlink,
|
|
2287
|
+
{
|
|
2288
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2289
|
+
href: builder.getNewPageUrl(pages),
|
|
2290
|
+
children: pages
|
|
2291
|
+
}
|
|
2292
|
+
),
|
|
2293
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "relative inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2294
|
+
"select",
|
|
2295
|
+
{
|
|
2296
|
+
className: "px-2 py-1 border border-gray-300 bg-white text-gray-700 appearance-none rounded-none",
|
|
2297
|
+
value: activePageNumber > 2 && activePageNumber < pages - 1 ? activePageNumber : "",
|
|
2298
|
+
onChange: (e) => {
|
|
2299
|
+
const page = parseInt(e.target.value);
|
|
2300
|
+
if (page) {
|
|
2301
|
+
router.push(builder.getNewPageUrl(page));
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
2304
|
+
children: [
|
|
2305
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: "", children: "Jump to" }),
|
|
2306
|
+
Array.from({ length: pages - 4 }, (_, index) => index + 3).filter((page) => page > 2 && page < pages - 1).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: page, children: page }, page))
|
|
2307
|
+
]
|
|
2308
|
+
}
|
|
2309
|
+
) })
|
|
2310
|
+
] });
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react35.default.Fragment, { children: [
|
|
2315
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(ContentView_default, { isDataFound, children: [
|
|
2316
|
+
(props.title || props.filters || props.addLinkHref) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2317
|
+
"div",
|
|
2318
|
+
{
|
|
2319
|
+
className: `flex justify-between items-center bg-white pl-6 pr-2 h-14 mb-3 shadow-sm rounded-md border-b border-neutral-200 sticky top-0`,
|
|
2320
|
+
children: [
|
|
2321
|
+
props.title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { className: "text-lg font-semibold text-black-800", children: props.title }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", {}),
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2323
|
+
props.filters && props.filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2324
|
+
InputControl_default,
|
|
2325
|
+
{
|
|
2326
|
+
name: filter.name,
|
|
2327
|
+
controlType: InputControlType_default.select,
|
|
2328
|
+
value: formState.inputValues[filter.name],
|
|
2329
|
+
dataSource: filter.servicePath,
|
|
2330
|
+
dataKeyFieldName: filter.dataKeyFieldName,
|
|
2331
|
+
dataTextFieldName: filter.dataTextFieldName,
|
|
2332
|
+
serviceClient: props.serviceClient,
|
|
2333
|
+
callback: handleFilterChange,
|
|
2334
|
+
attributes: { placeholder: filter.placeholder }
|
|
2335
|
+
},
|
|
2336
|
+
filter.name
|
|
2337
|
+
)),
|
|
2338
|
+
props.addLinkHref && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2339
|
+
Hyperlink,
|
|
2340
|
+
{
|
|
2341
|
+
className: "gap-1",
|
|
2342
|
+
linkType: "Primary" /* Primary */,
|
|
2343
|
+
href: props.addLinkHref,
|
|
2344
|
+
children: [
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { name: "plus", className: "w-4 h-4" }),
|
|
2346
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-sm font-medium", children: props.addLinkText || "Add New" })
|
|
2347
|
+
]
|
|
2348
|
+
}
|
|
2349
|
+
)
|
|
2350
|
+
] })
|
|
2351
|
+
]
|
|
2352
|
+
}
|
|
2353
|
+
),
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex-1 overflow-y-auto justify-end bg-white rounded shadow h-[calc(100vh-14rem)]", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("table", { className: "w-full divide-y divide-gray-200", children: [
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("thead", { className: "bg-gray-50 sticky top-0", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: props?.columns?.map((column) => {
|
|
2356
|
+
let url = builder.getNewOrderByUrl(column.name);
|
|
2357
|
+
let icon = "chevronUpDown";
|
|
2358
|
+
if (orderBy.includes(`${column.name} desc`)) {
|
|
2359
|
+
icon = "chevronDown";
|
|
2360
|
+
url = builder.getNewOrderByUrl(column.name);
|
|
2361
|
+
} else if (orderBy.includes(`${column.name}`)) {
|
|
2362
|
+
icon = "chevronUp";
|
|
2363
|
+
url = builder.getNewOrderByUrl(column.name + " desc");
|
|
2364
|
+
}
|
|
2365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2366
|
+
"th",
|
|
2367
|
+
{
|
|
2368
|
+
className: "px-6 py-3 text-left font-medium cursor-pointer bg-neutral-soft " + column.width + (column.controlType == ViewControlTypes_default.moneyView ? " text-right" : ""),
|
|
2369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Hyperlink, { href: url, className: "!text-neutral-contrast ", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "flex items-center space-x-1", children: [
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: column.label }),
|
|
2371
|
+
column.enableSorting && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { className: "w-4 h-4", name: icon })
|
|
2372
|
+
] }) })
|
|
2373
|
+
},
|
|
2374
|
+
column.name
|
|
2375
|
+
);
|
|
2376
|
+
}) }) }),
|
|
2377
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tbody", { className: "divide-y divide-gray-200 ", children: props.dataset?.result?.map((dataitem, index) => {
|
|
2378
|
+
let validityClass = "";
|
|
2379
|
+
console.log("dataitem", dataitem);
|
|
2380
|
+
if (props.recordValidityColumnName && getNestedProperty(dataitem, props.recordValidityColumnName) == false) {
|
|
2381
|
+
validityClass = "bg-alert-200";
|
|
2382
|
+
}
|
|
2383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { className: validityClass, children: props?.columns?.map((column, colindex) => {
|
|
2384
|
+
console.log("column", column);
|
|
2385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react35.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2386
|
+
"td",
|
|
2387
|
+
{
|
|
2388
|
+
className: "px-6 py-2 whitespace-normal " + (column.controlType == ViewControlTypes_default.moneyView ? "" : ""),
|
|
2389
|
+
children: column.addhref === true ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2390
|
+
Hyperlink,
|
|
2391
|
+
{
|
|
2392
|
+
className: "",
|
|
2393
|
+
href: `https://${dataitem[column.name]}`,
|
|
2394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2395
|
+
ViewControl_default,
|
|
2396
|
+
{
|
|
2397
|
+
controlType: column.controlType,
|
|
2398
|
+
value: getNestedProperty(
|
|
2399
|
+
dataitem,
|
|
2400
|
+
column.name
|
|
2401
|
+
),
|
|
2402
|
+
format: column.format,
|
|
2403
|
+
customProps: column.customProps
|
|
2404
|
+
}
|
|
2405
|
+
)
|
|
2406
|
+
}
|
|
2407
|
+
) : column.showAsLink ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2408
|
+
Hyperlink,
|
|
2409
|
+
{
|
|
2410
|
+
href: props.path + dataitem[props.columns[0].name] + "/" + (dataitem.linkUrlSegment ?? column.linkUrlSegment),
|
|
2411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2412
|
+
ViewControl_default,
|
|
2413
|
+
{
|
|
2414
|
+
controlType: column.controlType,
|
|
2415
|
+
value: getNestedProperty(dataitem, column.name) || column.emptyValueLabel,
|
|
2416
|
+
format: column.format,
|
|
2417
|
+
customProps: column.customProps
|
|
2418
|
+
}
|
|
2419
|
+
)
|
|
2420
|
+
}
|
|
2421
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2422
|
+
ViewControl_default,
|
|
2423
|
+
{
|
|
2424
|
+
controlType: column.controlType,
|
|
2425
|
+
value: getNestedProperty(dataitem, column.name),
|
|
2426
|
+
format: column.format,
|
|
2427
|
+
customProps: column.customProps
|
|
2428
|
+
}
|
|
2429
|
+
)
|
|
2430
|
+
}
|
|
2431
|
+
) }, colindex);
|
|
2432
|
+
}) }, index);
|
|
2433
|
+
}) })
|
|
2434
|
+
] }) }),
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "pt-4 border-t border-t-gray-50 sticky bottom-0 h-11 mt-2 ", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
2436
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-gray-700", children: label }),
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex space-x-2 items-center", children: [
|
|
2438
|
+
activePageNumber > 1 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2439
|
+
Hyperlink,
|
|
2440
|
+
{
|
|
2441
|
+
className: "px-3 py-1 rounded-l-md border border-gray-300 bg-white text-gray-500 hover:bg-gray-200",
|
|
2442
|
+
href: builder.getNewPageUrl(activePageNumber - 1),
|
|
2443
|
+
children: "Prev"
|
|
2444
|
+
}
|
|
2445
|
+
),
|
|
2446
|
+
activePageNumber <= 1 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "px-3 py-1 rounded-l-md border border-gray-300 bg-gray-200 text-gray-500 hover:bg-gray-200", children: "Prev" }),
|
|
2447
|
+
renderPageNumbers(),
|
|
2448
|
+
activePageNumber < pages && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2449
|
+
Hyperlink,
|
|
2450
|
+
{
|
|
2451
|
+
className: "px-3 py-1 rounded-r-md border border-gray-300 bg-white text-gray-500 hover:bg-gray-200",
|
|
2452
|
+
href: builder.getNewPageUrl(activePageNumber + 1),
|
|
2453
|
+
children: "Next"
|
|
2454
|
+
}
|
|
2455
|
+
),
|
|
2456
|
+
activePageNumber >= pages && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "px-3 py-1 rounded-r-md border border-gray-300 bg-gray-200 text-gray-500", children: "Next" })
|
|
2457
|
+
] })
|
|
2458
|
+
] }) })
|
|
2459
|
+
] }),
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(NoContentView_default, { isDataFound, children: [
|
|
2461
|
+
(props.title || props.filters || props.addLinkHref) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2462
|
+
"div",
|
|
2463
|
+
{
|
|
2464
|
+
className: `flex justify-between items-center bg-white pl-6 pr-2 h-14 mb-3 shadow-sm rounded-md border-b border-neutral-200`,
|
|
2465
|
+
children: [
|
|
2466
|
+
props.title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { className: "text-lg font-semibold text-primary-800", children: props.title }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", {}),
|
|
2467
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2468
|
+
props.filters && props.filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2469
|
+
InputControl_default,
|
|
2470
|
+
{
|
|
2471
|
+
name: filter.name,
|
|
2472
|
+
controlType: InputControlType_default.select,
|
|
2473
|
+
value: formState.inputValues[filter.name],
|
|
2474
|
+
dataSource: filter.servicePath,
|
|
2475
|
+
dataKeyFieldName: filter.dataKeyFieldName,
|
|
2476
|
+
dataTextFieldName: filter.dataTextFieldName,
|
|
2477
|
+
serviceClient: props.serviceClient,
|
|
2478
|
+
callback: handleFilterChange,
|
|
2479
|
+
attributes: { placeholder: filter.placeholder }
|
|
2480
|
+
},
|
|
2481
|
+
filter.name
|
|
2482
|
+
)),
|
|
2483
|
+
props.addLinkHref && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2484
|
+
Hyperlink,
|
|
2485
|
+
{
|
|
2486
|
+
className: "gap-1",
|
|
2487
|
+
linkType: "Primary" /* Primary */,
|
|
2488
|
+
href: props.addLinkHref,
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { name: "plus", className: "w-4 h-4" }),
|
|
2491
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-sm font-medium", children: props.addLinkText || "Add New" })
|
|
2492
|
+
]
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
2495
|
+
] })
|
|
2496
|
+
]
|
|
2497
|
+
}
|
|
2498
|
+
),
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex-grow overflow-y-auto justify-end bg-white rounded shadow h-[75vh]", children: [
|
|
2500
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("table", { className: "w-full divide-y divide-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("thead", { className: "bg-gray-50", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: props?.columns?.map((column) => {
|
|
2501
|
+
let url = builder.getNewOrderByUrl(column.name);
|
|
2502
|
+
let icon = "chevronUpDown";
|
|
2503
|
+
if (orderBy.includes(`${column.name} desc`)) {
|
|
2504
|
+
icon = "chevronDown";
|
|
2505
|
+
url = builder.getNewOrderByUrl(column.name);
|
|
2506
|
+
} else if (orderBy.includes(`${column.name}`)) {
|
|
2507
|
+
icon = "chevronUp";
|
|
2508
|
+
url = builder.getNewOrderByUrl(column.name + " desc");
|
|
2509
|
+
}
|
|
2510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2511
|
+
"th",
|
|
2512
|
+
{
|
|
2513
|
+
className: "px-6 py-3 text-left font-medium cursor-pointer " + column.width + (column.controlType == ViewControlTypes_default.moneyView ? " text-right" : ""),
|
|
2514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Hyperlink, { href: url, className: "text-body-950", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "flex items-center space-x-1", children: [
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: column.label }),
|
|
2516
|
+
column.enableSorting && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { className: "w-4 h-4", name: icon })
|
|
2517
|
+
] }) })
|
|
2518
|
+
},
|
|
2519
|
+
column.name
|
|
2520
|
+
);
|
|
2521
|
+
}) }) }) }) }),
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-full text-center bg-transparent pt-5", children: "There are no entries in the table at the moment." })
|
|
2523
|
+
] })
|
|
2524
|
+
] })
|
|
2525
|
+
] });
|
|
2526
|
+
};
|
|
2527
|
+
var DataList_default = DataList;
|
|
1846
2528
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1847
2529
|
0 && (module.exports = {
|
|
2530
|
+
DataList,
|
|
1848
2531
|
InputControl,
|
|
1849
2532
|
InputControlType,
|
|
1850
2533
|
ViewControl,
|