@almadar/ui 4.12.1 → 4.13.0
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/avl/index.cjs +82 -11
- package/dist/avl/index.js +82 -11
- package/dist/components/index.cjs +53 -6
- package/dist/components/index.js +53 -6
- package/dist/components/molecules/DataGrid.d.ts +1 -1
- package/dist/components/molecules/DataList.d.ts +1 -1
- package/dist/providers/index.cjs +53 -6
- package/dist/providers/index.js +53 -6
- package/dist/runtime/index.cjs +82 -11
- package/dist/runtime/index.js +82 -11
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -8185,13 +8185,13 @@ var init_MapView = __esm({
|
|
|
8185
8185
|
shadowSize: [41, 41]
|
|
8186
8186
|
});
|
|
8187
8187
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
8188
|
-
const { useEffect:
|
|
8188
|
+
const { useEffect: useEffect70, useRef: useRef65, useCallback: useCallback110, useState: useState103 } = React115__default;
|
|
8189
8189
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
8190
8190
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
8191
8191
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
8192
8192
|
const map = useMap();
|
|
8193
8193
|
const prevRef = useRef65({ centerLat, centerLng, zoom });
|
|
8194
|
-
|
|
8194
|
+
useEffect70(() => {
|
|
8195
8195
|
const prev = prevRef.current;
|
|
8196
8196
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
8197
8197
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -8202,7 +8202,7 @@ var init_MapView = __esm({
|
|
|
8202
8202
|
}
|
|
8203
8203
|
function MapClickHandler({ onMapClick }) {
|
|
8204
8204
|
const map = useMap();
|
|
8205
|
-
|
|
8205
|
+
useEffect70(() => {
|
|
8206
8206
|
if (!onMapClick) return;
|
|
8207
8207
|
const handler = (e) => {
|
|
8208
8208
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -18557,7 +18557,8 @@ function DataGrid({
|
|
|
18557
18557
|
loadMoreEvent,
|
|
18558
18558
|
hasMore,
|
|
18559
18559
|
children,
|
|
18560
|
-
pageSize = 0
|
|
18560
|
+
pageSize = 0,
|
|
18561
|
+
renderItem: schemaRenderItem
|
|
18561
18562
|
}) {
|
|
18562
18563
|
const eventBus = useEventBus();
|
|
18563
18564
|
const { t } = useTranslate();
|
|
@@ -18622,6 +18623,26 @@ function DataGrid({
|
|
|
18622
18623
|
return /* @__PURE__ */ jsx(Box, { className: "text-center py-12", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
|
|
18623
18624
|
}
|
|
18624
18625
|
const hasRenderProp = typeof children === "function";
|
|
18626
|
+
useEffect(() => {
|
|
18627
|
+
const renderItemTypeOf = typeof schemaRenderItem;
|
|
18628
|
+
const childrenTypeOf = typeof children;
|
|
18629
|
+
if (data.length > 0 && !hasRenderProp) {
|
|
18630
|
+
const firstRow = data[0];
|
|
18631
|
+
const sampleKeys = firstRow ? Object.keys(firstRow).slice(0, 6) : [];
|
|
18632
|
+
const renderItemRaw = schemaRenderItem;
|
|
18633
|
+
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
18634
|
+
dataGridLog.warn("renderItem-unresolved", {
|
|
18635
|
+
rowCount: data.length,
|
|
18636
|
+
fieldsCount: fields?.length ?? 0,
|
|
18637
|
+
renderItemTypeOf,
|
|
18638
|
+
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
18639
|
+
renderItemIsFnLambda: isFnLambda,
|
|
18640
|
+
renderItemHead: Array.isArray(renderItemRaw) ? String(renderItemRaw[0]) : void 0,
|
|
18641
|
+
childrenTypeOf,
|
|
18642
|
+
sampleRowKeys: sampleKeys
|
|
18643
|
+
});
|
|
18644
|
+
}
|
|
18645
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fields]);
|
|
18625
18646
|
const allIds = data.map((item, i) => item.id || String(i));
|
|
18626
18647
|
const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
|
|
18627
18648
|
const someSelected = selectedIds.size > 0;
|
|
@@ -18823,11 +18844,12 @@ function DataGrid({
|
|
|
18823
18844
|
)
|
|
18824
18845
|
] });
|
|
18825
18846
|
}
|
|
18826
|
-
var BADGE_VARIANTS, gapStyles6;
|
|
18847
|
+
var dataGridLog, BADGE_VARIANTS, gapStyles6;
|
|
18827
18848
|
var init_DataGrid = __esm({
|
|
18828
18849
|
"components/molecules/DataGrid.tsx"() {
|
|
18829
18850
|
"use client";
|
|
18830
18851
|
init_cn();
|
|
18852
|
+
init_logger();
|
|
18831
18853
|
init_getNestedValue();
|
|
18832
18854
|
init_useEventBus();
|
|
18833
18855
|
init_useTranslate();
|
|
@@ -18838,6 +18860,7 @@ var init_DataGrid = __esm({
|
|
|
18838
18860
|
init_Button();
|
|
18839
18861
|
init_Icon();
|
|
18840
18862
|
init_InfiniteScrollSentinel();
|
|
18863
|
+
dataGridLog = createLogger("almadar:ui:data-grid");
|
|
18841
18864
|
BADGE_VARIANTS = /* @__PURE__ */ new Set([
|
|
18842
18865
|
"default",
|
|
18843
18866
|
"primary",
|
|
@@ -18929,7 +18952,8 @@ function DataList({
|
|
|
18929
18952
|
loadMoreEvent,
|
|
18930
18953
|
hasMore,
|
|
18931
18954
|
children,
|
|
18932
|
-
pageSize = 5
|
|
18955
|
+
pageSize = 5,
|
|
18956
|
+
renderItem: schemaRenderItem
|
|
18933
18957
|
}) {
|
|
18934
18958
|
const eventBus = useEventBus();
|
|
18935
18959
|
const { t } = useTranslate();
|
|
@@ -19020,6 +19044,26 @@ function DataList({
|
|
|
19020
19044
|
] }, gi)) });
|
|
19021
19045
|
}
|
|
19022
19046
|
const hasRenderProp = typeof children === "function";
|
|
19047
|
+
React115__default.useEffect(() => {
|
|
19048
|
+
const renderItemTypeOf = typeof schemaRenderItem;
|
|
19049
|
+
const childrenTypeOf = typeof children;
|
|
19050
|
+
if (data.length > 0 && !hasRenderProp) {
|
|
19051
|
+
const firstRow = data[0];
|
|
19052
|
+
const sampleKeys = firstRow ? Object.keys(firstRow).slice(0, 6) : [];
|
|
19053
|
+
const renderItemRaw = schemaRenderItem;
|
|
19054
|
+
const isFnLambda = Array.isArray(renderItemRaw) && renderItemRaw.length >= 3 && (renderItemRaw[0] === "fn" || renderItemRaw[0] === "lambda");
|
|
19055
|
+
dataListLog.warn("renderItem-unresolved", {
|
|
19056
|
+
rowCount: data.length,
|
|
19057
|
+
fieldsCount: fields?.length ?? 0,
|
|
19058
|
+
renderItemTypeOf,
|
|
19059
|
+
renderItemIsArray: Array.isArray(renderItemRaw),
|
|
19060
|
+
renderItemIsFnLambda: isFnLambda,
|
|
19061
|
+
renderItemHead: Array.isArray(renderItemRaw) ? String(renderItemRaw[0]) : void 0,
|
|
19062
|
+
childrenTypeOf,
|
|
19063
|
+
sampleRowKeys: sampleKeys
|
|
19064
|
+
});
|
|
19065
|
+
}
|
|
19066
|
+
}, [data, hasRenderProp, schemaRenderItem, children, fields]);
|
|
19023
19067
|
const items = data.map((item) => item);
|
|
19024
19068
|
const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
|
|
19025
19069
|
const renderItem = (itemData, index, isLast) => {
|
|
@@ -19198,10 +19242,12 @@ function DataList({
|
|
|
19198
19242
|
}
|
|
19199
19243
|
);
|
|
19200
19244
|
}
|
|
19245
|
+
var dataListLog;
|
|
19201
19246
|
var init_DataList = __esm({
|
|
19202
19247
|
"components/molecules/DataList.tsx"() {
|
|
19203
19248
|
"use client";
|
|
19204
19249
|
init_cn();
|
|
19250
|
+
init_logger();
|
|
19205
19251
|
init_getNestedValue();
|
|
19206
19252
|
init_useEventBus();
|
|
19207
19253
|
init_useTranslate();
|
|
@@ -19214,6 +19260,7 @@ var init_DataList = __esm({
|
|
|
19214
19260
|
init_ProgressBar();
|
|
19215
19261
|
init_Divider();
|
|
19216
19262
|
init_InfiniteScrollSentinel();
|
|
19263
|
+
dataListLog = createLogger("almadar:ui:data-list");
|
|
19217
19264
|
DataList.displayName = "DataList";
|
|
19218
19265
|
}
|
|
19219
19266
|
});
|
|
@@ -39271,16 +39318,40 @@ function normalizeChild(child) {
|
|
|
39271
39318
|
props: { ...rest, ...normalizedChildren !== void 0 ? { children: normalizedChildren } : {} }
|
|
39272
39319
|
};
|
|
39273
39320
|
}
|
|
39274
|
-
function SlotBridge() {
|
|
39321
|
+
function SlotBridge({ embeddedTraits }) {
|
|
39275
39322
|
const slots = useSlots();
|
|
39276
|
-
const { render, clear } = useUISlots();
|
|
39323
|
+
const { render, clear, updateTraitContent } = useUISlots();
|
|
39277
39324
|
useEffect(() => {
|
|
39278
39325
|
slotLog.debug("SlotBridge:effect-fired", {
|
|
39279
39326
|
slotCount: Object.keys(slots).length,
|
|
39280
39327
|
slots: Object.keys(slots)
|
|
39281
39328
|
});
|
|
39282
39329
|
for (const [slotName, slotState] of Object.entries(slots)) {
|
|
39283
|
-
const
|
|
39330
|
+
const allEntries = slotEntriesInOrder(slotState);
|
|
39331
|
+
const entries = [];
|
|
39332
|
+
for (const e of allEntries) {
|
|
39333
|
+
const traitName = e.entry.source?.trait;
|
|
39334
|
+
if (traitName && embeddedTraits?.has(traitName)) {
|
|
39335
|
+
const last = e.entry.patterns[e.entry.patterns.length - 1];
|
|
39336
|
+
if (last?.pattern && typeof last.pattern === "object") {
|
|
39337
|
+
const record = last.pattern;
|
|
39338
|
+
const { type: patternType, children: nested, ...inlineProps } = record;
|
|
39339
|
+
const normalizedNested = Array.isArray(nested) ? nested.map((c) => normalizeChild(c)) : nested;
|
|
39340
|
+
updateTraitContent(traitName, {
|
|
39341
|
+
pattern: patternType,
|
|
39342
|
+
props: {
|
|
39343
|
+
...inlineProps,
|
|
39344
|
+
...last.props,
|
|
39345
|
+
...normalizedNested !== void 0 ? { children: normalizedNested } : {}
|
|
39346
|
+
},
|
|
39347
|
+
priority: 0,
|
|
39348
|
+
animation: "fade"
|
|
39349
|
+
});
|
|
39350
|
+
}
|
|
39351
|
+
continue;
|
|
39352
|
+
}
|
|
39353
|
+
entries.push(e);
|
|
39354
|
+
}
|
|
39284
39355
|
if (entries.length === 0) {
|
|
39285
39356
|
clear(slotName);
|
|
39286
39357
|
continue;
|
|
@@ -39329,7 +39400,7 @@ function SlotBridge() {
|
|
|
39329
39400
|
});
|
|
39330
39401
|
}
|
|
39331
39402
|
}
|
|
39332
|
-
}, [slots, render, clear]);
|
|
39403
|
+
}, [slots, render, clear, updateTraitContent, embeddedTraits]);
|
|
39333
39404
|
return null;
|
|
39334
39405
|
}
|
|
39335
39406
|
function applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits) {
|
|
@@ -39564,7 +39635,7 @@ function SchemaRunner({ schema, serverUrl, transport, mockData, pageName, onNavi
|
|
|
39564
39635
|
persistence
|
|
39565
39636
|
}
|
|
39566
39637
|
),
|
|
39567
|
-
/* @__PURE__ */ jsx(SlotBridge, {}),
|
|
39638
|
+
/* @__PURE__ */ jsx(SlotBridge, { embeddedTraits }),
|
|
39568
39639
|
/* @__PURE__ */ jsx(Box, { className: "h-full p-4", children: /* @__PURE__ */ jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) })
|
|
39569
39640
|
]
|
|
39570
39641
|
}
|