@adaptabletools/adaptable 24.0.0-canary.6 → 24.0.0-canary.7
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/index.css +29 -173
- package/package.json +1 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +4 -6
- package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +4 -0
- package/src/Api/Implementation/QuickSearchApiImpl.js +2 -2
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +0 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +9 -15
- package/src/Api/Internal/AdaptableInternalApi.js +5 -3
- package/src/Api/Internal/StateInternalApi.js +4 -3
- package/src/Api/UserInterfaceApi.d.ts +0 -4
- package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +9 -0
- package/src/Redux/ActionsReducers/QuickSearchRedux.js +9 -0
- package/src/Redux/Store/AdaptableStore.js +4 -2
- package/src/Utilities/Helpers/UIHelper.d.ts +6 -11
- package/src/Utilities/Helpers/UIHelper.js +6 -33
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +9 -11
- package/src/View/Components/StyleComponent.js +2 -2
- package/src/View/Dashboard/Dashboard.d.ts +1 -1
- package/src/View/Dashboard/Dashboard.js +1 -1
- package/src/View/QuickSearch/QuickSearchInput.js +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
- package/src/View/QuickSearch/Utilities/useQuickSearchDebounced.d.ts +2 -2
- package/src/View/StyledColumn/RangesComponent.js +8 -11
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +0 -2
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +2 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +0 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +3 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +7 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +4 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +7 -7
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +4 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +3 -3
- package/src/components/ColorField/index.d.ts +14 -0
- package/src/components/ColorField/index.js +6 -0
- package/src/env.js +2 -2
- package/src/migration/VersionUpgrade24.d.ts +9 -0
- package/src/migration/VersionUpgrade24.js +27 -0
- package/src/setupDevTools.js +163 -9
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/components/ColorField/index.d.ts +43 -0
- package/vendor/components/ColorField/index.d.ts.map +1 -0
- package/vendor/components/ColorField/index.js +81 -0
- package/vendor/components/ColorField/index.js.map +1 -0
- package/vendor/components/ColorPicker/colorPickerTab.d.ts +2 -2
- package/vendor/components/ColorPicker/colorPickerTab.d.ts.map +1 -1
- package/vendor/components/ColorPicker/colorPickerTab.js +6 -28
- package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -1
- package/vendor/components/ColorPicker/index.d.ts +36 -8
- package/vendor/components/ColorPicker/index.d.ts.map +1 -1
- package/vendor/components/ColorPicker/index.js +97 -25
- package/vendor/components/ColorPicker/index.js.map +1 -1
- package/vendor/components/ColorPicker/themeColors.d.ts +33 -4
- package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -1
- package/vendor/components/ColorPicker/themeColors.js +76 -18
- package/vendor/components/ColorPicker/themeColors.js.map +1 -1
- package/vendor/components/NumberInput/index.d.ts +51 -0
- package/vendor/components/NumberInput/index.d.ts.map +1 -0
- package/vendor/components/NumberInput/index.js +82 -0
- package/vendor/components/NumberInput/index.js.map +1 -0
- package/vendor/components/index.css +67 -24
- package/vendor/components/index.d.ts +6 -2
- package/vendor/components/index.d.ts.map +1 -1
- package/vendor/components/index.js +3 -1
- package/vendor/components/index.js.map +1 -1
- package/vendor/components/ui/input-group.d.ts.map +1 -1
- package/vendor/components/ui/input-group.js +5 -4
- package/vendor/components/ui/input-group.js.map +1 -1
- package/src/components/ColorPicker/ColorPicker.d.ts +0 -12
- package/src/components/ColorPicker/ColorPicker.js +0 -48
- package/src/components/ColorPicker/OptionalColorPicker.d.ts +0 -12
- package/src/components/ColorPicker/OptionalColorPicker.js +0 -13
- package/src/components/ColorPicker/index.d.ts +0 -2
- package/src/components/ColorPicker/index.js +0 -2
|
@@ -161,7 +161,7 @@ export const isValidIconStyleMappings = (data) => {
|
|
|
161
161
|
return true;
|
|
162
162
|
};
|
|
163
163
|
export const StyledColumnWizardIconSection = (props) => {
|
|
164
|
-
const { data
|
|
164
|
+
const { data } = useOnePageAdaptableWizardContext();
|
|
165
165
|
const iconStyle = data.IconStyle ?? {};
|
|
166
166
|
const mappings = iconStyle.Mappings ?? [];
|
|
167
167
|
const disabled = !data.ColumnId;
|
|
@@ -299,7 +299,7 @@ export const StyledColumnWizardIconSection = (props) => {
|
|
|
299
299
|
{ value: 'After', label: 'After' },
|
|
300
300
|
{ value: 'Above', label: 'Above' },
|
|
301
301
|
{ value: 'Below', label: 'Below' },
|
|
302
|
-
] }) }) })] }), _jsx(Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: _jsx(StyledColumnFontStyleEditor, {
|
|
302
|
+
] }) }) })] }), _jsx(Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: _jsx(StyledColumnFontStyleEditor, { disabled: disabled || cellTextDisabled, value: iconStyle.Font, onChange: onFontChange }) })] })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Tooltip" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Choose whether and how to display a tooltip" })] }), _jsx(Card.Body, { children: _jsx(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: _jsxs(FormRow, { label: "Tooltip Display:", children: [_jsx(CheckBox, { checked: toolTipText.includes('CellValue'), onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), ' ', _jsx(CheckBox, { className: "twa:ml-3", checked: toolTipText.includes('IconDescription'), onChange: (checked) => toggleToolTipText('IconDescription', checked), children: "Description" })] }) }) })] }), _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Optional cell box styling (overrides Format Column properties)" })] }), _jsx(Card.Body, { children: _jsx(StyledColumnCellStyleEditor, { disabled: disabled, value: iconStyle.Cell, onChange: onCellChange }) })] })] }));
|
|
303
303
|
};
|
|
304
304
|
const ICON_KIND_OPTIONS = [
|
|
305
305
|
{ value: 'Emoji', label: 'Emoji' },
|
|
@@ -5,10 +5,10 @@ import ErrorBox from '../../../components/ErrorBox';
|
|
|
5
5
|
import FormLayout, { FormRow } from '../../../components/FormLayout';
|
|
6
6
|
import { Tag } from '../../../components/Tag';
|
|
7
7
|
import { InputGroup } from '../../../components/InputGroup';
|
|
8
|
-
import {
|
|
8
|
+
import { ColorField } from '../../../components/ColorField';
|
|
9
9
|
import { RangesComponent } from '../RangesComponent';
|
|
10
10
|
import { ColumnSelector } from '../../Components/Selectors/ColumnSelector';
|
|
11
|
-
import { getDefaultRangeColor } from '../../../Utilities/Helpers/UIHelper';
|
|
11
|
+
import { getDefaultRangeColor, themeColorVar } from '../../../Utilities/Helpers/UIHelper';
|
|
12
12
|
import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
|
|
13
13
|
import AdaptableInput from '../../Components/AdaptableInput';
|
|
14
14
|
import { Box, Flex } from '../../../components/Flex';
|
|
@@ -419,18 +419,18 @@ export const StyledColumnWizardRangeBarSection = (props) => {
|
|
|
419
419
|
field: 'Reference',
|
|
420
420
|
optional: true,
|
|
421
421
|
fallbackNumber: minMaxRangeValues?.max ?? 0,
|
|
422
|
-
})] }) })] }), _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Ranges" }), _jsxs(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-700px]", children: ["Optional coloured segments drawn ", _jsx("em", { children: "behind" }), " track to form qualitative scale;leave empty for a plain track"] })] }), _jsx(Card.Body, { children: _jsx(RangesComponent, { allowEmptyRanges: true, disabled: disabled, minMaxRangeValues: minMaxRangeValues, api: api, scope: scope, ranges: range.CellRanges ?? [], rangeValueType: range.RangeValueType, onRangeValueTypeChange: onRangeValueTypeChange, columnComparison: range.ColumnComparison, updateRanges: onUpdateRanges, updateColumnComparison: onUpdateColumnComparison, hideColumnComparison: true }) })] })] })), !isRangeVariant && (_jsxs(_Fragment, { children: [_jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Value Marker" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Drawn at the cell value's position along the track." })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Shape:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: valueMarker.Shape, onValueChange: (s) => updateValueMarker({ Shape: s }), items: MARKER_SHAPES.map((s) => ({ value: s.value, label: s.label })) }) }) }), _jsx(FormRow, { label: `${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(
|
|
422
|
+
})] }) })] }), _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Ranges" }), _jsxs(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-700px]", children: ["Optional coloured segments drawn ", _jsx("em", { children: "behind" }), " track to form qualitative scale;leave empty for a plain track"] })] }), _jsx(Card.Body, { children: _jsx(RangesComponent, { allowEmptyRanges: true, disabled: disabled, minMaxRangeValues: minMaxRangeValues, api: api, scope: scope, ranges: range.CellRanges ?? [], rangeValueType: range.RangeValueType, onRangeValueTypeChange: onRangeValueTypeChange, columnComparison: range.ColumnComparison, updateRanges: onUpdateRanges, updateColumnComparison: onUpdateColumnComparison, hideColumnComparison: true }) })] })] })), !isRangeVariant && (_jsxs(_Fragment, { children: [_jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Value Marker" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Drawn at the cell value's position along the track." })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Shape:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: valueMarker.Shape, onValueChange: (s) => updateValueMarker({ Shape: s }), items: MARKER_SHAPES.map((s) => ({ value: s.value, label: s.label })) }) }) }), _jsx(FormRow, { label: `${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(ColorField, { clearable: false, disabled: disabled, value: valueMarker.Color || undefined, onChange: (c) => updateValueMarker({ Color: c }) }) }), _jsx(FormRow, { label: "Size:", children: _jsx(Box, { className: "twa:max-w-[100px]", children: _jsx(AdaptableInput, { type: "number", min: 1, value: valueMarker.Size, onChange: (e) => updateValueMarker({ Size: Number(e.target.value) }) }) }) })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Reference Marker" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: hasReference
|
|
423
423
|
? 'Drawn at the Reference value (e.g. previous close, target, midpoint).'
|
|
424
|
-
: 'Optional second marker when a Reference bound is set on the Style step.' })] }), _jsx(Card.Body, { children: hasReference ? (_jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Shape:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: referenceMarker.Shape, onValueChange: (s) => updateReferenceMarker({ Shape: s }), items: MARKER_SHAPES.map((s) => ({ value: s.value, label: s.label })) }) }) }), _jsx(FormRow, { label: `${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(
|
|
424
|
+
: 'Optional second marker when a Reference bound is set on the Style step.' })] }), _jsx(Card.Body, { children: hasReference ? (_jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Shape:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: referenceMarker.Shape, onValueChange: (s) => updateReferenceMarker({ Shape: s }), items: MARKER_SHAPES.map((s) => ({ value: s.value, label: s.label })) }) }) }), _jsx(FormRow, { label: `${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(ColorField, { clearable: false, disabled: disabled, value: referenceMarker.Color || undefined, onChange: (c) => updateReferenceMarker({ Color: c }) }) }), _jsx(FormRow, { label: "Size:", children: _jsx(Box, { className: "twa:max-w-[100px]", children: _jsx(AdaptableInput, { type: "number", min: 1, value: referenceMarker.Size, onChange: (e) => updateReferenceMarker({ Size: Number(e.target.value) }) }) }) })] })) : (_jsx(Box, { className: "twa:text-xs twa:opacity-60 twa:max-w-[520px]", children: "Add a Reference value on the Style step (Bounds section) to enable this marker (e.g. previous close, target, midpoint)." })) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Track" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "The line representing the [Min, Max] interval, plus optional cell background." })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Orientation:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: range.Orientation ?? 'Horizontal', onValueChange: (v) => update({ Orientation: v }), items: [
|
|
425
425
|
{ value: 'Horizontal', label: 'Horizontal' },
|
|
426
426
|
{ value: 'Vertical', label: 'Vertical' },
|
|
427
|
-
] }) }) }), range.Orientation === 'Vertical' && (_jsx(FormRow, { label: "", children: _jsxs(Box, { className: "twa:text-xs twa:text-neutral-500 twa:max-w-[520px]", children: ["Tip: vertical Range Bars need a tall row height to be readable (we recommend at least 60px). Set ", _jsx("code", { children: "rowHeight" }), " on ", _jsx("code", { children: " gridOptions " }), " or use ", _jsx("code", { children: "getRowHeight" }), "."] }) })), _jsx(FormRow, { label: `Track ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(
|
|
427
|
+
] }) }) }), range.Orientation === 'Vertical' && (_jsx(FormRow, { label: "", children: _jsxs(Box, { className: "twa:text-xs twa:text-neutral-500 twa:max-w-[520px]", children: ["Tip: vertical Range Bars need a tall row height to be readable (we recommend at least 60px). Set ", _jsx("code", { children: "rowHeight" }), " on ", _jsx("code", { children: " gridOptions " }), " or use ", _jsx("code", { children: "getRowHeight" }), "."] }) })), _jsx(FormRow, { label: `Track ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(ColorField, { disabled: disabled, value: range.Track?.Color, defaultColor: getDefaultRangeColor(), onChange: (c) => updateTrackProperties({ Color: c }) }) }), _jsx(FormRow, { label: range.Orientation === 'Vertical' ? 'Track Width (px):' : 'Track Height (px):', children: _jsx(Box, { className: "twa:max-w-[100px]", children: _jsx(AdaptableInput, { type: "number", min: 1, value: range.Track?.Height ?? '', onChange: (e) => updateTrackProperties({
|
|
428
428
|
Height: e.target.value === '' ? undefined : Number(e.target.value),
|
|
429
|
-
}), placeholder: "4" }) }) }), _jsx(FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(
|
|
429
|
+
}), placeholder: "4" }) }) }), _jsx(FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(ColorField, { disabled: disabled, value: range.BackColor ?? undefined, defaultColor: getDefaultRangeColor(), onChange: (c) => updateBackColor(c) }) })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Out of Range" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "How to draw the value marker when the cell value falls outside [Min, Max]." })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Behaviour:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: outOfRangeMode, onValueChange: (v) => updateOutOfRangeProperties({
|
|
430
430
|
Mode: v,
|
|
431
431
|
}), items: [
|
|
432
432
|
{ value: 'Clamp', label: 'Clamp to edge' },
|
|
433
433
|
{ value: 'Overflow', label: 'Show outside' },
|
|
434
434
|
{ value: 'Hide', label: 'Hide marker' },
|
|
435
|
-
] }) }) }), outOfRangeMode === 'Clamp' && (_jsx(FormRow, { label: `Out-of-range ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(
|
|
435
|
+
] }) }) }), outOfRangeMode === 'Clamp' && (_jsx(FormRow, { label: `Out-of-range ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(ColorField, { disabled: disabled, value: range.OutOfRange?.Color, defaultColor: themeColorVar('destructive'), onChange: (c) => updateOutOfRangeProperties({ Color: c }) }) }))] }) })] }), _jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Text & Tooltip" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Optional cell-text overlay and AG Grid tooltip content." })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...RANGE_STYLE_FORM_SIZES], children: [_jsx(BarStyleCellTextLayoutEditor, { disabled: disabled, cellTextProperties: range.CellTextProperties, onToggle: toggleCellText, onPlacementChange: onCellTextPlacementChange }), _jsxs(FormRow, { label: "Tooltip Display:", children: [_jsx(CheckBox, { disabled: disabled, checked: range.ToolTipText?.includes('CellValue'), onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), ' ', _jsx(CheckBox, { disabled: disabled, className: "twa:ml-3", checked: range.ToolTipText?.includes('PercentageValue'), onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percent Value" })] })] }) })] })] }))] }));
|
|
436
436
|
};
|
|
@@ -3,7 +3,7 @@ import { CheckBox } from '../../../components/CheckBox';
|
|
|
3
3
|
import ErrorBox from '../../../components/ErrorBox';
|
|
4
4
|
import FormLayout, { FormRow } from '../../../components/FormLayout';
|
|
5
5
|
import { Tag } from '../../../components/Tag';
|
|
6
|
-
import {
|
|
6
|
+
import { ColorField } from '../../../components/ColorField';
|
|
7
7
|
import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
|
|
8
8
|
import { Box, Flex } from '../../../components/Flex';
|
|
9
9
|
import { SingleSelect } from '../../../components/Select';
|
|
@@ -112,7 +112,7 @@ export const isValidRatingStyle = (data) => {
|
|
|
112
112
|
return true;
|
|
113
113
|
};
|
|
114
114
|
export const StyledColumnWizardRatingSection = (props) => {
|
|
115
|
-
const { data
|
|
115
|
+
const { data } = useOnePageAdaptableWizardContext();
|
|
116
116
|
const rating = data.RatingStyle ?? {};
|
|
117
117
|
const disabled = !data.ColumnId;
|
|
118
118
|
if (!data.ColumnId) {
|
|
@@ -141,7 +141,7 @@ export const StyledColumnWizardRatingSection = (props) => {
|
|
|
141
141
|
update({
|
|
142
142
|
Max: Number.isFinite(parsed) && parsed >= 1 ? Math.floor(parsed) : undefined,
|
|
143
143
|
});
|
|
144
|
-
} }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Icon count and rating cap (no auto scaling is applied)" })] }) }), _jsx(FormRow, { label: "Icon:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: rating.Icon ?? DEFAULT_RATING_ICON, onValueChange: (v) => update({ Icon: v }), items: ICON_CHOICES }) }) }), _jsx(FormRow, { label: "Filled Colour:", children: _jsx(
|
|
144
|
+
} }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Icon count and rating cap (no auto scaling is applied)" })] }) }), _jsx(FormRow, { label: "Icon:", children: _jsx(Box, { className: "twa:max-w-[160px]", children: _jsx(SingleSelect, { className: "twa:w-full", value: rating.Icon ?? DEFAULT_RATING_ICON, onValueChange: (v) => update({ Icon: v }), items: ICON_CHOICES }) }) }), _jsx(FormRow, { label: "Filled Colour:", children: _jsx(ColorField, { clearable: false, disabled: disabled, value: getDisplayedFilledColor(rating), onChange: (c) => update({ FilledColor: c }) }) }), _jsx(FormRow, { label: "Empty Colour:", children: _jsx(ColorField, { clearable: false, disabled: disabled, value: getDisplayedEmptyColor(rating), onChange: (c) => update({ EmptyColor: c }) }) }), _jsx(FormRow, { label: "Icon Size (px):", children: _jsxs(Flex, { alignItems: "center", className: "twa:gap-2", children: [_jsx(Input, { type: "number", min: 4, step: 1, value: rating.Size ?? '', placeholder: String(DEFAULT_RATING_SIZE), style: { width: 80 }, onChange: (event) => {
|
|
145
145
|
const raw = event.target.value;
|
|
146
146
|
if (raw === '' || raw == null) {
|
|
147
147
|
update({ Size: undefined });
|
|
@@ -161,7 +161,7 @@ export const StyledColumnWizardRatingSection = (props) => {
|
|
|
161
161
|
update({
|
|
162
162
|
Gap: Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined,
|
|
163
163
|
});
|
|
164
|
-
} }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Pixel space between adjacent icons" })] }) }), _jsx(FormRow, { label: "Allow Half Icons:", children: _jsx(CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.AllowHalf ?? true, onChange: (checked) => update({ AllowHalf: checked }), children: "Render fractional values as a partial icon (e.g. 3.5 \u2192 \u2605\u2605\u2605\u00BD\u2606)" }) })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsx(Card.Title, { children: "Text" }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Show Value:", children: _jsx(CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.ShowValue ?? false, onChange: (checked) => update({ ShowValue: checked }), children: "Display the numeric value beside the icons" }) }), _jsx(FormRow, { label: "Tooltip:", children: _jsxs(Flex, { flexDirection: "column", className: "twa:gap-1 twa:ml-2", children: [_jsx(CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('CellValue') ?? false, onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), _jsx(CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('PercentageValue') ?? false, onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percentage Value (value \u00F7 Max)" })] }) })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[500px]", children: "Optional Cell Style properties overrides Format Column properties)" })] }), _jsx(Card.Body, { children: _jsx(StyledColumnCellStyleEditor, {
|
|
164
|
+
} }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:min-w-0 twa:shrink", children: "Pixel space between adjacent icons" })] }) }), _jsx(FormRow, { label: "Allow Half Icons:", children: _jsx(CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.AllowHalf ?? true, onChange: (checked) => update({ AllowHalf: checked }), children: "Render fractional values as a partial icon (e.g. 3.5 \u2192 \u2605\u2605\u2605\u00BD\u2606)" }) })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsx(Card.Title, { children: "Text" }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: [_jsx(FormRow, { label: "Show Value:", children: _jsx(CheckBox, { disabled: disabled, className: "twa:ml-2", checked: rating.ShowValue ?? false, onChange: (checked) => update({ ShowValue: checked }), children: "Display the numeric value beside the icons" }) }), _jsx(FormRow, { label: "Tooltip:", children: _jsxs(Flex, { flexDirection: "column", className: "twa:gap-1 twa:ml-2", children: [_jsx(CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('CellValue') ?? false, onChange: (checked) => toggleToolTipText('CellValue', checked), children: "Cell Value" }), _jsx(CheckBox, { disabled: disabled, checked: rating.ToolTipText?.includes('PercentageValue') ?? false, onChange: (checked) => toggleToolTipText('PercentageValue', checked), children: "Percentage Value (value \u00F7 Max)" })] }) })] }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[500px]", children: "Optional Cell Style properties overrides Format Column properties)" })] }), _jsx(Card.Body, { children: _jsx(StyledColumnCellStyleEditor, { disabled: disabled, value: rating.Cell, onChange: (next) => {
|
|
165
165
|
if (next) {
|
|
166
166
|
update({ Cell: next });
|
|
167
167
|
}
|
|
@@ -5,7 +5,7 @@ import FormLayout, { FormRow } from '../../../../components/FormLayout';
|
|
|
5
5
|
import { Tag } from '../../../../components/Tag';
|
|
6
6
|
import { formatBarStyleCellTextLayoutSummary, getActiveBarStyleCellTextTokens, hasBarStyleCellTextConfigured, patchBarStyleCellTextPlacement, resolveBarStyleCellTextLayout, toggleBarStyleCellTextToken, } from '../../../../Utilities/Helpers/StyledColumns/BarStylesHelper';
|
|
7
7
|
import { BarStyleCellTextLayoutEditor } from './Components/BarStyleCellTextLayoutEditor';
|
|
8
|
-
import {
|
|
8
|
+
import { ColorField } from '../../../../components/ColorField';
|
|
9
9
|
import { getDefaultRangeColor } from '../../../../Utilities/Helpers/UIHelper';
|
|
10
10
|
import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptableWizard';
|
|
11
11
|
import { Box, Flex } from '../../../../components/Flex';
|
|
@@ -136,7 +136,7 @@ export const StyledColumnWizardStyleSection = (props) => {
|
|
|
136
136
|
const currentOrigin = typeof pb.Origin === 'number'
|
|
137
137
|
? 'Min'
|
|
138
138
|
: pb.Origin ?? 'Auto';
|
|
139
|
-
return (_jsxs(Box, { children: [_jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Bar Position" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set the position of the cell text relative to the bar" })] }), _jsx(Card.Body, { children: _jsx(RadioGroup, { orientation: "vertical", name: "ab-percentbar-origin", value: currentOrigin, onRadioChange: handleOriginChange, children: ORIGIN_CHOICES.map((choice) => (_jsx(Radio, { value: choice.value, disabled: disabled, children: _jsxs(Flex, { alignItems: "center", children: [_jsx(Box, { className: "twa:min-w-[60px]", children: choice.label }), _jsx(Box, { className: "twa:text-xs twa:opacity-70", children: choice.hint })] }) }, choice.value))) }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell Text" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[540px]", children: "Pick which values to display and where each one sits around the bar (font properties take precedence over Format Column)" })] }), _jsxs(Card.Body, { children: [_jsx(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: _jsx(BarStyleCellTextLayoutEditor, { disabled: disabled, cellTextProperties: cellTextProperties, onToggle: onCellTextLayoutToggle, onPlacementChange: onCellTextPlacementChange }) }), _jsx(Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: _jsx(StyledColumnFontStyleEditor, {
|
|
139
|
+
return (_jsxs(Box, { children: [_jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Bar Position" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Set the position of the cell text relative to the bar" })] }), _jsx(Card.Body, { children: _jsx(RadioGroup, { orientation: "vertical", name: "ab-percentbar-origin", value: currentOrigin, onRadioChange: handleOriginChange, children: ORIGIN_CHOICES.map((choice) => (_jsx(Radio, { value: choice.value, disabled: disabled, children: _jsxs(Flex, { alignItems: "center", children: [_jsx(Box, { className: "twa:min-w-[60px]", children: choice.label }), _jsx(Box, { className: "twa:text-xs twa:opacity-70", children: choice.hint })] }) }, choice.value))) }) })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell Text" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[540px]", children: "Pick which values to display and where each one sits around the bar (font properties take precedence over Format Column)" })] }), _jsxs(Card.Body, { children: [_jsx(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: _jsx(BarStyleCellTextLayoutEditor, { disabled: disabled, cellTextProperties: cellTextProperties, onToggle: onCellTextLayoutToggle, onPlacementChange: onCellTextPlacementChange }) }), _jsx(Box, { className: `twa:mt-3 twa:pt-3 twa:border-t twa:border-foreground/15 ${cellTextDisabled ? 'twa:opacity-50' : ''}`, children: _jsx(StyledColumnFontStyleEditor, { disabled: cellTextDisabled, value: pb.Font, onChange: (next) => {
|
|
140
140
|
if (next) {
|
|
141
141
|
update({ Font: next });
|
|
142
142
|
}
|
|
@@ -145,5 +145,5 @@ export const StyledColumnWizardStyleSection = (props) => {
|
|
|
145
145
|
delete cleaned.Font;
|
|
146
146
|
props.onChange({ ...data, PercentBarStyle: cleaned });
|
|
147
147
|
}
|
|
148
|
-
} }) })] })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell Style" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Configure Tooltip and Background Colour" })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: [_jsxs(FormRow, { label: "Tooltip Display:", children: [_jsx(CheckBox, { disabled: disabled, checked: pb.ToolTipText?.includes('CellValue'), onChange: (checked) => onToolTipTextChanged('CellValue', checked), children: "Cell Value" }), ' ', _jsx(CheckBox, { disabled: disabled, className: "twa:ml-3", checked: pb.ToolTipText?.includes('PercentageValue'), onChange: (checked) => onToolTipTextChanged('PercentageValue', checked), children: "Percent Value" })] }), _jsx(FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(
|
|
148
|
+
} }) })] })] }), _jsxs(Card, { shadow: false, className: "twa:mb-3", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Cell Style" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Configure Tooltip and Background Colour" })] }), _jsx(Card.Body, { children: _jsxs(FormLayout, { sizes: [...STYLE_FORM_SIZES], children: [_jsxs(FormRow, { label: "Tooltip Display:", children: [_jsx(CheckBox, { disabled: disabled, checked: pb.ToolTipText?.includes('CellValue'), onChange: (checked) => onToolTipTextChanged('CellValue', checked), children: "Cell Value" }), ' ', _jsx(CheckBox, { disabled: disabled, className: "twa:ml-3", checked: pb.ToolTipText?.includes('PercentageValue'), onChange: (checked) => onToolTipTextChanged('PercentageValue', checked), children: "Percent Value" })] }), _jsx(FormRow, { label: `Back ${api.internalApi.getCorrectEnglishVariant('Colour')}:`, children: _jsx(ColorField, { disabled: disabled, value: pb.BackColor ?? undefined, defaultColor: getDefaultRangeColor(), onChange: onBackColorChange }) })] }) })] })] }));
|
|
149
149
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ColorFieldProps as SharedColorFieldProps } from "../../../vendor/components/ColorField";
|
|
3
|
+
export type ColorFieldProps = Omit<SharedColorFieldProps, 'onChange' | 'clearable' | 'data-name'> & {
|
|
4
|
+
'data-name'?: string;
|
|
5
|
+
} & ({
|
|
6
|
+
clearable?: true;
|
|
7
|
+
onChange: (color: string | undefined) => void;
|
|
8
|
+
} | {
|
|
9
|
+
/** The colour is required, so there is no clear button and `onChange` always gets one. */
|
|
10
|
+
clearable: false;
|
|
11
|
+
onChange: (color: string) => void;
|
|
12
|
+
});
|
|
13
|
+
/** The shared colour field with AdapTable's defaults. */
|
|
14
|
+
export declare const ColorField: (props: ColorFieldProps) => React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ColorField as SharedColorField, } from "../../../vendor/components/ColorField";
|
|
3
|
+
export const ColorField = (props) => {
|
|
4
|
+
const { onChange, 'data-name': dataName = 'color-field', ...rest } = props;
|
|
5
|
+
return (_jsx(SharedColorField, { ...rest, "data-name": dataName, onChange: onChange }));
|
|
6
|
+
};
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "24.0.0-canary.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1792496906928 || Date.now(),
|
|
4
|
+
VERSION: "24.0.0-canary.7" || '--current-version--',
|
|
5
5
|
};
|
|
@@ -33,6 +33,8 @@ import type { MigrationLogger } from './AdaptableUpgradeHelper';
|
|
|
33
33
|
* `Type: 'Change'` when missing
|
|
34
34
|
* 16. {@link migrateLayoutTagsToRegistry} — Layout extensions held in object Tags
|
|
35
35
|
* (`layoutTagOptions.autoCheckTagsForLayouts`) → `Layout.LayoutExtensions`
|
|
36
|
+
* 17. {@link VersionUpgrade24.migrateSwatchColorVars} — `--ab-color-swatch-N`
|
|
37
|
+
* colours → `--ab-color-palette-{N+12}`
|
|
36
38
|
*/
|
|
37
39
|
export declare class VersionUpgrade24 extends VersionUpgrade {
|
|
38
40
|
private options;
|
|
@@ -40,6 +42,13 @@ export declare class VersionUpgrade24 extends VersionUpgrade {
|
|
|
40
42
|
layoutTagOptions?: LayoutTagOptions;
|
|
41
43
|
});
|
|
42
44
|
migrateState(state: AdaptableState): AdaptableState;
|
|
45
|
+
/**
|
|
46
|
+
* Step 17. The 20 swatch colours were merged into the palette after its 12
|
|
47
|
+
* light / dark pairs, so `var(--ab-color-swatch-N)` in any saved style
|
|
48
|
+
* (Format Columns, Styled Columns, Alerts, Flashing Cells, shared entities…)
|
|
49
|
+
* becomes `var(--ab-color-palette-{N+12})` with the same colour.
|
|
50
|
+
*/
|
|
51
|
+
private migrateSwatchColorVars;
|
|
43
52
|
/**
|
|
44
53
|
* Migrates Notes from a single `Timestamp` to explicit `CreatedAt` / `UpdatedAt`.
|
|
45
54
|
*
|
|
@@ -34,8 +34,35 @@ export class VersionUpgrade24 extends VersionUpgrade {
|
|
|
34
34
|
this.retypeObservableCalculatedColumns(state);
|
|
35
35
|
this.stampFlashingCellTypes(state);
|
|
36
36
|
migrateLayoutTagsToRegistry(state, this.logger, this.options.layoutTagOptions);
|
|
37
|
+
this.migrateSwatchColorVars(state);
|
|
37
38
|
return state;
|
|
38
39
|
}
|
|
40
|
+
migrateSwatchColorVars(state) {
|
|
41
|
+
const swatchVar = /--ab-color-swatch-(\d+)\b/g;
|
|
42
|
+
let rewritten = 0;
|
|
43
|
+
const visit = (node) => {
|
|
44
|
+
if (!node || typeof node !== 'object') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const container = node;
|
|
48
|
+
for (const key of Object.keys(container)) {
|
|
49
|
+
const value = container[key];
|
|
50
|
+
if (typeof value !== 'string') {
|
|
51
|
+
visit(value);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const next = value.replace(swatchVar, (_, n) => `--ab-color-palette-${Number(n) + 12}`);
|
|
55
|
+
if (next !== value) {
|
|
56
|
+
container[key] = next;
|
|
57
|
+
rewritten++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
visit(state);
|
|
62
|
+
if (rewritten > 0) {
|
|
63
|
+
this.logger.info(`Rewrote ${rewritten} colour value(s) from --ab-color-swatch-N to --ab-color-palette-{N+12} (v24).`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
39
66
|
migrateNoteTimestamps(state) {
|
|
40
67
|
const notes = state.Note?.Notes;
|
|
41
68
|
if (!notes?.length) {
|
package/src/setupDevTools.js
CHANGED
|
@@ -4,6 +4,7 @@ import { resolveVisibleSettingsPanelNavigationGroups } from './Utilities/Helpers
|
|
|
4
4
|
import { isTransientReduxAction } from './Redux/Store/isTransientReduxAction';
|
|
5
5
|
import { isPivotLayout } from './Utilities/Helpers/Layouts/LayoutHelper';
|
|
6
6
|
import { debug } from '@infinite-table/infinite-react';
|
|
7
|
+
import { colorSchemeDark, colorSchemeLight, themeQuartz } from 'ag-grid-enterprise';
|
|
7
8
|
import { warnOnce } from './agGrid/AdaptableLogger';
|
|
8
9
|
let DEV_TOOLS_LISTENING_STARTED = false;
|
|
9
10
|
let DEV_TOOLS_READY = false;
|
|
@@ -204,39 +205,192 @@ function handleOpenSettingsPanelMessage(payload) {
|
|
|
204
205
|
console.warn(error.message);
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
const THEME_PREVIEW_ATTR = 'data-ab-devtools-theme-preview';
|
|
209
|
+
function clearInlineAbVars(el) {
|
|
210
|
+
const style = el.style;
|
|
209
211
|
for (let i = style.length - 1; i >= 0; i--) {
|
|
210
212
|
const prop = style[i];
|
|
211
|
-
if (prop.startsWith('--ab-')) {
|
|
213
|
+
if (prop?.startsWith('--ab-') && !prop.startsWith('--ab-qs-')) {
|
|
212
214
|
style.removeProperty(prop);
|
|
213
215
|
}
|
|
214
216
|
}
|
|
217
|
+
}
|
|
218
|
+
let themeAliasMaps = null;
|
|
219
|
+
let themeAliasSheetCount = -1;
|
|
220
|
+
function collectThemeAliases() {
|
|
221
|
+
const sheetCount = document.styleSheets.length;
|
|
222
|
+
if (themeAliasMaps && themeAliasSheetCount === sheetCount) {
|
|
223
|
+
return themeAliasMaps;
|
|
224
|
+
}
|
|
225
|
+
const root = new Map();
|
|
226
|
+
const dark = new Map();
|
|
227
|
+
const visit = (rules) => {
|
|
228
|
+
for (let index = 0; index < rules.length; index++) {
|
|
229
|
+
const rule = rules[index];
|
|
230
|
+
const group = rule;
|
|
231
|
+
if (group.cssRules) {
|
|
232
|
+
visit(group.cssRules);
|
|
233
|
+
}
|
|
234
|
+
const styleRule = rule;
|
|
235
|
+
if (!styleRule.style || !styleRule.selectorText) {
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const selector = styleRule.selectorText;
|
|
239
|
+
const isDark = selector.includes('ab--theme-dark');
|
|
240
|
+
const isRoot = selector.includes(':root') ||
|
|
241
|
+
selector.includes('ab--theme-light') ||
|
|
242
|
+
/(^|[^\w-])html([^\w-]|$)/.test(selector);
|
|
243
|
+
if (!isDark && !isRoot) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const target = isDark ? dark : root;
|
|
247
|
+
for (let i = 0; i < styleRule.style.length; i++) {
|
|
248
|
+
const prop = styleRule.style[i];
|
|
249
|
+
if (!prop?.startsWith('--')) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
const value = styleRule.style.getPropertyValue(prop).trim();
|
|
253
|
+
if (value.includes('var(')) {
|
|
254
|
+
target.set(prop, value);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
for (let index = 0; index < document.styleSheets.length; index++) {
|
|
260
|
+
const sheet = document.styleSheets[index];
|
|
261
|
+
try {
|
|
262
|
+
visit(sheet.cssRules);
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
themeAliasMaps = { root, dark };
|
|
268
|
+
themeAliasSheetCount = sheetCount;
|
|
269
|
+
return themeAliasMaps;
|
|
270
|
+
}
|
|
271
|
+
let darkThemeProbe = null;
|
|
272
|
+
function themeDefaultStyle(variant) {
|
|
273
|
+
if (variant === 'light') {
|
|
274
|
+
return getComputedStyle(document.documentElement);
|
|
275
|
+
}
|
|
276
|
+
if (!darkThemeProbe) {
|
|
277
|
+
darkThemeProbe = document.createElement('div');
|
|
278
|
+
darkThemeProbe.className = 'ab--theme-dark';
|
|
279
|
+
darkThemeProbe.setAttribute('data-ab-devtools-theme-probe', '');
|
|
280
|
+
darkThemeProbe.style.cssText =
|
|
281
|
+
'position:absolute;width:0;height:0;overflow:hidden;pointer-events:none';
|
|
282
|
+
document.body.appendChild(darkThemeProbe);
|
|
283
|
+
}
|
|
284
|
+
return getComputedStyle(darkThemeProbe);
|
|
285
|
+
}
|
|
286
|
+
function installLiveAliases(el, variant) {
|
|
287
|
+
const { root, dark } = collectThemeAliases();
|
|
288
|
+
const defaults = themeDefaultStyle(variant);
|
|
289
|
+
const aliases = variant === 'dark' ? new Map([...root, ...dark]) : root;
|
|
290
|
+
for (const [name, raw] of aliases) {
|
|
291
|
+
const inline = el.style.getPropertyValue(name).trim();
|
|
292
|
+
const fallback = defaults.getPropertyValue(name).trim();
|
|
293
|
+
if (!inline || inline === raw || inline === fallback) {
|
|
294
|
+
el.style.setProperty(name, raw);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function clearDocumentThemePreview() {
|
|
299
|
+
clearInlineAbVars(document.documentElement);
|
|
300
|
+
}
|
|
301
|
+
function getInstanceThemeElements(adaptableId) {
|
|
302
|
+
const instance = getRegistration(adaptableId)?.instance;
|
|
303
|
+
if (!instance) {
|
|
304
|
+
return [];
|
|
305
|
+
}
|
|
306
|
+
const elements = [
|
|
307
|
+
instance.getAdaptableContainerElement(),
|
|
308
|
+
instance.getAgGridContainerElement(),
|
|
309
|
+
].filter((el) => el instanceof HTMLElement);
|
|
310
|
+
return [...new Set(elements)];
|
|
311
|
+
}
|
|
312
|
+
const originalAgGridThemes = new Map();
|
|
313
|
+
function applyAgGridPreviewTheme(adaptableId, variant) {
|
|
314
|
+
const instance = getRegistration(adaptableId)?.instance;
|
|
315
|
+
const gridApi = instance?.agGridAdapter.getAgGridApi();
|
|
316
|
+
if (!instance || instance.isDestroyed || !gridApi || gridApi.isDestroyed()) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (instance.agGridThemeAdapter.getAgGridThemeMode() === 'legacy') {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (!originalAgGridThemes.has(adaptableId)) {
|
|
323
|
+
originalAgGridThemes.set(adaptableId, gridApi.getGridOption('theme'));
|
|
324
|
+
}
|
|
325
|
+
const original = originalAgGridThemes.get(adaptableId);
|
|
326
|
+
const base = original && original !== 'legacy' && typeof original.withPart === 'function'
|
|
327
|
+
? original
|
|
328
|
+
: themeQuartz;
|
|
329
|
+
gridApi.setGridOption('theme', base.withPart(variant === 'dark' ? colorSchemeDark : colorSchemeLight));
|
|
330
|
+
}
|
|
331
|
+
function syncAgGridPreviewThemes(activeId, variant) {
|
|
332
|
+
applyAgGridPreviewTheme(activeId, variant);
|
|
333
|
+
}
|
|
334
|
+
function applyThemeVars(el, payload) {
|
|
335
|
+
clearInlineAbVars(el);
|
|
215
336
|
for (const [name, value] of Object.entries(payload.light)) {
|
|
216
337
|
if (value != null && value !== '') {
|
|
217
|
-
style.setProperty(name, String(value));
|
|
338
|
+
el.style.setProperty(name, String(value));
|
|
218
339
|
}
|
|
219
340
|
}
|
|
220
341
|
if (payload.variant === 'dark') {
|
|
221
342
|
for (const [name, value] of Object.entries(payload.dark)) {
|
|
222
343
|
if (value != null && value !== '') {
|
|
223
|
-
style.setProperty(name, String(value));
|
|
344
|
+
el.style.setProperty(name, String(value));
|
|
224
345
|
}
|
|
225
346
|
}
|
|
347
|
+
el.classList.add('ab--theme-dark');
|
|
226
348
|
}
|
|
349
|
+
else if (el.getAttribute(THEME_PREVIEW_ATTR) === 'dark') {
|
|
350
|
+
el.classList.remove('ab--theme-dark');
|
|
351
|
+
}
|
|
352
|
+
el.setAttribute(THEME_PREVIEW_ATTR, payload.variant);
|
|
353
|
+
installLiveAliases(el, payload.variant);
|
|
227
354
|
}
|
|
228
355
|
function handleThemeVarChangeMessage(payload) {
|
|
229
|
-
const { name, value } = payload ?? {};
|
|
230
|
-
if (!name) {
|
|
356
|
+
const { name, value, adaptableId } = payload ?? {};
|
|
357
|
+
if (!name || !adaptableId) {
|
|
231
358
|
return;
|
|
232
359
|
}
|
|
233
|
-
|
|
360
|
+
const targets = getInstanceThemeElements(adaptableId);
|
|
361
|
+
if (targets.length === 0) {
|
|
362
|
+
console.warn(`Adaptable DevTools: no theme container for "${adaptableId}"`);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const variant = payload.variant === 'dark' ? 'dark' : 'light';
|
|
366
|
+
clearDocumentThemePreview();
|
|
367
|
+
for (const el of targets) {
|
|
368
|
+
if (!el.hasAttribute(THEME_PREVIEW_ATTR)) {
|
|
369
|
+
el.setAttribute(THEME_PREVIEW_ATTR, variant);
|
|
370
|
+
}
|
|
371
|
+
installLiveAliases(el, variant);
|
|
372
|
+
el.style.setProperty(name, String(value ?? ''));
|
|
373
|
+
}
|
|
234
374
|
}
|
|
235
375
|
function handleApplyThemeMessage(payload) {
|
|
236
376
|
if (!payload || (payload.variant !== 'light' && payload.variant !== 'dark')) {
|
|
237
377
|
return;
|
|
238
378
|
}
|
|
239
|
-
|
|
379
|
+
const { adaptableId } = payload;
|
|
380
|
+
if (!adaptableId) {
|
|
381
|
+
console.warn('Adaptable DevTools: apply-theme message missing adaptableId');
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const targets = getInstanceThemeElements(adaptableId);
|
|
385
|
+
if (targets.length === 0) {
|
|
386
|
+
console.warn(`Adaptable DevTools: no theme container for "${adaptableId}"`);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
clearDocumentThemePreview();
|
|
390
|
+
for (const el of targets) {
|
|
391
|
+
applyThemeVars(el, payload);
|
|
392
|
+
}
|
|
393
|
+
syncAgGridPreviewThemes(adaptableId, payload.variant);
|
|
240
394
|
}
|
|
241
395
|
function handleLoadVariantMessage(payload) {
|
|
242
396
|
const { adaptableId, variant } = payload ?? {};
|