@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260708070033 → 0.8.1-dev.20260709113231
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/EnterAnimationClient-2JW323TH.mjs +32 -0
- package/dist/EnterAnimationClient-RS3NQNR4.mjs +30 -0
- package/dist/{InputControlClient-OQDLYA4S.mjs → InputControlClient-AZRPSTUZ.mjs} +80 -7
- package/dist/{InputControlClient-O4HBEUP4.mjs → InputControlClient-CS4JM7UY.mjs} +1 -1
- package/dist/{InputControlClient-646PQPKQ.mjs → InputControlClient-XS52LLEE.mjs} +1 -1
- package/dist/{LinkNodeButton-WA5N3CBJ.mjs → LinkNodeButton-LX3KKGZY.mjs} +3 -4
- package/dist/{LinkNodeButton-GVOICN34.mjs → LinkNodeButton-U7T2NP22.mjs} +29 -16
- package/dist/{LinkNodeButton-66LEXGVY.mjs → LinkNodeButton-XA7Z5IDR.mjs} +3 -4
- package/dist/{chunk-67IG5NBU.mjs → chunk-JKP4XOZB.mjs} +27 -13
- package/dist/{chunk-IKIXEQPV.mjs → chunk-YL6E76X2.mjs} +27 -13
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +309 -265
- package/dist/index.mjs +71 -79
- package/dist/server.js +30 -17
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/dist/Pagination-YCD5CU2L.mjs +0 -183
- package/dist/chunk-2GSYECIS.mjs +0 -109
- package/dist/chunk-R2HV35IB.mjs +0 -201
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
import {
|
|
5
|
-
OdataBuilder
|
|
6
|
-
} from "./chunk-R2HV35IB.mjs";
|
|
7
|
-
import {
|
|
8
|
-
Constants,
|
|
9
|
-
Hyperlink,
|
|
10
|
-
Icon_default
|
|
11
|
-
} from "./chunk-2GSYECIS.mjs";
|
|
12
|
-
import "./chunk-IMNQO57B.mjs";
|
|
13
|
-
|
|
14
|
-
// src/components/Pagination.tsx
|
|
15
|
-
import { useMemo } from "react";
|
|
16
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
var Pagination = (props) => {
|
|
18
|
-
const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
|
|
19
|
-
const builder = useMemo(() => {
|
|
20
|
-
const b = new OdataBuilder(path);
|
|
21
|
-
if (query) b.setQuery(query);
|
|
22
|
-
return b;
|
|
23
|
-
}, [path, query]);
|
|
24
|
-
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
25
|
-
const totalItems = dataset?.count || 0;
|
|
26
|
-
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
27
|
-
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
28
|
-
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
29
|
-
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
30
|
-
const getPaginationRange = () => {
|
|
31
|
-
const delta = 1;
|
|
32
|
-
const range = [];
|
|
33
|
-
if (totalPages <= 7) {
|
|
34
|
-
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
35
|
-
}
|
|
36
|
-
range.push(1);
|
|
37
|
-
let start = Math.max(2, activePageNumber - delta);
|
|
38
|
-
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
39
|
-
if (activePageNumber - delta <= 2) {
|
|
40
|
-
end = Math.min(totalPages - 1, 4);
|
|
41
|
-
}
|
|
42
|
-
if (activePageNumber + delta >= totalPages - 1) {
|
|
43
|
-
start = Math.max(2, totalPages - 4);
|
|
44
|
-
}
|
|
45
|
-
if (start > 2) {
|
|
46
|
-
range.push("...");
|
|
47
|
-
}
|
|
48
|
-
for (let i = start; i <= end; i++) {
|
|
49
|
-
range.push(i);
|
|
50
|
-
}
|
|
51
|
-
if (end < totalPages - 1) {
|
|
52
|
-
range.push("...");
|
|
53
|
-
}
|
|
54
|
-
if (totalPages > 1) {
|
|
55
|
-
range.push(totalPages);
|
|
56
|
-
}
|
|
57
|
-
return range;
|
|
58
|
-
};
|
|
59
|
-
const paginationRange = getPaginationRange();
|
|
60
|
-
const PageButton = ({ page, children }) => /* @__PURE__ */ jsx(
|
|
61
|
-
Hyperlink,
|
|
62
|
-
{
|
|
63
|
-
linkType: "Link" /* Link */,
|
|
64
|
-
className: `
|
|
65
|
-
min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
|
|
66
|
-
border text-sm font-medium transition-colors duration-150
|
|
67
|
-
${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
|
|
68
|
-
`,
|
|
69
|
-
href: builder.getNewPageUrl(page),
|
|
70
|
-
children
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
const NavigationButton = ({ page, disabled, children }) => {
|
|
74
|
-
if (disabled) {
|
|
75
|
-
return /* @__PURE__ */ 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 });
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ jsx(
|
|
78
|
-
Hyperlink,
|
|
79
|
-
{
|
|
80
|
-
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",
|
|
81
|
-
href: builder.getNewPageUrl(page),
|
|
82
|
-
children
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
if (totalPages <= 1 && totalItems === 0) return null;
|
|
87
|
-
return /* @__PURE__ */ jsxs("div", { className: "py-6 border-t bg-default", children: [
|
|
88
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
89
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
90
|
-
"Showing ",
|
|
91
|
-
/* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
|
|
92
|
-
startItem,
|
|
93
|
-
"-",
|
|
94
|
-
endItem
|
|
95
|
-
] }),
|
|
96
|
-
" ",
|
|
97
|
-
"out of ",
|
|
98
|
-
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
|
|
99
|
-
" results"
|
|
100
|
-
] }),
|
|
101
|
-
totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-1", children: [
|
|
102
|
-
/* @__PURE__ */ jsxs(
|
|
103
|
-
NavigationButton,
|
|
104
|
-
{
|
|
105
|
-
page: activePageNumber - 1,
|
|
106
|
-
disabled: activePageNumber === 1,
|
|
107
|
-
children: [
|
|
108
|
-
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
|
|
109
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Prev" })
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
paginationRange.map((item, index) => {
|
|
114
|
-
if (item === "...") {
|
|
115
|
-
return /* @__PURE__ */ jsx(
|
|
116
|
-
"span",
|
|
117
|
-
{
|
|
118
|
-
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
|
|
119
|
-
children: "..."
|
|
120
|
-
},
|
|
121
|
-
`ellipsis-${index}`
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
const page = item;
|
|
125
|
-
return /* @__PURE__ */ jsx(PageButton, { page, children: page }, page);
|
|
126
|
-
}),
|
|
127
|
-
/* @__PURE__ */ jsxs(
|
|
128
|
-
NavigationButton,
|
|
129
|
-
{
|
|
130
|
-
page: activePageNumber + 1,
|
|
131
|
-
disabled: activePageNumber === totalPages,
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Next" }),
|
|
134
|
-
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
] }),
|
|
139
|
-
showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
140
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Go to:" }),
|
|
141
|
-
/* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
142
|
-
"input",
|
|
143
|
-
{
|
|
144
|
-
type: "number",
|
|
145
|
-
min: "1",
|
|
146
|
-
max: totalPages,
|
|
147
|
-
defaultValue: activePageNumber,
|
|
148
|
-
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
149
|
-
onKeyDown: (e) => {
|
|
150
|
-
if (e.key === "Enter") {
|
|
151
|
-
const input = e.target;
|
|
152
|
-
const page = parseInt(input.value);
|
|
153
|
-
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
154
|
-
window.location.href = builder.getNewPageUrl(page);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
) })
|
|
160
|
-
] })
|
|
161
|
-
] }),
|
|
162
|
-
showPageSizeSelector && /* @__PURE__ */ jsx("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
163
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Show:" }),
|
|
164
|
-
/* @__PURE__ */ jsx("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx(
|
|
165
|
-
Hyperlink,
|
|
166
|
-
{
|
|
167
|
-
className: `
|
|
168
|
-
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
169
|
-
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
170
|
-
`,
|
|
171
|
-
href: builder.getNewPageSizeUrl(size),
|
|
172
|
-
children: size
|
|
173
|
-
},
|
|
174
|
-
size
|
|
175
|
-
)) }),
|
|
176
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "per page" })
|
|
177
|
-
] }) })
|
|
178
|
-
] });
|
|
179
|
-
};
|
|
180
|
-
var Pagination_default = Pagination;
|
|
181
|
-
export {
|
|
182
|
-
Pagination_default as default
|
|
183
|
-
};
|
package/dist/chunk-2GSYECIS.mjs
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
buttonClasses
|
|
5
|
-
} from "./chunk-IMNQO57B.mjs";
|
|
6
|
-
|
|
7
|
-
// src/components/controls/edit/InputControlType.tsx
|
|
8
|
-
var Constants = {
|
|
9
|
-
pagesize: 10
|
|
10
|
-
};
|
|
11
|
-
var InputControlType = {
|
|
12
|
-
lineTextInput: "text",
|
|
13
|
-
multilineTextInput: "multilinetext",
|
|
14
|
-
emailInput: "email",
|
|
15
|
-
moneyInput: "money",
|
|
16
|
-
select: "select",
|
|
17
|
-
percentageInput: "percentage",
|
|
18
|
-
asset: "asset",
|
|
19
|
-
phoneInput: "phone",
|
|
20
|
-
numberInput: "number",
|
|
21
|
-
checkboxInput: "boolean",
|
|
22
|
-
otpInput: "otp",
|
|
23
|
-
datetimeInput: "datetime",
|
|
24
|
-
timeInput: "time",
|
|
25
|
-
colorInput: "colorInput",
|
|
26
|
-
selectWithSearchInput: "selectWithSearchInput",
|
|
27
|
-
selectWithSearchPanel: "selectWithSearchPanel",
|
|
28
|
-
booleanSelect: "booleanSelect"
|
|
29
|
-
};
|
|
30
|
-
var InputControlType_default = InputControlType;
|
|
31
|
-
|
|
32
|
-
// src/components/dataForm/Hyperlink.tsx
|
|
33
|
-
import Link from "next/link";
|
|
34
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
35
|
-
function Hyperlink(props) {
|
|
36
|
-
let linkClass = props.linkType ? buttonClasses.get(props.linkType) : buttonClasses.get("Link" /* Link */);
|
|
37
|
-
const target = props?.href?.startsWith("http") ? "_blank" : "_self";
|
|
38
|
-
const additionalProps = {};
|
|
39
|
-
if (target == "_blank") {
|
|
40
|
-
additionalProps.rel = "noopener noreferrer";
|
|
41
|
-
}
|
|
42
|
-
return /* @__PURE__ */ jsx(Fragment, { children: props.href ? /* @__PURE__ */ jsx(
|
|
43
|
-
Link,
|
|
44
|
-
{
|
|
45
|
-
href: props.href,
|
|
46
|
-
prefetch: false,
|
|
47
|
-
className: [linkClass, props.className].filter(Boolean).join(" "),
|
|
48
|
-
...additionalProps,
|
|
49
|
-
target,
|
|
50
|
-
children: props.children
|
|
51
|
-
}
|
|
52
|
-
) : props.isHeading ? /* @__PURE__ */ jsx("h5", { className: props.className + "inline-block", children: props.children }) : /* @__PURE__ */ jsx("span", { className: props.className, children: props.children }) });
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/svg/chevron-updown.tsx
|
|
56
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
57
|
-
var ChevronUpDown = (props) => {
|
|
58
|
-
return /* @__PURE__ */ jsx2("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__ */ jsx2("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) });
|
|
59
|
-
};
|
|
60
|
-
var chevron_updown_default = ChevronUpDown;
|
|
61
|
-
|
|
62
|
-
// src/svg/chevron-down.tsx
|
|
63
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
64
|
-
var ChevronDown = (props) => {
|
|
65
|
-
return /* @__PURE__ */ jsx3("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__ */ jsx3("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) });
|
|
66
|
-
};
|
|
67
|
-
var chevron_down_default = ChevronDown;
|
|
68
|
-
|
|
69
|
-
// src/svg/chevron-up.tsx
|
|
70
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
71
|
-
var ChevronUp = (props) => {
|
|
72
|
-
return /* @__PURE__ */ jsx4("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__ */ jsx4("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) });
|
|
73
|
-
};
|
|
74
|
-
var chevron_up_default = ChevronUp;
|
|
75
|
-
|
|
76
|
-
// src/svg/plus.tsx
|
|
77
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
78
|
-
var Plus = (props) => {
|
|
79
|
-
return /* @__PURE__ */ jsx5("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__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) });
|
|
80
|
-
};
|
|
81
|
-
var plus_default = Plus;
|
|
82
|
-
|
|
83
|
-
// src/svg/Icons.tsx
|
|
84
|
-
var Icons = {
|
|
85
|
-
chevronUpDown: chevron_updown_default,
|
|
86
|
-
chevronDown: chevron_down_default,
|
|
87
|
-
chevronUp: chevron_up_default,
|
|
88
|
-
plus: plus_default
|
|
89
|
-
};
|
|
90
|
-
var Icons_default = Icons;
|
|
91
|
-
|
|
92
|
-
// src/svg/Icon.tsx
|
|
93
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
94
|
-
var Icon = ({ name, className, ...props }) => {
|
|
95
|
-
const IconComponent = Icons_default[name];
|
|
96
|
-
if (!IconComponent) {
|
|
97
|
-
console.error(`Icon "${name}" not found.`);
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
return /* @__PURE__ */ jsx6(IconComponent, { ...props, className });
|
|
101
|
-
};
|
|
102
|
-
var Icon_default = Icon;
|
|
103
|
-
|
|
104
|
-
export {
|
|
105
|
-
Constants,
|
|
106
|
-
InputControlType_default,
|
|
107
|
-
Hyperlink,
|
|
108
|
-
Icon_default
|
|
109
|
-
};
|
package/dist/chunk-R2HV35IB.mjs
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Constants
|
|
5
|
-
} from "./chunk-2GSYECIS.mjs";
|
|
6
|
-
|
|
7
|
-
// src/clients/OdataBuilder.tsx
|
|
8
|
-
var OdataBuilder = class {
|
|
9
|
-
constructor(url) {
|
|
10
|
-
this.baseUrl = url;
|
|
11
|
-
this.top = Constants.pagesize.toString();
|
|
12
|
-
this.skip = "0";
|
|
13
|
-
this.keyword = "";
|
|
14
|
-
this.filterBy = "";
|
|
15
|
-
this.orderBy = "";
|
|
16
|
-
}
|
|
17
|
-
// parseSearchParams(ReadonlyUrlSearchParams): DataQuery {
|
|
18
|
-
// this.top = top;
|
|
19
|
-
// return this;
|
|
20
|
-
// }
|
|
21
|
-
setQuery(odata) {
|
|
22
|
-
if (odata) {
|
|
23
|
-
for (const key in odata) {
|
|
24
|
-
if (odata[key] != null && odata[key] != "") {
|
|
25
|
-
if (key == "$skip") {
|
|
26
|
-
this.setSkip(odata[key]);
|
|
27
|
-
}
|
|
28
|
-
if (key == "$filter") {
|
|
29
|
-
this.setFilter(odata[key]);
|
|
30
|
-
}
|
|
31
|
-
if (key == "$top") {
|
|
32
|
-
this.setTop(odata[key]);
|
|
33
|
-
}
|
|
34
|
-
if (key == "$orderby") {
|
|
35
|
-
this.setOrderBy(odata[key]);
|
|
36
|
-
}
|
|
37
|
-
if (key == "searchTerm") {
|
|
38
|
-
this.searchTerm = odata[key];
|
|
39
|
-
}
|
|
40
|
-
if (key == "searchCols") {
|
|
41
|
-
this.searchCols = odata[key];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
// parseKeyValuePairs(inputString: string): { [key: string]: string } {
|
|
49
|
-
// return inputString.split('$')
|
|
50
|
-
// .map((pair) => pair.split('='))
|
|
51
|
-
// .reduce((result: { [key: string]: string }, [key, value]) => {
|
|
52
|
-
// if (key && value) {
|
|
53
|
-
// result[key.trim()] = value.trim();
|
|
54
|
-
// }
|
|
55
|
-
// return result;
|
|
56
|
-
// }, {});
|
|
57
|
-
// }
|
|
58
|
-
static getOdataQueryString(obj, defaultOrder) {
|
|
59
|
-
let queryString = "";
|
|
60
|
-
let skip = (obj && obj["$skip"]) ?? "0";
|
|
61
|
-
let top = (obj && obj["$top"]) ?? Constants.pagesize.toString();
|
|
62
|
-
queryString = `$skip=${skip}&$top=${top}&$count=true`;
|
|
63
|
-
if (obj?.["searchTerm"] && obj["searchTerm"].trim() !== "") {
|
|
64
|
-
queryString += `&searchTerm=${encodeURIComponent(obj["searchTerm"])}`;
|
|
65
|
-
}
|
|
66
|
-
if (obj?.["searchCols"] && obj["searchCols"].trim() !== "") {
|
|
67
|
-
queryString += `&searchCols=${encodeURIComponent(obj["searchCols"])}`;
|
|
68
|
-
}
|
|
69
|
-
if (obj) {
|
|
70
|
-
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
71
|
-
queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
|
|
72
|
-
}
|
|
73
|
-
if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
|
|
74
|
-
queryString = queryString + `&$orderby=${encodeURIComponent(obj["$orderby"])}`;
|
|
75
|
-
} else if (defaultOrder) {
|
|
76
|
-
queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
if (defaultOrder) {
|
|
80
|
-
queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return queryString;
|
|
84
|
-
}
|
|
85
|
-
setTop(top) {
|
|
86
|
-
this.top = top;
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
setSkip(skip) {
|
|
90
|
-
this.skip = skip;
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
setKeyword(keyword) {
|
|
94
|
-
this.keyword = keyword;
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
setFilter(filterBy) {
|
|
98
|
-
this.filterBy = filterBy;
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
setOrderBy(orderBy) {
|
|
102
|
-
this.orderBy = orderBy;
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
getPageNumber(pageSize) {
|
|
106
|
-
let pageNumber = 1;
|
|
107
|
-
if (this.skip && this.top) {
|
|
108
|
-
const skip = parseInt(this.skip);
|
|
109
|
-
const top = parseInt(this.top);
|
|
110
|
-
if (!isNaN(skip) && !isNaN(top)) {
|
|
111
|
-
pageNumber = skip / pageSize + 1;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return pageNumber;
|
|
115
|
-
}
|
|
116
|
-
getUrl() {
|
|
117
|
-
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
118
|
-
if (this.filterBy !== null && this.filterBy !== "") {
|
|
119
|
-
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
120
|
-
}
|
|
121
|
-
if (this.orderBy !== null && this.orderBy !== "") {
|
|
122
|
-
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
123
|
-
}
|
|
124
|
-
if (this.searchTerm) {
|
|
125
|
-
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
126
|
-
}
|
|
127
|
-
if (this.searchCols) {
|
|
128
|
-
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
129
|
-
}
|
|
130
|
-
console.log(url);
|
|
131
|
-
return url;
|
|
132
|
-
}
|
|
133
|
-
getNewOrderByUrl(orderBy) {
|
|
134
|
-
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
135
|
-
if (this.filterBy !== null && this.filterBy !== "") {
|
|
136
|
-
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
137
|
-
}
|
|
138
|
-
if (this.searchTerm) {
|
|
139
|
-
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
140
|
-
}
|
|
141
|
-
if (this.searchCols) {
|
|
142
|
-
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
143
|
-
}
|
|
144
|
-
url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
|
|
145
|
-
return url;
|
|
146
|
-
}
|
|
147
|
-
getNewFilterUrl(filterBy) {
|
|
148
|
-
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
149
|
-
if (filterBy !== null && filterBy !== "") {
|
|
150
|
-
url = url + `&$filter=${encodeURIComponent(filterBy)}`;
|
|
151
|
-
}
|
|
152
|
-
if (this.orderBy !== null && this.orderBy !== "") {
|
|
153
|
-
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
154
|
-
}
|
|
155
|
-
if (this.searchTerm) {
|
|
156
|
-
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
157
|
-
}
|
|
158
|
-
if (this.searchCols) {
|
|
159
|
-
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
160
|
-
}
|
|
161
|
-
return url;
|
|
162
|
-
}
|
|
163
|
-
getNewPageUrl(page) {
|
|
164
|
-
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
165
|
-
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
166
|
-
if (this.filterBy !== null && this.filterBy !== "") {
|
|
167
|
-
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
168
|
-
}
|
|
169
|
-
if (this.orderBy !== null && this.orderBy !== "") {
|
|
170
|
-
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
171
|
-
}
|
|
172
|
-
if (this.searchTerm) {
|
|
173
|
-
url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
|
|
174
|
-
}
|
|
175
|
-
if (this.searchCols) {
|
|
176
|
-
url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
|
|
177
|
-
}
|
|
178
|
-
return url;
|
|
179
|
-
}
|
|
180
|
-
getNewPageSizeUrl(pageSize) {
|
|
181
|
-
const currentPage = this.getPageNumber(
|
|
182
|
-
parseInt(this.top || Constants.pagesize.toString())
|
|
183
|
-
);
|
|
184
|
-
const skip = (currentPage - 1) * pageSize;
|
|
185
|
-
let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
|
|
186
|
-
if (this.filterBy !== null && this.filterBy !== "") {
|
|
187
|
-
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
188
|
-
}
|
|
189
|
-
if (this.orderBy !== null && this.orderBy !== "") {
|
|
190
|
-
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
191
|
-
}
|
|
192
|
-
return url;
|
|
193
|
-
}
|
|
194
|
-
getOrderBy() {
|
|
195
|
-
return this.orderBy;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export {
|
|
200
|
-
OdataBuilder
|
|
201
|
-
};
|