@juv/codego-react-ui 3.3.3 → 3.3.6
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.cjs +144 -16
- package/dist/index.d.cts +120 -2
- package/dist/index.d.ts +120 -2
- package/dist/index.global.js +496 -130
- package/dist/index.js +142 -16
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -124,6 +124,8 @@ __export(index_exports, {
|
|
|
124
124
|
TreeView: () => TreeView,
|
|
125
125
|
Widget: () => Widget,
|
|
126
126
|
Wizard: () => Wizard,
|
|
127
|
+
api: () => api,
|
|
128
|
+
createStore: () => createStore,
|
|
127
129
|
useServerBulletin: () => useServerBulletin,
|
|
128
130
|
useServerDataGrid: () => useServerDataGrid,
|
|
129
131
|
useServerTable: () => useServerTable,
|
|
@@ -940,7 +942,7 @@ var Input = React3.forwardRef(
|
|
|
940
942
|
id: inputId,
|
|
941
943
|
placeholder: placeholder ?? (inputType === "date" ? "MM/DD/YYYY" : inputType === "dateTime" ? "MM/DD/YYYY HH:mm" : inputType === "time" ? "HH:mm" : void 0),
|
|
942
944
|
className: cn(
|
|
943
|
-
"flex h-10 w-full rounded-xl border
|
|
945
|
+
"flex h-10 w-full rounded-xl border bg-background/50 backdrop-blur-sm px-3 py-5 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors hover:bg-background/80 dark:bg-gray-400/5 dark:hover:bg-gray-400/25 dark:focus:bg-gray-400/20",
|
|
944
946
|
hasLeftAddon && "pl-10",
|
|
945
947
|
(hasRightAddon || hasReveal) && "pr-10",
|
|
946
948
|
(readOnly || isDateType) && "bg-muted cursor-pointer",
|
|
@@ -3183,7 +3185,7 @@ function Combobox({
|
|
|
3183
3185
|
"aria-required": required,
|
|
3184
3186
|
"aria-invalid": !!error,
|
|
3185
3187
|
className: cn(
|
|
3186
|
-
"flex w-full items-center justify-between gap-2 rounded-xl border border-border bg-background px-3 py-2 text-sm transition-colors
|
|
3188
|
+
"flex w-full items-center justify-between gap-2 rounded-xl border-2 border-border bg-background px-3 py-2 text-sm transition-colors dark:bg-gray-400/5 dark:hover:bg-gray-400/25 dark:focus:bg-gray-400/20",
|
|
3187
3189
|
"hover:border-primary/40 focus:outline-none focus:ring-2 focus:ring-ring",
|
|
3188
3190
|
open && "border-primary ring-2 ring-ring",
|
|
3189
3191
|
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
@@ -4726,7 +4728,7 @@ function TagInput({
|
|
|
4726
4728
|
"div",
|
|
4727
4729
|
{
|
|
4728
4730
|
className: cn(
|
|
4729
|
-
"flex flex-wrap gap-1.5 min-h-10 w-full rounded-xl border border-border bg-background px-3 py-2 text-sm transition-colors
|
|
4731
|
+
"flex flex-wrap gap-1.5 min-h-10 w-full rounded-xl border-2 border-border bg-background px-3 py-2 text-sm transition-colors dark:bg-gray-400/5 dark:focus:bg-gray-100/40",
|
|
4730
4732
|
"focus-within:ring-2 focus-within:ring-ring focus-within:border-primary",
|
|
4731
4733
|
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
4732
4734
|
error && "border-destructive focus-within:ring-destructive",
|
|
@@ -4832,7 +4834,7 @@ function OtpInput({
|
|
|
4832
4834
|
"aria-required": required,
|
|
4833
4835
|
"aria-invalid": !!(error || invalid),
|
|
4834
4836
|
className: cn(
|
|
4835
|
-
"h-12 w-10 rounded-xl border text-center text-lg font-semibold bg-background transition-all outline-none
|
|
4837
|
+
"h-12 w-10 rounded-xl border-2 border-border text-center text-lg font-semibold bg-background transition-all outline-none dark:bg-gray-400/5 dark:hover:bg-gray-400/25 dark:focus:bg-gray-400/20",
|
|
4836
4838
|
"focus:ring-2 focus:ring-ring focus:border-primary",
|
|
4837
4839
|
invalid ? "border-danger focus:ring-danger" : "border-border",
|
|
4838
4840
|
disabled && "opacity-50 cursor-not-allowed",
|
|
@@ -4950,9 +4952,9 @@ function DateRangePicker({
|
|
|
4950
4952
|
disabled,
|
|
4951
4953
|
onClick: () => open ? setOpen(false) : openPicker(),
|
|
4952
4954
|
className: cn(
|
|
4953
|
-
"flex w-full items-center gap-2 rounded-xl border border-border bg-background px-3 py-2 text-sm transition-colors",
|
|
4955
|
+
"flex w-full items-center gap-2 rounded-xl border-2 border-border bg-background px-3 py-2 text-sm transition-colors",
|
|
4954
4956
|
"hover:border-primary/40 focus:outline-none focus:ring-2 focus:ring-ring",
|
|
4955
|
-
"dark:
|
|
4957
|
+
"dark:bg-gray-400/5",
|
|
4956
4958
|
open && "border-primary ring-2 ring-ring",
|
|
4957
4959
|
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
4958
4960
|
!range2.from && "text-muted-foreground"
|
|
@@ -6013,7 +6015,7 @@ var Textarea = React26.forwardRef(
|
|
|
6013
6015
|
onBlur?.(e);
|
|
6014
6016
|
};
|
|
6015
6017
|
const grammarly = disableGrammarly ? { "data-gramm": "false", "data-gramm_editor": "false", "data-enable-grammarly": "false" } : {};
|
|
6016
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative
|
|
6018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "relative w-full", children: [
|
|
6017
6019
|
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "block text-sm font-medium text-foreground mb-2", children: [
|
|
6018
6020
|
label,
|
|
6019
6021
|
required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
@@ -6035,7 +6037,7 @@ var Textarea = React26.forwardRef(
|
|
|
6035
6037
|
"aria-required": required,
|
|
6036
6038
|
"aria-invalid": !!error,
|
|
6037
6039
|
className: cn(
|
|
6038
|
-
"w-full rounded-xl border border-
|
|
6040
|
+
"w-full rounded-xl border-2 border-border bg-background/50 backdrop-blur-sm px-4 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 transition-colors hover:bg-background/80 dark:bg-gray-400/5 dark:hover:bg-gray-400/25 dark:focus:bg-gray-400/20",
|
|
6039
6041
|
readOnly && "cursor-default bg-muted/40 focus-visible:ring-0",
|
|
6040
6042
|
autosize && "resize-none overflow-hidden",
|
|
6041
6043
|
error && "border-destructive focus-visible:ring-destructive",
|
|
@@ -6403,7 +6405,7 @@ var import_react_dom2 = require("react-dom");
|
|
|
6403
6405
|
var import_axios3 = __toESM(require("axios"), 1);
|
|
6404
6406
|
var import_lucide_react17 = require("lucide-react");
|
|
6405
6407
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6406
|
-
function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOverrides }) {
|
|
6408
|
+
function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOverrides, debounce = 300, transform, manual = false, onSuccess, onError }) {
|
|
6407
6409
|
const [data, setData] = React28.useState([]);
|
|
6408
6410
|
const [columns, setColumns] = React28.useState([]);
|
|
6409
6411
|
const [currentPage, setCurrentPage] = React28.useState(1);
|
|
@@ -6411,17 +6413,22 @@ function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOv
|
|
|
6411
6413
|
const [loading, setLoading] = React28.useState(false);
|
|
6412
6414
|
const [error, setError] = React28.useState(null);
|
|
6413
6415
|
const [tick, setTick] = React28.useState(0);
|
|
6416
|
+
const [searchValue, setSearchValue] = React28.useState("");
|
|
6417
|
+
const debounceTimer = React28.useRef(void 0);
|
|
6414
6418
|
React28.useEffect(() => {
|
|
6419
|
+
if (manual && tick === 0) return;
|
|
6415
6420
|
let cancelled = false;
|
|
6416
6421
|
setLoading(true);
|
|
6417
6422
|
setError(null);
|
|
6418
6423
|
import_axios3.default.get(url, {
|
|
6419
|
-
params: { ...params, page: currentPage }
|
|
6424
|
+
params: { ...params, page: currentPage, search: searchValue }
|
|
6420
6425
|
}).then(({ data: res }) => {
|
|
6421
6426
|
if (cancelled) return;
|
|
6422
6427
|
const payload = encrypt ? decryptLaravelPayload(res, key) : res;
|
|
6423
6428
|
if (encrypt && decryptPayloadLog) console.log("[useServerTable] decrypted payload:", payload);
|
|
6424
|
-
|
|
6429
|
+
const transformed = transform ? transform(payload) : payload.data;
|
|
6430
|
+
setData(transformed);
|
|
6431
|
+
onSuccess?.(transformed);
|
|
6425
6432
|
const rawTotal = payload.total;
|
|
6426
6433
|
const rawPerPage = payload.per_page;
|
|
6427
6434
|
const rawLastPage = payload.last_page;
|
|
@@ -6437,9 +6444,9 @@ function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOv
|
|
|
6437
6444
|
links: payload.links ?? []
|
|
6438
6445
|
};
|
|
6439
6446
|
setPagination(pg);
|
|
6440
|
-
if (
|
|
6447
|
+
if (transformed.length > 0) {
|
|
6441
6448
|
setColumns(
|
|
6442
|
-
Object.keys(
|
|
6449
|
+
Object.keys(transformed[0]).map((k) => {
|
|
6443
6450
|
const columnKey = k;
|
|
6444
6451
|
return {
|
|
6445
6452
|
key: columnKey,
|
|
@@ -6451,14 +6458,24 @@ function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOv
|
|
|
6451
6458
|
}
|
|
6452
6459
|
}).catch((err) => {
|
|
6453
6460
|
if (cancelled) return;
|
|
6454
|
-
|
|
6461
|
+
const errorMsg = err?.response?.data?.message ?? err.message ?? "Request failed";
|
|
6462
|
+
setError(errorMsg);
|
|
6463
|
+
onError?.(new Error(errorMsg));
|
|
6455
6464
|
}).finally(() => {
|
|
6456
6465
|
if (!cancelled) setLoading(false);
|
|
6457
6466
|
});
|
|
6458
6467
|
return () => {
|
|
6459
6468
|
cancelled = true;
|
|
6460
6469
|
};
|
|
6461
|
-
}, [url, currentPage, tick, JSON.stringify(params), encrypt, decryptPayloadLog, JSON.stringify(columnOverrides)]);
|
|
6470
|
+
}, [url, currentPage, tick, JSON.stringify(params), encrypt, decryptPayloadLog, JSON.stringify(columnOverrides), searchValue]);
|
|
6471
|
+
const handleSearchChange = (value) => {
|
|
6472
|
+
setSearchValue(value);
|
|
6473
|
+
setCurrentPage(1);
|
|
6474
|
+
if (debounceTimer.current) clearTimeout(debounceTimer.current);
|
|
6475
|
+
debounceTimer.current = setTimeout(() => {
|
|
6476
|
+
setTick((t) => t + 1);
|
|
6477
|
+
}, debounce);
|
|
6478
|
+
};
|
|
6462
6479
|
return {
|
|
6463
6480
|
data,
|
|
6464
6481
|
columns,
|
|
@@ -6468,7 +6485,9 @@ function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOv
|
|
|
6468
6485
|
loading,
|
|
6469
6486
|
error,
|
|
6470
6487
|
goToPage: (page) => setCurrentPage(page),
|
|
6471
|
-
reload: () => setTick((t) => t + 1)
|
|
6488
|
+
reload: () => setTick((t) => t + 1),
|
|
6489
|
+
searchValue,
|
|
6490
|
+
onSearchChange: handleSearchChange
|
|
6472
6491
|
};
|
|
6473
6492
|
}
|
|
6474
6493
|
var MODAL_WIDTH = {
|
|
@@ -12800,6 +12819,113 @@ function Wizard({
|
|
|
12800
12819
|
className
|
|
12801
12820
|
), children: panel });
|
|
12802
12821
|
}
|
|
12822
|
+
|
|
12823
|
+
// src/lib/codego/axiosInstance.ts
|
|
12824
|
+
var import_axios5 = __toESM(require("axios"), 1);
|
|
12825
|
+
var axiosInstance = import_axios5.default.create({
|
|
12826
|
+
baseURL: "/",
|
|
12827
|
+
timeout: 1e4,
|
|
12828
|
+
headers: {
|
|
12829
|
+
"Content-Type": "application/json",
|
|
12830
|
+
Accept: "application/json"
|
|
12831
|
+
}
|
|
12832
|
+
});
|
|
12833
|
+
|
|
12834
|
+
// src/lib/codego/request.ts
|
|
12835
|
+
var request = async (config) => {
|
|
12836
|
+
try {
|
|
12837
|
+
const response = await axiosInstance(config);
|
|
12838
|
+
return response.data;
|
|
12839
|
+
} catch (error) {
|
|
12840
|
+
throw error.response?.data || error;
|
|
12841
|
+
}
|
|
12842
|
+
};
|
|
12843
|
+
|
|
12844
|
+
// src/lib/codego/interceptors.ts
|
|
12845
|
+
var toastFn = null;
|
|
12846
|
+
var setupInterceptors = () => {
|
|
12847
|
+
axiosInstance.interceptors.request.use(
|
|
12848
|
+
(config) => {
|
|
12849
|
+
const token = localStorage.getItem("token");
|
|
12850
|
+
if (token && !config.skipAuth) {
|
|
12851
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
12852
|
+
}
|
|
12853
|
+
return config;
|
|
12854
|
+
},
|
|
12855
|
+
(error) => Promise.reject(error)
|
|
12856
|
+
);
|
|
12857
|
+
axiosInstance.interceptors.response.use(
|
|
12858
|
+
(response) => {
|
|
12859
|
+
const config = response.config;
|
|
12860
|
+
if (config.onSuccessNotification && toastFn) {
|
|
12861
|
+
toastFn.toast({
|
|
12862
|
+
variant: "success",
|
|
12863
|
+
title: config.successNotifTitle || "Success",
|
|
12864
|
+
description: config.successNotifContent || "Operation completed successfully"
|
|
12865
|
+
});
|
|
12866
|
+
}
|
|
12867
|
+
return response;
|
|
12868
|
+
},
|
|
12869
|
+
(error) => {
|
|
12870
|
+
const config = error.config;
|
|
12871
|
+
if (config?.onErrorNotification && toastFn) {
|
|
12872
|
+
toastFn.toast({
|
|
12873
|
+
variant: "error",
|
|
12874
|
+
title: config.errorNotifTitle || "Error",
|
|
12875
|
+
description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
|
|
12876
|
+
});
|
|
12877
|
+
}
|
|
12878
|
+
if (error.response?.status === 401) {
|
|
12879
|
+
console.warn("Unauthorized - redirect login");
|
|
12880
|
+
}
|
|
12881
|
+
return Promise.reject(error);
|
|
12882
|
+
}
|
|
12883
|
+
);
|
|
12884
|
+
};
|
|
12885
|
+
|
|
12886
|
+
// src/lib/codego/index.ts
|
|
12887
|
+
setupInterceptors();
|
|
12888
|
+
var api = {
|
|
12889
|
+
get: (url, config) => request({ method: "GET", url, ...config }),
|
|
12890
|
+
post: (url, data, config) => request({ method: "POST", url, data, ...config }),
|
|
12891
|
+
put: (url, data, config) => request({ method: "PUT", url, data, ...config }),
|
|
12892
|
+
patch: (url, data, config) => request({ method: "PATCH", url, data, ...config }),
|
|
12893
|
+
delete: (url, config) => request({ method: "DELETE", url, ...config })
|
|
12894
|
+
};
|
|
12895
|
+
|
|
12896
|
+
// src/core/storage/store.ts
|
|
12897
|
+
var import_zustand = require("zustand");
|
|
12898
|
+
var import_middleware = require("zustand/middleware");
|
|
12899
|
+
function createStore(initialValue, sessionName, expireInterval) {
|
|
12900
|
+
if (expireInterval) {
|
|
12901
|
+
const expireKey = `${sessionName}_expires`;
|
|
12902
|
+
const now = Date.now();
|
|
12903
|
+
const storedExpire = localStorage.getItem(expireKey);
|
|
12904
|
+
if (storedExpire && now > parseInt(storedExpire)) {
|
|
12905
|
+
localStorage.removeItem(sessionName);
|
|
12906
|
+
localStorage.removeItem(expireKey);
|
|
12907
|
+
}
|
|
12908
|
+
localStorage.setItem(expireKey, (now + expireInterval).toString());
|
|
12909
|
+
}
|
|
12910
|
+
const store = (0, import_zustand.create)()(
|
|
12911
|
+
(0, import_middleware.persist)(
|
|
12912
|
+
(set) => ({
|
|
12913
|
+
...initialValue,
|
|
12914
|
+
set: (val) => set((prev) => ({ ...prev, ...val }))
|
|
12915
|
+
}),
|
|
12916
|
+
{
|
|
12917
|
+
name: sessionName,
|
|
12918
|
+
storage: (0, import_middleware.createJSONStorage)(() => localStorage)
|
|
12919
|
+
}
|
|
12920
|
+
)
|
|
12921
|
+
);
|
|
12922
|
+
const getStore = () => {
|
|
12923
|
+
const state = store.getState();
|
|
12924
|
+
const { set, ...rest } = state;
|
|
12925
|
+
return JSON.stringify(rest);
|
|
12926
|
+
};
|
|
12927
|
+
return { store, getStore };
|
|
12928
|
+
}
|
|
12803
12929
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12804
12930
|
0 && (module.exports = {
|
|
12805
12931
|
Accordion,
|
|
@@ -12897,6 +13023,8 @@ function Wizard({
|
|
|
12897
13023
|
TreeView,
|
|
12898
13024
|
Widget,
|
|
12899
13025
|
Wizard,
|
|
13026
|
+
api,
|
|
13027
|
+
createStore,
|
|
12900
13028
|
useServerBulletin,
|
|
12901
13029
|
useServerDataGrid,
|
|
12902
13030
|
useServerTable,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import { AxiosRequestConfig } from 'axios';
|
|
5
|
+
import { UseBoundStore, StoreApi } from 'zustand';
|
|
4
6
|
|
|
5
7
|
type AuthView = "login" | "register" | "resetPassword";
|
|
6
8
|
interface AuthField {
|
|
@@ -248,6 +250,16 @@ interface UseServerTableOptions {
|
|
|
248
250
|
* Example: { status: { type: "badge" }, enabled: { type: "toggle", onChange: (item, v) => patch(item.id, v) } }
|
|
249
251
|
*/
|
|
250
252
|
columnOverrides?: Record<string, Partial<Column<any>>>;
|
|
253
|
+
/** Debounce delay for search in milliseconds. Default 300ms */
|
|
254
|
+
debounce?: number;
|
|
255
|
+
/** Transform API response to T[]. Default: (res) => res.data */
|
|
256
|
+
transform?: (response: any) => any[];
|
|
257
|
+
/** If true, hook won't fetch automatically. Call reload() manually */
|
|
258
|
+
manual?: boolean;
|
|
259
|
+
/** Called after successful data fetch */
|
|
260
|
+
onSuccess?: (data: any[]) => void;
|
|
261
|
+
/** Called on fetch error */
|
|
262
|
+
onError?: (error: Error) => void;
|
|
251
263
|
}
|
|
252
264
|
/**
|
|
253
265
|
* Return type from the useServerTable hook
|
|
@@ -264,6 +276,8 @@ interface UseServerTableReturn<T> {
|
|
|
264
276
|
error: string | null;
|
|
265
277
|
goToPage: (page: number) => void;
|
|
266
278
|
reload: () => void;
|
|
279
|
+
searchValue?: string;
|
|
280
|
+
onSearchChange?: (value: string) => void;
|
|
267
281
|
}
|
|
268
282
|
/**
|
|
269
283
|
* Server-side pagination prop passed to the Table component
|
|
@@ -290,7 +304,7 @@ interface ServerPaginationProp {
|
|
|
290
304
|
* })
|
|
291
305
|
* ```
|
|
292
306
|
*/
|
|
293
|
-
declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key, decryptPayloadLog, columnOverrides }: UseServerTableOptions): UseServerTableReturn<T>;
|
|
307
|
+
declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key, decryptPayloadLog, columnOverrides, debounce, transform, manual, onSuccess, onError }: UseServerTableOptions): UseServerTableReturn<T>;
|
|
294
308
|
/**
|
|
295
309
|
* Available field types for action forms (edit/view modals)
|
|
296
310
|
* @type {ActionFieldType}
|
|
@@ -331,6 +345,8 @@ interface ActionField {
|
|
|
331
345
|
rowSpan?: number;
|
|
332
346
|
/** Custom render — overrides built-in field renderer */
|
|
333
347
|
render?: (value: any, onChange: (v: any) => void) => React.ReactNode;
|
|
348
|
+
/** Hide this field from view/edit forms */
|
|
349
|
+
hidden?: boolean;
|
|
334
350
|
}
|
|
335
351
|
/**
|
|
336
352
|
* Configuration for customizing the appearance of action buttons (View/Edit/Delete)
|
|
@@ -415,6 +431,21 @@ interface DefaultActionsConfig<T> {
|
|
|
415
431
|
onSuccess?: (action: "edit" | "delete", item: T) => void;
|
|
416
432
|
/** Show a toast or notification banner on successful edit/delete */
|
|
417
433
|
onSuccessNotif?: ActionSuccessNotif;
|
|
434
|
+
/** Delete confirmation dialog config */
|
|
435
|
+
deleteConfirm?: {
|
|
436
|
+
title: string;
|
|
437
|
+
message: string;
|
|
438
|
+
};
|
|
439
|
+
/** Role/permission-based visibility for actions */
|
|
440
|
+
permissions?: (item: T) => {
|
|
441
|
+
view?: boolean;
|
|
442
|
+
edit?: boolean;
|
|
443
|
+
delete?: boolean;
|
|
444
|
+
};
|
|
445
|
+
/** Hook called before edit — return false to cancel */
|
|
446
|
+
beforeEdit?: (item: T) => Promise<boolean>;
|
|
447
|
+
/** Hook called before delete — return false to cancel */
|
|
448
|
+
beforeDelete?: (item: T) => Promise<boolean>;
|
|
418
449
|
/** Customize the View button appearance */
|
|
419
450
|
viewButton?: ActionButtonConfig;
|
|
420
451
|
/** Customize the Edit button appearance */
|
|
@@ -500,6 +531,20 @@ interface Column<T> {
|
|
|
500
531
|
sortable?: boolean;
|
|
501
532
|
/** Called when a cell value changes (select, toggle, color, checkbox) */
|
|
502
533
|
onChange?: (item: T, value: any) => void;
|
|
534
|
+
/** Column width in px or CSS string */
|
|
535
|
+
width?: number | string;
|
|
536
|
+
/** Text alignment: left, center, right */
|
|
537
|
+
align?: "left" | "center" | "right";
|
|
538
|
+
/** Enable column-level filtering */
|
|
539
|
+
filterable?: boolean;
|
|
540
|
+
/** Filter type: text, select, date, range */
|
|
541
|
+
filterType?: "text" | "select" | "date" | "range";
|
|
542
|
+
/** Hide this column */
|
|
543
|
+
hidden?: boolean;
|
|
544
|
+
/** Tooltip text generator */
|
|
545
|
+
tooltip?: (item: T) => string;
|
|
546
|
+
/** Allow copying cell content */
|
|
547
|
+
copyable?: boolean;
|
|
503
548
|
}
|
|
504
549
|
/**
|
|
505
550
|
* Props for the Table component
|
|
@@ -509,6 +554,37 @@ interface Column<T> {
|
|
|
509
554
|
interface TableProps<T> {
|
|
510
555
|
data: T[];
|
|
511
556
|
columns: Column<T>[];
|
|
557
|
+
loading?: boolean;
|
|
558
|
+
emptyState?: React.ReactNode;
|
|
559
|
+
error?: string | null;
|
|
560
|
+
searchValue?: string;
|
|
561
|
+
onSearchChange?: (value: string) => void;
|
|
562
|
+
page?: number;
|
|
563
|
+
onPageChange?: (page: number) => void;
|
|
564
|
+
sort?: {
|
|
565
|
+
key: string;
|
|
566
|
+
direction: "asc" | "desc";
|
|
567
|
+
}[];
|
|
568
|
+
onSortChange?: (sort: {
|
|
569
|
+
key: string;
|
|
570
|
+
direction: "asc" | "desc";
|
|
571
|
+
}[]) => void;
|
|
572
|
+
onRowClick?: (item: T) => void;
|
|
573
|
+
onRowDoubleClick?: (item: T) => void;
|
|
574
|
+
rowClassName?: (item: T) => string;
|
|
575
|
+
expandable?: boolean;
|
|
576
|
+
renderExpanded?: (item: T) => React.ReactNode;
|
|
577
|
+
columnVisibility?: Record<string, boolean>;
|
|
578
|
+
onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;
|
|
579
|
+
exportable?: boolean;
|
|
580
|
+
onExport?: (type: "csv" | "excel" | "pdf") => void;
|
|
581
|
+
virtualized?: boolean;
|
|
582
|
+
draggable?: boolean;
|
|
583
|
+
onRowReorder?: (data: T[]) => void;
|
|
584
|
+
keyboardNavigation?: boolean;
|
|
585
|
+
theme?: "light" | "dark" | "auto";
|
|
586
|
+
meta?: Record<string, any>;
|
|
587
|
+
actions?: Record<string, (item: T) => void>;
|
|
512
588
|
searchable?: boolean;
|
|
513
589
|
searchPlaceholder?: string;
|
|
514
590
|
pagination?: boolean;
|
|
@@ -2300,4 +2376,46 @@ interface WizardProps {
|
|
|
2300
2376
|
}
|
|
2301
2377
|
declare function Wizard({ steps, step: controlledStep, defaultStep, onStepChange, onFinish, onClose, layout, variant, size, isOpen, showClose, unchange, title, description, hideHeader, footer, renderActions, backLabel, nextLabel, finishLabel, cancelLabel, showCancel, showBackOnFirst, loading, clickableSteps, className, contentClassName, }: WizardProps): react_jsx_runtime.JSX.Element;
|
|
2302
2378
|
|
|
2303
|
-
|
|
2379
|
+
interface NotificationConfig {
|
|
2380
|
+
/** Show success notification */
|
|
2381
|
+
onSuccessNotification?: boolean;
|
|
2382
|
+
/** Success notification title */
|
|
2383
|
+
successNotifTitle?: string;
|
|
2384
|
+
/** Success notification content/message */
|
|
2385
|
+
successNotifContent?: string;
|
|
2386
|
+
/** Show error notification */
|
|
2387
|
+
onErrorNotification?: boolean;
|
|
2388
|
+
/** Error notification title */
|
|
2389
|
+
errorNotifTitle?: string;
|
|
2390
|
+
/** Error notification content/message */
|
|
2391
|
+
errorNotifContent?: string;
|
|
2392
|
+
}
|
|
2393
|
+
interface RequestConfig<T = any> extends AxiosRequestConfig, NotificationConfig {
|
|
2394
|
+
data?: T;
|
|
2395
|
+
skipAuth?: boolean;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
declare const api: {
|
|
2399
|
+
get: <R = any>(url: string, config?: RequestConfig) => Promise<R>;
|
|
2400
|
+
post: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
|
|
2401
|
+
put: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
|
|
2402
|
+
patch: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
|
|
2403
|
+
delete: <R = any>(url: string, config?: RequestConfig) => Promise<R>;
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
type StoreWrapper<T extends object> = {
|
|
2407
|
+
store: UseBoundStore<StoreApi<T & {
|
|
2408
|
+
set: (val: Partial<T>) => void;
|
|
2409
|
+
}>>;
|
|
2410
|
+
getStore: () => string;
|
|
2411
|
+
};
|
|
2412
|
+
/**
|
|
2413
|
+
* Create a universal Zustand store with optional auto-expire
|
|
2414
|
+
*
|
|
2415
|
+
* @param initialValue - Initial state object
|
|
2416
|
+
* @param sessionName - Key for localStorage persistence
|
|
2417
|
+
* @param expireInterval - Optional expiration in milliseconds
|
|
2418
|
+
*/
|
|
2419
|
+
declare function createStore<T extends object>(initialValue: T, sessionName: string, expireInterval?: number): StoreWrapper<T>;
|
|
2420
|
+
|
|
2421
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
|