@qoretechnologies/reqore 0.78.16 → 0.78.17-pr.723.g4cfb0c4
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/.claude/CLAUDE.md +47 -1
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +60 -14
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +58 -21
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Bubble/index.d.ts.map +1 -1
- package/dist/components/Bubble/index.js +13 -4
- package/dist/components/Bubble/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +67 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +361 -142
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Callout/index.d.ts.map +1 -1
- package/dist/components/Callout/index.js +49 -29
- package/dist/components/Callout/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +112 -36
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/CollapsibleContent/index.d.ts.map +1 -1
- package/dist/components/CollapsibleContent/index.js +6 -2
- package/dist/components/CollapsibleContent/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +22 -1
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/DataView/index.d.ts +8 -0
- package/dist/components/DataView/index.d.ts.map +1 -1
- package/dist/components/DataView/index.js +202 -94
- package/dist/components/DataView/index.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +3 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +75 -43
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DescriptionList/index.d.ts.map +1 -1
- package/dist/components/DescriptionList/index.js +30 -4
- package/dist/components/DescriptionList/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +41 -25
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +19 -14
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +37 -0
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +224 -58
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/EntityRow/index.d.ts.map +1 -1
- package/dist/components/EntityRow/index.js +98 -59
- package/dist/components/EntityRow/index.js.map +1 -1
- package/dist/components/FeatureCard/index.d.ts.map +1 -1
- package/dist/components/FeatureCard/index.js +54 -21
- package/dist/components/FeatureCard/index.js.map +1 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +7 -4
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +13 -3
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +44 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +89 -23
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.d.ts +7 -2
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.js +12 -5
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +19 -10
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Link/index.d.ts.map +1 -1
- package/dist/components/Link/index.js +6 -1
- package/dist/components/Link/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +8 -3
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +17 -4
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +3 -5
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +20 -4
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/NavRail/index.d.ts +2 -0
- package/dist/components/NavRail/index.d.ts.map +1 -1
- package/dist/components/NavRail/index.js +131 -47
- package/dist/components/NavRail/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +6 -2
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +78 -18
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Notifications/styles.d.ts +20 -0
- package/dist/components/Notifications/styles.d.ts.map +1 -1
- package/dist/components/Notifications/styles.js +37 -9
- package/dist/components/Notifications/styles.js.map +1 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Paging/index.js +4 -3
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +3 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +214 -153
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Paragraph/index.js +8 -5
- package/dist/components/Paragraph/index.js.map +1 -1
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Rating/index.d.ts.map +1 -1
- package/dist/components/Rating/index.js +20 -8
- package/dist/components/Rating/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +89 -46
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.js +87 -42
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SeverityRow/index.d.ts.map +1 -1
- package/dist/components/SeverityRow/index.js +1 -1
- package/dist/components/SeverityRow/index.js.map +1 -1
- package/dist/components/Span/index.d.ts.map +1 -1
- package/dist/components/Span/index.js +8 -5
- package/dist/components/Span/index.js.map +1 -1
- package/dist/components/StackedBar/index.d.ts.map +1 -1
- package/dist/components/StackedBar/index.js +42 -12
- package/dist/components/StackedBar/index.js.map +1 -1
- package/dist/components/Statistic/index.d.ts.map +1 -1
- package/dist/components/Statistic/index.js +34 -6
- package/dist/components/Statistic/index.js.map +1 -1
- package/dist/components/Table/cell.d.ts.map +1 -1
- package/dist/components/Table/cell.js +128 -53
- package/dist/components/Table/cell.js.map +1 -1
- package/dist/components/Table/headerCell.d.ts.map +1 -1
- package/dist/components/Table/headerCell.js +7 -5
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +2 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/scrollbar.d.ts.map +1 -1
- package/dist/components/Table/scrollbar.js +17 -9
- package/dist/components/Table/scrollbar.js.map +1 -1
- package/dist/components/Tag/index.d.ts +70 -3
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +336 -100
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Testimonial/index.d.ts.map +1 -1
- package/dist/components/Testimonial/index.js +35 -20
- package/dist/components/Testimonial/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +6 -0
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +20 -20
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Tier/group.d.ts +2 -0
- package/dist/components/Tier/group.d.ts.map +1 -1
- package/dist/components/Tier/group.js +4 -2
- package/dist/components/Tier/group.js.map +1 -1
- package/dist/components/Timeline/index.d.ts +2 -0
- package/dist/components/Timeline/index.d.ts.map +1 -1
- package/dist/components/Timeline/index.js +56 -13
- package/dist/components/Timeline/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +23 -19
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +4 -1
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +11 -1
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +33 -4
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +6 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +2 -0
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/context/SurfaceContext.d.ts +18 -0
- package/dist/context/SurfaceContext.d.ts.map +1 -0
- package/dist/context/SurfaceContext.js +39 -0
- package/dist/context/SurfaceContext.js.map +1 -0
- package/dist/helpers/colors.d.ts +184 -2
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +739 -86
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/iconProps.d.ts +14 -0
- package/dist/helpers/iconProps.d.ts.map +1 -0
- package/dist/helpers/iconProps.js +33 -0
- package/dist/helpers/iconProps.js.map +1 -0
- package/dist/helpers/locale.d.ts +20 -0
- package/dist/helpers/locale.d.ts.map +1 -0
- package/dist/helpers/locale.js +61 -0
- package/dist/helpers/locale.js.map +1 -0
- package/dist/helpers/schedule.d.ts +12 -0
- package/dist/helpers/schedule.d.ts.map +1 -0
- package/dist/helpers/schedule.js +10 -0
- package/dist/helpers/schedule.js.map +1 -0
- package/dist/helpers/surface.d.ts +31 -0
- package/dist/helpers/surface.d.ts.map +1 -0
- package/dist/helpers/surface.js +87 -0
- package/dist/helpers/surface.js.map +1 -0
- package/dist/hooks/useDrawnSurface.d.ts +38 -0
- package/dist/hooks/useDrawnSurface.d.ts.map +1 -0
- package/dist/hooks/useDrawnSurface.js +48 -0
- package/dist/hooks/useDrawnSurface.js.map +1 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +24 -6
- package/dist/hooks/useFocusTrap.js.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.js +9 -1
- package/dist/hooks/usePrefersReducedMotion.js.map +1 -1
- package/dist/hooks/useTextareaAutoSize.d.ts +15 -0
- package/dist/hooks/useTextareaAutoSize.d.ts.map +1 -1
- package/dist/hooks/useTextareaAutoSize.js +90 -12
- package/dist/hooks/useTextareaAutoSize.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/{vite.config.ts → vite.config.mts} +6 -0
- package/vitest.config.mts +241 -0
- package/tests.json +0 -1
- package/vitest.config.ts +0 -152
|
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.reqoreUnwrapEnvelope = exports.reqoreSetAtPath = exports.reqoreRenameKeyAtPath = exports.reqoreIsRecord = exports.reqoreIsEnvelope = exports.reqoreHasStructuredValue = exports.reqoreFormatScalar = exports.reqoreEnvelopeType = exports.reqoreDeleteAtPath = exports.reqoreDataValueKind = exports.reqoreDataValueIntent = exports.reqoreCoerceValueToKind = exports.DEFAULT_ENVELOPE = exports.ReqoreDataView = void 0;
|
|
41
|
+
exports.reqoreUnwrapEnvelope = exports.reqoreSetAtPath = exports.reqoreRenameKeyAtPath = exports.reqoreIsRecord = exports.reqoreIsEnvelope = exports.reqoreHasStructuredValue = exports.reqoreFormatScalar = exports.reqoreEnvelopeType = exports.reqoreDeleteAtPath = exports.reqoreDataValueKind = exports.reqoreDataValueIntent = exports.reqoreCoerceValueToKind = exports.DEFAULT_ENVELOPE = exports.ReqoreDataView = exports.REQORE_DATA_VIEW_DEFAULT_LABELS = void 0;
|
|
42
42
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
43
|
/**
|
|
44
44
|
* `ReqoreDataView` — render a structured value (record / array / scalar)
|
|
@@ -71,6 +71,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
71
71
|
* so the operator doesn't lose their place when expanding deep
|
|
72
72
|
* trees.
|
|
73
73
|
*/
|
|
74
|
+
var lodash_1 = require("lodash");
|
|
74
75
|
var react_1 = require("react");
|
|
75
76
|
var polished_1 = require("polished");
|
|
76
77
|
var styled_components_1 = require("styled-components");
|
|
@@ -88,10 +89,46 @@ var Paragraph_1 = require("../Paragraph");
|
|
|
88
89
|
var Panel_1 = require("../Panel");
|
|
89
90
|
var Tag_1 = __importDefault(require("../Tag"));
|
|
90
91
|
var helpers_1 = require("./helpers");
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// A tag's effects, one object each for every tag that draws them: a tag is a memo component.
|
|
93
|
+
/** A key or a value written bold. */
|
|
94
|
+
var BOLD_TAG_EFFECT = { weight: 'bold' };
|
|
95
|
+
/** A value's type: faint small capitals. */
|
|
96
|
+
var TYPE_TAG_EFFECT = { uppercase: true, spaced: 1, opacity: 0.6 };
|
|
97
|
+
/** Every label, as the view writes it when the consumer gives none. */
|
|
98
|
+
exports.REQORE_DATA_VIEW_DEFAULT_LABELS = {
|
|
99
|
+
objectSection: function (count) { return "Object \u00B7 ".concat(count, " field").concat(count === 1 ? '' : 's'); },
|
|
100
|
+
listSection: function (count) { return "List \u00B7 ".concat(count, " item").concat(count === 1 ? '' : 's'); },
|
|
101
|
+
scalarSection: 'Value',
|
|
102
|
+
editValue: 'Edit value',
|
|
103
|
+
renameKey: 'Rename key',
|
|
104
|
+
removeProperty: function (key) { return "Remove ".concat(key); },
|
|
105
|
+
removeItem: function (indexOneBased) { return "Remove item ".concat(indexOneBased); },
|
|
106
|
+
changeType: 'Change type',
|
|
107
|
+
saveValueTooltip: 'Save (Enter)',
|
|
108
|
+
cancelValueTooltip: 'Cancel (Esc)',
|
|
109
|
+
renameCommitTooltip: 'Rename (Enter)',
|
|
110
|
+
renameCancelTooltip: 'Cancel (Esc)',
|
|
111
|
+
addPropertyLabel: 'Add property',
|
|
112
|
+
addItemLabel: 'Add item',
|
|
113
|
+
addCommitLabel: 'Add',
|
|
114
|
+
addCancelTooltip: 'Cancel',
|
|
115
|
+
propertyNamePlaceholder: 'property name',
|
|
116
|
+
typeStringLabel: 'String',
|
|
117
|
+
typeNumberLabel: 'Number',
|
|
118
|
+
typeBooleanLabel: 'Boolean',
|
|
119
|
+
typeObjectLabel: 'Object (hash)',
|
|
120
|
+
typeArrayLabel: 'Array (list)',
|
|
121
|
+
typeNullLabel: 'Null',
|
|
122
|
+
booleanTrue: 'true',
|
|
123
|
+
booleanFalse: 'false',
|
|
94
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* The consumer's labels over the defaults. A label given as `undefined` keeps its default: a
|
|
127
|
+
* consumer that builds its labels from its own translations passes the ones it has none for that
|
|
128
|
+
* way, and spread over the defaults they replaced them, so the view called `undefined` for a
|
|
129
|
+
* summary and threw.
|
|
130
|
+
*/
|
|
131
|
+
var resolveDataViewLabels = function (labels) { return (__assign(__assign({}, exports.REQORE_DATA_VIEW_DEFAULT_LABELS), (0, lodash_1.omitBy)(labels, lodash_1.isUndefined))); };
|
|
95
132
|
var Tree = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n gap: ", "px;\n min-width: 0;\n width: 100%;\n font-size: ", "px;\n color: ", ";\n\n /* Force monospace on every tag we render inside the view \u2014 keys,\n values and type labels \u2014 so the tree reads like one consistent\n data-view material rather than a row of disconnected chips.\n Override via the tag's own `effect.textSize` if you need to\n dial it back. `&&` (not `!important`) beats `StyledTag`'s\n `font-family: system-ui` \u2014 both are one generated class deep, so\n without the specificity boost the winner is just whichever\n styled-component happens to mount last. `!important` here would\n tax every downstream consumer trying to override this from their\n own `customTheme` / `effect`. \n Prefer `effect={{ fontFamily: 'mono' }}` on new code \u2014 `StyledTag` now only\n declares its own family when the effect does not, so a tag can simply ask for\n mono. This block stays because the classes below are set on tags this component\n does not own the props of; migrating them is a separate change. */\n && .reqore-data-view-key,\n && .reqore-data-view-key .reqore-tag-content,\n && .reqore-data-view-value,\n && .reqore-data-view-value .reqore-tag-content,\n && .reqore-data-view-type,\n && .reqore-data-view-type .reqore-tag-content {\n font-family: ", ";\n /* Long unbreakable identifiers (UUIDs, snake_case keys, HL7\n payloads with no spaces) need an extra hint to break \u2014 the\n tag's own `wrap` enables breaks at WHITESPACE, but these run\n on continuously. `overflow-wrap: anywhere` is the\n last-resort break point. Only applied here (inside the tag\n content) so the chip's outer geometry isn't affected. */\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n"], ["\n display: flex;\n flex-flow: column;\n gap: ", "px;\n min-width: 0;\n width: 100%;\n font-size: ", "px;\n color: ", ";\n\n /* Force monospace on every tag we render inside the view \u2014 keys,\n values and type labels \u2014 so the tree reads like one consistent\n data-view material rather than a row of disconnected chips.\n Override via the tag's own \\`effect.textSize\\` if you need to\n dial it back. \\`&&\\` (not \\`!important\\`) beats \\`StyledTag\\`'s\n \\`font-family: system-ui\\` \u2014 both are one generated class deep, so\n without the specificity boost the winner is just whichever\n styled-component happens to mount last. \\`!important\\` here would\n tax every downstream consumer trying to override this from their\n own \\`customTheme\\` / \\`effect\\`. \n Prefer \\`effect={{ fontFamily: 'mono' }}\\` on new code \u2014 \\`StyledTag\\` now only\n declares its own family when the effect does not, so a tag can simply ask for\n mono. This block stays because the classes below are set on tags this component\n does not own the props of; migrating them is a separate change. */\n && .reqore-data-view-key,\n && .reqore-data-view-key .reqore-tag-content,\n && .reqore-data-view-value,\n && .reqore-data-view-value .reqore-tag-content,\n && .reqore-data-view-type,\n && .reqore-data-view-type .reqore-tag-content {\n font-family: ", ";\n /* Long unbreakable identifiers (UUIDs, snake_case keys, HL7\n payloads with no spaces) need an extra hint to break \u2014 the\n tag's own \\`wrap\\` enables breaks at WHITESPACE, but these run\n on continuously. \\`overflow-wrap: anywhere\\` is the\n last-resort break point. Only applied here (inside the tag\n content) so the chip's outer geometry isn't affected. */\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n"])), function (_a) {
|
|
96
133
|
var $size = _a.$size;
|
|
97
134
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
@@ -102,7 +139,35 @@ var Tree = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTe
|
|
|
102
139
|
var $theme = _a.$theme;
|
|
103
140
|
return $theme.text.color || $theme.main;
|
|
104
141
|
}, fonts_1.MONO_FONT);
|
|
105
|
-
|
|
142
|
+
/** The key column of a record: as wide as its widest key chip, never wider than
|
|
143
|
+
* `min(34%, 220px)`. Measured by the browser from the chips themselves, so the value
|
|
144
|
+
* column starts one row gap after the longest key — not at a fixed offset that left
|
|
145
|
+
* short keys (`id`, `type`) 180px from their values. */
|
|
146
|
+
var KEY_COLUMN = 'fit-content(min(34%, 220px))';
|
|
147
|
+
/** The gap between a key chip and its value, and between a value and its actions. */
|
|
148
|
+
var KEY_VALUE_GAP_PX = 8;
|
|
149
|
+
/**
|
|
150
|
+
* A record's columns, set on the record and shared by its rows.
|
|
151
|
+
*
|
|
152
|
+
* Every key/value row used to be a grid of its own, so no row could know how wide the
|
|
153
|
+
* other rows' keys were: the only way to line the values up was a fixed key column, and
|
|
154
|
+
* the fixed column was too wide for most keys. The record is the grid now, and a plain
|
|
155
|
+
* row is a `subgrid` of it, so the key column is sized once, by the widest key of the
|
|
156
|
+
* record, and every value starts in the same place. A row whose value is a nested
|
|
157
|
+
* record or list, and every row of a stacked (narrow) record, spans the record and
|
|
158
|
+
* keeps a column of its own; see `rowColumns`.
|
|
159
|
+
*/
|
|
160
|
+
var recordColumns = function (_a) {
|
|
161
|
+
var $stacked = _a.$stacked, $editable = _a.$editable, $frozenKeyColumn = _a.$frozenKeyColumn;
|
|
162
|
+
if ($stacked) {
|
|
163
|
+
return 'minmax(0, 1fr)';
|
|
164
|
+
}
|
|
165
|
+
// While a key is renamed its column keeps the width it had when the rename opened (see
|
|
166
|
+
// `RecordTable`), so the values do not jump as the key is typed.
|
|
167
|
+
var keyColumn = $frozenKeyColumn !== null && $frozenKeyColumn !== void 0 ? $frozenKeyColumn : KEY_COLUMN;
|
|
168
|
+
return $editable ? "".concat(keyColumn, " minmax(0, 1fr) auto") : "".concat(keyColumn, " minmax(0, 1fr)");
|
|
169
|
+
};
|
|
170
|
+
var TableShell = styled_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: ", ";\n column-gap: ", "px;\n align-content: start;\n /* Rows, the add-property row and anything else the record holds span all of its\n columns; a plain row then lays its own cells out on the record's columns. */\n & > * {\n grid-column: 1 / -1;\n min-width: 0;\n }\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n /* Nested containers get a *darker* tint \u2014 visual depth comes from\n the surface itself stepping down a notch for every level of\n nesting, the same pattern the IDE uses. The container's right /\n top / bottom borders are a near-invisible neutral; the LEFT edge\n carries a 2px theme-tinted accent so every group (root *and*\n nested) reads as an indented chunk with a clear left rail. */\n border: 1px solid ", ";\n border-left: 2px solid ", ";\n border-radius: ", "px;\n /* Nested groups need a *visibly* darker fill to read as one level\n deeper. A small alpha bump (0.10 \u2192 0.22) was too subtle on top of\n an already-dark panel surface; 0.45 makes the depth step\n unmistakable while still being a colour darken (so it works on\n both light and dark themes). */\n background: ", ";\n"], ["\n display: grid;\n grid-template-columns: ", ";\n column-gap: ", "px;\n align-content: start;\n /* Rows, the add-property row and anything else the record holds span all of its\n columns; a plain row then lays its own cells out on the record's columns. */\n & > * {\n grid-column: 1 / -1;\n min-width: 0;\n }\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n /* Nested containers get a *darker* tint \u2014 visual depth comes from\n the surface itself stepping down a notch for every level of\n nesting, the same pattern the IDE uses. The container's right /\n top / bottom borders are a near-invisible neutral; the LEFT edge\n carries a 2px theme-tinted accent so every group (root *and*\n nested) reads as an indented chunk with a clear left rail. */\n border: 1px solid ", ";\n border-left: 2px solid ", ";\n border-radius: ", "px;\n /* Nested groups need a *visibly* darker fill to read as one level\n deeper. A small alpha bump (0.10 \u2192 0.22) was too subtle on top of\n an already-dark panel surface; 0.45 makes the depth step\n unmistakable while still being a colour darken (so it works on\n both light and dark themes). */\n background: ", ";\n"])), recordColumns, KEY_VALUE_GAP_PX, function (_a) {
|
|
106
171
|
var $theme = _a.$theme;
|
|
107
172
|
return (0, polished_1.rgba)((0, colors_1.getReadableColor)($theme), 0.08);
|
|
108
173
|
}, function (_a) {
|
|
@@ -115,17 +180,12 @@ var TableShell = styled_1.default.div(templateObject_2 || (templateObject_2 = __
|
|
|
115
180
|
var $nested = _a.$nested;
|
|
116
181
|
return $nested ? 'rgba(0, 0, 0, 0.45)' : 'rgba(0, 0, 0, 0.15)';
|
|
117
182
|
});
|
|
118
|
-
var Row = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: grid;\n /* Grid columns + named areas together so children land in fixed\n cells regardless of how many children render. Without\n grid-template-areas, a 3-child row (key + value + actions) in a\n 2-column grid would auto-place the value into the actions\n column. */\n grid-template-columns: ", ";\n grid-template-areas: ", ";\n\n & > .reqore-data-view-key,\n & > .reqore-data-view-key-edit-group {\n grid-area: key;\n }\n /* An editable key's \"Rename key\" control is as wide as its key, not its column: a grid item stretches to its\n cell, and it was a click target across the empty column (or, stacked, across the row). */\n & > .reqore-data-view-key-shell {\n grid-area: key;\n justify-self: start;\n }\n & > .reqore-data-view-value-cell {\n grid-area: value;\n }\n & > .reqore-data-view-row-actions {\n grid-area: actions;\n }\n gap: ", "px;\n align-items: start;\n min-width: 0;\n padding: ", "px ", "px;\n /* Zebra striping. The stripe tint is derived from the *text* colour\n (the high-contrast colour relative to the panel surface) \u2014 that\n way an alpha lift produces a visible stripe regardless of whether\n the theme is light, dark, or custom. Painting against theme.main\n directly is invisible on a panel whose background is also\n theme.main. */\n background: ", ";\n border-bottom: 1px solid\n ", ";\n\n &:last-child {\n border-bottom: 0;\n }\n\n ", "\n\n /* The key chip's grid behaviour, applied universally \u2014 covers\n two-column rows, complex-value rows AND stacked (narrow\n container) rows in one set of rules:\n - `justify-self: start` stops the grid's default\n `justify-items: stretch` from expanding the chip to fill the\n full grid cell. The chip sizes to its content instead, only\n hitting the column cap when content actually needs it.\n - `min-width: 0` releases ReqoreTag's intrinsic min-content size\n (its longest unbreakable run) so the
|
|
183
|
+
var Row = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: grid;\n /* Grid columns + named areas together so children land in fixed\n cells regardless of how many children render. Without\n grid-template-areas, a 3-child row (key + value + actions) in a\n 2-column grid would auto-place the value into the actions\n column. */\n /* A plain row takes the record's columns (see `recordColumns`), so its key column is\n the record's widest key. A row holding a nested record or list, or a row of a\n stacked record, puts its value under its key across the whole row, in a column of\n its own: as a subgrid its nested value would size the shared key column. */\n grid-template-columns: ", ";\n grid-template-areas: ", ";\n\n & > .reqore-data-view-key,\n & > .reqore-data-view-key-edit-group {\n grid-area: key;\n }\n /* An editable key's \"Rename key\" control is as wide as its key, not its column: a grid item stretches to its\n cell, and it was a click target across the empty column (or, stacked, across the row). */\n & > .reqore-data-view-key-shell {\n grid-area: key;\n justify-self: start;\n }\n & > .reqore-data-view-value-cell {\n grid-area: value;\n }\n & > .reqore-data-view-row-actions,\n & > .reqore-data-view-key-edit-actions {\n grid-area: actions;\n }\n /* The rename input is as wide as the key column, whatever is typed into it: text longer than\n the column scrolls inside the input (an input never wraps). Its commit and cancel buttons\n sit in the actions cell, so the whole column is the input's. */\n & > .reqore-data-view-key-edit-group {\n min-width: 0;\n }\n & > .reqore-data-view-key-edit-group .reqore-input,\n & > .reqore-data-view-key-edit-group input {\n min-width: 0;\n width: 100%;\n }\n gap: ", "px;\n align-items: start;\n min-width: 0;\n padding: ", "px ", "px;\n /* Zebra striping. The stripe tint is derived from the *text* colour\n (the high-contrast colour relative to the panel surface) \u2014 that\n way an alpha lift produces a visible stripe regardless of whether\n the theme is light, dark, or custom. Painting against theme.main\n directly is invisible on a panel whose background is also\n theme.main. */\n background: ", ";\n border-bottom: 1px solid\n ", ";\n\n &:last-child {\n border-bottom: 0;\n }\n\n ", "\n\n /* The key chip's grid behaviour, applied universally \u2014 covers\n two-column rows, complex-value rows AND stacked (narrow\n container) rows in one set of rules:\n - `justify-self: start` stops the grid's default\n `justify-items: stretch` from expanding the chip to fill the\n full grid cell. The chip sizes to its content instead, only\n hitting the column cap when content actually needs it.\n - `min-width: 0` releases ReqoreTag's intrinsic min-content size\n (its longest unbreakable run) so the key track can honour its\n `min(34%, 220px)` cap. Without this, snake_case keys or UUIDs\n feed back into the track sizing and expand the column past\n the cap. */\n & > .reqore-data-view-key {\n justify-self: start;\n min-width: 0;\n max-width: 100%;\n }\n"], ["\n display: grid;\n /* Grid columns + named areas together so children land in fixed\n cells regardless of how many children render. Without\n grid-template-areas, a 3-child row (key + value + actions) in a\n 2-column grid would auto-place the value into the actions\n column. */\n /* A plain row takes the record's columns (see \\`recordColumns\\`), so its key column is\n the record's widest key. A row holding a nested record or list, or a row of a\n stacked record, puts its value under its key across the whole row, in a column of\n its own: as a subgrid its nested value would size the shared key column. */\n grid-template-columns: ", ";\n grid-template-areas: ", ";\n\n & > .reqore-data-view-key,\n & > .reqore-data-view-key-edit-group {\n grid-area: key;\n }\n /* An editable key's \"Rename key\" control is as wide as its key, not its column: a grid item stretches to its\n cell, and it was a click target across the empty column (or, stacked, across the row). */\n & > .reqore-data-view-key-shell {\n grid-area: key;\n justify-self: start;\n }\n & > .reqore-data-view-value-cell {\n grid-area: value;\n }\n & > .reqore-data-view-row-actions,\n & > .reqore-data-view-key-edit-actions {\n grid-area: actions;\n }\n /* The rename input is as wide as the key column, whatever is typed into it: text longer than\n the column scrolls inside the input (an input never wraps). Its commit and cancel buttons\n sit in the actions cell, so the whole column is the input's. */\n & > .reqore-data-view-key-edit-group {\n min-width: 0;\n }\n & > .reqore-data-view-key-edit-group .reqore-input,\n & > .reqore-data-view-key-edit-group input {\n min-width: 0;\n width: 100%;\n }\n gap: ", "px;\n align-items: start;\n min-width: 0;\n padding: ", "px ", "px;\n /* Zebra striping. The stripe tint is derived from the *text* colour\n (the high-contrast colour relative to the panel surface) \u2014 that\n way an alpha lift produces a visible stripe regardless of whether\n the theme is light, dark, or custom. Painting against theme.main\n directly is invisible on a panel whose background is also\n theme.main. */\n background: ", ";\n border-bottom: 1px solid\n ", ";\n\n &:last-child {\n border-bottom: 0;\n }\n\n ", "\n\n /* The key chip's grid behaviour, applied universally \u2014 covers\n two-column rows, complex-value rows AND stacked (narrow\n container) rows in one set of rules:\n - \\`justify-self: start\\` stops the grid's default\n \\`justify-items: stretch\\` from expanding the chip to fill the\n full grid cell. The chip sizes to its content instead, only\n hitting the column cap when content actually needs it.\n - \\`min-width: 0\\` releases ReqoreTag's intrinsic min-content size\n (its longest unbreakable run) so the key track can honour its\n \\`min(34%, 220px)\\` cap. Without this, snake_case keys or UUIDs\n feed back into the track sizing and expand the column past\n the cap. */\n & > .reqore-data-view-key {\n justify-self: start;\n min-width: 0;\n max-width: 100%;\n }\n"])), function (_a) {
|
|
119
184
|
var $complex = _a.$complex, $stacked = _a.$stacked, $editable = _a.$editable;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return stacked
|
|
123
|
-
? 'minmax(0, 1fr) auto'
|
|
124
|
-
: 'minmax(120px, min(34%, 220px)) minmax(0, 1fr) auto';
|
|
185
|
+
if (!($complex || $stacked)) {
|
|
186
|
+
return 'subgrid';
|
|
125
187
|
}
|
|
126
|
-
return
|
|
127
|
-
? 'minmax(0, 1fr)'
|
|
128
|
-
: 'minmax(120px, min(34%, 220px)) minmax(0, 1fr)';
|
|
188
|
+
return $editable ? 'minmax(0, 1fr) auto' : 'minmax(0, 1fr)';
|
|
129
189
|
}, function (_a) {
|
|
130
190
|
var $complex = _a.$complex, $stacked = _a.$stacked, $editable = _a.$editable;
|
|
131
191
|
var stacked = $complex || $stacked;
|
|
@@ -137,7 +197,7 @@ var Row = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTem
|
|
|
137
197
|
return stacked ? "'key' 'value'" : "'key value'";
|
|
138
198
|
}, function (_a) {
|
|
139
199
|
var $size = _a.$size, $complex = _a.$complex, $stacked = _a.$stacked;
|
|
140
|
-
return $complex || $stacked ? sizes_1.GAP_FROM_SIZE[$size] :
|
|
200
|
+
return $complex || $stacked ? sizes_1.GAP_FROM_SIZE[$size] : KEY_VALUE_GAP_PX;
|
|
141
201
|
}, function (_a) {
|
|
142
202
|
var $size = _a.$size;
|
|
143
203
|
return sizes_1.PADDING_FROM_SIZE[$size] / 2;
|
|
@@ -154,7 +214,7 @@ var Row = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTem
|
|
|
154
214
|
var $complex = _a.$complex;
|
|
155
215
|
return $complex && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: column;\n "], ["\n flex-direction: column;\n "])));
|
|
156
216
|
});
|
|
157
|
-
var ValueCell = styled_1.default.div(
|
|
217
|
+
var ValueCell = styled_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n min-width: 0;\n max-width: 100%;\n font-family: ", ";\n font-size: ", "px;\n word-break: break-word;\n\n /* The monospace is for the data, not for the controls in the cell. Buttons and inputs take\n the font around them (see ReqoreButton), so without this the \"+ Add property\" /\n \"+ Add item\" buttons, the type picker, the delete button and the edit and rename inputs of\n every nested level would be in the cell's monospace. They get the theme's font when the\n theme names one, otherwise the browser's own control font (`revert`), which is what they\n were in before buttons and inputs inherited: CSS cannot name the page's font from inside a\n cell that has replaced it. The cell itself keeps the monospace, so its text and its line\n boxes, and with them the data, render exactly as they did. */\n & .reqore-button,\n & .reqore-input {\n font-family: ", ";\n }\n\n /* Complex values (records / arrays) get a generous left inset and a\n small top margin so the nested block reads as an indented chunk\n under its key. The left rail itself lives on the nested\n TableShell, NOT here \u2014 that way the root group carries the same\n rail without needing a wrapping ValueCell. */\n ", "\n\n /* A stacked row (a narrow record) draws its value on a line of its own under the key. The\n value is set against the row's far edge, so key and value read as a pair across the row\n rather than as two left-aligned lines: a chip, or a value with its type chip, ends at the\n right edge (and a row of chips that wraps justifies each line to it). Inside a value the\n text keeps its own alignment: a value that wraps across lines reads left to right in a box\n that sits at the right. What fills the width already \u2014 multi-line text, a parsed nested\n record \u2014 is unchanged. */\n ", "\n"], ["\n min-width: 0;\n max-width: 100%;\n font-family: ", ";\n font-size: ", "px;\n word-break: break-word;\n\n /* The monospace is for the data, not for the controls in the cell. Buttons and inputs take\n the font around them (see ReqoreButton), so without this the \"+ Add property\" /\n \"+ Add item\" buttons, the type picker, the delete button and the edit and rename inputs of\n every nested level would be in the cell's monospace. They get the theme's font when the\n theme names one, otherwise the browser's own control font (\\`revert\\`), which is what they\n were in before buttons and inputs inherited: CSS cannot name the page's font from inside a\n cell that has replaced it. The cell itself keeps the monospace, so its text and its line\n boxes, and with them the data, render exactly as they did. */\n & .reqore-button,\n & .reqore-input {\n font-family: ", ";\n }\n\n /* Complex values (records / arrays) get a generous left inset and a\n small top margin so the nested block reads as an indented chunk\n under its key. The left rail itself lives on the nested\n TableShell, NOT here \u2014 that way the root group carries the same\n rail without needing a wrapping ValueCell. */\n ", "\n\n /* A stacked row (a narrow record) draws its value on a line of its own under the key. The\n value is set against the row's far edge, so key and value read as a pair across the row\n rather than as two left-aligned lines: a chip, or a value with its type chip, ends at the\n right edge (and a row of chips that wraps justifies each line to it). Inside a value the\n text keeps its own alignment: a value that wraps across lines reads left to right in a box\n that sits at the right. What fills the width already \u2014 multi-line text, a parsed nested\n record \u2014 is unchanged. */\n ", "\n"])), fonts_1.MONO_FONT, function (_a) {
|
|
158
218
|
var $size = _a.$size;
|
|
159
219
|
return sizes_1.TEXT_FROM_SIZE[$size] - 1;
|
|
160
220
|
}, function (_a) {
|
|
@@ -163,6 +223,9 @@ var ValueCell = styled_1.default.div(templateObject_6 || (templateObject_6 = __m
|
|
|
163
223
|
}, function (_a) {
|
|
164
224
|
var $complex = _a.$complex, $size = _a.$size;
|
|
165
225
|
return $complex && (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-top: 4px;\n padding-left: ", "px;\n "], ["\n margin-top: 4px;\n padding-left: ", "px;\n "])), sizes_1.PADDING_FROM_SIZE[$size] + 6);
|
|
226
|
+
}, function (_a) {
|
|
227
|
+
var $stackedScalar = _a.$stackedScalar;
|
|
228
|
+
return $stackedScalar && (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n text-align: end;\n\n & > * {\n text-align: start;\n }\n\n & > .reqore-control-group {\n justify-content: flex-end;\n }\n "], ["\n text-align: end;\n\n & > * {\n text-align: start;\n }\n\n & > .reqore-control-group {\n justify-content: flex-end;\n }\n "])));
|
|
166
229
|
});
|
|
167
230
|
/** Multiline strings are data documents, not compact scalar labels. Rendering
|
|
168
231
|
* them inside a tag creates a very tall pill and makes large text/plain
|
|
@@ -173,7 +236,7 @@ var ValueCell = styled_1.default.div(templateObject_6 || (templateObject_6 = __m
|
|
|
173
236
|
* and no `color`) so the block reads as the same value-chip family, just
|
|
174
237
|
* taller and pre-formatted, rather than an unrelated visual element. Only
|
|
175
238
|
* the font, wrapping and scroll behaviour are new. */
|
|
176
|
-
var MultilineValue = styled_1.default.pre(
|
|
239
|
+
var MultilineValue = styled_1.default.pre(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n box-sizing: border-box;\n flex: 1 1 300px;\n width: 100%;\n min-width: 0;\n max-width: 100%;\n max-height: min(320px, 45vh);\n margin: 0;\n padding: ", "px;\n overflow: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n word-break: break-word;\n tab-size: 2;\n border: 1px solid ", ";\n border-radius: ", "px;\n background: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", "px;\n font-variant-ligatures: none;\n line-height: 1.45;\n cursor: ", ";\n\n ", "\n"], ["\n box-sizing: border-box;\n flex: 1 1 300px;\n width: 100%;\n min-width: 0;\n max-width: 100%;\n max-height: min(320px, 45vh);\n margin: 0;\n padding: ", "px;\n overflow: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n word-break: break-word;\n tab-size: 2;\n border: 1px solid ", ";\n border-radius: ", "px;\n background: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", "px;\n font-variant-ligatures: none;\n line-height: 1.45;\n cursor: ", ";\n\n ", "\n"])), function (_a) {
|
|
177
240
|
var $size = _a.$size;
|
|
178
241
|
return sizes_1.PADDING_FROM_SIZE[$size];
|
|
179
242
|
}, function (_a) {
|
|
@@ -193,13 +256,13 @@ var MultilineValue = styled_1.default.pre(templateObject_8 || (templateObject_8
|
|
|
193
256
|
return ($interactive ? 'pointer' : 'text');
|
|
194
257
|
}, function (_a) {
|
|
195
258
|
var $interactive = _a.$interactive, $theme = _a.$theme;
|
|
196
|
-
return $interactive && (0, styled_components_1.css)(
|
|
259
|
+
return $interactive && (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n &:hover,\n &:focus-visible {\n border-color: ", ";\n outline: none;\n }\n "], ["\n &:hover,\n &:focus-visible {\n border-color: ", ";\n outline: none;\n }\n "])), (0, colors_1.changeLightness)($theme.main, 0.35));
|
|
197
260
|
});
|
|
198
|
-
var ArrayStack = styled_1.default.div(
|
|
261
|
+
var ArrayStack = styled_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n gap: ", "px;\n min-width: 0;\n width: 100%;\n"], ["\n display: flex;\n flex-flow: column;\n gap: ", "px;\n min-width: 0;\n width: 100%;\n"])), function (_a) {
|
|
199
262
|
var $size = _a.$size;
|
|
200
263
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
201
264
|
});
|
|
202
|
-
var ArrayItem = styled_1.default.div(
|
|
265
|
+
var ArrayItem = styled_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n min-width: 0;\n max-width: 100%;\n /* Two-column flex layout: content (index + value) on the left,\n hover-revealed action cell on the right. Keeps the actions\n properly inside the item's bounds instead of leaning on absolute\n positioning. */\n display: flex;\n flex-flow: row;\n align-items: start;\n gap: 8px;\n /* More left padding than the other three sides so the item index\n and contents read as visually inset under the parent \u2014 mirrors\n the IDE pattern of \"nested = inset\". */\n padding: ", "px\n ", "px\n ", "px\n ", "px;\n border: 1px solid ", ";\n border-left: 2px solid ", ";\n border-radius: ", "px;\n background: rgba(0, 0, 0, 0.45);\n"], ["\n min-width: 0;\n max-width: 100%;\n /* Two-column flex layout: content (index + value) on the left,\n hover-revealed action cell on the right. Keeps the actions\n properly inside the item's bounds instead of leaning on absolute\n positioning. */\n display: flex;\n flex-flow: row;\n align-items: start;\n gap: 8px;\n /* More left padding than the other three sides so the item index\n and contents read as visually inset under the parent \u2014 mirrors\n the IDE pattern of \"nested = inset\". */\n padding: ", "px\n ", "px\n ", "px\n ", "px;\n border: 1px solid ", ";\n border-left: 2px solid ", ";\n border-radius: ", "px;\n background: rgba(0, 0, 0, 0.45);\n"])), function (_a) {
|
|
203
266
|
var $size = _a.$size;
|
|
204
267
|
return sizes_1.PADDING_FROM_SIZE[$size];
|
|
205
268
|
}, function (_a) {
|
|
@@ -224,8 +287,8 @@ var ArrayItem = styled_1.default.div(templateObject_10 || (templateObject_10 = _
|
|
|
224
287
|
/** Content column for an array item — wraps the item's index +
|
|
225
288
|
* rendered value so the flex row's other cell (the action group)
|
|
226
289
|
* sits to the right without competing for width. */
|
|
227
|
-
var ArrayItemContent = styled_1.default.div(
|
|
228
|
-
var ArrayItemIndex = styled_1.default.span(
|
|
290
|
+
var ArrayItemContent = styled_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n flex: 1 1 auto;\n min-width: 0;\n"], ["\n flex: 1 1 auto;\n min-width: 0;\n"])));
|
|
291
|
+
var ArrayItemIndex = styled_1.default.span(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n display: inline-block;\n margin-bottom: ", "px;\n padding: 1px 6px;\n border-radius: 4px;\n background: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 11px;\n opacity: 0.78;\n"], ["\n display: inline-block;\n margin-bottom: ", "px;\n padding: 1px 6px;\n border-radius: 4px;\n background: ", ";\n color: ", ";\n font-family: ", ";\n font-size: 11px;\n opacity: 0.78;\n"])), function (_a) {
|
|
229
292
|
var $size = _a.$size;
|
|
230
293
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
231
294
|
}, function (_a) {
|
|
@@ -235,12 +298,12 @@ var ArrayItemIndex = styled_1.default.span(templateObject_12 || (templateObject_
|
|
|
235
298
|
var $theme = _a.$theme;
|
|
236
299
|
return (0, colors_1.getReadableColor)($theme);
|
|
237
300
|
}, fonts_1.MONO_FONT);
|
|
238
|
-
var ScalarRow = (0, styled_1.default)(ControlGroup_1.default)(
|
|
239
|
-
var SectionDetails = styled_1.default.details(
|
|
301
|
+
var ScalarRow = (0, styled_1.default)(ControlGroup_1.default)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n flex-wrap: wrap;\n"], ["\n flex-wrap: wrap;\n"])));
|
|
302
|
+
var SectionDetails = styled_1.default.details(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n min-width: 0;\n max-width: 100%;\n\n &[open] > summary {\n margin-bottom: ", "px;\n }\n"], ["\n min-width: 0;\n max-width: 100%;\n\n &[open] > summary {\n margin-bottom: ", "px;\n }\n"])), function (_a) {
|
|
240
303
|
var $size = _a.$size;
|
|
241
304
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
242
305
|
});
|
|
243
|
-
var SectionSummary = styled_1.default.summary(
|
|
306
|
+
var SectionSummary = styled_1.default.summary(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n gap: 6px;\n width: fit-content;\n cursor: pointer;\n user-select: none;\n font-family: ", ";\n font-size: ", "px;\n font-weight: 700;\n /* Section labels MUST stay readable \u2014 they're the only way the\n operator knows what's nested below. We derive a high-contrast\n colour from the panel's surface instead of falling back to\n theme.main, which would be the SAME colour as the panel\n background on most themes (invisible). */\n color: ", ";\n opacity: 0.85;\n transition: opacity 0.15s ease-out;\n\n &:hover {\n opacity: 1;\n }\n\n &::-webkit-details-marker {\n display: none;\n }\n\n &::before {\n content: '\u25B8';\n display: inline-block;\n transition: transform 0.15s ease-out;\n transform-origin: 50% 50%;\n }\n\n ", "[open] > &::before {\n transform: rotate(90deg);\n }\n"], ["\n display: inline-flex;\n align-items: center;\n gap: 6px;\n width: fit-content;\n cursor: pointer;\n user-select: none;\n font-family: ", ";\n font-size: ", "px;\n font-weight: 700;\n /* Section labels MUST stay readable \u2014 they're the only way the\n operator knows what's nested below. We derive a high-contrast\n colour from the panel's surface instead of falling back to\n theme.main, which would be the SAME colour as the panel\n background on most themes (invisible). */\n color: ", ";\n opacity: 0.85;\n transition: opacity 0.15s ease-out;\n\n &:hover {\n opacity: 1;\n }\n\n &::-webkit-details-marker {\n display: none;\n }\n\n &::before {\n content: '\u25B8';\n display: inline-block;\n transition: transform 0.15s ease-out;\n transform-origin: 50% 50%;\n }\n\n ", "[open] > &::before {\n transform: rotate(90deg);\n }\n"])), fonts_1.MONO_FONT, function (_a) {
|
|
244
307
|
var $size = _a.$size;
|
|
245
308
|
return sizes_1.TEXT_FROM_SIZE[$size] - 2;
|
|
246
309
|
}, function (_a) {
|
|
@@ -314,6 +377,15 @@ var PreservedDetails = (0, react_1.memo)(function (_a) {
|
|
|
314
377
|
return ((0, jsx_runtime_1.jsxs)(SectionDetails, { "$size": size, "$theme": theme, open: open, children: [(0, jsx_runtime_1.jsx)(SectionSummary, { ref: summaryRef, "$size": size, "$theme": theme, role: 'button', "aria-expanded": open, tabIndex: 0, onClick: onSummaryClick, onKeyDown: onSummaryKey, children: label }), children] }));
|
|
315
378
|
});
|
|
316
379
|
PreservedDetails.displayName = 'ReqoreDataView.PreservedDetails';
|
|
380
|
+
/** How a scalar is written: a yes/no value in the labels' words, any other
|
|
381
|
+
* as `reqoreFormatScalar` writes it. */
|
|
382
|
+
var scalarDisplay = function (value, display, ctx) {
|
|
383
|
+
return typeof value === 'boolean'
|
|
384
|
+
? value
|
|
385
|
+
? ctx.labels.booleanTrue
|
|
386
|
+
: ctx.labels.booleanFalse
|
|
387
|
+
: display;
|
|
388
|
+
};
|
|
317
389
|
/** Render the read-only value chip for a scalar leaf. Extracted so
|
|
318
390
|
* both the read-only view and the click-to-edit cell share one
|
|
319
391
|
* rendering — keeps the "before / after" look of an edited row
|
|
@@ -322,9 +394,9 @@ var renderScalarChip = function (value, type, ctx, path) {
|
|
|
322
394
|
var scalar = (0, helpers_1.reqoreFormatScalar)(value, type, ctx.scalarOptions);
|
|
323
395
|
var kind = type ? (0, helpers_1.reqoreDataValueKind)(value, type) : scalar.kind;
|
|
324
396
|
var intent = (0, helpers_1.reqoreDataValueIntent)(kind);
|
|
325
|
-
return ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: false, minimal: true, wrap: true, label: scalar.display, intent: intent, effect:
|
|
397
|
+
return ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: false, minimal: true, wrap: true, label: scalarDisplay(value, scalar.display, ctx), intent: intent, effect: BOLD_TAG_EFFECT, onClick: ctx.onItemClick ? function () { return ctx.onItemClick(value, path); } : undefined, className: 'reqore-data-view-value' }));
|
|
326
398
|
};
|
|
327
|
-
var EditCellShell = styled_1.default.span(
|
|
399
|
+
var EditCellShell = styled_1.default.span(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n min-width: 0;\n max-width: 100%;\n cursor: ", ";\n\n /* Subtle hover hint on the chip so operators know it's clickable \u2014\n without shouting. The chip itself doesn't gain border / shadow;\n we just lift its outline a hair. */\n &:not([data-editing='true']):hover .reqore-data-view-value {\n outline: 1px dashed\n ", ";\n outline-offset: 1px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n min-width: 0;\n max-width: 100%;\n cursor: ", ";\n\n /* Subtle hover hint on the chip so operators know it's clickable \u2014\n without shouting. The chip itself doesn't gain border / shadow;\n we just lift its outline a hair. */\n &:not([data-editing='true']):hover .reqore-data-view-value {\n outline: 1px dashed\n ", ";\n outline-offset: 1px;\n }\n"])), function (_a) {
|
|
328
400
|
var $editing = _a.$editing;
|
|
329
401
|
return ($editing ? 'text' : 'pointer');
|
|
330
402
|
}, function (_a) {
|
|
@@ -418,7 +490,7 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
418
490
|
e.preventDefault();
|
|
419
491
|
startEditing();
|
|
420
492
|
}
|
|
421
|
-
}, role: 'button', tabIndex: 0, "aria-label":
|
|
493
|
+
}, role: 'button', tabIndex: 0, "aria-label": ctx.labels.editValue, children: renderScalarChip(value, type, ctx, path) }));
|
|
422
494
|
}
|
|
423
495
|
// Inline type-change. Coerces the CURRENT DRAFT (in its
|
|
424
496
|
// canonical form for the current kind — string for text/numeric
|
|
@@ -449,7 +521,7 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
449
521
|
setEditing(false);
|
|
450
522
|
}
|
|
451
523
|
};
|
|
452
|
-
var currentTypeItem =
|
|
524
|
+
var currentTypeItem = typePickerItems(ctx.labels).find(function (entry) { return entry.kind === kind; });
|
|
453
525
|
return ((0, jsx_runtime_1.jsxs)(ControlGroup_1.default, { gapSize: 'tiny', verticalAlign: 'center', size: ctx.size, className: 'reqore-data-view-edit-group', children: [isBoolean ? ((0, jsx_runtime_1.jsx)(Checkbox_1.default, { checked: draft === true, size: ctx.size,
|
|
454
526
|
// Toggle the LOCAL draft only — Save commits, Cancel
|
|
455
527
|
// discards. Keeps the edit semantics identical to
|
|
@@ -469,15 +541,15 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
469
541
|
event.preventDefault();
|
|
470
542
|
cancelEditing();
|
|
471
543
|
}
|
|
472
|
-
}, className: 'reqore-data-view-edit' })), ctx.commitTypeChange ? ((0, jsx_runtime_1.jsx)(Dropdown_1.default, { size: ctx.size, icon: (_b = currentTypeItem === null || currentTypeItem === void 0 ? void 0 : currentTypeItem.icon) !== null && _b !== void 0 ? _b : 'TextWrap', tooltip:
|
|
544
|
+
}, className: 'reqore-data-view-edit' })), ctx.commitTypeChange ? ((0, jsx_runtime_1.jsx)(Dropdown_1.default, { size: ctx.size, icon: (_b = currentTypeItem === null || currentTypeItem === void 0 ? void 0 : currentTypeItem.icon) !== null && _b !== void 0 ? _b : 'TextWrap', tooltip: ctx.labels.changeType, className: 'reqore-data-view-edit-type', items: typePickerItems(ctx.labels).map(function (entry) { return ({
|
|
473
545
|
label: entry.label,
|
|
474
546
|
icon: entry.icon,
|
|
475
547
|
selected: entry.kind === kind,
|
|
476
548
|
onClick: function () { return handlePickType(entry.kind); },
|
|
477
|
-
}); }) })) : null, (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CheckLine', intent: 'success', flat: true, minimal: true, tooltip:
|
|
549
|
+
}); }) })) : null, (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CheckLine', intent: 'success', flat: true, minimal: true, tooltip: ctx.labels.saveValueTooltip, onMouseDown: function (e) {
|
|
478
550
|
e.preventDefault();
|
|
479
551
|
commitDraft();
|
|
480
|
-
}, className: 'reqore-data-view-edit-commit' }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CloseLine', flat: true, minimal: true, tooltip:
|
|
552
|
+
}, className: 'reqore-data-view-edit-commit' }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CloseLine', flat: true, minimal: true, tooltip: ctx.labels.cancelValueTooltip, onMouseDown: function (e) {
|
|
481
553
|
e.preventDefault();
|
|
482
554
|
cancelEditing();
|
|
483
555
|
}, className: 'reqore-data-view-edit-cancel' })] }));
|
|
@@ -485,11 +557,25 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
485
557
|
EditableScalarCell.displayName = 'ReqoreDataView.EditableScalarCell';
|
|
486
558
|
var EditableKeyCell = (0, react_1.memo)(function (_a) {
|
|
487
559
|
var _b;
|
|
488
|
-
var keyName = _a.keyName, siblingKeys = _a.siblingKeys, parentPath = _a.parentPath, ctx = _a.ctx;
|
|
560
|
+
var keyName = _a.keyName, siblingKeys = _a.siblingKeys, parentPath = _a.parentPath, ctx = _a.ctx, onRenameOpenChange = _a.onRenameOpenChange;
|
|
489
561
|
var commit = ctx.commitRename;
|
|
490
562
|
var _c = (0, react_1.useState)(false), editing = _c[0], setEditing = _c[1];
|
|
491
563
|
var _d = (0, react_1.useState)(keyName), draft = _d[0], setDraft = _d[1];
|
|
492
564
|
var inputRef = (0, react_1.useRef)(null);
|
|
565
|
+
// Whether this cell has told its record that a rename is open, so that it says when it
|
|
566
|
+
// closes exactly once — including when the cell is unmounted mid-rename.
|
|
567
|
+
var openRef = (0, react_1.useRef)(false);
|
|
568
|
+
var keyNameRef = (0, react_1.useRef)(keyName);
|
|
569
|
+
keyNameRef.current = keyName;
|
|
570
|
+
var onRenameOpenChangeRef = (0, react_1.useRef)(onRenameOpenChange);
|
|
571
|
+
onRenameOpenChangeRef.current = onRenameOpenChange;
|
|
572
|
+
var setOpen = (0, react_1.useCallback)(function (open) {
|
|
573
|
+
if (openRef.current === open)
|
|
574
|
+
return;
|
|
575
|
+
openRef.current = open;
|
|
576
|
+
onRenameOpenChangeRef.current(keyNameRef.current, open);
|
|
577
|
+
}, []);
|
|
578
|
+
(0, react_1.useEffect)(function () { return function () { return setOpen(false); }; }, [setOpen]);
|
|
493
579
|
(0, react_1.useLayoutEffect)(function () {
|
|
494
580
|
if (editing)
|
|
495
581
|
return;
|
|
@@ -508,13 +594,16 @@ var EditableKeyCell = (0, react_1.memo)(function (_a) {
|
|
|
508
594
|
var start = (0, react_1.useCallback)(function () {
|
|
509
595
|
if (!commit)
|
|
510
596
|
return;
|
|
597
|
+
// The record measures its key column now, while the key is still drawn.
|
|
598
|
+
setOpen(true);
|
|
511
599
|
setDraft(keyName);
|
|
512
600
|
setEditing(true);
|
|
513
|
-
}, [commit, keyName]);
|
|
601
|
+
}, [commit, keyName, setOpen]);
|
|
514
602
|
var cancel = (0, react_1.useCallback)(function () {
|
|
515
603
|
setDraft(keyName);
|
|
516
604
|
setEditing(false);
|
|
517
|
-
|
|
605
|
+
setOpen(false);
|
|
606
|
+
}, [keyName, setOpen]);
|
|
518
607
|
var submit = (0, react_1.useCallback)(function () {
|
|
519
608
|
var trimmed = draft.trim();
|
|
520
609
|
if (!commit || !trimmed || trimmed === keyName) {
|
|
@@ -527,35 +616,36 @@ var EditableKeyCell = (0, react_1.memo)(function (_a) {
|
|
|
527
616
|
}
|
|
528
617
|
commit(parentPath, keyName, trimmed);
|
|
529
618
|
setEditing(false);
|
|
530
|
-
|
|
619
|
+
setOpen(false);
|
|
620
|
+
}, [cancel, commit, draft, keyName, parentPath, siblingKeys, setOpen]);
|
|
531
621
|
if (!editing) {
|
|
532
622
|
return ((0, jsx_runtime_1.jsx)(EditCellShell, { "data-editing": 'false', onClick: function (e) {
|
|
533
623
|
e.stopPropagation();
|
|
534
624
|
start();
|
|
535
|
-
}, role: 'button', tabIndex: 0, "aria-label":
|
|
625
|
+
}, role: 'button', tabIndex: 0, "aria-label": ctx.labels.renameKey, className: 'reqore-data-view-key-shell', children: (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: false, minimal: true, wrap: true, intent: ctx.keyIntent === null ? undefined : (_b = ctx.keyIntent) !== null && _b !== void 0 ? _b : 'info', color: ctx.keyColor, label: keyName, effect: BOLD_TAG_EFFECT, className: 'reqore-data-view-key' }) }));
|
|
536
626
|
}
|
|
537
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
627
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: 'reqore-data-view-key-edit-group', children: (0, jsx_runtime_1.jsx)(Input_1.default, { size: ctx.size, value: draft, fluid: true, ref: (function (node) {
|
|
628
|
+
if (node instanceof HTMLElement) {
|
|
629
|
+
inputRef.current = node.querySelector('input');
|
|
630
|
+
}
|
|
631
|
+
}), onChange: function (e) {
|
|
632
|
+
return setDraft(e.target.value);
|
|
633
|
+
}, onBlur: submit, onKeyDown: function (e) {
|
|
634
|
+
if (e.key === 'Enter') {
|
|
635
|
+
e.preventDefault();
|
|
636
|
+
submit();
|
|
637
|
+
}
|
|
638
|
+
else if (e.key === 'Escape') {
|
|
639
|
+
e.preventDefault();
|
|
640
|
+
cancel();
|
|
641
|
+
}
|
|
642
|
+
}, className: 'reqore-data-view-key-edit' }) }), (0, jsx_runtime_1.jsxs)(ControlGroup_1.default, { gapSize: 'tiny', verticalAlign: 'center', size: ctx.size, className: 'reqore-data-view-key-edit-actions', children: [(0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CheckLine', intent: 'success', flat: true, minimal: true, tooltip: ctx.labels.renameCommitTooltip, onMouseDown: function (e) {
|
|
643
|
+
e.preventDefault();
|
|
644
|
+
submit();
|
|
645
|
+
}, className: 'reqore-data-view-key-edit-commit' }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CloseLine', flat: true, minimal: true, tooltip: ctx.labels.renameCancelTooltip, onMouseDown: function (e) {
|
|
646
|
+
e.preventDefault();
|
|
647
|
+
cancel();
|
|
648
|
+
}, className: 'reqore-data-view-key-edit-cancel' })] })] }));
|
|
559
649
|
});
|
|
560
650
|
EditableKeyCell.displayName = 'ReqoreDataView.EditableKeyCell';
|
|
561
651
|
/** Hover-revealed row action group — currently the delete button.
|
|
@@ -565,7 +655,7 @@ EditableKeyCell.displayName = 'ReqoreDataView.EditableKeyCell';
|
|
|
565
655
|
* group's `opacity` is `0` by default and promoted to `1` on row
|
|
566
656
|
* hover via the parent `Row`'s `:hover` rule. The cell itself stays
|
|
567
657
|
* in the layout so the row width doesn't jump as the user hovers. */
|
|
568
|
-
var RowActionsContainer = styled_1.default.div(
|
|
658
|
+
var RowActionsContainer = styled_1.default.div(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n gap: 4px;\n /* Pad the action cell off the row's right edge a touch so the button\n doesn't kiss the panel's rounded corner. */\n padding-right: 2px;\n opacity: 0;\n transition: opacity 0.12s ease-out;\n pointer-events: none;\n\n .reqore-data-view-row:hover & {\n opacity: 1;\n pointer-events: auto;\n }\n\n /* Keep the actions visible when any child is focused (keyboard\n navigation must reveal them too). */\n &:focus-within {\n opacity: 1;\n pointer-events: auto;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n gap: 4px;\n /* Pad the action cell off the row's right edge a touch so the button\n doesn't kiss the panel's rounded corner. */\n padding-right: 2px;\n opacity: 0;\n transition: opacity 0.12s ease-out;\n pointer-events: none;\n\n .reqore-data-view-row:hover & {\n opacity: 1;\n pointer-events: auto;\n }\n\n /* Keep the actions visible when any child is focused (keyboard\n navigation must reveal them too). */\n &:focus-within {\n opacity: 1;\n pointer-events: auto;\n }\n"])));
|
|
569
659
|
var RowActions = (0, react_1.memo)(function (_a) {
|
|
570
660
|
var ctx = _a.ctx, path = _a.path, ariaLabel = _a.ariaLabel;
|
|
571
661
|
if (!ctx.commitDelete)
|
|
@@ -591,15 +681,16 @@ var defaultForKind = function (kind) {
|
|
|
591
681
|
return null;
|
|
592
682
|
}
|
|
593
683
|
};
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
{ kind: '
|
|
597
|
-
{ kind: '
|
|
598
|
-
{ kind: '
|
|
599
|
-
{ kind: '
|
|
600
|
-
{ kind: '
|
|
601
|
-
|
|
602
|
-
|
|
684
|
+
/** The kinds a value can be given, each named by the labels. */
|
|
685
|
+
var typePickerItems = function (labels) { return [
|
|
686
|
+
{ kind: 'string', label: labels.typeStringLabel, icon: 'TextWrap' },
|
|
687
|
+
{ kind: 'number', label: labels.typeNumberLabel, icon: 'Hashtag' },
|
|
688
|
+
{ kind: 'boolean', label: labels.typeBooleanLabel, icon: 'CheckboxLine' },
|
|
689
|
+
{ kind: 'object', label: labels.typeObjectLabel, icon: 'BracesLine' },
|
|
690
|
+
{ kind: 'array', label: labels.typeArrayLabel, icon: 'BracketsLine' },
|
|
691
|
+
{ kind: 'null', label: labels.typeNullLabel, icon: 'CircleLine' },
|
|
692
|
+
]; };
|
|
693
|
+
var AddRowShell = styled_1.default.div(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n display: flex;\n flex-flow: row wrap;\n gap: 6px;\n align-items: center;\n padding: 8px;\n border-top: 1px dashed\n ", ";\n background: rgba(0, 0, 0, 0.12);\n"], ["\n display: flex;\n flex-flow: row wrap;\n gap: 6px;\n align-items: center;\n padding: 8px;\n border-top: 1px dashed\n ", ";\n background: rgba(0, 0, 0, 0.12);\n"])), function (_a) {
|
|
603
694
|
var theme = _a.theme;
|
|
604
695
|
return (0, polished_1.rgba)((0, colors_1.getReadableColor)(theme), 0.2);
|
|
605
696
|
});
|
|
@@ -632,27 +723,29 @@ var AddEntryAffordance = (0, react_1.memo)(function (_a) {
|
|
|
632
723
|
reset();
|
|
633
724
|
};
|
|
634
725
|
if (!open) {
|
|
635
|
-
return ((0, jsx_runtime_1.jsx)(AddRowShell, { className: 'reqore-data-view-add-row', "data-state": 'collapsed', children: (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'AddLine', flat: true, minimal: true, onClick: function () { return setOpen(true); }, label: context.kind === 'record'
|
|
726
|
+
return ((0, jsx_runtime_1.jsx)(AddRowShell, { className: 'reqore-data-view-add-row', "data-state": 'collapsed', children: (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'AddLine', flat: true, minimal: true, onClick: function () { return setOpen(true); }, label: context.kind === 'record'
|
|
727
|
+
? ctx.labels.addPropertyLabel
|
|
728
|
+
: ctx.labels.addItemLabel }) }));
|
|
636
729
|
}
|
|
637
|
-
var typeItem =
|
|
730
|
+
var typeItem = typePickerItems(ctx.labels).find(function (entry) { return entry.kind === valueKind; });
|
|
638
731
|
return ((0, jsx_runtime_1.jsxs)(AddRowShell, { className: 'reqore-data-view-add-row', "data-state": 'expanded', onKeyDown: function (e) {
|
|
639
732
|
if (e.key === 'Escape') {
|
|
640
733
|
e.preventDefault();
|
|
641
734
|
reset();
|
|
642
735
|
}
|
|
643
|
-
}, children: [context.kind === 'record' ? ((0, jsx_runtime_1.jsx)(Input_1.default, { size: ctx.size, placeholder:
|
|
736
|
+
}, children: [context.kind === 'record' ? ((0, jsx_runtime_1.jsx)(Input_1.default, { size: ctx.size, placeholder: ctx.labels.propertyNamePlaceholder, value: key, onChange: function (e) {
|
|
644
737
|
return setKey(e.target.value);
|
|
645
738
|
}, onKeyDown: function (e) {
|
|
646
739
|
if (e.key === 'Enter') {
|
|
647
740
|
e.preventDefault();
|
|
648
741
|
submit();
|
|
649
742
|
}
|
|
650
|
-
}, className: 'reqore-data-view-add-key' })) : null, (0, jsx_runtime_1.jsx)(Dropdown_1.default, { size: ctx.size, icon: typeItem === null || typeItem === void 0 ? void 0 : typeItem.icon, label: (_b = typeItem === null || typeItem === void 0 ? void 0 : typeItem.label) !== null && _b !== void 0 ? _b :
|
|
743
|
+
}, className: 'reqore-data-view-add-key' })) : null, (0, jsx_runtime_1.jsx)(Dropdown_1.default, { size: ctx.size, icon: typeItem === null || typeItem === void 0 ? void 0 : typeItem.icon, label: (_b = typeItem === null || typeItem === void 0 ? void 0 : typeItem.label) !== null && _b !== void 0 ? _b : ctx.labels.typeStringLabel, className: 'reqore-data-view-add-type', items: typePickerItems(ctx.labels).map(function (entry) { return ({
|
|
651
744
|
label: entry.label,
|
|
652
745
|
icon: entry.icon,
|
|
653
746
|
selected: entry.kind === valueKind,
|
|
654
747
|
onClick: function () { return setValueKind(entry.kind); },
|
|
655
|
-
}); }) }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CheckLine', intent: 'success', flat: true, minimal: true, onClick: submit, label:
|
|
748
|
+
}); }) }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CheckLine', intent: 'success', flat: true, minimal: true, onClick: submit, label: ctx.labels.addCommitLabel, className: 'reqore-data-view-add-commit' }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: ctx.size, icon: 'CloseLine', flat: true, minimal: true, onClick: reset, tooltip: ctx.labels.addCancelTooltip, className: 'reqore-data-view-add-cancel' })] }));
|
|
656
749
|
});
|
|
657
750
|
AddEntryAffordance.displayName = 'ReqoreDataView.AddEntryAffordance';
|
|
658
751
|
var isInlineableScalarValue = function (value, ctx) {
|
|
@@ -674,7 +767,7 @@ var renderScalar = function (value, type, ctx, path) {
|
|
|
674
767
|
var cell = ((0, jsx_runtime_1.jsx)(EditableScalarCell, { value: value, kind: kind, type: type, ctx: ctx, path: path }));
|
|
675
768
|
if (!ctx.showTypes || !displayType)
|
|
676
769
|
return cell;
|
|
677
|
-
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { gapSize: 'tiny', verticalAlign: 'center', size: ctx.size, children: [cell, (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: true, minimal: true, label: displayType, effect:
|
|
770
|
+
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { gapSize: 'tiny', verticalAlign: 'center', size: ctx.size, children: [cell, (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: true, minimal: true, label: displayType, effect: TYPE_TAG_EFFECT, className: 'reqore-data-view-type' })] }));
|
|
678
771
|
}
|
|
679
772
|
var multiline = kind === 'string' && /[\r\n]/.test(scalar.display);
|
|
680
773
|
if (multiline) {
|
|
@@ -699,7 +792,7 @@ var renderScalar = function (value, type, ctx, path) {
|
|
|
699
792
|
: undefined, children: displayText }));
|
|
700
793
|
if (!ctx.showTypes || !displayType)
|
|
701
794
|
return block;
|
|
702
|
-
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { gapSize: 'tiny', verticalAlign: 'top', size: ctx.size, fluid: true, children: [block, (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: true, minimal: true, label: displayType, effect:
|
|
795
|
+
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { gapSize: 'tiny', verticalAlign: 'top', size: ctx.size, fluid: true, children: [block, (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: true, minimal: true, label: displayType, effect: TYPE_TAG_EFFECT, className: 'reqore-data-view-type' })] }));
|
|
703
796
|
}
|
|
704
797
|
// Value chip: minimal + intent-tinted (so the type is colour-coded
|
|
705
798
|
// without shouting), weight bold. We always render with a border
|
|
@@ -714,20 +807,17 @@ var renderScalar = function (value, type, ctx, path) {
|
|
|
714
807
|
// identifier) renders as a single non-wrapping pill that
|
|
715
808
|
// overflows its column horizontally. With `wrap`, ReqoreTag
|
|
716
809
|
// lets the label flow onto multiple lines inside the chip.
|
|
717
|
-
wrap: true, label: scalar.display, intent: intent, effect:
|
|
718
|
-
weight: 'bold',
|
|
719
|
-
}, onClick: ctx.onItemClick
|
|
810
|
+
wrap: true, label: scalarDisplay(value, scalar.display, ctx), intent: intent, effect: BOLD_TAG_EFFECT, onClick: ctx.onItemClick
|
|
720
811
|
? function () { return ctx.onItemClick(value, path); }
|
|
721
812
|
: undefined, className: 'reqore-data-view-value' }));
|
|
722
813
|
if (!ctx.showTypes || !displayType)
|
|
723
814
|
return tag;
|
|
724
|
-
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { gapSize: 'tiny', verticalAlign: 'center', size: ctx.size, children: [tag, (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: true, minimal: true, label: displayType, effect:
|
|
815
|
+
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { gapSize: 'tiny', verticalAlign: 'center', size: ctx.size, children: [tag, (0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: true, minimal: true, label: displayType, effect: TYPE_TAG_EFFECT, className: 'reqore-data-view-type' })] }));
|
|
725
816
|
};
|
|
726
817
|
/** Width (in CSS px) below which a `RecordTable` switches its rows
|
|
727
818
|
* from a two-column grid (key | value) to a single column (key on
|
|
728
|
-
* top, value beneath).
|
|
729
|
-
*
|
|
730
|
-
* useless sliver. */
|
|
819
|
+
* top, value beneath). Below it, a long key's capped column (34% of the
|
|
820
|
+
* record) plus the gap leaves the value a useless sliver. */
|
|
731
821
|
var STACK_BELOW_PX = 360;
|
|
732
822
|
/**
|
|
733
823
|
* Record renderer that observes its own width and switches the row
|
|
@@ -744,6 +834,22 @@ var RecordTable = (0, react_1.memo)(function (_a) {
|
|
|
744
834
|
var entries = _a.entries, ctx = _a.ctx, theme = _a.theme, depth = _a.depth, path = _a.path;
|
|
745
835
|
var shellRef = (0, react_1.useRef)(null);
|
|
746
836
|
var _b = (0, react_1.useState)(false), stacked = _b[0], setStacked = _b[1];
|
|
837
|
+
/** The key being renamed, and the key column's width when its rename opened. The column
|
|
838
|
+
* holds that width until the rename is committed or cancelled, then fits its keys again:
|
|
839
|
+
* sized from the keys while typing, every value of the record moved with each keystroke
|
|
840
|
+
* that made the key the widest (and the input itself started wider than the column). */
|
|
841
|
+
var _c = (0, react_1.useState)(), rename = _c[0], setRename = _c[1];
|
|
842
|
+
var onRenameOpenChange = (0, react_1.useCallback)(function (key, open) {
|
|
843
|
+
if (!open) {
|
|
844
|
+
setRename(function (current) { return ((current === null || current === void 0 ? void 0 : current.key) === key ? undefined : current); });
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
// Read the column's used width now, while the key is still drawn: the first track of
|
|
848
|
+
// the record's resolved `grid-template-columns` (stacked records have no key column).
|
|
849
|
+
var node = shellRef.current;
|
|
850
|
+
var track = node ? getComputedStyle(node).gridTemplateColumns.split(' ')[0] : undefined;
|
|
851
|
+
setRename({ key: key, keyColumn: track && /^[\d.]+px$/.test(track) ? track : undefined });
|
|
852
|
+
}, []);
|
|
747
853
|
(0, react_1.useLayoutEffect)(function () {
|
|
748
854
|
var node = shellRef.current;
|
|
749
855
|
if (!node || typeof ResizeObserver === 'undefined')
|
|
@@ -763,7 +869,7 @@ var RecordTable = (0, react_1.memo)(function (_a) {
|
|
|
763
869
|
var k = _a[0];
|
|
764
870
|
return k;
|
|
765
871
|
});
|
|
766
|
-
return ((0, jsx_runtime_1.jsxs)(TableShell, { ref: shellRef, "$size": ctx.size, "$theme": theme, "$nested": depth > 0, className: 'reqore-data-view-record', children: [entries.map(function (_a, index) {
|
|
872
|
+
return ((0, jsx_runtime_1.jsxs)(TableShell, { ref: shellRef, "$size": ctx.size, "$theme": theme, "$nested": depth > 0, "$stacked": stacked, "$editable": ctx.editable, "$frozenKeyColumn": stacked ? undefined : rename === null || rename === void 0 ? void 0 : rename.keyColumn, className: 'reqore-data-view-record', children: [entries.map(function (_a, index) {
|
|
767
873
|
var _b;
|
|
768
874
|
var key = _a[0], item = _a[1];
|
|
769
875
|
var complex = (0, helpers_1.reqoreIsRecord)(ctx.envelope === false ? item : (0, helpers_1.reqoreUnwrapEnvelope)(item, ctx.envelope)) ||
|
|
@@ -773,7 +879,7 @@ var RecordTable = (0, react_1.memo)(function (_a) {
|
|
|
773
879
|
? item
|
|
774
880
|
: (0, helpers_1.reqoreUnwrapEnvelope)(item, ctx.envelope)).every(function (entry) { return isInlineableScalarValue(entry, ctx); })));
|
|
775
881
|
var rowPath = __spreadArray(__spreadArray([], path, true), [key], false);
|
|
776
|
-
return ((0, jsx_runtime_1.jsxs)(Row, { "$size": ctx.size, "$theme": theme, "$complex": complex, "$odd": index % 2 === 0, "$stacked": stacked, "$editable": ctx.editable, className: 'reqore-data-view-row', children: [ctx.editable ? ((0, jsx_runtime_1.jsx)(EditableKeyCell, { keyName: key, siblingKeys: siblingKeys, parentPath: path, ctx: ctx })) : ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: false, minimal: true, wrap: true, intent: ctx.keyIntent === null ? undefined : (_b = ctx.keyIntent) !== null && _b !== void 0 ? _b : 'info', color: ctx.keyColor, label: key, effect:
|
|
882
|
+
return ((0, jsx_runtime_1.jsxs)(Row, { "$size": ctx.size, "$theme": theme, "$complex": complex, "$odd": index % 2 === 0, "$stacked": stacked, "$editable": ctx.editable, className: 'reqore-data-view-row', children: [ctx.editable ? ((0, jsx_runtime_1.jsx)(EditableKeyCell, { keyName: key, siblingKeys: siblingKeys, parentPath: path, ctx: ctx, onRenameOpenChange: onRenameOpenChange })) : ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, flat: false, minimal: true, wrap: true, intent: ctx.keyIntent === null ? undefined : (_b = ctx.keyIntent) !== null && _b !== void 0 ? _b : 'info', color: ctx.keyColor, label: key, effect: BOLD_TAG_EFFECT, className: 'reqore-data-view-key' })), (0, jsx_runtime_1.jsx)(ValueCell, { "$size": ctx.size, "$theme": theme, "$complex": complex, "$stackedScalar": stacked && !complex, className: 'reqore-data-view-value-cell', children: renderTree(item, ctx, theme, depth + 1, rowPath) }), ctx.editable && (rename === null || rename === void 0 ? void 0 : rename.key) !== key ? ((0, jsx_runtime_1.jsx)(RowActions, { ctx: ctx, path: rowPath, ariaLabel: ctx.labels.removeProperty(key) })) : null] }, "".concat(path.join('.'), "-").concat(key)));
|
|
777
883
|
}), ctx.editable ? ((0, jsx_runtime_1.jsx)(AddEntryAffordance, { ctx: ctx, parentPath: path, context: { kind: 'record', existingKeys: siblingKeys } })) : null] }));
|
|
778
884
|
});
|
|
779
885
|
RecordTable.displayName = 'ReqoreDataView.RecordTable';
|
|
@@ -796,15 +902,15 @@ var renderTree = function (value, ctx, theme, depth, path) {
|
|
|
796
902
|
ctx.inlineScalarArrays &&
|
|
797
903
|
unwrapped.every(function (item) { return isInlineableScalarValue(item, ctx); });
|
|
798
904
|
if (allInlineable) {
|
|
799
|
-
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { size: ctx.size, gapSize: 'small', verticalAlign: 'center', children: [envelopeType ? ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, minimal: true, flat: false, label: envelopeType, effect:
|
|
905
|
+
return ((0, jsx_runtime_1.jsxs)(ScalarRow, { size: ctx.size, gapSize: 'small', verticalAlign: 'center', children: [envelopeType ? ((0, jsx_runtime_1.jsx)(Tag_1.default, { size: ctx.size, minimal: true, flat: false, label: envelopeType, effect: TYPE_TAG_EFFECT, className: 'reqore-data-view-type' })) : null, unwrapped.map(function (item, index) { return ((0, jsx_runtime_1.jsx)("span", { children: renderScalar(ctx.envelope === false ? item : (0, helpers_1.reqoreUnwrapEnvelope)(item, ctx.envelope), ctx.envelope === false ? undefined : (0, helpers_1.reqoreEnvelopeType)(item, ctx.envelope), ctx, __spreadArray(__spreadArray([], path, true), [String(index)], false)) }, "".concat(path.join('.'), "-").concat(index))); })] }));
|
|
800
906
|
}
|
|
801
907
|
var content = ((0, jsx_runtime_1.jsxs)(ArrayStack, { "$size": ctx.size, "$theme": theme, className: 'reqore-data-view-array', children: [unwrapped.map(function (item, index) {
|
|
802
908
|
var itemPath = __spreadArray(__spreadArray([], path, true), [String(index)], false);
|
|
803
|
-
return ((0, jsx_runtime_1.jsxs)(ArrayItem, { "$size": ctx.size, "$theme": theme, className: 'reqore-data-view-array-item reqore-data-view-row', children: [(0, jsx_runtime_1.jsxs)(ArrayItemContent, { children: [unwrapped.length > 1 ? ((0, jsx_runtime_1.jsx)(ArrayItemIndex, { "$size": ctx.size, "$theme": theme, children: index + 1 })) : null, renderTree(item, ctx, theme, depth + 1, itemPath)] }), ctx.editable ? ((0, jsx_runtime_1.jsx)(RowActions, { ctx: ctx, path: itemPath, ariaLabel:
|
|
909
|
+
return ((0, jsx_runtime_1.jsxs)(ArrayItem, { "$size": ctx.size, "$theme": theme, className: 'reqore-data-view-array-item reqore-data-view-row', children: [(0, jsx_runtime_1.jsxs)(ArrayItemContent, { children: [unwrapped.length > 1 ? ((0, jsx_runtime_1.jsx)(ArrayItemIndex, { "$size": ctx.size, "$theme": theme, children: index + 1 })) : null, renderTree(item, ctx, theme, depth + 1, itemPath)] }), ctx.editable ? ((0, jsx_runtime_1.jsx)(RowActions, { ctx: ctx, path: itemPath, ariaLabel: ctx.labels.removeItem(index + 1) })) : null] }, "".concat(path.join('.'), "-").concat(index)));
|
|
804
910
|
}), ctx.editable ? ((0, jsx_runtime_1.jsx)(AddEntryAffordance, { ctx: ctx, parentPath: path, context: { kind: 'array', length: unwrapped.length } })) : null] }));
|
|
805
911
|
if (depth === 0)
|
|
806
912
|
return content;
|
|
807
|
-
return ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: depth < ctx.defaultExpandDepth, label:
|
|
913
|
+
return ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: depth < ctx.defaultExpandDepth, label: ctx.labels.listSection(unwrapped.length), path: path, size: ctx.size, theme: theme, onToggle: ctx.onSectionToggle, children: content }));
|
|
808
914
|
}
|
|
809
915
|
// Records.
|
|
810
916
|
if ((0, helpers_1.reqoreIsRecord)(unwrapped)) {
|
|
@@ -812,13 +918,13 @@ var renderTree = function (value, ctx, theme, depth, path) {
|
|
|
812
918
|
var content = ((0, jsx_runtime_1.jsx)(RecordTable, { entries: entries, ctx: ctx, theme: theme, depth: depth, path: path }));
|
|
813
919
|
if (depth === 0)
|
|
814
920
|
return content;
|
|
815
|
-
return ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: depth < ctx.defaultExpandDepth, label:
|
|
921
|
+
return ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: depth < ctx.defaultExpandDepth, label: ctx.labels.objectSection(entries.length), path: path, size: ctx.size, theme: theme, onToggle: ctx.onSectionToggle, children: content }));
|
|
816
922
|
}
|
|
817
923
|
return renderScalar(unwrapped, envelopeType, ctx, path);
|
|
818
924
|
};
|
|
819
925
|
exports.ReqoreDataView = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref) {
|
|
820
926
|
var _b;
|
|
821
|
-
var data = _a.data, _c = _a.emptyText, emptyText = _c === void 0 ? 'No data.' : _c, _d = _a.collapsibleRoot, collapsibleRoot = _d === void 0 ? true : _d, _e = _a.defaultExpandDepth, defaultExpandDepth = _e === void 0 ? 2 : _e, _f = _a.showTypes, showTypes = _f === void 0 ? false : _f, _g = _a.inlineScalarArrays, inlineScalarArrays = _g === void 0 ? true : _g, _h = _a.envelope, envelope = _h === void 0 ? helpers_1.DEFAULT_ENVELOPE : _h, parseEmbedded = _a.parseEmbedded, parseDate = _a.parseDate, formatDate = _a.formatDate, onItemClick = _a.onItemClick, onSectionToggle = _a.onSectionToggle, keyColor = _a.keyColor, keyIntent = _a.keyIntent, _j = _a.editable, editable = _j === void 0 ? false : _j, onDataChange = _a.onDataChange, onValueChange = _a.onValueChange, onRemoveProperty = _a.onRemoveProperty, onRenameProperty = _a.onRenameProperty, onAddProperty = _a.onAddProperty, onChangeType = _a.onChangeType, _k = _a.size, size = _k === void 0 ? 'normal' : _k, customTheme = _a.customTheme, inheritCustomTheme = _a.inheritCustomTheme, intent = _a.intent, flat = _a.flat, panelProps = __rest(_a, ["data", "emptyText", "collapsibleRoot", "defaultExpandDepth", "showTypes", "inlineScalarArrays", "envelope", "parseEmbedded", "parseDate", "formatDate", "onItemClick", "onSectionToggle", "keyColor", "keyIntent", "editable", "onDataChange", "onValueChange", "onRemoveProperty", "onRenameProperty", "onAddProperty", "onChangeType", "size", "customTheme", "inheritCustomTheme", "intent", "flat"]);
|
|
927
|
+
var data = _a.data, _c = _a.emptyText, emptyText = _c === void 0 ? 'No data.' : _c, _d = _a.collapsibleRoot, collapsibleRoot = _d === void 0 ? true : _d, _e = _a.defaultExpandDepth, defaultExpandDepth = _e === void 0 ? 2 : _e, _f = _a.showTypes, showTypes = _f === void 0 ? false : _f, _g = _a.inlineScalarArrays, inlineScalarArrays = _g === void 0 ? true : _g, _h = _a.envelope, envelope = _h === void 0 ? helpers_1.DEFAULT_ENVELOPE : _h, parseEmbedded = _a.parseEmbedded, parseDate = _a.parseDate, formatDate = _a.formatDate, onItemClick = _a.onItemClick, onSectionToggle = _a.onSectionToggle, keyColor = _a.keyColor, keyIntent = _a.keyIntent, _j = _a.editable, editable = _j === void 0 ? false : _j, onDataChange = _a.onDataChange, onValueChange = _a.onValueChange, onRemoveProperty = _a.onRemoveProperty, onRenameProperty = _a.onRenameProperty, onAddProperty = _a.onAddProperty, onChangeType = _a.onChangeType, labels = _a.labels, _k = _a.size, size = _k === void 0 ? 'normal' : _k, customTheme = _a.customTheme, inheritCustomTheme = _a.inheritCustomTheme, intent = _a.intent, flat = _a.flat, panelProps = __rest(_a, ["data", "emptyText", "collapsibleRoot", "defaultExpandDepth", "showTypes", "inlineScalarArrays", "envelope", "parseEmbedded", "parseDate", "formatDate", "onItemClick", "onSectionToggle", "keyColor", "keyIntent", "editable", "onDataChange", "onValueChange", "onRemoveProperty", "onRenameProperty", "onAddProperty", "onChangeType", "labels", "size", "customTheme", "inheritCustomTheme", "intent", "flat"]);
|
|
822
928
|
var theme = (0, useTheme_1.useReqoreTheme)('main', customTheme, intent, undefined, inheritCustomTheme);
|
|
823
929
|
// In editable mode an empty `{}` or `[]` must still render the
|
|
824
930
|
// tree so the `+ Add property` / `+ Add item` affordance is
|
|
@@ -885,8 +991,10 @@ exports.ReqoreDataView = (0, react_1.memo)((0, react_1.forwardRef)(function (_a,
|
|
|
885
991
|
var next = (0, helpers_1.reqoreSetAtPath)(dataRef.current, path, (0, helpers_1.reqoreCoerceValueToKind)(current, kind));
|
|
886
992
|
onDataChange(next);
|
|
887
993
|
}, [onChangeType, onDataChange]);
|
|
994
|
+
var resolvedLabels = (0, react_1.useMemo)(function () { return resolveDataViewLabels(labels); }, [labels]);
|
|
888
995
|
var ctx = {
|
|
889
996
|
theme: theme,
|
|
997
|
+
labels: resolvedLabels,
|
|
890
998
|
envelope: envelope,
|
|
891
999
|
parseEmbedded: parseEmbedded,
|
|
892
1000
|
showTypes: showTypes,
|
|
@@ -906,10 +1014,10 @@ exports.ReqoreDataView = (0, react_1.memo)((0, react_1.forwardRef)(function (_a,
|
|
|
906
1014
|
commitTypeChange: editable ? commitTypeChange : undefined,
|
|
907
1015
|
};
|
|
908
1016
|
var body = empty ? ((0, jsx_runtime_1.jsx)(Paragraph_1.ReqoreP, { size: size, effect: { opacity: 0.65 }, children: emptyText })) : collapsibleRoot ? ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: true, label: Array.isArray(data)
|
|
909
|
-
?
|
|
1017
|
+
? ctx.labels.listSection(data.length)
|
|
910
1018
|
: (0, helpers_1.reqoreIsRecord)(data)
|
|
911
|
-
?
|
|
912
|
-
:
|
|
1019
|
+
? ctx.labels.objectSection(Object.keys(data).length)
|
|
1020
|
+
: ctx.labels.scalarSection, path: [], size: size, theme: theme, onToggle: onSectionToggle, children: (0, jsx_runtime_1.jsx)(Tree, { "$size": size, "$theme": theme, className: 'reqore-data-view-root', children: renderTree(data, ctx, theme, 0, []) }) })) : ((0, jsx_runtime_1.jsx)(Tree, { "$size": size, "$theme": theme, className: 'reqore-data-view-root', children: renderTree(data, ctx, theme, 0, []) }));
|
|
913
1021
|
return ((0, jsx_runtime_1.jsx)(Panel_1.ReqorePanel, __assign({}, panelProps, { ref: ref, size: size, customTheme: customTheme, inheritCustomTheme: inheritCustomTheme, intent: intent, flat: flat, className: "reqore-data-view ".concat((_b = panelProps.className) !== null && _b !== void 0 ? _b : '').trim(), children: body })));
|
|
914
1022
|
}));
|
|
915
1023
|
exports.ReqoreDataView.displayName = 'ReqoreDataView';
|
|
@@ -927,5 +1035,5 @@ Object.defineProperty(exports, "reqoreIsRecord", { enumerable: true, get: functi
|
|
|
927
1035
|
Object.defineProperty(exports, "reqoreRenameKeyAtPath", { enumerable: true, get: function () { return helpers_2.reqoreRenameKeyAtPath; } });
|
|
928
1036
|
Object.defineProperty(exports, "reqoreSetAtPath", { enumerable: true, get: function () { return helpers_2.reqoreSetAtPath; } });
|
|
929
1037
|
Object.defineProperty(exports, "reqoreUnwrapEnvelope", { enumerable: true, get: function () { return helpers_2.reqoreUnwrapEnvelope; } });
|
|
930
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18;
|
|
1038
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19;
|
|
931
1039
|
//# sourceMappingURL=index.js.map
|