@balena/ui-shared-components 12.3.2-build-reduced-default-device-columns-experiment-d2dd6a507d829c022f95ee1c2c8afe98b21a6985-1 → 12.3.2-build-fix-non-unified-os-release-variant-selection-90cd58ee804ea7899167b6feb1468e8a2e6beb56-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DownloadImageDialog/ImageForm.js +11 -4
- package/dist/components/RJST/Lenses/types/index.d.ts +0 -1
- package/dist/components/RJST/Lenses/types/table.js +2 -2
- package/dist/components/RJST/components/Table/useColumns.d.ts +1 -1
- package/dist/components/RJST/components/Table/useColumns.js +4 -12
- package/dist/components/RJST/index.d.ts +1 -2
- package/dist/components/RJST/index.js +2 -2
- package/package.json +2 -2
|
@@ -46,10 +46,17 @@ export const ImageForm = memo(function ImageForm({ compatibleDeviceTypes, osVers
|
|
|
46
46
|
const { selectionOpts, preferredSelectionOpts } = useMemo(() => getCategorizedVersions(osVersions, model.deviceType, osType), [osVersions, model.deviceType, osType]);
|
|
47
47
|
const versionSelectionOpts = useMemo(() => (showAllVersions ? selectionOpts : preferredSelectionOpts), [preferredSelectionOpts, selectionOpts, showAllVersions]);
|
|
48
48
|
const showAllVersionsToggle = useMemo(() => preferredSelectionOpts.length < selectionOpts.length, [preferredSelectionOpts.length, selectionOpts.length]);
|
|
49
|
-
const handleVariantChange = useCallback((
|
|
50
|
-
setVariant(
|
|
51
|
-
onChange('developmentMode',
|
|
52
|
-
|
|
49
|
+
const handleVariantChange = useCallback((newVariant) => {
|
|
50
|
+
setVariant(newVariant);
|
|
51
|
+
onChange('developmentMode', newVariant === 'dev');
|
|
52
|
+
if (version === null || version === void 0 ? void 0 : version.hasPrebuiltVariants) {
|
|
53
|
+
const rawVersionForVariant = version.rawVersions[newVariant];
|
|
54
|
+
if (rawVersionForVariant != null &&
|
|
55
|
+
rawVersionForVariant !== version.value) {
|
|
56
|
+
onChange('version', rawVersionForVariant);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [onChange, version]);
|
|
53
60
|
const handleVersionChange = useCallback((ver) => {
|
|
54
61
|
var _a;
|
|
55
62
|
ver !== null && ver !== void 0 ? ver : (ver = (_a = versionSelectionOpts.find((v) => v.isRecommended)) !== null && _a !== void 0 ? _a : versionSelectionOpts[0]);
|
|
@@ -84,9 +84,9 @@ const sortData = (data, columns, sort) => {
|
|
|
84
84
|
}
|
|
85
85
|
return sortedData;
|
|
86
86
|
};
|
|
87
|
-
const TableRenderer = ({ filtered, selected, properties, hasUpdateActions, checkedState, changeSelected, data, rjstContext, onEntityClick, onPageChange, onSort, pagination, model, sort, rowKey = 'id',
|
|
87
|
+
const TableRenderer = ({ filtered, selected, properties, hasUpdateActions, checkedState, changeSelected, data, rjstContext, onEntityClick, onPageChange, onSort, pagination, model, sort, rowKey = 'id', }) => {
|
|
88
88
|
const { state: analytics } = useAnalyticsContext();
|
|
89
|
-
const [columns, setColumns] = useColumns(rjstContext.resource, properties, tagKeyRender
|
|
89
|
+
const [columns, setColumns] = useColumns(rjstContext.resource, properties, tagKeyRender);
|
|
90
90
|
const { actions, showAddTagDialog, setShowAddTagDialog, tagKeys } = useTagActions(rjstContext, data);
|
|
91
91
|
const memoizedPagination = React.useMemo(() => {
|
|
92
92
|
var _a, _b;
|
|
@@ -2,7 +2,7 @@ import type React from 'react';
|
|
|
2
2
|
import type { TagField } from './utils';
|
|
3
3
|
import type { RJSTEntityPropertyDefinition } from '../../schemaOps';
|
|
4
4
|
export declare const TAG_COLUMN_PREFIX = "tag_column_";
|
|
5
|
-
export declare function useColumns<T>(resourceName: string, defaultColumns: Array<RJSTEntityPropertyDefinition<T>>, tagKeyRender: (key: string) => (tags: TagField[] | undefined) => React.ReactElement | null
|
|
5
|
+
export declare function useColumns<T>(resourceName: string, defaultColumns: Array<RJSTEntityPropertyDefinition<T>>, tagKeyRender: (key: string) => (tags: TagField[] | undefined) => React.ReactElement | null): readonly [{
|
|
6
6
|
render: ((tags: TagField[] | undefined) => React.ReactElement | null) | ((value: any, row: T) => string | number | JSX.Element | null | undefined);
|
|
7
7
|
selected: boolean;
|
|
8
8
|
index: number;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import { getFromLocalStorage, setToLocalStorage } from '../../utils';
|
|
3
|
-
import { useAnalyticsContext } from '../../../../contexts/AnalyticsContext';
|
|
4
3
|
export const TAG_COLUMN_PREFIX = 'tag_column_';
|
|
5
|
-
const EXPERIMENTAL_REDUCED_DEFAULT_COLUMNS_PREFIX = 'experimental_reduced_default__';
|
|
6
4
|
// Move columns logic inside a dedicated hook to make the refactor easier and move this logic without effort.
|
|
7
|
-
export function useColumns(resourceName, defaultColumns, tagKeyRender
|
|
8
|
-
var _a;
|
|
9
|
-
const { state: analyticsState } = useAnalyticsContext();
|
|
5
|
+
export function useColumns(resourceName, defaultColumns, tagKeyRender) {
|
|
10
6
|
const [columns, setColumns] = useState(() => {
|
|
11
|
-
const storedColumns = getFromLocalStorage(`${
|
|
7
|
+
const storedColumns = getFromLocalStorage(`${resourceName}__columns`);
|
|
12
8
|
if (storedColumns) {
|
|
13
9
|
const storedColumnsMap = new Map(storedColumns.map((s) => [s.key, s]));
|
|
14
10
|
const tagColumns = storedColumns.filter((c) => c.key.startsWith(TAG_COLUMN_PREFIX));
|
|
@@ -30,11 +26,7 @@ export function useColumns(resourceName, defaultColumns, tagKeyRender, useExperi
|
|
|
30
26
|
}
|
|
31
27
|
});
|
|
32
28
|
useEffect(() => {
|
|
33
|
-
setToLocalStorage(`${
|
|
34
|
-
}, [
|
|
35
|
-
resourceName,
|
|
36
|
-
columns,
|
|
37
|
-
(_a = analyticsState.featureFlags) === null || _a === void 0 ? void 0 : _a.reducedDefaultDeviceColumns,
|
|
38
|
-
]);
|
|
29
|
+
setToLocalStorage(`${resourceName}__columns`, columns.map((c) => (Object.assign(Object.assign({}, c), { label: typeof c.label === 'string' ? c.label : null }))));
|
|
30
|
+
}, [resourceName, columns]);
|
|
39
31
|
return [columns, setColumns];
|
|
40
32
|
}
|
|
@@ -56,7 +56,6 @@ export interface RJSTProps<T> extends Omit<BoxProps, 'onChange'> {
|
|
|
56
56
|
rowKey?: keyof T;
|
|
57
57
|
noDataInfo?: NoDataInfo;
|
|
58
58
|
persistFilters?: boolean;
|
|
59
|
-
useExperimentalReducedColumnLocalStorageKeyPrefix?: boolean;
|
|
60
59
|
}
|
|
61
|
-
export declare const RJST: <T extends RJSTBaseResource<T>>({ model: modelRaw, data, formats, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading, rowKey, noDataInfo, persistFilters,
|
|
60
|
+
export declare const RJST: <T extends RJSTBaseResource<T>>({ model: modelRaw, data, formats, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading, rowKey, noDataInfo, persistFilters, ...boxProps }: RJSTProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
62
61
|
export { rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection, rjstAddToSchema, type RJSTAction, type RJSTBaseResource, type RJSTRawModel, type RJSTModel, rjstJsonSchemaPick, rjstGetDisabledReason, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty, generateSchemaFromRefScheme, };
|
|
@@ -37,7 +37,7 @@ const HeaderGrid = styled(Box)(({ theme }) => ({
|
|
|
37
37
|
// any typing we have in lenses today.
|
|
38
38
|
export const RJST = (_a) => {
|
|
39
39
|
var _b, _c, _d, _e, _f;
|
|
40
|
-
var { model: modelRaw, data, formats, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading = false, rowKey, noDataInfo, persistFilters = true
|
|
40
|
+
var { model: modelRaw, data, formats, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading = false, rowKey, noDataInfo, persistFilters = true } = _a, boxProps = __rest(_a, ["model", "data", "formats", "actions", "sdk", "customSort", "refresh", "getBaseUrl", "onEntityClick", "onChange", "pagination", "customLenses", "loading", "rowKey", "noDataInfo", "persistFilters"]);
|
|
41
41
|
const { t } = useTranslation();
|
|
42
42
|
const { state: analytics } = useAnalyticsContext();
|
|
43
43
|
const navigate = useNavigate();
|
|
@@ -269,7 +269,7 @@ export const RJST = (_a) => {
|
|
|
269
269
|
page: currentPage,
|
|
270
270
|
itemsPerPage,
|
|
271
271
|
});
|
|
272
|
-
}, pagination: Object.assign(Object.assign({}, (pagination !== null && pagination !== void 0 ? pagination : {})), internalPagination), rowKey: rowKey
|
|
272
|
+
}, pagination: Object.assign(Object.assign({}, (pagination !== null && pagination !== void 0 ? pagination : {})), internalPagination), rowKey: rowKey })), (_f = (_e = actionData === null || actionData === void 0 ? void 0 : actionData.action) === null || _e === void 0 ? void 0 : _e.renderer) === null || _f === void 0 ? void 0 : _f.call(_e, {
|
|
273
273
|
schema: actionData.schema,
|
|
274
274
|
affectedEntries: actionData.affectedEntries,
|
|
275
275
|
onDone: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "12.3.2-build-
|
|
3
|
+
"version": "12.3.2-build-fix-non-unified-os-release-variant-selection-90cd58ee804ea7899167b6feb1468e8a2e6beb56-1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -138,6 +138,6 @@
|
|
|
138
138
|
},
|
|
139
139
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
140
140
|
"versionist": {
|
|
141
|
-
"publishedAt": "2025-04-
|
|
141
|
+
"publishedAt": "2025-04-23T15:21:12.813Z"
|
|
142
142
|
}
|
|
143
143
|
}
|