@balena/ui-shared-components 15.3.1-build-renovate-npm-storybook-vulnerability-85aadb2c7befcfc44385fb6a5fd9f3a2bdf7f374-1 → 15.4.0-build-consolidate-formats-under-context-27f23d315b7cc4e97f12eeeab5a13c350d8e952f-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/RJST/Filters/Filters.js +2 -2
- package/dist/components/RJST/components/Filters/FocusSearch.js +2 -2
- package/dist/components/RJST/index.d.ts +1 -4
- package/dist/components/RJST/index.js +3 -3
- package/dist/contexts/UiSharedComponentsContextProvider.d.ts +2 -0
- package/dist/hooks/useUiSharedComponentsContext.d.ts +1 -0
- package/dist/hooks/useUiSharedComponentsContext.js +6 -0
- package/package.json +2 -2
- package/dist/hooks/useNavigate.d.ts +0 -1
- package/dist/hooks/useNavigate.js +0 -6
|
@@ -3,10 +3,10 @@ import React from 'react';
|
|
|
3
3
|
import { PersistentFilters } from './PersistentFilters';
|
|
4
4
|
import { Filters as FiltersComponent, } from '../components/Filters';
|
|
5
5
|
import { modifySchemaWithRefSchemes, removeFieldsWithNoFilter, removeRefSchemeSeparatorsFromFilters, } from './utils';
|
|
6
|
-
import {
|
|
6
|
+
import { useUiSharedComponentsContext } from '../../../hooks/useUiSharedComponentsContext';
|
|
7
7
|
const DEFAULT_RENDER_MODE = ['add', 'search', 'views'].slice();
|
|
8
8
|
export const Filters = ({ schema, filters, views, changeFilters, changeViews, viewsRestorationKey, renderMode, onSearch, persistFilters, }) => {
|
|
9
|
-
const navigate =
|
|
9
|
+
const { navigate } = useUiSharedComponentsContext();
|
|
10
10
|
const filteredSchema = React.useMemo(() => removeFieldsWithNoFilter(schema), [schema]);
|
|
11
11
|
// This is the function that will rework the schema taking in consideration x-ref-scheme and x-foreign-key-scheme.
|
|
12
12
|
const reworkedSchema = React.useMemo(() => modifySchemaWithRefSchemes(filteredSchema), [filteredSchema]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
|
-
import {
|
|
4
|
+
import { useUiSharedComponentsContext } from '../../../../hooks/useUiSharedComponentsContext';
|
|
5
5
|
import { ajvFilter, createFullTextSearchFilter } from './SchemaSieve';
|
|
6
6
|
import { Box, styled, Typography } from '@mui/material';
|
|
7
7
|
import { convertToPineClientFilter } from '../../oData/jsonToOData';
|
|
@@ -34,7 +34,7 @@ const FocusItem = styled(Box)(({ hasGetBaseUrl }) => ({
|
|
|
34
34
|
}));
|
|
35
35
|
export const FocusSearch = ({ searchTerm, filtered, rjstContext, model, rowKey = 'id', }) => {
|
|
36
36
|
var _a;
|
|
37
|
-
const navigate =
|
|
37
|
+
const { navigate } = useUiSharedComponentsContext();
|
|
38
38
|
const [searchResults, setSearchResults] = React.useState(null);
|
|
39
39
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
40
40
|
const inputSearch = (_a = rjstContext.sdk) === null || _a === void 0 ? void 0 : _a.inputSearch;
|
|
@@ -6,7 +6,6 @@ import { rjstDefaultPermissions, rjstGetModelForCollection, rjstRunTransformers
|
|
|
6
6
|
import { rjstGetDisabledReason } from './utils';
|
|
7
7
|
import type { LensTemplate } from './Lenses';
|
|
8
8
|
import type { BoxProps } from '@mui/material';
|
|
9
|
-
import type { Format } from './components/Widget/utils';
|
|
10
9
|
import type { Pagination } from './components/Table/utils';
|
|
11
10
|
export interface NoDataInfo {
|
|
12
11
|
title?: string | React.ReactElement;
|
|
@@ -21,8 +20,6 @@ export interface RJSTProps<T> extends Omit<BoxProps, 'onChange'> {
|
|
|
21
20
|
model: RJSTModel<T>;
|
|
22
21
|
/** Array of data or data entity to display */
|
|
23
22
|
data: T[] | undefined;
|
|
24
|
-
/** Formats are custom widgets to render in the table cell. The type of format to display is described in the model. */
|
|
25
|
-
formats?: Format[];
|
|
26
23
|
/** Actions is an array of actions applicable on the selected items */
|
|
27
24
|
actions?: Array<RJSTAction<T>>;
|
|
28
25
|
/** The sdk is used to pass the method to handle tags when added removed or updated */
|
|
@@ -57,5 +54,5 @@ export interface RJSTProps<T> extends Omit<BoxProps, 'onChange'> {
|
|
|
57
54
|
noDataInfo?: NoDataInfo;
|
|
58
55
|
persistFilters?: boolean;
|
|
59
56
|
}
|
|
60
|
-
export declare const RJST: <T extends RJSTBaseResource<T>>({ model: modelRaw, data,
|
|
57
|
+
export declare const RJST: <T extends RJSTBaseResource<T>>({ model: modelRaw, data, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading, rowKey, noDataInfo, persistFilters, ...boxProps }: RJSTProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
61
58
|
export { rjstRunTransformers, rjstDefaultPermissions, rjstGetModelForCollection, rjstAddToSchema, type RJSTAction, type RJSTBaseResource, type RJSTRawModel, type RJSTModel, rjstJsonSchemaPick, rjstGetDisabledReason, getPropertyScheme, getSubSchemaFromRefScheme, parseDescription, parseDescriptionProperty, generateSchemaFromRefScheme, };
|
|
@@ -17,7 +17,7 @@ import { NoRecordsFoundView } from './NoRecordsFoundView';
|
|
|
17
17
|
import { Box, Link, styled } from '@mui/material';
|
|
18
18
|
import { useTranslation } from '../../hooks/useTranslations';
|
|
19
19
|
import { useAnalyticsContext } from '../../contexts/AnalyticsContext';
|
|
20
|
-
import {
|
|
20
|
+
import { useUiSharedComponentsContext } from '../../hooks/useUiSharedComponentsContext';
|
|
21
21
|
import { convertToPineClientFilter, orderbyBuilder } from './oData/jsonToOData';
|
|
22
22
|
import { ajvFilter } from './components/Filters/SchemaSieve';
|
|
23
23
|
import { Spinner } from '../Spinner';
|
|
@@ -37,10 +37,10 @@ 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,
|
|
40
|
+
var { model: modelRaw, data, actions, sdk, customSort, refresh, getBaseUrl, onEntityClick, onChange, pagination, customLenses, loading = false, rowKey, noDataInfo, persistFilters = true } = _a, boxProps = __rest(_a, ["model", "data", "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
|
-
const navigate =
|
|
43
|
+
const { navigate, RJSTFormats: formats } = useUiSharedComponentsContext();
|
|
44
44
|
const modelRef = React.useRef(modelRaw);
|
|
45
45
|
// This allows the component to work even if
|
|
46
46
|
// consumers are passing a new model object every time.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { TFunction } from '../hooks/useTranslations';
|
|
2
2
|
import type { NavigateFunction } from 'react-router-dom';
|
|
3
|
+
import type { Format } from '../components/RJST/components/Widget/utils';
|
|
3
4
|
export interface UiSharedComponentsContextProviderInterface {
|
|
4
5
|
navigate?: NavigateFunction;
|
|
5
6
|
t?: TFunction;
|
|
6
7
|
externalTranslationMap?: Dictionary<string>;
|
|
8
|
+
RJSTFormats?: Format[];
|
|
7
9
|
}
|
|
8
10
|
export declare const UiSharedComponentsContextProvider: import("react").Context<UiSharedComponentsContextProviderInterface>;
|
|
9
11
|
export declare const UiSharedComponentsProvider: ({ children, ...otherProps }: UiSharedComponentsContextProviderInterface & {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useUiSharedComponentsContext: () => import("../contexts/UiSharedComponentsContextProvider").UiSharedComponentsContextProviderInterface;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UiSharedComponentsContextProvider } from '../contexts/UiSharedComponentsContextProvider';
|
|
3
|
+
export const useUiSharedComponentsContext = () => {
|
|
4
|
+
const context = React.useContext(UiSharedComponentsContextProvider);
|
|
5
|
+
return context;
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/ui-shared-components",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.4.0-build-consolidate-formats-under-context-27f23d315b7cc4e97f12eeeab5a13c350d8e952f-1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
"homepage": "https://github.com/balena-io/ui-shared-components#readme",
|
|
139
139
|
"versionist": {
|
|
140
|
-
"publishedAt": "2025-12-
|
|
140
|
+
"publishedAt": "2025-12-23T12:19:18.907Z"
|
|
141
141
|
},
|
|
142
142
|
"overrides": {
|
|
143
143
|
"storybook": "$storybook",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useNavigate: () => import("react-router").NavigateFunction | undefined;
|