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