@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260707162731 → 0.8.1-dev.20260708060703
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/{InputControlClient-NJV6B65M.mjs → InputControlClient-646PQPKQ.mjs} +79 -6
- package/dist/{InputControlClient-TW664WIJ.mjs → InputControlClient-O4HBEUP4.mjs} +79 -6
- package/dist/{Pagination-FSYLYKUA.mjs → Pagination-4K7GMWUE.mjs} +2 -2
- package/dist/Pagination-OQT7Q2XO.mjs +183 -0
- package/dist/chunk-FI2KJBK2.mjs +110 -0
- package/dist/{chunk-47HD7QP7.mjs → chunk-FYGNBMII.mjs} +1 -1
- package/dist/chunk-OGGIS4AN.mjs +201 -0
- package/dist/{chunk-CM7LUGCH.mjs → chunk-UWFXFVUU.mjs} +2 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +565 -484
- package/dist/index.mjs +19 -19
- package/package.json +1 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Constants
|
|
5
|
+
} from "./chunk-FI2KJBK2.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
|
+
};
|
|
@@ -23,7 +23,8 @@ var InputControlType = {
|
|
|
23
23
|
colorInput: "colorInput",
|
|
24
24
|
selectWithSearchInput: "selectWithSearchInput",
|
|
25
25
|
selectWithSearchPanel: "selectWithSearchPanel",
|
|
26
|
-
booleanSelect: "booleanSelect"
|
|
26
|
+
booleanSelect: "booleanSelect",
|
|
27
|
+
switchInput: "switchInput"
|
|
27
28
|
};
|
|
28
29
|
var InputControlType_default = InputControlType;
|
|
29
30
|
|
package/dist/index.d.mts
CHANGED