@almadar/ui 2.1.0 → 2.1.2
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/{chunk-FZJ73RDM.js → chunk-LB3HXNAR.js} +8 -30
- package/dist/components/index.d.ts +1006 -1
- package/dist/components/index.js +2466 -201
- package/dist/hooks/index.js +2 -2
- package/dist/providers/index.js +1 -1
- package/package.json +1 -1
- package/dist/{chunk-6WHMUKED.js → chunk-BKC4XU44.js} +1 -1
|
@@ -9,7 +9,6 @@ import * as LucideIcons from 'lucide-react';
|
|
|
9
9
|
import { Loader2, ChevronDown, X, Check, Copy, AlertCircle, User, Sun, Moon, FileQuestion, Inbox, Search, Info, XCircle, CheckCircle, AlertTriangle, ChevronRight, Filter, Plus, ChevronLeft, HelpCircle, ChevronUp, MoreHorizontal, TrendingUp, TrendingDown, Minus, ArrowLeft, Calendar, Tag, Clock, CheckCircle2, DollarSign, FileText, Package } from 'lucide-react';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
12
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
13
12
|
import { createPortal } from 'react-dom';
|
|
14
13
|
import ReactMarkdown from 'react-markdown';
|
|
15
14
|
import remarkGfm from 'remark-gfm';
|
|
@@ -3097,15 +3096,6 @@ var Breadcrumb = ({
|
|
|
3097
3096
|
);
|
|
3098
3097
|
};
|
|
3099
3098
|
Breadcrumb.displayName = "Breadcrumb";
|
|
3100
|
-
function useSafeNavigate() {
|
|
3101
|
-
try {
|
|
3102
|
-
const navigate = useNavigate();
|
|
3103
|
-
return navigate;
|
|
3104
|
-
} catch {
|
|
3105
|
-
return () => {
|
|
3106
|
-
};
|
|
3107
|
-
}
|
|
3108
|
-
}
|
|
3109
3099
|
function useSafeEventBus() {
|
|
3110
3100
|
try {
|
|
3111
3101
|
return useEventBus();
|
|
@@ -3127,7 +3117,6 @@ var ButtonGroup = ({
|
|
|
3127
3117
|
entity: _entity,
|
|
3128
3118
|
filters
|
|
3129
3119
|
}) => {
|
|
3130
|
-
const navigate = useSafeNavigate();
|
|
3131
3120
|
const eventBus = useSafeEventBus();
|
|
3132
3121
|
const variantClasses2 = {
|
|
3133
3122
|
default: "gap-0",
|
|
@@ -3143,7 +3132,7 @@ var ButtonGroup = ({
|
|
|
3143
3132
|
eventBus.emit("UI:DISPATCH", { event: action.event });
|
|
3144
3133
|
}
|
|
3145
3134
|
if (action.navigatesTo) {
|
|
3146
|
-
|
|
3135
|
+
eventBus.emit("UI:NAVIGATE", { url: action.navigatesTo });
|
|
3147
3136
|
}
|
|
3148
3137
|
};
|
|
3149
3138
|
const renderFormActions = () => {
|
|
@@ -6482,7 +6471,6 @@ function DataTable({
|
|
|
6482
6471
|
null
|
|
6483
6472
|
);
|
|
6484
6473
|
const eventBus = useEventBus();
|
|
6485
|
-
const navigate = useNavigate();
|
|
6486
6474
|
const { t } = useTranslate();
|
|
6487
6475
|
const resolvedEmptyTitle = emptyTitle ?? t("table.empty.title");
|
|
6488
6476
|
const resolvedEmptyDescription = emptyDescription ?? t("table.empty.description");
|
|
@@ -6506,7 +6494,7 @@ function DataTable({
|
|
|
6506
6494
|
/\{\{id\}\}/g,
|
|
6507
6495
|
String(row.id)
|
|
6508
6496
|
);
|
|
6509
|
-
|
|
6497
|
+
eventBus.emit("UI:NAVIGATE", { url, row, entity });
|
|
6510
6498
|
return;
|
|
6511
6499
|
}
|
|
6512
6500
|
if (action.event) {
|
|
@@ -6528,13 +6516,13 @@ function DataTable({
|
|
|
6528
6516
|
/\{\{id\}\}/g,
|
|
6529
6517
|
String(row.id)
|
|
6530
6518
|
);
|
|
6531
|
-
|
|
6519
|
+
eventBus.emit("UI:NAVIGATE", { url, row, entity });
|
|
6532
6520
|
return;
|
|
6533
6521
|
}
|
|
6534
6522
|
eventBus.emit("UI:VIEW", { row, entity });
|
|
6535
6523
|
}
|
|
6536
6524
|
},
|
|
6537
|
-
[viewAction,
|
|
6525
|
+
[viewAction, eventBus, entity]
|
|
6538
6526
|
);
|
|
6539
6527
|
const isRowClickable = !!viewAction;
|
|
6540
6528
|
const effectiveColumns = fields ?? columns ?? [];
|
|
@@ -7054,24 +7042,16 @@ var PageHeader = ({
|
|
|
7054
7042
|
children,
|
|
7055
7043
|
className
|
|
7056
7044
|
}) => {
|
|
7057
|
-
const navigate = useNavigate();
|
|
7058
|
-
const params = useParams();
|
|
7059
7045
|
const eventBus = useEventBus();
|
|
7060
7046
|
const handleBack = () => {
|
|
7061
7047
|
eventBus.emit(`UI:${backEvent}`);
|
|
7062
7048
|
};
|
|
7063
|
-
const replacePlaceholders = (url) => {
|
|
7064
|
-
return url.replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
7065
|
-
return String(params[key] || "");
|
|
7066
|
-
});
|
|
7067
|
-
};
|
|
7068
7049
|
const createActionHandler = (action) => () => {
|
|
7069
7050
|
if (action.event) {
|
|
7070
7051
|
eventBus.emit(`UI:${action.event}`);
|
|
7071
7052
|
}
|
|
7072
7053
|
if (action.navigatesTo) {
|
|
7073
|
-
|
|
7074
|
-
navigate(resolvedUrl);
|
|
7054
|
+
eventBus.emit("UI:NAVIGATE", { url: action.navigatesTo });
|
|
7075
7055
|
}
|
|
7076
7056
|
if (action.onClick) {
|
|
7077
7057
|
action.onClick();
|
|
@@ -7246,7 +7226,6 @@ var DetailPanel = ({
|
|
|
7246
7226
|
isLoading = false,
|
|
7247
7227
|
error
|
|
7248
7228
|
}) => {
|
|
7249
|
-
const navigate = useNavigate();
|
|
7250
7229
|
const eventBus = useEventBus();
|
|
7251
7230
|
const isFieldDefArray = (arr) => {
|
|
7252
7231
|
if (!arr || arr.length === 0) return false;
|
|
@@ -7261,7 +7240,7 @@ var DetailPanel = ({
|
|
|
7261
7240
|
/\{\{(\w+)\}\}/g,
|
|
7262
7241
|
(_, key) => String(data2?.[key] ?? "")
|
|
7263
7242
|
);
|
|
7264
|
-
|
|
7243
|
+
eventBus.emit("UI:NAVIGATE", { url, row: data2, entity });
|
|
7265
7244
|
return;
|
|
7266
7245
|
}
|
|
7267
7246
|
if (action.event) {
|
|
@@ -7271,7 +7250,7 @@ var DetailPanel = ({
|
|
|
7271
7250
|
action.onClick();
|
|
7272
7251
|
}
|
|
7273
7252
|
},
|
|
7274
|
-
[
|
|
7253
|
+
[eventBus, entity]
|
|
7275
7254
|
);
|
|
7276
7255
|
const handleClose = useCallback(() => {
|
|
7277
7256
|
eventBus.emit("UI:CLOSE", {});
|
|
@@ -8084,7 +8063,6 @@ var CardGrid = ({
|
|
|
8084
8063
|
showTotal = true
|
|
8085
8064
|
}) => {
|
|
8086
8065
|
const eventBus = useEventBus();
|
|
8087
|
-
const navigate = useNavigate();
|
|
8088
8066
|
const effectiveFieldNames = normalizeFields(fields).length > 0 ? normalizeFields(fields) : fieldNames ?? normalizeFields(columns);
|
|
8089
8067
|
const gridTemplateColumns = `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
8090
8068
|
const normalizedData = Array.isArray(externalData) ? externalData : externalData ? [externalData] : [];
|
|
@@ -8133,7 +8111,7 @@ var CardGrid = ({
|
|
|
8133
8111
|
const value = getNestedValue(itemData, field);
|
|
8134
8112
|
return value !== void 0 && value !== null ? String(value) : "";
|
|
8135
8113
|
});
|
|
8136
|
-
|
|
8114
|
+
eventBus.emit("UI:NAVIGATE", { url, row: itemData, entity });
|
|
8137
8115
|
return;
|
|
8138
8116
|
}
|
|
8139
8117
|
if (action.event) {
|