@coveord/plasma-mantine 56.18.0 → 56.20.1
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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-test.log +113 -113
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.js +1 -0
- package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/cjs/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/cjs/components/CodeEditor/CodeEditor.js +2 -1
- package/dist/cjs/components/CodeEditor/CodeEditor.js.map +1 -1
- package/dist/cjs/components/Collection/Collection.d.ts +75 -12
- package/dist/cjs/components/Collection/Collection.d.ts.map +1 -1
- package/dist/cjs/components/Collection/Collection.js +94 -38
- package/dist/cjs/components/Collection/Collection.js.map +1 -1
- package/dist/cjs/components/Collection/Collection.module.css +13 -1
- package/dist/cjs/components/Collection/CollectionAddButton.d.ts +25 -0
- package/dist/cjs/components/Collection/CollectionAddButton.d.ts.map +1 -0
- package/dist/cjs/components/Collection/CollectionAddButton.js +33 -0
- package/dist/cjs/components/Collection/CollectionAddButton.js.map +1 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.d.ts +72 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.d.ts.map +1 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.js +6 -0
- package/dist/cjs/components/Collection/CollectionColumn.types.js.map +1 -0
- package/dist/cjs/components/Collection/CollectionContext.d.ts +5 -0
- package/dist/cjs/components/Collection/CollectionContext.d.ts.map +1 -1
- package/dist/cjs/components/Collection/CollectionContext.js.map +1 -1
- package/dist/cjs/components/Collection/CollectionItem.d.ts +2 -2
- package/dist/cjs/components/Collection/CollectionItem.d.ts.map +1 -1
- package/dist/cjs/components/Collection/CollectionItem.js +18 -38
- package/dist/cjs/components/Collection/CollectionItem.js.map +1 -1
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.d.ts +46 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.js +6 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayout.types.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.d.ts +26 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.js +29 -0
- package/dist/cjs/components/Collection/layouts/CollectionLayouts.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts +12 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.js +24 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts +6 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js +78 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts +6 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js +56 -0
- package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.d.ts +12 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.js +28 -0
- package/dist/cjs/components/Collection/layouts/shared/DragHandle.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.d.ts +11 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.js +39 -0
- package/dist/cjs/components/Collection/layouts/shared/RemoveButton.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.d.ts +8 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.js +24 -0
- package/dist/cjs/components/Collection/layouts/shared/columnUtils.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.d.ts +8 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.js +21 -0
- package/dist/cjs/components/Collection/layouts/shared/headerUtils.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.d.ts +78 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.js +160 -0
- package/dist/cjs/components/Collection/layouts/shared/itemRenderer.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.d.ts +38 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.js +31 -0
- package/dist/cjs/components/Collection/layouts/shared/layoutConstants.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts +12 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.js +24 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts +6 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js +134 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts +10 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts.map +1 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js +15 -0
- package/dist/cjs/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js.map +1 -0
- package/dist/cjs/components/CopyToClipboard/CopyToClipboard.js +1 -0
- package/dist/cjs/components/CopyToClipboard/CopyToClipboard.js.map +1 -1
- package/dist/cjs/hooks/useParentHeight.d.ts.map +1 -1
- package/dist/cjs/hooks/useParentHeight.js +6 -4
- package/dist/cjs/hooks/useParentHeight.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +1 -0
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/esm/components/CodeEditor/CodeEditor.js +2 -1
- package/dist/esm/components/CodeEditor/CodeEditor.js.map +1 -1
- package/dist/esm/components/Collection/Collection.d.ts +75 -12
- package/dist/esm/components/Collection/Collection.d.ts.map +1 -1
- package/dist/esm/components/Collection/Collection.js +87 -32
- package/dist/esm/components/Collection/Collection.js.map +1 -1
- package/dist/esm/components/Collection/Collection.module.css +13 -1
- package/dist/esm/components/Collection/CollectionAddButton.d.ts +25 -0
- package/dist/esm/components/Collection/CollectionAddButton.d.ts.map +1 -0
- package/dist/esm/components/Collection/CollectionAddButton.js +19 -0
- package/dist/esm/components/Collection/CollectionAddButton.js.map +1 -0
- package/dist/esm/components/Collection/CollectionColumn.types.d.ts +72 -0
- package/dist/esm/components/Collection/CollectionColumn.types.d.ts.map +1 -0
- package/dist/esm/components/Collection/CollectionColumn.types.js +5 -0
- package/dist/esm/components/Collection/CollectionColumn.types.js.map +1 -0
- package/dist/esm/components/Collection/CollectionContext.d.ts +5 -0
- package/dist/esm/components/Collection/CollectionContext.d.ts.map +1 -1
- package/dist/esm/components/Collection/CollectionContext.js.map +1 -1
- package/dist/esm/components/Collection/CollectionItem.d.ts +2 -2
- package/dist/esm/components/Collection/CollectionItem.d.ts.map +1 -1
- package/dist/esm/components/Collection/CollectionItem.js +15 -34
- package/dist/esm/components/Collection/CollectionItem.js.map +1 -1
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.d.ts +46 -0
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.js +6 -0
- package/dist/esm/components/Collection/layouts/CollectionLayout.types.js.map +1 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.d.ts +26 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.js +10 -0
- package/dist/esm/components/Collection/layouts/CollectionLayouts.js.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts +12 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.js +11 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.js.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts +6 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js +49 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.js.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts +6 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js +36 -0
- package/dist/esm/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.d.ts +12 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.js +20 -0
- package/dist/esm/components/Collection/layouts/shared/DragHandle.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.d.ts +11 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.js +30 -0
- package/dist/esm/components/Collection/layouts/shared/RemoveButton.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.d.ts +8 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.js +17 -0
- package/dist/esm/components/Collection/layouts/shared/columnUtils.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.d.ts +8 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.js +14 -0
- package/dist/esm/components/Collection/layouts/shared/headerUtils.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.d.ts +78 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.js +150 -0
- package/dist/esm/components/Collection/layouts/shared/itemRenderer.js.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.d.ts +38 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.js +18 -0
- package/dist/esm/components/Collection/layouts/shared/layoutConstants.js.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts +12 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.js +11 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.js.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts +6 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js +103 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutBody.js.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts +10 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.d.ts.map +1 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js +6 -0
- package/dist/esm/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.js.map +1 -0
- package/dist/esm/components/CopyToClipboard/CopyToClipboard.js +1 -0
- package/dist/esm/components/CopyToClipboard/CopyToClipboard.js.map +1 -1
- package/dist/esm/hooks/useParentHeight.d.ts.map +1 -1
- package/dist/esm/hooks/useParentHeight.js +5 -4
- package/dist/esm/hooks/useParentHeight.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Checkbox/Checkbox.ts +1 -0
- package/src/components/CodeEditor/CodeEditor.tsx +2 -8
- package/src/components/CodeEditor/__tests__/CodeEditor.spec.tsx +18 -0
- package/src/components/Collection/Collection.module.css +13 -1
- package/src/components/Collection/Collection.tsx +149 -50
- package/src/components/Collection/CollectionAddButton.tsx +42 -0
- package/src/components/Collection/CollectionColumn.types.ts +79 -0
- package/src/components/Collection/CollectionContext.ts +5 -0
- package/src/components/Collection/CollectionItem.tsx +10 -21
- package/src/components/Collection/__tests__/CollectionWithColumns.spec.tsx +560 -0
- package/src/components/Collection/layouts/CollectionLayout.types.ts +56 -0
- package/src/components/Collection/layouts/CollectionLayouts.tsx +15 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayout.module.css +37 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayout.tsx +9 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.tsx +68 -0
- package/src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx +33 -0
- package/src/components/Collection/layouts/shared/DragHandle.tsx +22 -0
- package/src/components/Collection/layouts/shared/RemoveButton.tsx +30 -0
- package/src/components/Collection/layouts/shared/columnUtils.ts +20 -0
- package/src/components/Collection/layouts/shared/headerUtils.ts +14 -0
- package/src/components/Collection/layouts/shared/itemRenderer.tsx +242 -0
- package/src/components/Collection/layouts/shared/layoutConstants.ts +51 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayout.module.css +35 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayout.tsx +9 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayoutBody.tsx +120 -0
- package/src/components/Collection/layouts/vertical-layout/VerticalLayoutHeader.tsx +8 -0
- package/src/components/CopyToClipboard/CopyToClipboard.tsx +2 -0
- package/src/hooks/__tests__/useParentHeight.spec.tsx +150 -0
- package/src/hooks/useParentHeight.ts +6 -3
- package/src/index.ts +11 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalLayoutBody", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalLayoutBody;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
13
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
14
|
+
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
|
|
15
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
16
|
+
var _core = require("@mantine/core");
|
|
17
|
+
var _react = require("react");
|
|
18
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
19
|
+
var _columnUtils = require("../shared/columnUtils.js");
|
|
20
|
+
var _itemRenderer = require("../shared/itemRenderer.js");
|
|
21
|
+
var _layoutConstants = require("../shared/layoutConstants.js");
|
|
22
|
+
var _HorizontalLayoutmodulecss = /*#__PURE__*/ _interop_require_default._(require("./HorizontalLayout.module.css"));
|
|
23
|
+
var defaultProps = _layoutConstants.LAYOUT_BODY_DEFAULT_PROPS;
|
|
24
|
+
/**
|
|
25
|
+
* Horizontal layout specific content renderer - renders cells in a row
|
|
26
|
+
*/ var renderHorizontalContent = function(item, index, columns, cellContext, layoutClasses) {
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
28
|
+
children: columns.map(function(column, colIndex) {
|
|
29
|
+
var _column_id;
|
|
30
|
+
var columnId = (_column_id = column.id) !== null && _column_id !== void 0 ? _column_id : "column-".concat(colIndex);
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, {
|
|
32
|
+
className: layoutClasses.cell,
|
|
33
|
+
style: (0, _columnUtils.getColumnSizeStyles)(column),
|
|
34
|
+
children: column.cell(item, index, cellContext)
|
|
35
|
+
}, columnId);
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
// Create renderers once - they are stable component references
|
|
40
|
+
var horizontalRenderers = (0, _itemRenderer.createItemRenderers)();
|
|
41
|
+
var HorizontalLayoutBody = function(props) {
|
|
42
|
+
var collectionCtx = (0, _CollectionContext.useCollectionContext)();
|
|
43
|
+
var _useProps = (0, _core.useProps)('HorizontalLayoutBody', defaultProps, props), items = _useProps.items, onRemove = _useProps.onRemove, removable = _useProps.removable, draggable = _useProps.draggable, disabled = _useProps.disabled, readOnly = _useProps.readOnly, getItemId = _useProps.getItemId, gap = _useProps.gap, ref = _useProps.ref, others = _object_without_properties._(_useProps, [
|
|
44
|
+
"items",
|
|
45
|
+
"onRemove",
|
|
46
|
+
"removable",
|
|
47
|
+
"draggable",
|
|
48
|
+
"disabled",
|
|
49
|
+
"readOnly",
|
|
50
|
+
"getItemId",
|
|
51
|
+
"gap",
|
|
52
|
+
"ref"
|
|
53
|
+
]);
|
|
54
|
+
var config = (0, _react.useMemo)(function() {
|
|
55
|
+
return {
|
|
56
|
+
renderContent: renderHorizontalContent,
|
|
57
|
+
containerSelector: 'row',
|
|
58
|
+
inlineControls: true
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
var rows = (0, _itemRenderer.mapItemsToComponents)(items, horizontalRenderers, config, _HorizontalLayoutmodulecss.default, {
|
|
62
|
+
getItemId: getItemId,
|
|
63
|
+
onRemove: onRemove,
|
|
64
|
+
removable: removable,
|
|
65
|
+
draggable: draggable,
|
|
66
|
+
disabled: disabled,
|
|
67
|
+
readOnly: readOnly,
|
|
68
|
+
columns: collectionCtx.columns
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Stack, _object_spread_props._(_object_spread._({
|
|
71
|
+
ref: ref,
|
|
72
|
+
gap: gap
|
|
73
|
+
}, others), {
|
|
74
|
+
children: rows
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=HorizontalLayoutBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutBody.tsx"],"sourcesContent":["import {Box, Stack, useProps} from '@mantine/core';\nimport {ForwardedRef, useMemo} from 'react';\nimport {useCollectionContext} from '../../CollectionContext.js';\nimport {getColumnSizeStyles} from '../shared/columnUtils.js';\nimport {createItemRenderers, ItemContentRenderer, LayoutClasses, mapItemsToComponents} from '../shared/itemRenderer.js';\nimport {LAYOUT_BODY_DEFAULT_PROPS, LayoutBodyProps} from '../shared/layoutConstants.js';\nimport classes from './HorizontalLayout.module.css';\n\nconst defaultProps: Partial<LayoutBodyProps> = LAYOUT_BODY_DEFAULT_PROPS;\n\n/**\n * Horizontal layout specific content renderer - renders cells in a row\n */\nconst renderHorizontalContent: ItemContentRenderer<unknown> = (\n item,\n index,\n columns,\n cellContext,\n layoutClasses: LayoutClasses,\n) => (\n <>\n {columns.map((column, colIndex) => {\n const columnId = column.id ?? `column-${colIndex}`;\n return (\n <Box key={columnId} className={layoutClasses.cell} style={getColumnSizeStyles(column)}>\n {column.cell(item, index, cellContext)}\n </Box>\n );\n })}\n </>\n);\n\n// Create renderers once - they are stable component references\nconst horizontalRenderers = createItemRenderers<unknown>();\n\nexport const HorizontalLayoutBody = <T,>(props: LayoutBodyProps<T> & {ref?: ForwardedRef<HTMLDivElement>}) => {\n const collectionCtx = useCollectionContext();\n const {items, onRemove, removable, draggable, disabled, readOnly, getItemId, gap, ref, ...others} = useProps(\n 'HorizontalLayoutBody',\n defaultProps as LayoutBodyProps<T>,\n props,\n );\n\n const config = useMemo(\n () => ({\n renderContent: renderHorizontalContent,\n containerSelector: 'row',\n inlineControls: true,\n }),\n [],\n );\n\n const rows = mapItemsToComponents(items, horizontalRenderers, config, classes as LayoutClasses, {\n getItemId,\n onRemove,\n removable,\n draggable,\n disabled,\n readOnly,\n columns: collectionCtx.columns,\n });\n\n return (\n <Stack ref={ref} gap={gap} {...others}>\n {rows}\n </Stack>\n );\n};\n"],"names":["HorizontalLayoutBody","defaultProps","LAYOUT_BODY_DEFAULT_PROPS","renderHorizontalContent","item","index","columns","cellContext","layoutClasses","map","column","colIndex","columnId","id","Box","className","cell","style","getColumnSizeStyles","horizontalRenderers","createItemRenderers","props","collectionCtx","useCollectionContext","useProps","items","onRemove","removable","draggable","disabled","readOnly","getItemId","gap","ref","others","config","useMemo","renderContent","containerSelector","inlineControls","rows","mapItemsToComponents","classes","Stack"],"mappings":";;;;+BAmCaA;;;eAAAA;;;;;;;;oBAnCsB;qBACC;iCACD;2BACD;4BAC0D;+BACnC;kFACrC;AAEpB,IAAMC,eAAyCC,0CAAyB;AAExE;;CAEC,GACD,IAAMC,0BAAwD,SAC1DC,MACAC,OACAC,SACAC,aACAC;yBAEA;kBACKF,QAAQG,GAAG,CAAC,SAACC,QAAQC;gBACDD;YAAjB,IAAME,WAAWF,CAAAA,aAAAA,OAAOG,EAAE,cAATH,wBAAAA,aAAa,AAAC,UAAkB,OAATC;YACxC,qBACI,qBAACG,SAAG;gBAAgBC,WAAWP,cAAcQ,IAAI;gBAAEC,OAAOC,IAAAA,gCAAmB,EAACR;0BACzEA,OAAOM,IAAI,CAACZ,MAAMC,OAAOE;eADpBK;QAIlB;;;AAIR,+DAA+D;AAC/D,IAAMO,sBAAsBC,IAAAA,iCAAmB;AAExC,IAAMpB,uBAAuB,SAAKqB;IACrC,IAAMC,gBAAgBC,IAAAA,uCAAoB;IAC1C,IAAoGC,YAAAA,IAAAA,cAAQ,EACxG,wBACAvB,cACAoB,QAHGI,QAA6FD,UAA7FC,OAAOC,WAAsFF,UAAtFE,UAAUC,YAA4EH,UAA5EG,WAAWC,YAAiEJ,UAAjEI,WAAWC,WAAsDL,UAAtDK,UAAUC,WAA4CN,UAA5CM,UAAUC,YAAkCP,UAAlCO,WAAWC,MAAuBR,UAAvBQ,KAAKC,MAAkBT,UAAlBS,KAAQC,sCAAUV;QAA7FC;QAAOC;QAAUC;QAAWC;QAAWC;QAAUC;QAAUC;QAAWC;QAAKC;;IAMlF,IAAME,SAASC,IAAAA,cAAO,EAClB;eAAO;YACHC,eAAelC;YACfmC,mBAAmB;YACnBC,gBAAgB;QACpB;OACA,EAAE;IAGN,IAAMC,OAAOC,IAAAA,kCAAoB,EAAChB,OAAON,qBAAqBgB,QAAQO,kCAAO,EAAmB;QAC5FX,WAAAA;QACAL,UAAAA;QACAC,WAAAA;QACAC,WAAAA;QACAC,UAAAA;QACAC,UAAAA;QACAxB,SAASgB,cAAchB,OAAO;IAClC;IAEA,qBACI,qBAACqC,WAAK;QAACV,KAAKA;QAAKD,KAAKA;OAASE;kBAC1BM;;AAGb"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardedRef } from 'react';
|
|
2
|
+
import { LayoutHeaderProps } from '../shared/layoutConstants.js';
|
|
3
|
+
export declare const HorizontalLayoutHeader: (props: LayoutHeaderProps & {
|
|
4
|
+
ref?: ForwardedRef<HTMLDivElement>;
|
|
5
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=HorizontalLayoutHeader.d.ts.map
|
package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalLayoutHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAInC,OAAO,EAA8B,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAK5F,eAAO,MAAM,sBAAsB,GAAI,OAAO,iBAAiB,GAAG;IAAC,GAAG,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;CAAC,+CAsBrG,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HorizontalLayoutHeader", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HorizontalLayoutHeader;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
13
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
14
|
+
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
|
|
15
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
16
|
+
var _core = require("@mantine/core");
|
|
17
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
18
|
+
var _columnUtils = require("../shared/columnUtils.js");
|
|
19
|
+
var _headerUtils = require("../shared/headerUtils.js");
|
|
20
|
+
var _layoutConstants = require("../shared/layoutConstants.js");
|
|
21
|
+
var _HorizontalLayoutmodulecss = /*#__PURE__*/ _interop_require_default._(require("./HorizontalLayout.module.css"));
|
|
22
|
+
var defaultProps = _layoutConstants.LAYOUT_HEADER_DEFAULT_PROPS;
|
|
23
|
+
var HorizontalLayoutHeader = function(props) {
|
|
24
|
+
var collectionCtx = (0, _CollectionContext.useCollectionContext)();
|
|
25
|
+
var _useProps = (0, _core.useProps)('HorizontalLayoutHeader', defaultProps, props), draggable = _useProps.draggable, removable = _useProps.removable, style = _useProps.style, ref = _useProps.ref, others = _object_without_properties._(_useProps, [
|
|
26
|
+
"draggable",
|
|
27
|
+
"removable",
|
|
28
|
+
"style",
|
|
29
|
+
"ref"
|
|
30
|
+
]);
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Box, _object_spread_props._(_object_spread._({
|
|
32
|
+
ref: ref,
|
|
33
|
+
className: _HorizontalLayoutmodulecss.default.headerRow,
|
|
34
|
+
style: style
|
|
35
|
+
}, others), {
|
|
36
|
+
children: [
|
|
37
|
+
draggable && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
38
|
+
className: _HorizontalLayoutmodulecss.default.dragHandleHeader
|
|
39
|
+
}),
|
|
40
|
+
collectionCtx.columns.map(function(column, index) {
|
|
41
|
+
var _column_id;
|
|
42
|
+
var columnId = (_column_id = column.id) !== null && _column_id !== void 0 ? _column_id : "column-".concat(index);
|
|
43
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, {
|
|
44
|
+
className: _HorizontalLayoutmodulecss.default.headerCell,
|
|
45
|
+
style: (0, _columnUtils.getColumnSizeStyles)(column),
|
|
46
|
+
children: (0, _headerUtils.renderColumnHeader)(column.header, index)
|
|
47
|
+
}, columnId);
|
|
48
|
+
}),
|
|
49
|
+
removable && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
50
|
+
className: _HorizontalLayoutmodulecss.default.removeButtonHeader
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=HorizontalLayoutHeader.js.map
|
package/dist/cjs/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Collection/layouts/horizontal-layout/HorizontalLayoutHeader.tsx"],"sourcesContent":["import {Box, useProps} from '@mantine/core';\nimport {ForwardedRef} from 'react';\nimport {useCollectionContext} from '../../CollectionContext.js';\nimport {getColumnSizeStyles} from '../shared/columnUtils.js';\nimport {renderColumnHeader} from '../shared/headerUtils.js';\nimport {LAYOUT_HEADER_DEFAULT_PROPS, LayoutHeaderProps} from '../shared/layoutConstants.js';\nimport classes from './HorizontalLayout.module.css';\n\nconst defaultProps: Partial<LayoutHeaderProps> = LAYOUT_HEADER_DEFAULT_PROPS;\n\nexport const HorizontalLayoutHeader = (props: LayoutHeaderProps & {ref?: ForwardedRef<HTMLDivElement>}) => {\n const collectionCtx = useCollectionContext();\n const {draggable, removable, style, ref, ...others} = useProps(\n 'HorizontalLayoutHeader',\n defaultProps as LayoutHeaderProps,\n props,\n );\n\n return (\n <Box ref={ref} className={classes.headerRow} style={style} {...others}>\n {draggable && <div className={classes.dragHandleHeader} />}\n {collectionCtx.columns.map((column, index) => {\n const columnId = column.id ?? `column-${index}`;\n return (\n <Box key={columnId} className={classes.headerCell} style={getColumnSizeStyles(column)}>\n {renderColumnHeader(column.header, index)}\n </Box>\n );\n })}\n {removable && <div className={classes.removeButtonHeader} />}\n </Box>\n );\n};\n"],"names":["HorizontalLayoutHeader","defaultProps","LAYOUT_HEADER_DEFAULT_PROPS","props","collectionCtx","useCollectionContext","useProps","draggable","removable","style","ref","others","Box","className","classes","headerRow","div","dragHandleHeader","columns","map","column","index","columnId","id","headerCell","getColumnSizeStyles","renderColumnHeader","header","removeButtonHeader"],"mappings":";;;;+BAUaA;;;eAAAA;;;;;;;;oBAVe;iCAEO;2BACD;2BACD;+BAC4B;kFACzC;AAEpB,IAAMC,eAA2CC,4CAA2B;AAErE,IAAMF,yBAAyB,SAACG;IACnC,IAAMC,gBAAgBC,IAAAA,uCAAoB;IAC1C,IAAsDC,YAAAA,IAAAA,cAAQ,EAC1D,0BACAL,cACAE,QAHGI,YAA+CD,UAA/CC,WAAWC,YAAoCF,UAApCE,WAAWC,QAAyBH,UAAzBG,OAAOC,MAAkBJ,UAAlBI,KAAQC,sCAAUL;QAA/CC;QAAWC;QAAWC;QAAOC;;IAMpC,qBACI,sBAACE,SAAG;QAACF,KAAKA;QAAKG,WAAWC,kCAAO,CAACC,SAAS;QAAEN,OAAOA;OAAWE;;YAC1DJ,2BAAa,qBAACS;gBAAIH,WAAWC,kCAAO,CAACG,gBAAgB;;YACrDb,cAAcc,OAAO,CAACC,GAAG,CAAC,SAACC,QAAQC;oBACfD;gBAAjB,IAAME,WAAWF,CAAAA,aAAAA,OAAOG,EAAE,cAATH,wBAAAA,aAAa,AAAC,UAAe,OAANC;gBACxC,qBACI,qBAACT,SAAG;oBAAgBC,WAAWC,kCAAO,CAACU,UAAU;oBAAEf,OAAOgB,IAAAA,gCAAmB,EAACL;8BACzEM,IAAAA,+BAAkB,EAACN,OAAOO,MAAM,EAAEN;mBAD7BC;YAIlB;YACCd,2BAAa,qBAACQ;gBAAIH,WAAWC,kCAAO,CAACc,kBAAkB;;;;AAGpE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
export interface DragHandleProps {
|
|
3
|
+
setActivatorNodeRef: (element: HTMLElement | null) => void;
|
|
4
|
+
listeners: any;
|
|
5
|
+
attributes: any;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Shared drag handle component used by both horizontal and vertical layouts.
|
|
9
|
+
* Renders the drag icon with proper event handlers for drag and drop functionality.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DragHandle: FunctionComponent<DragHandleProps>;
|
|
12
|
+
//# sourceMappingURL=DragHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/shared/DragHandle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAG7C,MAAM,WAAW,eAAe;IAC5B,mBAAmB,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,SAAS,EAAE,GAAG,CAAC;IACf,UAAU,EAAE,GAAG,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAOzD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "DragHandle", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return DragHandle;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
12
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
13
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
14
|
+
var _plasmareacticons = require("@coveord/plasma-react-icons");
|
|
15
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
16
|
+
var DragHandle = function(param) {
|
|
17
|
+
var setActivatorNodeRef = param.setActivatorNodeRef, listeners = param.listeners, attributes = param.attributes;
|
|
18
|
+
var getStyles = (0, _CollectionContext.useCollectionContext)().getStyles;
|
|
19
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", _object_spread_props._(_object_spread._({
|
|
20
|
+
ref: setActivatorNodeRef
|
|
21
|
+
}, listeners, attributes, getStyles('dragHandle')), {
|
|
22
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_plasmareacticons.DragAndDropSize16Px, {
|
|
23
|
+
height: 16
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=DragHandle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Collection/layouts/shared/DragHandle.tsx"],"sourcesContent":["import {DragAndDropSize16Px} from '@coveord/plasma-react-icons';\nimport type {FunctionComponent} from 'react';\nimport {useCollectionContext} from '../../CollectionContext.js';\n\nexport interface DragHandleProps {\n setActivatorNodeRef: (element: HTMLElement | null) => void;\n listeners: any;\n attributes: any;\n}\n\n/**\n * Shared drag handle component used by both horizontal and vertical layouts.\n * Renders the drag icon with proper event handlers for drag and drop functionality.\n */\nexport const DragHandle: FunctionComponent<DragHandleProps> = ({setActivatorNodeRef, listeners, attributes}) => {\n const {getStyles} = useCollectionContext();\n return (\n <div ref={setActivatorNodeRef} {...listeners} {...attributes} {...getStyles('dragHandle')}>\n <DragAndDropSize16Px height={16} />\n </div>\n );\n};\n"],"names":["DragHandle","setActivatorNodeRef","listeners","attributes","getStyles","useCollectionContext","div","ref","DragAndDropSize16Px","height"],"mappings":";;;;+BAcaA;;;eAAAA;;;;;;gCAdqB;iCAEC;AAY5B,IAAMA,aAAiD;QAAEC,4BAAAA,qBAAqBC,kBAAAA,WAAWC,mBAAAA;IAC5F,IAAM,AAACC,YAAaC,IAAAA,uCAAoB,IAAjCD;IACP,qBACI,qBAACE;QAAIC,KAAKN;OAAyBC,WAAeC,YAAgBC,UAAU;kBACxE,cAAA,qBAACI,qCAAmB;YAACC,QAAQ;;;AAGzC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionComponent, type MouseEventHandler } from 'react';
|
|
2
|
+
export interface RemoveButtonProps {
|
|
3
|
+
removable?: boolean;
|
|
4
|
+
onRemove?: MouseEventHandler<HTMLButtonElement>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Shared remove button component used by both horizontal and vertical layouts.
|
|
8
|
+
* Renders a trash icon button when removable, or a spacer div otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RemoveButton: FunctionComponent<RemoveButtonProps>;
|
|
11
|
+
//# sourceMappingURL=RemoveButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoveButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/shared/RemoveButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAE,KAAK,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAIhE,MAAM,WAAW,iBAAiB;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CACnD;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAc7D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "RemoveButton", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return RemoveButton;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
12
|
+
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
|
|
13
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
14
|
+
var _plasmareacticons = require("@coveord/plasma-react-icons");
|
|
15
|
+
var _core = require("@mantine/core");
|
|
16
|
+
var _ActionIcon = require("../../../ActionIcon/ActionIcon.js");
|
|
17
|
+
var _CollectionContext = require("../../CollectionContext.js");
|
|
18
|
+
var RemoveButton = function(param) {
|
|
19
|
+
var removable = param.removable, onRemove = param.onRemove;
|
|
20
|
+
var getStyles = (0, _CollectionContext.useCollectionContext)().getStyles;
|
|
21
|
+
if (!removable || !onRemove) {
|
|
22
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
23
|
+
style: {
|
|
24
|
+
width: 28
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, _object_spread_props._(_object_spread._({}, getStyles('removeButton')), {
|
|
29
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ActionIcon.ActionIcon.Quaternary, {
|
|
30
|
+
onClick: onRemove,
|
|
31
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_plasmareacticons.IconTrash, {
|
|
32
|
+
"aria-label": "Remove",
|
|
33
|
+
size: 16
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=RemoveButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Collection/layouts/shared/RemoveButton.tsx"],"sourcesContent":["import {IconTrash} from '@coveord/plasma-react-icons';\nimport {Box} from '@mantine/core';\nimport {FunctionComponent, type MouseEventHandler} from 'react';\nimport {ActionIcon} from '../../../ActionIcon/ActionIcon.js';\nimport {useCollectionContext} from '../../CollectionContext.js';\n\nexport interface RemoveButtonProps {\n removable?: boolean;\n onRemove?: MouseEventHandler<HTMLButtonElement>;\n}\n\n/**\n * Shared remove button component used by both horizontal and vertical layouts.\n * Renders a trash icon button when removable, or a spacer div otherwise.\n */\nexport const RemoveButton: FunctionComponent<RemoveButtonProps> = ({removable, onRemove}) => {\n const {getStyles} = useCollectionContext();\n\n if (!removable || !onRemove) {\n return <div style={{width: 28}} />;\n }\n\n return (\n <Box {...getStyles('removeButton')}>\n <ActionIcon.Quaternary onClick={onRemove}>\n <IconTrash aria-label=\"Remove\" size={16} />\n </ActionIcon.Quaternary>\n </Box>\n );\n};\n"],"names":["RemoveButton","removable","onRemove","getStyles","useCollectionContext","div","style","width","Box","ActionIcon","Quaternary","onClick","IconTrash","aria-label","size"],"mappings":";;;;+BAeaA;;;eAAAA;;;;;;gCAfW;oBACN;0BAEO;iCACU;AAW5B,IAAMA,eAAqD;QAAEC,kBAAAA,WAAWC,iBAAAA;IAC3E,IAAM,AAACC,YAAaC,IAAAA,uCAAoB,IAAjCD;IAEP,IAAI,CAACF,aAAa,CAACC,UAAU;QACzB,qBAAO,qBAACG;YAAIC,OAAO;gBAACC,OAAO;YAAE;;IACjC;IAEA,qBACI,qBAACC,SAAG,8CAAKL,UAAU;kBACf,cAAA,qBAACM,sBAAU,CAACC,UAAU;YAACC,SAAST;sBAC5B,cAAA,qBAACU,2BAAS;gBAACC,cAAW;gBAASC,MAAM;;;;AAIrD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { CollectionColumnDef } from '../../CollectionColumn.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Converts column size configuration to CSS styles.
|
|
5
|
+
* Handles both numeric (px) and string (%, fr, etc.) size values.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getColumnSizeStyles: (column: CollectionColumnDef<any>) => CSSProperties;
|
|
8
|
+
//# sourceMappingURL=columnUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/shared/columnUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AACpC,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,mBAAmB,CAAC,GAAG,CAAC,KAAG,aAYtE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getColumnSizeStyles", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getColumnSizeStyles;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var getColumnSizeStyles = function(column) {
|
|
12
|
+
var sizeToStyle = function(size) {
|
|
13
|
+
if (size === undefined) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
return typeof size === 'number' ? "".concat(size, "px") : size;
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
minWidth: sizeToStyle(column.minSize),
|
|
20
|
+
maxWidth: sizeToStyle(column.maxSize)
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=columnUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Collection/layouts/shared/columnUtils.ts"],"sourcesContent":["import {CSSProperties} from 'react';\nimport {CollectionColumnDef} from '../../CollectionColumn.types.js';\n\n/**\n * Converts column size configuration to CSS styles.\n * Handles both numeric (px) and string (%, fr, etc.) size values.\n */\nexport const getColumnSizeStyles = (column: CollectionColumnDef<any>): CSSProperties => {\n const sizeToStyle = (size: number | string | undefined): string | undefined => {\n if (size === undefined) {\n return undefined;\n }\n return typeof size === 'number' ? `${size}px` : size;\n };\n\n return {\n minWidth: sizeToStyle(column.minSize),\n maxWidth: sizeToStyle(column.maxSize),\n };\n};\n"],"names":["getColumnSizeStyles","column","sizeToStyle","size","undefined","minWidth","minSize","maxWidth","maxSize"],"mappings":";;;;+BAOaA;;;eAAAA;;;AAAN,IAAMA,sBAAsB,SAACC;IAChC,IAAMC,cAAc,SAACC;QACjB,IAAIA,SAASC,WAAW;YACpB,OAAOA;QACX;QACA,OAAO,OAAOD,SAAS,WAAW,AAAC,GAAO,OAALA,MAAK,QAAMA;IACpD;IAEA,OAAO;QACHE,UAAUH,YAAYD,OAAOK,OAAO;QACpCC,UAAUL,YAAYD,OAAOO,OAAO;IACxC;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CollectionColumnDef } from '../../CollectionColumn.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a column header by invoking the header function with context if needed.
|
|
5
|
+
* Handles both static headers (strings/nodes) and dynamic header functions.
|
|
6
|
+
*/
|
|
7
|
+
export declare const renderColumnHeader: (header: CollectionColumnDef<unknown>["header"], index: number) => ReactNode;
|
|
8
|
+
//# sourceMappingURL=headerUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/shared/headerUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,mBAAmB,EAA0B,MAAM,iCAAiC,CAAC;AAE7F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,mBAAmB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,MAAM,KAAG,SAMlG,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "renderColumnHeader", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return renderColumnHeader;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var renderColumnHeader = function(header, index) {
|
|
12
|
+
if (typeof header === 'function') {
|
|
13
|
+
var context = {
|
|
14
|
+
index: index
|
|
15
|
+
};
|
|
16
|
+
return header(context);
|
|
17
|
+
}
|
|
18
|
+
return header;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=headerUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/Collection/layouts/shared/headerUtils.ts"],"sourcesContent":["import {ReactNode} from 'react';\nimport {CollectionColumnDef, CollectionHeaderContext} from '../../CollectionColumn.types.js';\n\n/**\n * Renders a column header by invoking the header function with context if needed.\n * Handles both static headers (strings/nodes) and dynamic header functions.\n */\nexport const renderColumnHeader = (header: CollectionColumnDef<unknown>['header'], index: number): ReactNode => {\n if (typeof header === 'function') {\n const context: CollectionHeaderContext = {index};\n return header(context);\n }\n return header;\n};\n"],"names":["renderColumnHeader","header","index","context"],"mappings":";;;;+BAOaA;;;eAAAA;;;AAAN,IAAMA,qBAAqB,SAACC,QAAgDC;IAC/E,IAAI,OAAOD,WAAW,YAAY;QAC9B,IAAME,UAAmC;YAACD,OAAAA;QAAK;QAC/C,OAAOD,OAAOE;IAClB;IACA,OAAOF;AACX"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CollectionCellContext, CollectionColumnDef } from '../../CollectionColumn.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* CSS classes object for layout styling.
|
|
5
|
+
*/
|
|
6
|
+
export interface LayoutClasses {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Common props for rendering an item/row in either layout.
|
|
11
|
+
*/
|
|
12
|
+
export interface ItemProps<T> {
|
|
13
|
+
item: T;
|
|
14
|
+
index: number;
|
|
15
|
+
id: string;
|
|
16
|
+
columns: Array<CollectionColumnDef<T>>;
|
|
17
|
+
onRemove?: () => void;
|
|
18
|
+
removable?: boolean;
|
|
19
|
+
draggable?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
classes: LayoutClasses;
|
|
23
|
+
config: ItemRendererConfig<T>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Function type that renders the content specific to each layout.
|
|
27
|
+
* Horizontal layout renders cells in a row, vertical layout renders stacked fields.
|
|
28
|
+
*/
|
|
29
|
+
export type ItemContentRenderer<T> = (item: T, index: number, columns: Array<CollectionColumnDef<T>>, cellContext: CollectionCellContext<T>, classes: LayoutClasses) => ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Function type that renders content with inline drag handle for draggable items.
|
|
32
|
+
* Used by layouts that want the drag handle integrated into the content (e.g., vertical layout).
|
|
33
|
+
*/
|
|
34
|
+
export type DraggableContentRenderer<T> = (item: T, index: number, columns: Array<CollectionColumnDef<T>>, cellContext: CollectionCellContext<T>, classes: LayoutClasses, dragHandleProps: {
|
|
35
|
+
setActivatorNodeRef: (element: HTMLElement | null) => void;
|
|
36
|
+
listeners: any;
|
|
37
|
+
attributes: any;
|
|
38
|
+
}) => ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for creating layout-specific item renderers.
|
|
41
|
+
*/
|
|
42
|
+
export interface ItemRendererConfig<T> {
|
|
43
|
+
/** The content rendering function specific to the layout */
|
|
44
|
+
renderContent: ItemContentRenderer<T>;
|
|
45
|
+
/** The container style selector ('row' for horizontal, 'item' for vertical) */
|
|
46
|
+
containerSelector: string;
|
|
47
|
+
/** Optional: whether to render drag handle and remove button inline with content (used by horizontal layout) */
|
|
48
|
+
inlineControls?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Optional: custom content renderer for draggable items that integrates the drag handle.
|
|
51
|
+
* If provided, this is used instead of the default drag handle + renderContent pattern.
|
|
52
|
+
* Used by vertical layout to place drag handle alongside the field stack.
|
|
53
|
+
*/
|
|
54
|
+
renderDraggableContent?: DraggableContentRenderer<T>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a set of item renderers (draggable, static, disabled) for a layout.
|
|
58
|
+
* This eliminates the duplication of three nearly identical component variants.
|
|
59
|
+
* The renderers are stable function references that don't capture variables in closures.
|
|
60
|
+
*/
|
|
61
|
+
export declare const createItemRenderers: <T>() => {
|
|
62
|
+
DraggableItem: (props: ItemProps<T>) => import("react/jsx-runtime.js").JSX.Element;
|
|
63
|
+
StaticItem: (props: ItemProps<T>) => import("react/jsx-runtime.js").JSX.Element;
|
|
64
|
+
DisabledItem: (props: ItemProps<T>) => import("react/jsx-runtime.js").JSX.Element;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Maps items to their appropriate renderer components based on state.
|
|
68
|
+
*/
|
|
69
|
+
export declare const mapItemsToComponents: <T>(items: T[], renderers: ReturnType<typeof createItemRenderers<T>>, config: ItemRendererConfig<T>, classes: LayoutClasses, options: {
|
|
70
|
+
getItemId?: (item: T, index: number) => string;
|
|
71
|
+
onRemove?: (index: number) => void;
|
|
72
|
+
removable?: boolean;
|
|
73
|
+
draggable?: boolean;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
readOnly?: boolean;
|
|
76
|
+
columns: Array<CollectionColumnDef<T>>;
|
|
77
|
+
}) => ReactNode[];
|
|
78
|
+
//# sourceMappingURL=itemRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Collection/layouts/shared/itemRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,qBAAqB,EAAE,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAI3F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACjC,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EACtC,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACrC,OAAO,EAAE,aAAa,KACrB,SAAS,CAAC;AAEf;;;GAGG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,CACtC,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EACtC,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACrC,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE;IACb,mBAAmB,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,SAAS,EAAE,GAAG,CAAC;IACf,UAAU,EAAE,GAAG,CAAC;CACnB,KACA,SAAS,CAAC;AAEf;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,4DAA4D;IAC5D,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACtC,+EAA+E;IAC/E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gHAAgH;IAChH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC;2BAIH,SAAS,CAAC,CAAC,CAAC;wBAgEf,SAAS,CAAC,CAAC,CAAC;0BAsBV,SAAS,CAAC,CAAC,CAAC;CAkB5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAClC,OAAO,CAAC,EAAE,EACV,WAAW,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,EACpD,QAAQ,kBAAkB,CAAC,CAAC,CAAC,EAC7B,SAAS,aAAa,EACtB,SAAS;IACL,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1C,KACF,SAAS,EA8BX,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get createItemRenderers () {
|
|
13
|
+
return createItemRenderers;
|
|
14
|
+
},
|
|
15
|
+
get mapItemsToComponents () {
|
|
16
|
+
return mapItemsToComponents;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _object_spread = require("@swc/helpers/_/_object_spread");
|
|
20
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
21
|
+
var _sortable = require("@dnd-kit/sortable");
|
|
22
|
+
var _utilities = require("@dnd-kit/utilities");
|
|
23
|
+
var _core = require("@mantine/core");
|
|
24
|
+
var _DragHandle = require("./DragHandle.js");
|
|
25
|
+
var _RemoveButton = require("./RemoveButton.js");
|
|
26
|
+
var createItemRenderers = function() {
|
|
27
|
+
/**
|
|
28
|
+
* Draggable item/row renderer with drag and drop functionality
|
|
29
|
+
*/ var DraggableItem = function(props) {
|
|
30
|
+
var item = props.item, index = props.index, id = props.id, columns = props.columns, onRemove = props.onRemove, removable = props.removable, disabled = props.disabled, readOnly = props.readOnly, classes = props.classes, config = props.config;
|
|
31
|
+
var _useSortable = (0, _sortable.useSortable)({
|
|
32
|
+
id: id
|
|
33
|
+
}), attributes = _useSortable.attributes, listeners = _useSortable.listeners, setNodeRef = _useSortable.setNodeRef, transform = _useSortable.transform, transition = _useSortable.transition, isDragging = _useSortable.isDragging, setActivatorNodeRef = _useSortable.setActivatorNodeRef;
|
|
34
|
+
var cellContext = {
|
|
35
|
+
removable: removable,
|
|
36
|
+
draggable: true,
|
|
37
|
+
disabled: disabled,
|
|
38
|
+
readOnly: readOnly,
|
|
39
|
+
onRemove: onRemove
|
|
40
|
+
};
|
|
41
|
+
var dragHandleProps = {
|
|
42
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
43
|
+
listeners: listeners,
|
|
44
|
+
attributes: attributes
|
|
45
|
+
};
|
|
46
|
+
// Use renderDraggableContent if provided (integrates drag handle into content)
|
|
47
|
+
if (config.renderDraggableContent) {
|
|
48
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, {
|
|
49
|
+
ref: setNodeRef,
|
|
50
|
+
"data-testid": "item-".concat(id),
|
|
51
|
+
className: classes[config.containerSelector],
|
|
52
|
+
style: transform ? {
|
|
53
|
+
transform: _utilities.CSS.Transform.toString(transform),
|
|
54
|
+
transition: transition
|
|
55
|
+
} : undefined,
|
|
56
|
+
"data-isdragging": isDragging,
|
|
57
|
+
children: config.renderDraggableContent(item, index, columns, cellContext, classes, dragHandleProps)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// Default behavior: inline drag handle + content + remove button (used by horizontal layout)
|
|
61
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Box, {
|
|
62
|
+
ref: setNodeRef,
|
|
63
|
+
"data-testid": "item-".concat(id),
|
|
64
|
+
className: classes[config.containerSelector],
|
|
65
|
+
style: transform ? {
|
|
66
|
+
transform: _utilities.CSS.Transform.toString(transform),
|
|
67
|
+
transition: transition
|
|
68
|
+
} : undefined,
|
|
69
|
+
"data-isdragging": isDragging,
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_DragHandle.DragHandle, {
|
|
72
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
73
|
+
listeners: listeners,
|
|
74
|
+
attributes: attributes
|
|
75
|
+
}),
|
|
76
|
+
config.renderContent(item, index, columns, cellContext, classes),
|
|
77
|
+
config.inlineControls && /*#__PURE__*/ (0, _jsxruntime.jsx)(_RemoveButton.RemoveButton, {
|
|
78
|
+
removable: removable,
|
|
79
|
+
onRemove: onRemove
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Static (non-draggable) item/row renderer
|
|
86
|
+
*/ var StaticItem = function(props) {
|
|
87
|
+
var item = props.item, index = props.index, id = props.id, columns = props.columns, onRemove = props.onRemove, removable = props.removable, disabled = props.disabled, readOnly = props.readOnly, classes = props.classes, config = props.config;
|
|
88
|
+
var cellContext = {
|
|
89
|
+
removable: removable,
|
|
90
|
+
draggable: false,
|
|
91
|
+
disabled: disabled,
|
|
92
|
+
readOnly: readOnly,
|
|
93
|
+
onRemove: onRemove
|
|
94
|
+
};
|
|
95
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Box, {
|
|
96
|
+
"data-testid": "item-".concat(id),
|
|
97
|
+
className: classes[config.containerSelector],
|
|
98
|
+
children: [
|
|
99
|
+
config.renderContent(item, index, columns, cellContext, classes),
|
|
100
|
+
config.inlineControls && /*#__PURE__*/ (0, _jsxruntime.jsx)(_RemoveButton.RemoveButton, {
|
|
101
|
+
removable: removable,
|
|
102
|
+
onRemove: onRemove
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Disabled item/row renderer (no drag, no remove)
|
|
109
|
+
*/ var DisabledItem = function(props) {
|
|
110
|
+
var item = props.item, index = props.index, id = props.id, columns = props.columns, disabled = props.disabled, readOnly = props.readOnly, classes = props.classes, config = props.config;
|
|
111
|
+
var cellContext = {
|
|
112
|
+
removable: false,
|
|
113
|
+
draggable: false,
|
|
114
|
+
disabled: disabled,
|
|
115
|
+
readOnly: readOnly
|
|
116
|
+
};
|
|
117
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Box, {
|
|
118
|
+
"data-testid": "item-".concat(id),
|
|
119
|
+
className: classes[config.containerSelector],
|
|
120
|
+
children: config.renderContent(item, index, columns, cellContext, classes)
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
DraggableItem: DraggableItem,
|
|
125
|
+
StaticItem: StaticItem,
|
|
126
|
+
DisabledItem: DisabledItem
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
var mapItemsToComponents = function(items, renderers, config, classes, options) {
|
|
130
|
+
var getItemId = options.getItemId, onRemove = options.onRemove, removable = options.removable, draggable = options.draggable, disabled = options.disabled, readOnly = options.readOnly, columns = options.columns;
|
|
131
|
+
var DraggableItem = renderers.DraggableItem, StaticItem = renderers.StaticItem, DisabledItem = renderers.DisabledItem;
|
|
132
|
+
return items.map(function(item, index) {
|
|
133
|
+
var _getItemId;
|
|
134
|
+
var id = (_getItemId = getItemId === null || getItemId === void 0 ? void 0 : getItemId(item, index)) !== null && _getItemId !== void 0 ? _getItemId : String(index);
|
|
135
|
+
var itemProps = {
|
|
136
|
+
item: item,
|
|
137
|
+
index: index,
|
|
138
|
+
id: id,
|
|
139
|
+
columns: columns,
|
|
140
|
+
onRemove: onRemove ? function() {
|
|
141
|
+
return onRemove(index);
|
|
142
|
+
} : undefined,
|
|
143
|
+
removable: removable,
|
|
144
|
+
draggable: draggable,
|
|
145
|
+
disabled: disabled,
|
|
146
|
+
readOnly: readOnly,
|
|
147
|
+
classes: classes,
|
|
148
|
+
config: config
|
|
149
|
+
};
|
|
150
|
+
if (disabled) {
|
|
151
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(DisabledItem, _object_spread._({}, itemProps), id);
|
|
152
|
+
}
|
|
153
|
+
if (draggable) {
|
|
154
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(DraggableItem, _object_spread._({}, itemProps), id);
|
|
155
|
+
}
|
|
156
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(StaticItem, _object_spread._({}, itemProps), id);
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=itemRenderer.js.map
|