@qoretechnologies/reqore 0.78.19 → 0.78.20-pr.723.g9cefab8
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 +359 -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 +217 -114
- 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,32 @@ 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;
|
|
162
|
+
if ($stacked) {
|
|
163
|
+
return 'minmax(0, 1fr)';
|
|
164
|
+
}
|
|
165
|
+
return $editable ? "".concat(KEY_COLUMN, " minmax(0, 1fr) auto") : "".concat(KEY_COLUMN, " minmax(0, 1fr)");
|
|
166
|
+
};
|
|
167
|
+
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
168
|
var $theme = _a.$theme;
|
|
107
169
|
return (0, polished_1.rgba)((0, colors_1.getReadableColor)($theme), 0.08);
|
|
108
170
|
}, function (_a) {
|
|
@@ -115,17 +177,12 @@ var TableShell = styled_1.default.div(templateObject_2 || (templateObject_2 = __
|
|
|
115
177
|
var $nested = _a.$nested;
|
|
116
178
|
return $nested ? 'rgba(0, 0, 0, 0.45)' : 'rgba(0, 0, 0, 0.15)';
|
|
117
179
|
});
|
|
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
|
|
180
|
+
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 /* While a key is renamed, its column, and so every value of the record, stays exactly where it\n was. The key column is sized by the browser from what its cells contribute, so the rename\n cell contributes what the key did: the key itself, drawn as it was at rest but invisible and\n no height (`.reqore-data-view-key-edit-sizer`), holds the cell's width, and the input\n contributes nothing (`width: 0`) and fills the cell it is given (`min-width: 100%`).\n Nothing is measured, so nothing is rounded: a width read back from the page (the resolved\n `grid-template-columns` is serialized to a few digits) and set again moved the values by a\n fraction of a pixel. Text longer than the column scrolls inside the input, which never\n wraps; the commit and cancel buttons sit in the actions cell, so the column is the input's. */\n & > .reqore-data-view-key-edit-group {\n display: grid;\n }\n & > .reqore-data-view-key-edit-group > * {\n grid-area: 1 / 1;\n }\n & > .reqore-data-view-key-edit-group > .reqore-data-view-key-edit-sizer {\n justify-self: start;\n height: 0;\n visibility: hidden;\n pointer-events: none;\n }\n & > .reqore-data-view-key-edit-group > .reqore-control-wrapper {\n width: 0;\n min-width: 100%;\n }\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 /* While a key is renamed, its column, and so every value of the record, stays exactly where it\n was. The key column is sized by the browser from what its cells contribute, so the rename\n cell contributes what the key did: the key itself, drawn as it was at rest but invisible and\n no height (\\`.reqore-data-view-key-edit-sizer\\`), holds the cell's width, and the input\n contributes nothing (\\`width: 0\\`) and fills the cell it is given (\\`min-width: 100%\\`).\n Nothing is measured, so nothing is rounded: a width read back from the page (the resolved\n \\`grid-template-columns\\` is serialized to a few digits) and set again moved the values by a\n fraction of a pixel. Text longer than the column scrolls inside the input, which never\n wraps; the commit and cancel buttons sit in the actions cell, so the column is the input's. */\n & > .reqore-data-view-key-edit-group {\n display: grid;\n }\n & > .reqore-data-view-key-edit-group > * {\n grid-area: 1 / 1;\n }\n & > .reqore-data-view-key-edit-group > .reqore-data-view-key-edit-sizer {\n justify-self: start;\n height: 0;\n visibility: hidden;\n pointer-events: none;\n }\n & > .reqore-data-view-key-edit-group > .reqore-control-wrapper {\n width: 0;\n min-width: 100%;\n }\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
181
|
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';
|
|
182
|
+
if (!($complex || $stacked)) {
|
|
183
|
+
return 'subgrid';
|
|
125
184
|
}
|
|
126
|
-
return
|
|
127
|
-
? 'minmax(0, 1fr)'
|
|
128
|
-
: 'minmax(120px, min(34%, 220px)) minmax(0, 1fr)';
|
|
185
|
+
return $editable ? 'minmax(0, 1fr) auto' : 'minmax(0, 1fr)';
|
|
129
186
|
}, function (_a) {
|
|
130
187
|
var $complex = _a.$complex, $stacked = _a.$stacked, $editable = _a.$editable;
|
|
131
188
|
var stacked = $complex || $stacked;
|
|
@@ -137,7 +194,7 @@ var Row = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTem
|
|
|
137
194
|
return stacked ? "'key' 'value'" : "'key value'";
|
|
138
195
|
}, function (_a) {
|
|
139
196
|
var $size = _a.$size, $complex = _a.$complex, $stacked = _a.$stacked;
|
|
140
|
-
return $complex || $stacked ? sizes_1.GAP_FROM_SIZE[$size] :
|
|
197
|
+
return $complex || $stacked ? sizes_1.GAP_FROM_SIZE[$size] : KEY_VALUE_GAP_PX;
|
|
141
198
|
}, function (_a) {
|
|
142
199
|
var $size = _a.$size;
|
|
143
200
|
return sizes_1.PADDING_FROM_SIZE[$size] / 2;
|
|
@@ -154,7 +211,7 @@ var Row = styled_1.default.div(templateObject_4 || (templateObject_4 = __makeTem
|
|
|
154
211
|
var $complex = _a.$complex;
|
|
155
212
|
return $complex && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: column;\n "], ["\n flex-direction: column;\n "])));
|
|
156
213
|
});
|
|
157
|
-
var ValueCell = styled_1.default.div(
|
|
214
|
+
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
215
|
var $size = _a.$size;
|
|
159
216
|
return sizes_1.TEXT_FROM_SIZE[$size] - 1;
|
|
160
217
|
}, function (_a) {
|
|
@@ -163,6 +220,9 @@ var ValueCell = styled_1.default.div(templateObject_6 || (templateObject_6 = __m
|
|
|
163
220
|
}, function (_a) {
|
|
164
221
|
var $complex = _a.$complex, $size = _a.$size;
|
|
165
222
|
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);
|
|
223
|
+
}, function (_a) {
|
|
224
|
+
var $stackedScalar = _a.$stackedScalar;
|
|
225
|
+
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
226
|
});
|
|
167
227
|
/** Multiline strings are data documents, not compact scalar labels. Rendering
|
|
168
228
|
* them inside a tag creates a very tall pill and makes large text/plain
|
|
@@ -173,7 +233,7 @@ var ValueCell = styled_1.default.div(templateObject_6 || (templateObject_6 = __m
|
|
|
173
233
|
* and no `color`) so the block reads as the same value-chip family, just
|
|
174
234
|
* taller and pre-formatted, rather than an unrelated visual element. Only
|
|
175
235
|
* the font, wrapping and scroll behaviour are new. */
|
|
176
|
-
var MultilineValue = styled_1.default.pre(
|
|
236
|
+
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
237
|
var $size = _a.$size;
|
|
178
238
|
return sizes_1.PADDING_FROM_SIZE[$size];
|
|
179
239
|
}, function (_a) {
|
|
@@ -193,13 +253,13 @@ var MultilineValue = styled_1.default.pre(templateObject_8 || (templateObject_8
|
|
|
193
253
|
return ($interactive ? 'pointer' : 'text');
|
|
194
254
|
}, function (_a) {
|
|
195
255
|
var $interactive = _a.$interactive, $theme = _a.$theme;
|
|
196
|
-
return $interactive && (0, styled_components_1.css)(
|
|
256
|
+
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
257
|
});
|
|
198
|
-
var ArrayStack = styled_1.default.div(
|
|
258
|
+
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
259
|
var $size = _a.$size;
|
|
200
260
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
201
261
|
});
|
|
202
|
-
var ArrayItem = styled_1.default.div(
|
|
262
|
+
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
263
|
var $size = _a.$size;
|
|
204
264
|
return sizes_1.PADDING_FROM_SIZE[$size];
|
|
205
265
|
}, function (_a) {
|
|
@@ -224,8 +284,8 @@ var ArrayItem = styled_1.default.div(templateObject_10 || (templateObject_10 = _
|
|
|
224
284
|
/** Content column for an array item — wraps the item's index +
|
|
225
285
|
* rendered value so the flex row's other cell (the action group)
|
|
226
286
|
* sits to the right without competing for width. */
|
|
227
|
-
var ArrayItemContent = styled_1.default.div(
|
|
228
|
-
var ArrayItemIndex = styled_1.default.span(
|
|
287
|
+
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"])));
|
|
288
|
+
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
289
|
var $size = _a.$size;
|
|
230
290
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
231
291
|
}, function (_a) {
|
|
@@ -235,12 +295,12 @@ var ArrayItemIndex = styled_1.default.span(templateObject_12 || (templateObject_
|
|
|
235
295
|
var $theme = _a.$theme;
|
|
236
296
|
return (0, colors_1.getReadableColor)($theme);
|
|
237
297
|
}, fonts_1.MONO_FONT);
|
|
238
|
-
var ScalarRow = (0, styled_1.default)(ControlGroup_1.default)(
|
|
239
|
-
var SectionDetails = styled_1.default.details(
|
|
298
|
+
var ScalarRow = (0, styled_1.default)(ControlGroup_1.default)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n flex-wrap: wrap;\n"], ["\n flex-wrap: wrap;\n"])));
|
|
299
|
+
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
300
|
var $size = _a.$size;
|
|
241
301
|
return sizes_1.GAP_FROM_SIZE[$size];
|
|
242
302
|
});
|
|
243
|
-
var SectionSummary = styled_1.default.summary(
|
|
303
|
+
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
304
|
var $size = _a.$size;
|
|
245
305
|
return sizes_1.TEXT_FROM_SIZE[$size] - 2;
|
|
246
306
|
}, function (_a) {
|
|
@@ -314,6 +374,15 @@ var PreservedDetails = (0, react_1.memo)(function (_a) {
|
|
|
314
374
|
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
375
|
});
|
|
316
376
|
PreservedDetails.displayName = 'ReqoreDataView.PreservedDetails';
|
|
377
|
+
/** How a scalar is written: a yes/no value in the labels' words, any other
|
|
378
|
+
* as `reqoreFormatScalar` writes it. */
|
|
379
|
+
var scalarDisplay = function (value, display, ctx) {
|
|
380
|
+
return typeof value === 'boolean'
|
|
381
|
+
? value
|
|
382
|
+
? ctx.labels.booleanTrue
|
|
383
|
+
: ctx.labels.booleanFalse
|
|
384
|
+
: display;
|
|
385
|
+
};
|
|
317
386
|
/** Render the read-only value chip for a scalar leaf. Extracted so
|
|
318
387
|
* both the read-only view and the click-to-edit cell share one
|
|
319
388
|
* rendering — keeps the "before / after" look of an edited row
|
|
@@ -322,9 +391,9 @@ var renderScalarChip = function (value, type, ctx, path) {
|
|
|
322
391
|
var scalar = (0, helpers_1.reqoreFormatScalar)(value, type, ctx.scalarOptions);
|
|
323
392
|
var kind = type ? (0, helpers_1.reqoreDataValueKind)(value, type) : scalar.kind;
|
|
324
393
|
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:
|
|
394
|
+
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
395
|
};
|
|
327
|
-
var EditCellShell = styled_1.default.span(
|
|
396
|
+
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
397
|
var $editing = _a.$editing;
|
|
329
398
|
return ($editing ? 'text' : 'pointer');
|
|
330
399
|
}, function (_a) {
|
|
@@ -409,17 +478,6 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
409
478
|
commit(path, text);
|
|
410
479
|
setEditing(false);
|
|
411
480
|
}, [cancelEditing, commit, draft, isBoolean, isNumber, path, value]);
|
|
412
|
-
if (!editing) {
|
|
413
|
-
return ((0, jsx_runtime_1.jsx)(EditCellShell, { "data-editing": 'false', onClick: function (e) {
|
|
414
|
-
e.stopPropagation();
|
|
415
|
-
startEditing();
|
|
416
|
-
}, onKeyDown: function (e) {
|
|
417
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
418
|
-
e.preventDefault();
|
|
419
|
-
startEditing();
|
|
420
|
-
}
|
|
421
|
-
}, role: 'button', tabIndex: 0, "aria-label": 'Edit value', children: renderScalarChip(value, type, ctx, path) }));
|
|
422
|
-
}
|
|
423
481
|
// Inline type-change. Coerces the CURRENT DRAFT (in its
|
|
424
482
|
// canonical form for the current kind — string for text/numeric
|
|
425
483
|
// inputs, boolean for the checkbox) to the picked kind. A user
|
|
@@ -433,7 +491,7 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
433
491
|
// `object` / `array` / `null` commits the coerced value and
|
|
434
492
|
// exits so the right control takes over (structural view / "—"
|
|
435
493
|
// chip).
|
|
436
|
-
var handlePickType = function (newKind) {
|
|
494
|
+
var handlePickType = (0, react_1.useCallback)(function (newKind) {
|
|
437
495
|
var _a;
|
|
438
496
|
if (newKind === kind)
|
|
439
497
|
return;
|
|
@@ -448,8 +506,27 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
448
506
|
else {
|
|
449
507
|
setEditing(false);
|
|
450
508
|
}
|
|
451
|
-
};
|
|
452
|
-
var
|
|
509
|
+
}, [ctx, draft, kind, path]);
|
|
510
|
+
var typeItems = (0, react_1.useMemo)(function () {
|
|
511
|
+
return typePickerItems(ctx.labels).map(function (entry) { return ({
|
|
512
|
+
label: entry.label,
|
|
513
|
+
icon: entry.icon,
|
|
514
|
+
selected: entry.kind === kind,
|
|
515
|
+
onClick: function () { return handlePickType(entry.kind); },
|
|
516
|
+
}); });
|
|
517
|
+
}, [ctx.labels, handlePickType, kind]);
|
|
518
|
+
if (!editing) {
|
|
519
|
+
return ((0, jsx_runtime_1.jsx)(EditCellShell, { "data-editing": 'false', onClick: function (e) {
|
|
520
|
+
e.stopPropagation();
|
|
521
|
+
startEditing();
|
|
522
|
+
}, onKeyDown: function (e) {
|
|
523
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
524
|
+
e.preventDefault();
|
|
525
|
+
startEditing();
|
|
526
|
+
}
|
|
527
|
+
}, role: 'button', tabIndex: 0, "aria-label": ctx.labels.editValue, children: renderScalarChip(value, type, ctx, path) }));
|
|
528
|
+
}
|
|
529
|
+
var currentTypeItem = typePickerItems(ctx.labels).find(function (entry) { return entry.kind === kind; });
|
|
453
530
|
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
531
|
// Toggle the LOCAL draft only — Save commits, Cancel
|
|
455
532
|
// discards. Keeps the edit semantics identical to
|
|
@@ -469,15 +546,10 @@ var EditableScalarCell = (0, react_1.memo)(function (_a) {
|
|
|
469
546
|
event.preventDefault();
|
|
470
547
|
cancelEditing();
|
|
471
548
|
}
|
|
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:
|
|
473
|
-
label: entry.label,
|
|
474
|
-
icon: entry.icon,
|
|
475
|
-
selected: entry.kind === kind,
|
|
476
|
-
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: 'Save (Enter)', onMouseDown: function (e) {
|
|
549
|
+
}, 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: typeItems })) : 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,15 @@ 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
|
+
setOpen(true);
|
|
511
598
|
setDraft(keyName);
|
|
512
599
|
setEditing(true);
|
|
513
|
-
}, [commit, keyName]);
|
|
600
|
+
}, [commit, keyName, setOpen]);
|
|
514
601
|
var cancel = (0, react_1.useCallback)(function () {
|
|
515
602
|
setDraft(keyName);
|
|
516
603
|
setEditing(false);
|
|
517
|
-
|
|
604
|
+
setOpen(false);
|
|
605
|
+
}, [keyName, setOpen]);
|
|
518
606
|
var submit = (0, react_1.useCallback)(function () {
|
|
519
607
|
var trimmed = draft.trim();
|
|
520
608
|
if (!commit || !trimmed || trimmed === keyName) {
|
|
@@ -527,35 +615,39 @@ var EditableKeyCell = (0, react_1.memo)(function (_a) {
|
|
|
527
615
|
}
|
|
528
616
|
commit(parentPath, keyName, trimmed);
|
|
529
617
|
setEditing(false);
|
|
530
|
-
|
|
618
|
+
setOpen(false);
|
|
619
|
+
}, [cancel, commit, draft, keyName, parentPath, siblingKeys, setOpen]);
|
|
620
|
+
var keyTag = ((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' }));
|
|
621
|
+
var handleCommitMouseDown = (0, react_1.useCallback)(function (e) {
|
|
622
|
+
e.preventDefault();
|
|
623
|
+
submit();
|
|
624
|
+
}, [submit]);
|
|
625
|
+
var handleCancelMouseDown = (0, react_1.useCallback)(function (e) {
|
|
626
|
+
e.preventDefault();
|
|
627
|
+
cancel();
|
|
628
|
+
}, [cancel]);
|
|
531
629
|
if (!editing) {
|
|
532
630
|
return ((0, jsx_runtime_1.jsx)(EditCellShell, { "data-editing": 'false', onClick: function (e) {
|
|
533
631
|
e.stopPropagation();
|
|
534
632
|
start();
|
|
535
|
-
}, role: 'button', tabIndex: 0, "aria-label":
|
|
633
|
+
}, role: 'button', tabIndex: 0, "aria-label": ctx.labels.renameKey, className: 'reqore-data-view-key-shell', children: keyTag }));
|
|
536
634
|
}
|
|
537
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
e.preventDefault();
|
|
554
|
-
submit();
|
|
555
|
-
}, 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: 'Cancel (Esc)', onMouseDown: function (e) {
|
|
556
|
-
e.preventDefault();
|
|
557
|
-
cancel();
|
|
558
|
-
}, className: 'reqore-data-view-key-edit-cancel' })] }));
|
|
635
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'reqore-data-view-key-edit-group', children: [(0, jsx_runtime_1.jsx)(EditCellShell, { "data-editing": 'true', "aria-hidden": true, className: 'reqore-data-view-key-shell reqore-data-view-key-edit-sizer', children: keyTag }), (0, jsx_runtime_1.jsx)(Input_1.default, { size: ctx.size, value: draft, fluid: true, ref: (function (node) {
|
|
636
|
+
if (node instanceof HTMLElement) {
|
|
637
|
+
inputRef.current = node.querySelector('input');
|
|
638
|
+
}
|
|
639
|
+
}), onChange: function (e) {
|
|
640
|
+
return setDraft(e.target.value);
|
|
641
|
+
}, onBlur: submit, onKeyDown: function (e) {
|
|
642
|
+
if (e.key === 'Enter') {
|
|
643
|
+
e.preventDefault();
|
|
644
|
+
submit();
|
|
645
|
+
}
|
|
646
|
+
else if (e.key === 'Escape') {
|
|
647
|
+
e.preventDefault();
|
|
648
|
+
cancel();
|
|
649
|
+
}
|
|
650
|
+
}, 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: handleCommitMouseDown, 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: handleCancelMouseDown, className: 'reqore-data-view-key-edit-cancel' })] })] }));
|
|
559
651
|
});
|
|
560
652
|
EditableKeyCell.displayName = 'ReqoreDataView.EditableKeyCell';
|
|
561
653
|
/** Hover-revealed row action group — currently the delete button.
|
|
@@ -565,7 +657,7 @@ EditableKeyCell.displayName = 'ReqoreDataView.EditableKeyCell';
|
|
|
565
657
|
* group's `opacity` is `0` by default and promoted to `1` on row
|
|
566
658
|
* hover via the parent `Row`'s `:hover` rule. The cell itself stays
|
|
567
659
|
* in the layout so the row width doesn't jump as the user hovers. */
|
|
568
|
-
var RowActionsContainer = styled_1.default.div(
|
|
660
|
+
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
661
|
var RowActions = (0, react_1.memo)(function (_a) {
|
|
570
662
|
var ctx = _a.ctx, path = _a.path, ariaLabel = _a.ariaLabel;
|
|
571
663
|
if (!ctx.commitDelete)
|
|
@@ -591,15 +683,16 @@ var defaultForKind = function (kind) {
|
|
|
591
683
|
return null;
|
|
592
684
|
}
|
|
593
685
|
};
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
{ kind: '
|
|
597
|
-
{ kind: '
|
|
598
|
-
{ kind: '
|
|
599
|
-
{ kind: '
|
|
600
|
-
{ kind: '
|
|
601
|
-
|
|
602
|
-
|
|
686
|
+
/** The kinds a value can be given, each named by the labels. */
|
|
687
|
+
var typePickerItems = function (labels) { return [
|
|
688
|
+
{ kind: 'string', label: labels.typeStringLabel, icon: 'TextWrap' },
|
|
689
|
+
{ kind: 'number', label: labels.typeNumberLabel, icon: 'Hashtag' },
|
|
690
|
+
{ kind: 'boolean', label: labels.typeBooleanLabel, icon: 'CheckboxLine' },
|
|
691
|
+
{ kind: 'object', label: labels.typeObjectLabel, icon: 'BracesLine' },
|
|
692
|
+
{ kind: 'array', label: labels.typeArrayLabel, icon: 'BracketsLine' },
|
|
693
|
+
{ kind: 'null', label: labels.typeNullLabel, icon: 'CircleLine' },
|
|
694
|
+
]; };
|
|
695
|
+
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
696
|
var theme = _a.theme;
|
|
604
697
|
return (0, polished_1.rgba)((0, colors_1.getReadableColor)(theme), 0.2);
|
|
605
698
|
});
|
|
@@ -609,6 +702,14 @@ var AddEntryAffordance = (0, react_1.memo)(function (_a) {
|
|
|
609
702
|
var _c = (0, react_1.useState)(false), open = _c[0], setOpen = _c[1];
|
|
610
703
|
var _d = (0, react_1.useState)(''), key = _d[0], setKey = _d[1];
|
|
611
704
|
var _e = (0, react_1.useState)('string'), valueKind = _e[0], setValueKind = _e[1];
|
|
705
|
+
var typeItems = (0, react_1.useMemo)(function () {
|
|
706
|
+
return typePickerItems(ctx.labels).map(function (entry) { return ({
|
|
707
|
+
label: entry.label,
|
|
708
|
+
icon: entry.icon,
|
|
709
|
+
selected: entry.kind === valueKind,
|
|
710
|
+
onClick: function () { return setValueKind(entry.kind); },
|
|
711
|
+
}); });
|
|
712
|
+
}, [ctx.labels, valueKind]);
|
|
612
713
|
if (!ctx.commitAdd)
|
|
613
714
|
return null;
|
|
614
715
|
var reset = function () {
|
|
@@ -632,27 +733,24 @@ var AddEntryAffordance = (0, react_1.memo)(function (_a) {
|
|
|
632
733
|
reset();
|
|
633
734
|
};
|
|
634
735
|
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'
|
|
736
|
+
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'
|
|
737
|
+
? ctx.labels.addPropertyLabel
|
|
738
|
+
: ctx.labels.addItemLabel }) }));
|
|
636
739
|
}
|
|
637
|
-
var typeItem =
|
|
740
|
+
var typeItem = typePickerItems(ctx.labels).find(function (entry) { return entry.kind === valueKind; });
|
|
638
741
|
return ((0, jsx_runtime_1.jsxs)(AddRowShell, { className: 'reqore-data-view-add-row', "data-state": 'expanded', onKeyDown: function (e) {
|
|
639
742
|
if (e.key === 'Escape') {
|
|
640
743
|
e.preventDefault();
|
|
641
744
|
reset();
|
|
642
745
|
}
|
|
643
|
-
}, children: [context.kind === 'record' ? ((0, jsx_runtime_1.jsx)(Input_1.default, { size: ctx.size, placeholder:
|
|
746
|
+
}, 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
747
|
return setKey(e.target.value);
|
|
645
748
|
}, onKeyDown: function (e) {
|
|
646
749
|
if (e.key === 'Enter') {
|
|
647
750
|
e.preventDefault();
|
|
648
751
|
submit();
|
|
649
752
|
}
|
|
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 :
|
|
651
|
-
label: entry.label,
|
|
652
|
-
icon: entry.icon,
|
|
653
|
-
selected: entry.kind === valueKind,
|
|
654
|
-
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: 'Add', 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: 'Cancel', className: 'reqore-data-view-add-cancel' })] }));
|
|
753
|
+
}, 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: typeItems }), (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
754
|
});
|
|
657
755
|
AddEntryAffordance.displayName = 'ReqoreDataView.AddEntryAffordance';
|
|
658
756
|
var isInlineableScalarValue = function (value, ctx) {
|
|
@@ -674,7 +772,7 @@ var renderScalar = function (value, type, ctx, path) {
|
|
|
674
772
|
var cell = ((0, jsx_runtime_1.jsx)(EditableScalarCell, { value: value, kind: kind, type: type, ctx: ctx, path: path }));
|
|
675
773
|
if (!ctx.showTypes || !displayType)
|
|
676
774
|
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:
|
|
775
|
+
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
776
|
}
|
|
679
777
|
var multiline = kind === 'string' && /[\r\n]/.test(scalar.display);
|
|
680
778
|
if (multiline) {
|
|
@@ -699,7 +797,7 @@ var renderScalar = function (value, type, ctx, path) {
|
|
|
699
797
|
: undefined, children: displayText }));
|
|
700
798
|
if (!ctx.showTypes || !displayType)
|
|
701
799
|
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:
|
|
800
|
+
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
801
|
}
|
|
704
802
|
// Value chip: minimal + intent-tinted (so the type is colour-coded
|
|
705
803
|
// without shouting), weight bold. We always render with a border
|
|
@@ -714,20 +812,17 @@ var renderScalar = function (value, type, ctx, path) {
|
|
|
714
812
|
// identifier) renders as a single non-wrapping pill that
|
|
715
813
|
// overflows its column horizontally. With `wrap`, ReqoreTag
|
|
716
814
|
// 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
|
|
815
|
+
wrap: true, label: scalarDisplay(value, scalar.display, ctx), intent: intent, effect: BOLD_TAG_EFFECT, onClick: ctx.onItemClick
|
|
720
816
|
? function () { return ctx.onItemClick(value, path); }
|
|
721
817
|
: undefined, className: 'reqore-data-view-value' }));
|
|
722
818
|
if (!ctx.showTypes || !displayType)
|
|
723
819
|
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:
|
|
820
|
+
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
821
|
};
|
|
726
822
|
/** Width (in CSS px) below which a `RecordTable` switches its rows
|
|
727
823
|
* from a two-column grid (key | value) to a single column (key on
|
|
728
|
-
* top, value beneath).
|
|
729
|
-
*
|
|
730
|
-
* useless sliver. */
|
|
824
|
+
* top, value beneath). Below it, a long key's capped column (34% of the
|
|
825
|
+
* record) plus the gap leaves the value a useless sliver. */
|
|
731
826
|
var STACK_BELOW_PX = 360;
|
|
732
827
|
/**
|
|
733
828
|
* Record renderer that observes its own width and switches the row
|
|
@@ -744,6 +839,12 @@ var RecordTable = (0, react_1.memo)(function (_a) {
|
|
|
744
839
|
var entries = _a.entries, ctx = _a.ctx, theme = _a.theme, depth = _a.depth, path = _a.path;
|
|
745
840
|
var shellRef = (0, react_1.useRef)(null);
|
|
746
841
|
var _b = (0, react_1.useState)(false), stacked = _b[0], setStacked = _b[1];
|
|
842
|
+
/** The key being renamed: its row's actions cell holds the rename's commit and cancel
|
|
843
|
+
* buttons, in place of the delete button, until the rename is committed or cancelled. */
|
|
844
|
+
var _c = (0, react_1.useState)(), renamingKey = _c[0], setRenamingKey = _c[1];
|
|
845
|
+
var onRenameOpenChange = (0, react_1.useCallback)(function (key, open) {
|
|
846
|
+
setRenamingKey(function (current) { return (open ? key : current === key ? undefined : current); });
|
|
847
|
+
}, []);
|
|
747
848
|
(0, react_1.useLayoutEffect)(function () {
|
|
748
849
|
var node = shellRef.current;
|
|
749
850
|
if (!node || typeof ResizeObserver === 'undefined')
|
|
@@ -763,7 +864,7 @@ var RecordTable = (0, react_1.memo)(function (_a) {
|
|
|
763
864
|
var k = _a[0];
|
|
764
865
|
return k;
|
|
765
866
|
});
|
|
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) {
|
|
867
|
+
return ((0, jsx_runtime_1.jsxs)(TableShell, { ref: shellRef, "$size": ctx.size, "$theme": theme, "$nested": depth > 0, "$stacked": stacked, "$editable": ctx.editable, className: 'reqore-data-view-record', children: [entries.map(function (_a, index) {
|
|
767
868
|
var _b;
|
|
768
869
|
var key = _a[0], item = _a[1];
|
|
769
870
|
var complex = (0, helpers_1.reqoreIsRecord)(ctx.envelope === false ? item : (0, helpers_1.reqoreUnwrapEnvelope)(item, ctx.envelope)) ||
|
|
@@ -773,7 +874,7 @@ var RecordTable = (0, react_1.memo)(function (_a) {
|
|
|
773
874
|
? item
|
|
774
875
|
: (0, helpers_1.reqoreUnwrapEnvelope)(item, ctx.envelope)).every(function (entry) { return isInlineableScalarValue(entry, ctx); })));
|
|
775
876
|
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:
|
|
877
|
+
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 && renamingKey !== key ? ((0, jsx_runtime_1.jsx)(RowActions, { ctx: ctx, path: rowPath, ariaLabel: ctx.labels.removeProperty(key) })) : null] }, "".concat(path.join('.'), "-").concat(key)));
|
|
777
878
|
}), ctx.editable ? ((0, jsx_runtime_1.jsx)(AddEntryAffordance, { ctx: ctx, parentPath: path, context: { kind: 'record', existingKeys: siblingKeys } })) : null] }));
|
|
778
879
|
});
|
|
779
880
|
RecordTable.displayName = 'ReqoreDataView.RecordTable';
|
|
@@ -796,15 +897,15 @@ var renderTree = function (value, ctx, theme, depth, path) {
|
|
|
796
897
|
ctx.inlineScalarArrays &&
|
|
797
898
|
unwrapped.every(function (item) { return isInlineableScalarValue(item, ctx); });
|
|
798
899
|
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:
|
|
900
|
+
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
901
|
}
|
|
801
902
|
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
903
|
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:
|
|
904
|
+
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
905
|
}), ctx.editable ? ((0, jsx_runtime_1.jsx)(AddEntryAffordance, { ctx: ctx, parentPath: path, context: { kind: 'array', length: unwrapped.length } })) : null] }));
|
|
805
906
|
if (depth === 0)
|
|
806
907
|
return content;
|
|
807
|
-
return ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: depth < ctx.defaultExpandDepth, label:
|
|
908
|
+
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
909
|
}
|
|
809
910
|
// Records.
|
|
810
911
|
if ((0, helpers_1.reqoreIsRecord)(unwrapped)) {
|
|
@@ -812,13 +913,13 @@ var renderTree = function (value, ctx, theme, depth, path) {
|
|
|
812
913
|
var content = ((0, jsx_runtime_1.jsx)(RecordTable, { entries: entries, ctx: ctx, theme: theme, depth: depth, path: path }));
|
|
813
914
|
if (depth === 0)
|
|
814
915
|
return content;
|
|
815
|
-
return ((0, jsx_runtime_1.jsx)(PreservedDetails, { initialOpen: depth < ctx.defaultExpandDepth, label:
|
|
916
|
+
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
917
|
}
|
|
817
918
|
return renderScalar(unwrapped, envelopeType, ctx, path);
|
|
818
919
|
};
|
|
819
920
|
exports.ReqoreDataView = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref) {
|
|
820
921
|
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"]);
|
|
922
|
+
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
923
|
var theme = (0, useTheme_1.useReqoreTheme)('main', customTheme, intent, undefined, inheritCustomTheme);
|
|
823
924
|
// In editable mode an empty `{}` or `[]` must still render the
|
|
824
925
|
// tree so the `+ Add property` / `+ Add item` affordance is
|
|
@@ -885,8 +986,10 @@ exports.ReqoreDataView = (0, react_1.memo)((0, react_1.forwardRef)(function (_a,
|
|
|
885
986
|
var next = (0, helpers_1.reqoreSetAtPath)(dataRef.current, path, (0, helpers_1.reqoreCoerceValueToKind)(current, kind));
|
|
886
987
|
onDataChange(next);
|
|
887
988
|
}, [onChangeType, onDataChange]);
|
|
989
|
+
var resolvedLabels = (0, react_1.useMemo)(function () { return resolveDataViewLabels(labels); }, [labels]);
|
|
888
990
|
var ctx = {
|
|
889
991
|
theme: theme,
|
|
992
|
+
labels: resolvedLabels,
|
|
890
993
|
envelope: envelope,
|
|
891
994
|
parseEmbedded: parseEmbedded,
|
|
892
995
|
showTypes: showTypes,
|
|
@@ -906,10 +1009,10 @@ exports.ReqoreDataView = (0, react_1.memo)((0, react_1.forwardRef)(function (_a,
|
|
|
906
1009
|
commitTypeChange: editable ? commitTypeChange : undefined,
|
|
907
1010
|
};
|
|
908
1011
|
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
|
-
?
|
|
1012
|
+
? ctx.labels.listSection(data.length)
|
|
910
1013
|
: (0, helpers_1.reqoreIsRecord)(data)
|
|
911
|
-
?
|
|
912
|
-
:
|
|
1014
|
+
? ctx.labels.objectSection(Object.keys(data).length)
|
|
1015
|
+
: 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
1016
|
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
1017
|
}));
|
|
915
1018
|
exports.ReqoreDataView.displayName = 'ReqoreDataView';
|
|
@@ -927,5 +1030,5 @@ Object.defineProperty(exports, "reqoreIsRecord", { enumerable: true, get: functi
|
|
|
927
1030
|
Object.defineProperty(exports, "reqoreRenameKeyAtPath", { enumerable: true, get: function () { return helpers_2.reqoreRenameKeyAtPath; } });
|
|
928
1031
|
Object.defineProperty(exports, "reqoreSetAtPath", { enumerable: true, get: function () { return helpers_2.reqoreSetAtPath; } });
|
|
929
1032
|
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;
|
|
1033
|
+
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
1034
|
//# sourceMappingURL=index.js.map
|