@revisium/schema-toolkit-ui 0.6.11 → 0.6.13
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 +212 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -27
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +37 -27
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +213 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2793,7 +2793,7 @@ const SHARED_STYLES = {
|
|
|
2793
2793
|
fontSize: "inherit",
|
|
2794
2794
|
fontFamily: "inherit"
|
|
2795
2795
|
};
|
|
2796
|
-
const SegmentContent = ({ segment, isHighlighted, onClick }) => {
|
|
2796
|
+
const SegmentContent = ({ segment, isHighlighted, isLast, onClick }) => {
|
|
2797
2797
|
if (onClick) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledButton, {
|
|
2798
2798
|
type: "button",
|
|
2799
2799
|
...SHARED_STYLES,
|
|
@@ -2815,7 +2815,7 @@ const SegmentContent = ({ segment, isHighlighted, onClick }) => {
|
|
|
2815
2815
|
...SHARED_STYLES,
|
|
2816
2816
|
color: isHighlighted ? CURRENT_COLOR : SEGMENT_COLOR,
|
|
2817
2817
|
fontWeight: isHighlighted ? "600" : void 0,
|
|
2818
|
-
cursor: isHighlighted ? "text" : "default",
|
|
2818
|
+
cursor: isHighlighted || isLast ? "text" : "default",
|
|
2819
2819
|
"aria-current": isHighlighted ? "page" : void 0,
|
|
2820
2820
|
"data-testid": segment.dataTestId,
|
|
2821
2821
|
children: segment.label
|
|
@@ -2848,6 +2848,7 @@ const Breadcrumbs = ({ segments, separator = "/", dataTestId, highlightLast = tr
|
|
|
2848
2848
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SegmentContent, {
|
|
2849
2849
|
segment,
|
|
2850
2850
|
isHighlighted: isLast && highlightLast,
|
|
2851
|
+
isLast,
|
|
2851
2852
|
onClick: isLast ? void 0 : onSegmentClick ? () => onSegmentClick(segment, index) : void 0
|
|
2852
2853
|
})
|
|
2853
2854
|
}), (!isLast || editable) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Flex, {
|
|
@@ -14232,6 +14233,45 @@ var MockDataSource = class {
|
|
|
14232
14233
|
}
|
|
14233
14234
|
};
|
|
14234
14235
|
|
|
14236
|
+
//#endregion
|
|
14237
|
+
//#region src/hooks/useDelayedVisibility.ts
|
|
14238
|
+
/**
|
|
14239
|
+
* Controls visibility with a show delay and minimum display time.
|
|
14240
|
+
*
|
|
14241
|
+
* - If `active` becomes false before `delayMs` elapses → never shown.
|
|
14242
|
+
* - If shown, stays visible for at least `minShowMs` after `active` becomes false.
|
|
14243
|
+
*/
|
|
14244
|
+
function useDelayedVisibility(active, { delayMs = 150, minShowMs = 300 } = {}) {
|
|
14245
|
+
const [visible, setVisible] = (0, react.useState)(false);
|
|
14246
|
+
const shownAt = (0, react.useRef)(null);
|
|
14247
|
+
(0, react.useEffect)(() => {
|
|
14248
|
+
if (active) {
|
|
14249
|
+
const timer = setTimeout(() => {
|
|
14250
|
+
shownAt.current = Date.now();
|
|
14251
|
+
setVisible(true);
|
|
14252
|
+
}, delayMs);
|
|
14253
|
+
return () => clearTimeout(timer);
|
|
14254
|
+
}
|
|
14255
|
+
if (shownAt.current !== null) {
|
|
14256
|
+
const remaining = minShowMs - (Date.now() - shownAt.current);
|
|
14257
|
+
if (remaining > 0) {
|
|
14258
|
+
const timer = setTimeout(() => {
|
|
14259
|
+
shownAt.current = null;
|
|
14260
|
+
setVisible(false);
|
|
14261
|
+
}, remaining);
|
|
14262
|
+
return () => clearTimeout(timer);
|
|
14263
|
+
}
|
|
14264
|
+
shownAt.current = null;
|
|
14265
|
+
}
|
|
14266
|
+
setVisible(false);
|
|
14267
|
+
}, [
|
|
14268
|
+
active,
|
|
14269
|
+
delayMs,
|
|
14270
|
+
minShowMs
|
|
14271
|
+
]);
|
|
14272
|
+
return visible;
|
|
14273
|
+
}
|
|
14274
|
+
|
|
14235
14275
|
//#endregion
|
|
14236
14276
|
//#region src/table-editor/Status/ui/CellInfoWidget.tsx
|
|
14237
14277
|
const CellInfoWidget = (0, mobx_react_lite.observer)(({ model }) => {
|
|
@@ -14374,17 +14414,178 @@ const ViewSettingsBadge = (0, mobx_react_lite.observer)(({ model }) => {
|
|
|
14374
14414
|
});
|
|
14375
14415
|
});
|
|
14376
14416
|
|
|
14417
|
+
//#endregion
|
|
14418
|
+
//#region src/table-editor/TableEditor/ui/TableEditorSkeleton.tsx
|
|
14419
|
+
const HEADER_ROW_HEIGHT = 40;
|
|
14420
|
+
const DATA_ROW_HEIGHT = 40;
|
|
14421
|
+
const SKELETON_ROW_COUNT = 8;
|
|
14422
|
+
const COLUMN_WIDTHS = [
|
|
14423
|
+
120,
|
|
14424
|
+
150,
|
|
14425
|
+
120,
|
|
14426
|
+
100,
|
|
14427
|
+
130
|
|
14428
|
+
];
|
|
14429
|
+
const CONTENT_WIDTHS = [
|
|
14430
|
+
[
|
|
14431
|
+
80,
|
|
14432
|
+
110,
|
|
14433
|
+
70,
|
|
14434
|
+
60,
|
|
14435
|
+
90
|
|
14436
|
+
],
|
|
14437
|
+
[
|
|
14438
|
+
100,
|
|
14439
|
+
90,
|
|
14440
|
+
100,
|
|
14441
|
+
80,
|
|
14442
|
+
110
|
|
14443
|
+
],
|
|
14444
|
+
[
|
|
14445
|
+
60,
|
|
14446
|
+
130,
|
|
14447
|
+
80,
|
|
14448
|
+
70,
|
|
14449
|
+
80
|
|
14450
|
+
],
|
|
14451
|
+
[
|
|
14452
|
+
90,
|
|
14453
|
+
100,
|
|
14454
|
+
60,
|
|
14455
|
+
90,
|
|
14456
|
+
100
|
|
14457
|
+
],
|
|
14458
|
+
[
|
|
14459
|
+
75,
|
|
14460
|
+
120,
|
|
14461
|
+
90,
|
|
14462
|
+
55,
|
|
14463
|
+
70
|
|
14464
|
+
],
|
|
14465
|
+
[
|
|
14466
|
+
110,
|
|
14467
|
+
80,
|
|
14468
|
+
75,
|
|
14469
|
+
80,
|
|
14470
|
+
120
|
|
14471
|
+
],
|
|
14472
|
+
[
|
|
14473
|
+
85,
|
|
14474
|
+
140,
|
|
14475
|
+
95,
|
|
14476
|
+
65,
|
|
14477
|
+
95
|
|
14478
|
+
],
|
|
14479
|
+
[
|
|
14480
|
+
95,
|
|
14481
|
+
70,
|
|
14482
|
+
110,
|
|
14483
|
+
85,
|
|
14484
|
+
80
|
|
14485
|
+
]
|
|
14486
|
+
];
|
|
14487
|
+
const TableEditorSkeleton = ({ breadcrumbs, onBreadcrumbClick, showCreateButton, useWindowScroll }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Box, {
|
|
14488
|
+
display: "flex",
|
|
14489
|
+
flexDirection: "column",
|
|
14490
|
+
height: useWindowScroll ? void 0 : "100%",
|
|
14491
|
+
flex: useWindowScroll ? 1 : void 0,
|
|
14492
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Flex, {
|
|
14493
|
+
px: 3,
|
|
14494
|
+
pt: "32px",
|
|
14495
|
+
pb: "48px",
|
|
14496
|
+
alignItems: "flex-start",
|
|
14497
|
+
justifyContent: "space-between",
|
|
14498
|
+
...useWindowScroll && {
|
|
14499
|
+
position: "sticky",
|
|
14500
|
+
top: 0,
|
|
14501
|
+
zIndex: 3,
|
|
14502
|
+
bg: "white"
|
|
14503
|
+
},
|
|
14504
|
+
children: [breadcrumbs.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Breadcrumbs, {
|
|
14505
|
+
segments: breadcrumbs,
|
|
14506
|
+
highlightLast: false,
|
|
14507
|
+
onSegmentClick: onBreadcrumbClick,
|
|
14508
|
+
action: showCreateButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Skeleton, {
|
|
14509
|
+
height: "32px",
|
|
14510
|
+
width: "32px",
|
|
14511
|
+
borderRadius: "6px"
|
|
14512
|
+
}) : void 0
|
|
14513
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Box, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Flex, {
|
|
14514
|
+
alignItems: "center",
|
|
14515
|
+
gap: "8px",
|
|
14516
|
+
children: [
|
|
14517
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Skeleton, {
|
|
14518
|
+
height: "32px",
|
|
14519
|
+
width: "32px",
|
|
14520
|
+
borderRadius: "6px"
|
|
14521
|
+
}),
|
|
14522
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Skeleton, {
|
|
14523
|
+
height: "32px",
|
|
14524
|
+
width: "32px",
|
|
14525
|
+
borderRadius: "6px"
|
|
14526
|
+
}),
|
|
14527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Skeleton, {
|
|
14528
|
+
height: "32px",
|
|
14529
|
+
width: "32px",
|
|
14530
|
+
borderRadius: "6px"
|
|
14531
|
+
})
|
|
14532
|
+
]
|
|
14533
|
+
})]
|
|
14534
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Box, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Flex, {
|
|
14535
|
+
height: `${HEADER_ROW_HEIGHT}px`,
|
|
14536
|
+
alignItems: "center",
|
|
14537
|
+
px: 3,
|
|
14538
|
+
borderBottom: "1px solid",
|
|
14539
|
+
borderColor: "gray.100",
|
|
14540
|
+
children: COLUMN_WIDTHS.map((colWidth, j) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Box, {
|
|
14541
|
+
width: `${colWidth}px`,
|
|
14542
|
+
flexShrink: 0,
|
|
14543
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Skeleton, {
|
|
14544
|
+
height: "12px",
|
|
14545
|
+
width: "60px",
|
|
14546
|
+
borderRadius: "4px"
|
|
14547
|
+
})
|
|
14548
|
+
}, `h-${j}`))
|
|
14549
|
+
}), CONTENT_WIDTHS.slice(0, SKELETON_ROW_COUNT).map((contentWidths, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Flex, {
|
|
14550
|
+
height: `${DATA_ROW_HEIGHT}px`,
|
|
14551
|
+
alignItems: "center",
|
|
14552
|
+
px: 3,
|
|
14553
|
+
borderBottom: "1px solid",
|
|
14554
|
+
borderColor: "gray.100",
|
|
14555
|
+
children: COLUMN_WIDTHS.map((colWidth, j) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Box, {
|
|
14556
|
+
width: `${colWidth}px`,
|
|
14557
|
+
flexShrink: 0,
|
|
14558
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_chakra_ui_react.Skeleton, {
|
|
14559
|
+
height: "14px",
|
|
14560
|
+
width: `${contentWidths[j]}px`,
|
|
14561
|
+
borderRadius: "4px"
|
|
14562
|
+
})
|
|
14563
|
+
}, `r-${i}-c-${j}`))
|
|
14564
|
+
}, `r-${i}`))] })]
|
|
14565
|
+
});
|
|
14566
|
+
|
|
14377
14567
|
//#endregion
|
|
14378
14568
|
//#region src/table-editor/TableEditor/ui/TableEditor.tsx
|
|
14379
14569
|
const noop = () => {};
|
|
14570
|
+
function getWriteCallbacks(isReadonly, viewModel, callbacks) {
|
|
14571
|
+
return {
|
|
14572
|
+
onDeleteRow: isReadonly ? void 0 : (id) => viewModel.deleteRows([id]),
|
|
14573
|
+
onDuplicateRow: isReadonly ? void 0 : callbacks.onDuplicateRow,
|
|
14574
|
+
onDeleteSelected: isReadonly ? void 0 : (ids) => viewModel.deleteRows(ids),
|
|
14575
|
+
onUploadFile: isReadonly ? void 0 : callbacks.onUploadFile
|
|
14576
|
+
};
|
|
14577
|
+
}
|
|
14380
14578
|
const TableEditor = (0, mobx_react_lite.observer)(({ viewModel, useWindowScroll }) => {
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14579
|
+
const showSkeleton = useDelayedVisibility(viewModel.isBootstrapping);
|
|
14580
|
+
if (viewModel.isBootstrapping) {
|
|
14581
|
+
if (!showSkeleton) return null;
|
|
14582
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableEditorSkeleton, {
|
|
14583
|
+
breadcrumbs: viewModel.breadcrumbs,
|
|
14584
|
+
onBreadcrumbClick: viewModel.callbacks.onBreadcrumbClick,
|
|
14585
|
+
showCreateButton: !viewModel.readonly && !!viewModel.callbacks.onCreateRow,
|
|
14586
|
+
useWindowScroll
|
|
14587
|
+
});
|
|
14588
|
+
}
|
|
14388
14589
|
const isReadonly = viewModel.readonly;
|
|
14389
14590
|
const { breadcrumbs, callbacks } = viewModel;
|
|
14390
14591
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_chakra_ui_react.Box, {
|
|
@@ -14445,11 +14646,8 @@ const TableEditor = (0, mobx_react_lite.observer)(({ viewModel, useWindowScroll
|
|
|
14445
14646
|
onEndReached: viewModel.loadMore,
|
|
14446
14647
|
onOpenRow: callbacks.onOpenRow,
|
|
14447
14648
|
onPickRow: callbacks.onPickRow,
|
|
14448
|
-
|
|
14449
|
-
onDuplicateRow: isReadonly ? void 0 : callbacks.onDuplicateRow,
|
|
14450
|
-
onDeleteSelected: isReadonly ? void 0 : (ids) => viewModel.deleteRows(ids),
|
|
14649
|
+
...getWriteCallbacks(isReadonly, viewModel, callbacks),
|
|
14451
14650
|
onSearchForeignKey: callbacks.onSearchForeignKey,
|
|
14452
|
-
onUploadFile: isReadonly ? void 0 : callbacks.onUploadFile,
|
|
14453
14651
|
onOpenFile: callbacks.onOpenFile,
|
|
14454
14652
|
onCopyPath: callbacks.onCopyPath,
|
|
14455
14653
|
useWindowScroll
|
|
@@ -14576,6 +14774,7 @@ exports.operatorRequiresValue = operatorRequiresValue;
|
|
|
14576
14774
|
exports.selectDefaultColumns = selectDefaultColumns;
|
|
14577
14775
|
exports.typeMenuGroups = typeMenuGroups;
|
|
14578
14776
|
exports.useContentEditable = useContentEditable;
|
|
14777
|
+
exports.useDelayedVisibility = useDelayedVisibility;
|
|
14579
14778
|
Object.keys(_revisium_schema_toolkit).forEach(function (k) {
|
|
14580
14779
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
14581
14780
|
enumerable: true,
|