@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260704091052 → 0.8.1-dev.20260706110649
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/CopyButton-UPJPMJUB.mjs +57 -0
- package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
- package/dist/DateViewClient-VLTRN47D.mjs +9 -0
- package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
- package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
- package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
- package/dist/InputControlClient-NJV6B65M.mjs +604 -0
- package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
- package/dist/InputControlClient-TW664WIJ.mjs +602 -0
- package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
- package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
- package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
- package/dist/Pagination-6OFACRMQ.mjs +229 -0
- package/dist/Pagination-FSYLYKUA.mjs +181 -0
- package/dist/Pagination-YCD5CU2L.mjs +183 -0
- package/dist/Slider-554BKC7N.mjs +322 -0
- package/dist/Slider-PEIVH6A5.mjs +320 -0
- package/dist/chunk-2GSYECIS.mjs +109 -0
- package/dist/chunk-3GWLDT7C.mjs +204 -0
- package/dist/chunk-3R4VVVNK.mjs +903 -0
- package/dist/chunk-47HD7QP7.mjs +199 -0
- package/dist/chunk-56HSDML5.mjs +22 -0
- package/dist/chunk-67IG5NBU.mjs +200 -0
- package/dist/chunk-7ZFZLN56.mjs +903 -0
- package/dist/chunk-CM7LUGCH.mjs +107 -0
- package/dist/chunk-IKIXEQPV.mjs +198 -0
- package/dist/chunk-IMNQO57B.mjs +25 -0
- package/dist/chunk-R2HV35IB.mjs +201 -0
- package/dist/chunk-SPRVN5IM.mjs +118 -0
- package/dist/chunk-TVL6KVD5.mjs +229 -0
- package/dist/chunk-WEV5U33G.mjs +207 -0
- package/dist/chunk-YG6FKKQJ.mjs +900 -0
- package/dist/index.d.mts +57 -170
- package/dist/index.d.ts +57 -170
- package/dist/index.js +3938 -3807
- package/dist/index.mjs +588 -2922
- package/dist/server.d.mts +72 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +5126 -0
- package/dist/server.mjs +2698 -0
- package/package.json +18 -4
- package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
- package/dist/chunk-DOKQUUH3.mjs +0 -414
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buttonClasses
|
|
3
|
+
} from "./chunk-56HSDML5.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/controls/edit/InputControlType.tsx
|
|
6
|
+
var Constants = {
|
|
7
|
+
pagesize: 10
|
|
8
|
+
};
|
|
9
|
+
var InputControlType = {
|
|
10
|
+
lineTextInput: "text",
|
|
11
|
+
multilineTextInput: "multilinetext",
|
|
12
|
+
emailInput: "email",
|
|
13
|
+
moneyInput: "money",
|
|
14
|
+
select: "select",
|
|
15
|
+
percentageInput: "percentage",
|
|
16
|
+
asset: "asset",
|
|
17
|
+
phoneInput: "phone",
|
|
18
|
+
numberInput: "number",
|
|
19
|
+
checkboxInput: "boolean",
|
|
20
|
+
otpInput: "otp",
|
|
21
|
+
datetimeInput: "datetime",
|
|
22
|
+
timeInput: "time",
|
|
23
|
+
colorInput: "colorInput",
|
|
24
|
+
selectWithSearchInput: "selectWithSearchInput",
|
|
25
|
+
selectWithSearchPanel: "selectWithSearchPanel",
|
|
26
|
+
booleanSelect: "booleanSelect"
|
|
27
|
+
};
|
|
28
|
+
var InputControlType_default = InputControlType;
|
|
29
|
+
|
|
30
|
+
// src/components/dataForm/Hyperlink.tsx
|
|
31
|
+
import Link from "next/link";
|
|
32
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
33
|
+
function Hyperlink(props) {
|
|
34
|
+
let linkClass = props.linkType ? buttonClasses.get(props.linkType) : buttonClasses.get("Link" /* Link */);
|
|
35
|
+
const target = props?.href?.startsWith("http") ? "_blank" : "_self";
|
|
36
|
+
const additionalProps = {};
|
|
37
|
+
if (target == "_blank") {
|
|
38
|
+
additionalProps.rel = "noopener noreferrer";
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.href ? /* @__PURE__ */ jsx(
|
|
41
|
+
Link,
|
|
42
|
+
{
|
|
43
|
+
href: props.href,
|
|
44
|
+
prefetch: false,
|
|
45
|
+
className: [linkClass, props.className].filter(Boolean).join(" "),
|
|
46
|
+
...additionalProps,
|
|
47
|
+
target,
|
|
48
|
+
children: props.children
|
|
49
|
+
}
|
|
50
|
+
) : props.isHeading ? /* @__PURE__ */ jsx("h5", { className: props.className + "inline-block", children: props.children }) : /* @__PURE__ */ jsx("span", { className: props.className, children: props.children }) });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/svg/chevron-updown.tsx
|
|
54
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
55
|
+
var ChevronUpDown = (props) => {
|
|
56
|
+
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" }) });
|
|
57
|
+
};
|
|
58
|
+
var chevron_updown_default = ChevronUpDown;
|
|
59
|
+
|
|
60
|
+
// src/svg/chevron-down.tsx
|
|
61
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
62
|
+
var ChevronDown = (props) => {
|
|
63
|
+
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" }) });
|
|
64
|
+
};
|
|
65
|
+
var chevron_down_default = ChevronDown;
|
|
66
|
+
|
|
67
|
+
// src/svg/chevron-up.tsx
|
|
68
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
69
|
+
var ChevronUp = (props) => {
|
|
70
|
+
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" }) });
|
|
71
|
+
};
|
|
72
|
+
var chevron_up_default = ChevronUp;
|
|
73
|
+
|
|
74
|
+
// src/svg/plus.tsx
|
|
75
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
76
|
+
var Plus = (props) => {
|
|
77
|
+
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" }) });
|
|
78
|
+
};
|
|
79
|
+
var plus_default = Plus;
|
|
80
|
+
|
|
81
|
+
// src/svg/Icons.tsx
|
|
82
|
+
var Icons = {
|
|
83
|
+
chevronUpDown: chevron_updown_default,
|
|
84
|
+
chevronDown: chevron_down_default,
|
|
85
|
+
chevronUp: chevron_up_default,
|
|
86
|
+
plus: plus_default
|
|
87
|
+
};
|
|
88
|
+
var Icons_default = Icons;
|
|
89
|
+
|
|
90
|
+
// src/svg/Icon.tsx
|
|
91
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
92
|
+
var Icon = ({ name, className, ...props }) => {
|
|
93
|
+
const IconComponent = Icons_default[name];
|
|
94
|
+
if (!IconComponent) {
|
|
95
|
+
console.error(`Icon "${name}" not found.`);
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return /* @__PURE__ */ jsx6(IconComponent, { ...props, className });
|
|
99
|
+
};
|
|
100
|
+
var Icon_default = Icon;
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
Constants,
|
|
104
|
+
InputControlType_default,
|
|
105
|
+
Hyperlink,
|
|
106
|
+
Icon_default
|
|
107
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buttonClasses,
|
|
3
|
+
progressClasses
|
|
4
|
+
} from "./chunk-56HSDML5.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/ToastService.tsx
|
|
7
|
+
var ToastService = class _ToastService {
|
|
8
|
+
static initialize(showToast, closeToast) {
|
|
9
|
+
_ToastService.showToast = showToast;
|
|
10
|
+
_ToastService.closeToast = closeToast;
|
|
11
|
+
}
|
|
12
|
+
static showError(message) {
|
|
13
|
+
if (_ToastService.showToast) {
|
|
14
|
+
_ToastService.showToast(message, "error");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
static showInfo(message) {
|
|
18
|
+
if (_ToastService.showToast) {
|
|
19
|
+
_ToastService.showToast(message, "info");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static showWarning(message) {
|
|
23
|
+
if (_ToastService.showToast) {
|
|
24
|
+
_ToastService.showToast(message, "warning");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
static showSuccess(message) {
|
|
28
|
+
if (_ToastService.showToast) {
|
|
29
|
+
_ToastService.showToast(message, "success");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
static close() {
|
|
33
|
+
if (_ToastService.closeToast) {
|
|
34
|
+
_ToastService.closeToast();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var ToastService_default = ToastService;
|
|
39
|
+
|
|
40
|
+
// src/components/Button.tsx
|
|
41
|
+
import React3, { useState as useState2 } from "react";
|
|
42
|
+
|
|
43
|
+
// src/components/Confirm.tsx
|
|
44
|
+
import { useState } from "react";
|
|
45
|
+
|
|
46
|
+
// src/components/ClientButton.tsx
|
|
47
|
+
import React from "react";
|
|
48
|
+
import { jsx } from "react/jsx-runtime";
|
|
49
|
+
var ClientButton = (props) => {
|
|
50
|
+
const execute = async (event) => {
|
|
51
|
+
if (props.onClick !== void 0) {
|
|
52
|
+
props.onClick();
|
|
53
|
+
} else {
|
|
54
|
+
ToastService_default.showError("No action defined.");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
|
|
58
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsx(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
onClick: execute,
|
|
63
|
+
className: buttonClass + " " + props.className,
|
|
64
|
+
children: props.children
|
|
65
|
+
}
|
|
66
|
+
) });
|
|
67
|
+
};
|
|
68
|
+
var ClientButton_default = ClientButton;
|
|
69
|
+
|
|
70
|
+
// src/components/Confirm.tsx
|
|
71
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
72
|
+
var Confirm = ({ message, onConfirm, onCancel }) => {
|
|
73
|
+
const [showModal, setShowModal] = useState(true);
|
|
74
|
+
const handleConfirmAction = () => {
|
|
75
|
+
setShowModal(false);
|
|
76
|
+
if (onConfirm) {
|
|
77
|
+
onConfirm();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const handleCancelAction = () => {
|
|
81
|
+
setShowModal(false);
|
|
82
|
+
if (onCancel) {
|
|
83
|
+
onCancel();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: showModal && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 flex items-center justify-center z-50", children: [
|
|
87
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute inset-0 bg-black opacity-70" }),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-white rounded-md p-6 w-2/6 shadow border z-50", children: [
|
|
89
|
+
/* @__PURE__ */ jsx2("p", { className: "text-xl font-medium mb-4", children: "Confirmation" }),
|
|
90
|
+
/* @__PURE__ */ jsx2("p", { className: "mb-4", children: message }),
|
|
91
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-8", children: [
|
|
92
|
+
/* @__PURE__ */ jsx2(
|
|
93
|
+
ClientButton_default,
|
|
94
|
+
{
|
|
95
|
+
onClick: handleCancelAction,
|
|
96
|
+
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
97
|
+
children: "Cancel"
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ jsx2(
|
|
101
|
+
ClientButton_default,
|
|
102
|
+
{
|
|
103
|
+
onClick: handleConfirmAction,
|
|
104
|
+
children: "Confirm"
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] })
|
|
108
|
+
] })
|
|
109
|
+
] }) });
|
|
110
|
+
};
|
|
111
|
+
var Confirm_default = Confirm;
|
|
112
|
+
{
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// src/components/Button.tsx
|
|
116
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
117
|
+
var Button = (props) => {
|
|
118
|
+
const [inProgress, setInProgress] = useState2(false);
|
|
119
|
+
const [isActionPerformed, setIsActionPerformed] = useState2(false);
|
|
120
|
+
const [responseMessage, setResponseMessage] = useState2(null);
|
|
121
|
+
const [showModal, setShowModal] = useState2(null);
|
|
122
|
+
const execute = async (event) => {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
if (props.confirm) {
|
|
126
|
+
const confirmed = await showConfirmation("Are you sure you want to delete this item?");
|
|
127
|
+
setShowModal(null);
|
|
128
|
+
if (!confirmed) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (props.oneTimeAction && isActionPerformed) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setInProgress(true);
|
|
136
|
+
let isValid = true;
|
|
137
|
+
if (props.onValidate !== void 0) {
|
|
138
|
+
isValid = await props.onValidate();
|
|
139
|
+
if (!isValid) {
|
|
140
|
+
setInProgress(false);
|
|
141
|
+
ToastService_default.showError("There are errors in the form. Please fix them before proceeding.");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (props.onClick !== void 0) {
|
|
146
|
+
let response = await props.onClick();
|
|
147
|
+
if (response.isSuccessful) {
|
|
148
|
+
setIsActionPerformed(true);
|
|
149
|
+
setResponseMessage(response.message);
|
|
150
|
+
if (props.showToast) {
|
|
151
|
+
ToastService_default.showInfo(response.message || "");
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
ToastService_default.showError(response.message || "");
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
ToastService_default.showError("No action defined.");
|
|
158
|
+
}
|
|
159
|
+
setInProgress(false);
|
|
160
|
+
};
|
|
161
|
+
const showConfirmation = (message) => {
|
|
162
|
+
return new Promise((resolve) => {
|
|
163
|
+
const onConfirm = () => resolve(true);
|
|
164
|
+
const onCancel = () => resolve(false);
|
|
165
|
+
setShowModal(/* @__PURE__ */ jsx3(Confirm_default, { message: props.confirmationMessage, onConfirm, onCancel }));
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
|
|
169
|
+
let progressClass = props.ButtonType ? progressClasses.get(props.ButtonType) : progressClasses.get("Primary" /* Solid */);
|
|
170
|
+
const isDisabled = inProgress || isActionPerformed && props.oneTimeAction;
|
|
171
|
+
return /* @__PURE__ */ jsxs2(React3.Fragment, { children: [
|
|
172
|
+
/* @__PURE__ */ jsxs2(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "submit",
|
|
176
|
+
onClick: execute,
|
|
177
|
+
disabled: props.disabled,
|
|
178
|
+
title: isDisabled ? "The button is disabled to prevent any action" : "",
|
|
179
|
+
className: buttonClass + " relative " + props.className,
|
|
180
|
+
children: [
|
|
181
|
+
isActionPerformed && props.oneTimeAction && responseMessage ? responseMessage : props.children,
|
|
182
|
+
inProgress && /* @__PURE__ */ jsx3(React3.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs2("svg", { className: "animate-spin ml-2 mr-3 h-5 w-5 " + progressClass, xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
183
|
+
/* @__PURE__ */ jsx3("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
184
|
+
/* @__PURE__ */ jsx3("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
185
|
+
] }) })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
showModal
|
|
190
|
+
] });
|
|
191
|
+
};
|
|
192
|
+
var Button_default = Button;
|
|
193
|
+
|
|
194
|
+
export {
|
|
195
|
+
ToastService_default,
|
|
196
|
+
ClientButton_default,
|
|
197
|
+
Button_default
|
|
198
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// src/components/StyleTypes.tsx
|
|
5
|
+
var buttonClasses = /* @__PURE__ */ new Map([
|
|
6
|
+
[
|
|
7
|
+
"Primary" /* Solid */,
|
|
8
|
+
"btn-solid relative inline-flex items-center justify-center rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out"
|
|
9
|
+
],
|
|
10
|
+
[
|
|
11
|
+
"PrimaryHollow" /* Hollow */,
|
|
12
|
+
"btn-hollow inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
|
|
13
|
+
],
|
|
14
|
+
["Link" /* Link */, "btn-link"]
|
|
15
|
+
]);
|
|
16
|
+
var progressClasses = /* @__PURE__ */ new Map([
|
|
17
|
+
["Primary" /* Solid */, ""],
|
|
18
|
+
["PrimaryHollow" /* Hollow */, ""],
|
|
19
|
+
["Link" /* Link */, ""]
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
buttonClasses,
|
|
24
|
+
progressClasses
|
|
25
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// src/components/controls/view/DateViewClient.tsx
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var DateViewClient = (props) => {
|
|
8
|
+
const [timeZoneAbbr, setTimeZoneAbbr] = useState("");
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const parts = new Intl.DateTimeFormat("en", {
|
|
11
|
+
timeZoneName: "short"
|
|
12
|
+
}).formatToParts(/* @__PURE__ */ new Date());
|
|
13
|
+
const abbr = parts.find((part) => part.type === "timeZoneName")?.value || "";
|
|
14
|
+
setTimeZoneAbbr(abbr);
|
|
15
|
+
}, []);
|
|
16
|
+
const toUtcDate = (dateString) => {
|
|
17
|
+
const s = dateString.trim();
|
|
18
|
+
if (!s) {
|
|
19
|
+
throw new Error("Empty date string");
|
|
20
|
+
}
|
|
21
|
+
const iso = s.replace(" ", "T");
|
|
22
|
+
const hasTimeZone = /Z$/i.test(iso) || /[+-]\d{2}:\d{2}$/.test(iso);
|
|
23
|
+
const utc = hasTimeZone ? iso : `${iso}Z`;
|
|
24
|
+
const date = new Date(utc);
|
|
25
|
+
if (Number.isNaN(date.getTime())) {
|
|
26
|
+
throw new Error(`Invalid date: ${dateString}`);
|
|
27
|
+
}
|
|
28
|
+
return date;
|
|
29
|
+
};
|
|
30
|
+
const formatDate = (date) => {
|
|
31
|
+
return new Intl.DateTimeFormat("en", {
|
|
32
|
+
day: "2-digit",
|
|
33
|
+
month: "short",
|
|
34
|
+
year: "numeric"
|
|
35
|
+
}).format(date);
|
|
36
|
+
};
|
|
37
|
+
const formatTime = (date) => {
|
|
38
|
+
return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
|
|
39
|
+
hour: "2-digit",
|
|
40
|
+
minute: "2-digit"
|
|
41
|
+
}).format(date) : new Intl.DateTimeFormat("en", {
|
|
42
|
+
hour: "2-digit",
|
|
43
|
+
minute: "2-digit",
|
|
44
|
+
second: "2-digit"
|
|
45
|
+
}).format(date);
|
|
46
|
+
};
|
|
47
|
+
const formatDateTime = (date) => {
|
|
48
|
+
return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
|
|
49
|
+
day: "2-digit",
|
|
50
|
+
month: "short",
|
|
51
|
+
year: "numeric",
|
|
52
|
+
hour: "2-digit",
|
|
53
|
+
minute: "2-digit"
|
|
54
|
+
}).format(date) : new Intl.DateTimeFormat("en", {
|
|
55
|
+
day: "2-digit",
|
|
56
|
+
month: "short",
|
|
57
|
+
year: "numeric",
|
|
58
|
+
hour: "2-digit",
|
|
59
|
+
minute: "2-digit",
|
|
60
|
+
second: "2-digit"
|
|
61
|
+
}).format(date);
|
|
62
|
+
};
|
|
63
|
+
const getTimePeriod = (date) => {
|
|
64
|
+
const hours = date.getHours();
|
|
65
|
+
if (hours >= 5 && hours < 8) return "Early Morning";
|
|
66
|
+
if (hours >= 8 && hours < 12) return "Morning";
|
|
67
|
+
if (hours >= 12 && hours < 14) return "Noon";
|
|
68
|
+
if (hours >= 14 && hours < 17) return "Afternoon";
|
|
69
|
+
if (hours >= 17 && hours < 20) return "Evening";
|
|
70
|
+
if (hours >= 20 && hours < 22) return "Late Evening";
|
|
71
|
+
return "Night";
|
|
72
|
+
};
|
|
73
|
+
const getRelativeTime = (dateString) => {
|
|
74
|
+
const now = /* @__PURE__ */ new Date();
|
|
75
|
+
const utcDate = toUtcDate(dateString);
|
|
76
|
+
const diffMs = now.getTime() - utcDate.getTime();
|
|
77
|
+
const diffSec = Math.floor(diffMs / 1e3);
|
|
78
|
+
const diffMin = Math.floor(diffSec / 60);
|
|
79
|
+
const diffHr = Math.floor(diffMin / 60);
|
|
80
|
+
const diffDay = Math.floor(diffHr / 24);
|
|
81
|
+
if (diffSec < 60) return "Just now";
|
|
82
|
+
if (diffMin < 60) return `${diffMin} minute${diffMin > 1 ? "s" : ""} ago`;
|
|
83
|
+
if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
|
|
84
|
+
if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
|
|
85
|
+
return formatDate(utcDate);
|
|
86
|
+
};
|
|
87
|
+
const parseAndFormatDate = (dateString, format) => {
|
|
88
|
+
if (format === "relative") {
|
|
89
|
+
return getRelativeTime(dateString);
|
|
90
|
+
}
|
|
91
|
+
const utcDate = toUtcDate(dateString);
|
|
92
|
+
switch (props.controlType) {
|
|
93
|
+
case "date":
|
|
94
|
+
return formatDate(utcDate);
|
|
95
|
+
case "time":
|
|
96
|
+
return `${formatTime(utcDate)} ${timeZoneAbbr} (${getTimePeriod(
|
|
97
|
+
utcDate
|
|
98
|
+
)})`;
|
|
99
|
+
default:
|
|
100
|
+
return formatDateTime(utcDate);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
let localDateTime = "";
|
|
104
|
+
try {
|
|
105
|
+
localDateTime = parseAndFormatDate(props.value, props.format);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("Error parsing date:", props.value, error);
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-wrap gap-1", children: [
|
|
110
|
+
/* @__PURE__ */ jsx("span", { children: localDateTime }),
|
|
111
|
+
!props.format && props.controlType !== "date" && props.controlType !== "datetime" && timeZoneAbbr && /* @__PURE__ */ jsx("span", { children: timeZoneAbbr })
|
|
112
|
+
] });
|
|
113
|
+
};
|
|
114
|
+
var DateViewClient_default = DateViewClient;
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
DateViewClient_default
|
|
118
|
+
};
|