@rio-cloud/uikit-mcp 1.1.4 → 1.1.6
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/README.md +1 -0
- package/dist/doc-metadata.json +188 -88
- package/dist/docs/components/accentBar.md +35 -3
- package/dist/docs/components/activity.md +14 -3
- package/dist/docs/components/animatedNumber.md +17 -4
- package/dist/docs/components/animatedTextReveal.md +54 -8
- package/dist/docs/components/animations.md +33 -33
- package/dist/docs/components/appHeader.md +65 -9
- package/dist/docs/components/appLayout.md +566 -61
- package/dist/docs/components/appNavigationBar.md +55 -3
- package/dist/docs/components/areaCharts.md +14 -14
- package/dist/docs/components/aspectRatioPlaceholder.md +11 -3
- package/dist/docs/components/assetTree.md +1174 -328
- package/dist/docs/components/autosuggests.md +2 -2
- package/dist/docs/components/avatar.md +25 -3
- package/dist/docs/components/banner.md +3 -3
- package/dist/docs/components/barCharts.md +38 -38
- package/dist/docs/components/barList.md +22 -10
- package/dist/docs/components/basicMap.md +2 -2
- package/dist/docs/components/bottomSheet.md +100 -3
- package/dist/docs/components/button.md +549 -36
- package/dist/docs/components/buttonToolbar.md +10 -3
- package/dist/docs/components/calendarStripe.md +127 -85
- package/dist/docs/components/card.md +11 -3
- package/dist/docs/components/carousel.md +2 -2
- package/dist/docs/components/chartColors.md +2 -2
- package/dist/docs/components/chartsGettingStarted.md +2 -2
- package/dist/docs/components/chat.md +3 -3
- package/dist/docs/components/checkbox.md +67 -45
- package/dist/docs/components/circularProgress.md +465 -0
- package/dist/docs/components/clearableInput.md +18 -18
- package/dist/docs/components/collapse.md +28 -4
- package/dist/docs/components/composedCharts.md +20 -20
- package/dist/docs/components/contentLoader.md +126 -105
- package/dist/docs/components/dataTabs.md +191 -11
- package/dist/docs/components/datepickers.md +735 -723
- package/dist/docs/components/dialogs.md +362 -2
- package/dist/docs/components/divider.md +15 -3
- package/dist/docs/components/dropdowns.md +4548 -4355
- package/dist/docs/components/editableContent.md +187 -3
- package/dist/docs/components/expander.md +52 -5
- package/dist/docs/components/fade.md +42 -7
- package/dist/docs/components/fadeExpander.md +13 -4
- package/dist/docs/components/fadeUp.md +22 -4
- package/dist/docs/components/feedback.md +44 -3
- package/dist/docs/components/filePickers.md +45 -3
- package/dist/docs/components/formLabel.md +20 -5
- package/dist/docs/components/groupedItemList.md +54 -3
- package/dist/docs/components/iconList.md +5 -5
- package/dist/docs/components/imagePreloader.md +7 -3
- package/dist/docs/components/labeledElement.md +13 -3
- package/dist/docs/components/licensePlate.md +11 -3
- package/dist/docs/components/lineCharts.md +10 -10
- package/dist/docs/components/listMenu.md +78 -8
- package/dist/docs/components/loadMore.md +29 -3
- package/dist/docs/components/mainNavigation.md +5 -5
- package/dist/docs/components/mapCircle.md +2 -2
- package/dist/docs/components/mapCluster.md +2 -2
- package/dist/docs/components/mapContext.md +2 -2
- package/dist/docs/components/mapDraggableMarker.md +2 -2
- package/dist/docs/components/mapGettingStarted.md +2 -2
- package/dist/docs/components/mapInfoBubble.md +2 -2
- package/dist/docs/components/mapLayerGroup.md +2 -2
- package/dist/docs/components/mapMarker.md +2 -2
- package/dist/docs/components/mapPolygon.md +2 -2
- package/dist/docs/components/mapRoute.md +2 -2
- package/dist/docs/components/mapRouteGenerator.md +2 -2
- package/dist/docs/components/mapSettings.md +9 -9
- package/dist/docs/components/mapUtils.md +2 -2
- package/dist/docs/components/multiselects.md +2 -2
- package/dist/docs/components/noData.md +23 -3
- package/dist/docs/components/notifications.md +2 -2
- package/dist/docs/components/numbercontrol.md +54 -5
- package/dist/docs/components/onboarding.md +26 -2
- package/dist/docs/components/page.md +33 -3
- package/dist/docs/components/pager.md +15 -3
- package/dist/docs/components/pieCharts.md +89 -78
- package/dist/docs/components/popover.md +40 -2
- package/dist/docs/components/position.md +11 -3
- package/dist/docs/components/radialBarCharts.md +2054 -2012
- package/dist/docs/components/radioCardGroup.md +487 -0
- package/dist/docs/components/radiobutton.md +138 -10
- package/dist/docs/components/releaseNotes.md +19 -2
- package/dist/docs/components/resizer.md +14 -3
- package/dist/docs/components/responsiveColumnStripe.md +20 -3
- package/dist/docs/components/responsiveVideo.md +12 -3
- package/dist/docs/components/rioglyph.md +13 -3
- package/dist/docs/components/rules.md +95 -5
- package/dist/docs/components/saveableInput.md +400 -276
- package/dist/docs/components/selects.md +2 -2
- package/dist/docs/components/sidebar.md +39 -3
- package/dist/docs/components/sliders.md +38 -3
- package/dist/docs/components/smoothScrollbars.md +93 -3
- package/dist/docs/components/spinners.md +51 -3
- package/dist/docs/components/states.md +217 -2
- package/dist/docs/components/statsWidgets.md +123 -3
- package/dist/docs/components/statusBar.md +29 -3
- package/dist/docs/components/stepButton.md +9 -3
- package/dist/docs/components/steppedProgressBars.md +67 -3
- package/dist/docs/components/subNavigation.md +24 -17
- package/dist/docs/components/supportMarker.md +2 -2
- package/dist/docs/components/svgImage.md +13 -3
- package/dist/docs/components/switch.md +218 -82
- package/dist/docs/components/tables.md +2 -2
- package/dist/docs/components/tagManager.md +56 -2
- package/dist/docs/components/tags.md +33 -3
- package/dist/docs/components/teaser.md +30 -3
- package/dist/docs/components/textTruncateMiddle.md +151 -0
- package/dist/docs/components/timeline.md +2 -2
- package/dist/docs/components/timepicker.md +687 -63
- package/dist/docs/components/toggleButton.md +96 -10
- package/dist/docs/components/tooltip.md +30 -21
- package/dist/docs/components/tracker.md +631 -0
- package/dist/docs/components/virtualList.md +107 -84
- package/dist/docs/foundations.md +647 -275
- package/dist/docs/start/changelog.md +2 -738
- package/dist/docs/start/goodtoknow.md +2 -2
- package/dist/docs/start/guidelines/color-combinations.md +2 -2
- package/dist/docs/start/guidelines/custom-css.md +2 -2
- package/dist/docs/start/guidelines/custom-rioglyph.md +2 -2
- package/dist/docs/start/guidelines/formatting.md +2 -2
- package/dist/docs/start/guidelines/iframe.md +2 -2
- package/dist/docs/start/guidelines/obfuscate-data.md +2 -2
- package/dist/docs/start/guidelines/print-css.md +2 -2
- package/dist/docs/start/guidelines/spinner.md +82 -82
- package/dist/docs/start/guidelines/state-in-url.md +263 -0
- package/dist/docs/start/guidelines/supported-browsers.md +2 -2
- package/dist/docs/start/guidelines/writing.md +2 -2
- package/dist/docs/start/howto.md +10 -10
- package/dist/docs/start/intro.md +2 -2
- package/dist/docs/start/responsiveness.md +2 -2
- package/dist/docs/templates/common-table.md +15 -14
- package/dist/docs/templates/detail-views.md +3 -3
- package/dist/docs/templates/expandable-details.md +2 -2
- package/dist/docs/templates/feature-cards.md +56 -56
- package/dist/docs/templates/form-summary.md +23 -23
- package/dist/docs/templates/form-toggle.md +2 -2
- package/dist/docs/templates/list-blocks.md +204 -204
- package/dist/docs/templates/loading-progress.md +2 -2
- package/dist/docs/templates/options-panel.md +2 -2
- package/dist/docs/templates/panel-variants.md +2 -2
- package/dist/docs/templates/progress-cards.md +2 -2
- package/dist/docs/templates/progress-success.md +2 -2
- package/dist/docs/templates/settings-form.md +24 -24
- package/dist/docs/templates/stats-blocks.md +18 -18
- package/dist/docs/templates/table-panel.md +2 -2
- package/dist/docs/templates/table-row-animation.md +2 -2
- package/dist/docs/templates/usage-cards.md +2 -2
- package/dist/docs/utilities/classNames.md +191 -0
- package/dist/docs/utilities/deviceUtils.md +2 -2
- package/dist/docs/utilities/featureToggles.md +2 -2
- package/dist/docs/utilities/fuelTypeUtils.md +2 -2
- package/dist/docs/utilities/routeUtils.md +326 -90
- package/dist/docs/utilities/useAfterMount.md +2 -2
- package/dist/docs/utilities/useAutoAnimate.md +2 -2
- package/dist/docs/utilities/useAverage.md +2 -2
- package/dist/docs/utilities/useClickOutside.md +2 -2
- package/dist/docs/utilities/useClipboard.md +3 -3
- package/dist/docs/utilities/useCookies.md +188 -0
- package/dist/docs/utilities/useCount.md +2 -2
- package/dist/docs/utilities/useDarkMode.md +2 -2
- package/dist/docs/utilities/useDebugInfo.md +5 -5
- package/dist/docs/utilities/useEffectOnce.md +2 -2
- package/dist/docs/utilities/useElapsedTime.md +2 -2
- package/dist/docs/utilities/useElementSize.md +2 -2
- package/dist/docs/utilities/useEsc.md +2 -2
- package/dist/docs/utilities/useEvent.md +2 -2
- package/dist/docs/utilities/useFocusTrap.md +2 -2
- package/dist/docs/utilities/useFullscreen.md +2 -2
- package/dist/docs/utilities/useHover.md +2 -2
- package/dist/docs/utilities/useIncomingPostMessages.md +2 -2
- package/dist/docs/utilities/useInterval.md +2 -2
- package/dist/docs/utilities/useIsFocusWithin.md +2 -2
- package/dist/docs/utilities/useKey.md +2 -2
- package/dist/docs/utilities/useLocalStorage.md +2 -2
- package/dist/docs/utilities/useLocationSuggestions.md +2 -2
- package/dist/docs/utilities/useMax.md +2 -2
- package/dist/docs/utilities/useMin.md +2 -2
- package/dist/docs/utilities/useMutationObserver.md +2 -2
- package/dist/docs/utilities/useOnScreen.md +2 -2
- package/dist/docs/utilities/useOnlineStatus.md +2 -2
- package/dist/docs/utilities/usePostMessage.md +3 -3
- package/dist/docs/utilities/usePostMessageSender.md +2 -2
- package/dist/docs/utilities/usePrevious.md +2 -2
- package/dist/docs/utilities/useResizeObserver.md +2 -2
- package/dist/docs/utilities/useRioCookieConsent.md +90 -0
- package/dist/docs/utilities/useScrollPosition.md +2 -2
- package/dist/docs/utilities/useSearch.md +2 -2
- package/dist/docs/utilities/useSearchHighlight.md +815 -0
- package/dist/docs/utilities/useSorting.md +2 -2
- package/dist/docs/utilities/useStateWithValidation.md +2 -2
- package/dist/docs/utilities/useSum.md +2 -2
- package/dist/docs/utilities/useTableExport.md +53 -53
- package/dist/docs/utilities/useTableSelection.md +90 -90
- package/dist/docs/utilities/useTimeout.md +2 -2
- package/dist/docs/utilities/useToggle.md +3 -3
- package/dist/docs/utilities/useUrlState.md +418 -0
- package/dist/docs/utilities/useWindowResize.md +2 -2
- package/dist/index.mjs +8 -8
- package/dist/version.json +2 -2
- package/package.json +9 -9
|
@@ -2,30 +2,243 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Helper
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/routeUtils
|
|
6
|
+
*Captured:* 2026-02-23T13:48:46.337Z
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Utility helpers for parsing and serializing URL state. These are low-level building blocks for service-specific mapping.
|
|
9
9
|
|
|
10
10
|
## Route Utils
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
For end-to-end URL sync (URL - store + store - URL), prefer the useUrlState hook. Use the route utils on this page when you need custom parse/serialize logic for specific values.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
For history behavior guidance (pushState vs. replaceState), see the State in URL guideline .
|
|
15
|
+
|
|
16
|
+
If you use UrlConfigItem with useUrlState, set an explicit defaultValue for every key so removed params can reliably reset state.
|
|
17
|
+
|
|
18
|
+
## Route utils overview
|
|
19
|
+
|
|
20
|
+
## Simple state in URL
|
|
21
|
+
|
|
22
|
+
Example for manual parse/stringify helpers in a service file.
|
|
15
23
|
|
|
16
24
|
### Example: Example 1
|
|
17
25
|
|
|
18
|
-
import
|
|
19
|
-
|
|
26
|
+
import { deserializeValue, serializeValue } from '@rio-cloud/rio-uikit/routeUtils';
|
|
27
|
+
|
|
28
|
+
// Adapt to your configuration
|
|
29
|
+
const BASE_PATH = 'my-service';
|
|
30
|
+
const VIEW_OPTIONS = ['list', 'grid'] as const;
|
|
31
|
+
|
|
32
|
+
type ViewType = (typeof VIEW_OPTIONS)[number];
|
|
33
|
+
const DEFAULT_VIEW: ViewType = 'list';
|
|
34
|
+
const DEFAULT_TAB_ID = 1;
|
|
35
|
+
|
|
36
|
+
type RouterLike = { location?: Location };
|
|
37
|
+
type RouteState = {
|
|
38
|
+
query: string;
|
|
39
|
+
view: ViewType;
|
|
40
|
+
tabId: number;
|
|
41
|
+
tags: string[];
|
|
42
|
+
showArchived: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const isViewType = (value: string): value is ViewType => (VIEW_OPTIONS as readonly string[]).includes(value);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Reads URL state from a router-like object.
|
|
49
|
+
* Useful when you want a lightweight parser without a hook.
|
|
50
|
+
*
|
|
51
|
+
* Note: Optional service helper when you only need a one-off parse.
|
|
52
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const state = parseRoute({ location: window.location });
|
|
56
|
+
*/
|
|
57
|
+
export const parseRoute = (router: RouterLike): RouteState => {
|
|
58
|
+
const location = (router?.location ?? {}) as Location;
|
|
59
|
+
const params = new URLSearchParams(location.search || '');
|
|
60
|
+
|
|
61
|
+
const parsedView = deserializeValue(params.get('view'), 'string');
|
|
62
|
+
const parsedTabId = deserializeValue(params.get('tabId'), 'number');
|
|
63
|
+
const parsedTags = deserializeValue(params.get('tags'), 'array');
|
|
64
|
+
const parsedArchived = deserializeValue(params.get('archived'), 'boolean');
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
query: deserializeValue(params.get('q'), 'string') ?? '',
|
|
68
|
+
view: parsedView && isViewType(parsedView) ? parsedView : DEFAULT_VIEW,
|
|
69
|
+
tabId: parsedTabId ?? DEFAULT_TAB_ID,
|
|
70
|
+
tags: parsedTags ?? [],
|
|
71
|
+
showArchived: parsedArchived ?? false,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Builds a deep-link URL for a given state.
|
|
77
|
+
* Useful for linking to a screen with preselected filters.
|
|
78
|
+
*
|
|
79
|
+
* Note: Optional service helper when you only need to build a link.
|
|
80
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const url = makeRoute({ query: 'rio', view: 'list', tabId: 2, tags: ['banana'], showArchived: false });
|
|
84
|
+
*/
|
|
85
|
+
export const makeRoute = (state: RouteState) => {
|
|
86
|
+
const params = new URLSearchParams();
|
|
87
|
+
|
|
88
|
+
const query = serializeValue(state.query, 'string');
|
|
89
|
+
if (query) {
|
|
90
|
+
params.set('q', query);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (state.view !== DEFAULT_VIEW) {
|
|
94
|
+
const view = serializeValue(state.view, 'string');
|
|
95
|
+
if (view) {
|
|
96
|
+
params.set('view', view);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (state.tabId !== DEFAULT_TAB_ID) {
|
|
101
|
+
const tabId = serializeValue(state.tabId, 'number');
|
|
102
|
+
if (tabId) {
|
|
103
|
+
params.set('tabId', tabId);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const tags = serializeValue(state.tags, 'array');
|
|
108
|
+
if (tags) {
|
|
109
|
+
params.set('tags', tags);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (state.showArchived) {
|
|
113
|
+
const archived = serializeValue(state.showArchived, 'boolean');
|
|
114
|
+
if (archived) {
|
|
115
|
+
params.set('archived', archived);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const queryString = params.toString();
|
|
120
|
+
return `${BASE_PATH}/${queryString ? `?${queryString}` : ''}`;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
#### Summary
|
|
124
|
+
|
|
125
|
+
import { deserializeValue, serializeValue } from '@rio-cloud/rio-uikit/routeUtils';
|
|
126
|
+
|
|
127
|
+
// Adapt to your configuration
|
|
128
|
+
const BASE_PATH = 'my-service';
|
|
129
|
+
const VIEW_OPTIONS = ['list', 'grid'] as const;
|
|
130
|
+
|
|
131
|
+
type ViewType = (typeof VIEW_OPTIONS)[number];
|
|
132
|
+
const DEFAULT_VIEW: ViewType = 'list';
|
|
133
|
+
const DEFAULT_TAB_ID = 1;
|
|
134
|
+
|
|
135
|
+
type RouterLike = { location?: Location };
|
|
136
|
+
type RouteState = {
|
|
137
|
+
query: string;
|
|
138
|
+
view: ViewType;
|
|
139
|
+
tabId: number;
|
|
140
|
+
tags: string[];
|
|
141
|
+
showArchived: boolean;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const isViewType = (value: string): value is ViewType => (VIEW_OPTIONS as readonly string[]).includes(value);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Reads URL state from a router-like object.
|
|
148
|
+
* Useful when you want a lightweight parser without a hook.
|
|
149
|
+
*
|
|
150
|
+
* Note: Optional service helper when you only need a one-off parse.
|
|
151
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* const state = parseRoute({ location: window.location });
|
|
155
|
+
*/
|
|
156
|
+
export const parseRoute = (router: RouterLike): RouteState => {
|
|
157
|
+
const location = (router?.location ?? {}) as Location;
|
|
158
|
+
const params = new URLSearchParams(location.search || '');
|
|
159
|
+
|
|
160
|
+
const parsedView = deserializeValue(params.get('view'), 'string');
|
|
161
|
+
const parsedTabId = deserializeValue(params.get('tabId'), 'number');
|
|
162
|
+
const parsedTags = deserializeValue(params.get('tags'), 'array');
|
|
163
|
+
const parsedArchived = deserializeValue(params.get('archived'), 'boolean');
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
query: deserializeValue(params.get('q'), 'string') ?? '',
|
|
167
|
+
view: parsedView && isViewType(parsedView) ? parsedView : DEFAULT_VIEW,
|
|
168
|
+
tabId: parsedTabId ?? DEFAULT_TAB_ID,
|
|
169
|
+
tags: parsedTags ?? [],
|
|
170
|
+
showArchived: parsedArchived ?? false,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Builds a deep-link URL for a given state.
|
|
176
|
+
* Useful for linking to a screen with preselected filters.
|
|
177
|
+
*
|
|
178
|
+
* Note: Optional service helper when you only need to build a link.
|
|
179
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* const url = makeRoute({ query: 'rio', view: 'list', tabId: 2, tags: ['banana'], showArchived: false });
|
|
183
|
+
*/
|
|
184
|
+
export const makeRoute = (state: RouteState) => {
|
|
185
|
+
const params = new URLSearchParams();
|
|
186
|
+
|
|
187
|
+
const query = serializeValue(state.query, 'string');
|
|
188
|
+
if (query) {
|
|
189
|
+
params.set('q', query);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (state.view !== DEFAULT_VIEW) {
|
|
193
|
+
const view = serializeValue(state.view, 'string');
|
|
194
|
+
if (view) {
|
|
195
|
+
params.set('view', view);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (state.tabId !== DEFAULT_TAB_ID) {
|
|
200
|
+
const tabId = serializeValue(state.tabId, 'number');
|
|
201
|
+
if (tabId) {
|
|
202
|
+
params.set('tabId', tabId);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const tags = serializeValue(state.tags, 'array');
|
|
207
|
+
if (tags) {
|
|
208
|
+
params.set('tags', tags);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (state.showArchived) {
|
|
212
|
+
const archived = serializeValue(state.showArchived, 'boolean');
|
|
213
|
+
if (archived) {
|
|
214
|
+
params.set('archived', archived);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const queryString = params.toString();
|
|
219
|
+
return `${BASE_PATH}/${queryString ? `?${queryString}` : ''}`;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
## TableSettingsDialog state
|
|
223
|
+
|
|
224
|
+
Example for compact sort + table settings mapping with dedicated helpers.
|
|
225
|
+
|
|
226
|
+
Example: http://my-url/#demoService/table?sort=userNickName&columns=itemId,userImageStatus,userNickName:278,userFirstName,userLastName,userActivity,userJobTitle,userEmail,userPhoneNumber
|
|
227
|
+
|
|
228
|
+
### Example: Example 2
|
|
20
229
|
|
|
21
230
|
import {
|
|
22
|
-
|
|
231
|
+
deserializeValue,
|
|
23
232
|
mapColumnsSettingsToStrings,
|
|
24
|
-
|
|
233
|
+
parseColumnsSettingsStrings,
|
|
25
234
|
parseSorting,
|
|
26
|
-
|
|
235
|
+
serializeSorting,
|
|
236
|
+
serializeValue,
|
|
27
237
|
} from '@rio-cloud/rio-uikit/routeUtils';
|
|
238
|
+
import type { SortDirectionType } from '@rio-cloud/rio-uikit/SortUtils';
|
|
239
|
+
import type { TableColumnsSettings } from '@rio-cloud/rio-uikit/TableSettingsDialog';
|
|
28
240
|
|
|
241
|
+
// TableSettingsDialog state example.
|
|
29
242
|
// Adapt to your configuration
|
|
30
243
|
const BASE_PATH = 'my-service';
|
|
31
244
|
const defaultColumnsDetails: Record<string, { width: number; defaultWidth?: number }> = {
|
|
@@ -35,77 +248,89 @@ defaultWidth: 250,
|
|
|
35
248
|
},
|
|
36
249
|
};
|
|
37
250
|
|
|
38
|
-
// Options for the "qs" library
|
|
39
|
-
const OPTIONS = {
|
|
40
|
-
comma: true, // required to parse comma separated string into array
|
|
41
|
-
arrayFormat: 'comma' as const, // required to stringify arrays into comma separated strings
|
|
42
|
-
indices: false, // don't use array indices
|
|
43
|
-
encode: false, // don't encode the entire string as it will be done individually for certain params
|
|
44
|
-
decode: false,
|
|
45
|
-
skipNulls: true, // required to remove empty params
|
|
46
|
-
};
|
|
47
|
-
|
|
48
251
|
// Sample code for parsing the route just for illustration how to use the utils functions
|
|
49
252
|
// Feel free to modify this to your needs.
|
|
50
253
|
// Note: the "parseRoute" and "makeRoute" functions may contain more props which are left out in this demo
|
|
51
254
|
type RouterLike = { location?: Location };
|
|
52
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Reads table settings state from a router-like object.
|
|
258
|
+
*
|
|
259
|
+
* Note: Optional service helper when you only need a one-off parse.
|
|
260
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* const state = parseRoute({ location: window.location });
|
|
264
|
+
*/
|
|
53
265
|
export const parseRoute = (router: RouterLike) => {
|
|
54
|
-
const location =
|
|
55
|
-
const
|
|
266
|
+
const location = (router?.location ?? {}) as Location;
|
|
267
|
+
const params = new URLSearchParams(location.search || '');
|
|
56
268
|
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
columns?: string[] | Record<string, string>;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const sorting = sort ? parseSorting(sort) : undefined;
|
|
269
|
+
const sortValue = deserializeValue(params.get('sort'), 'string');
|
|
270
|
+
const sorting = sortValue ? parseSorting(sortValue) : undefined;
|
|
63
271
|
|
|
64
|
-
const
|
|
65
|
-
const
|
|
272
|
+
const columnsList = deserializeValue(params.get('columns'), 'array');
|
|
273
|
+
const columns = columnsList ? parseColumnsSettingsStrings(columnsList, defaultColumnsDetails) : undefined;
|
|
66
274
|
|
|
67
275
|
return {
|
|
68
|
-
sortBy,
|
|
69
|
-
sortDir,
|
|
70
|
-
columns
|
|
71
|
-
columns &&
|
|
72
|
-
parseColumnsSettingsStrings(
|
|
73
|
-
Array.isArray(columns) ? columns : Object.values(columns || {}),
|
|
74
|
-
defaultColumnsDetails
|
|
75
|
-
),
|
|
276
|
+
sortBy: sorting?.sortBy,
|
|
277
|
+
sortDir: sorting?.sortDir,
|
|
278
|
+
columns,
|
|
76
279
|
};
|
|
77
280
|
};
|
|
78
281
|
|
|
79
282
|
type mapRouteProps = {
|
|
80
283
|
sortBy: string;
|
|
81
|
-
sortDir:
|
|
82
|
-
columns:
|
|
284
|
+
sortDir: SortDirectionType;
|
|
285
|
+
columns: TableColumnsSettings;
|
|
83
286
|
};
|
|
84
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Builds a deep-link URL for a given table settings state.
|
|
290
|
+
*
|
|
291
|
+
* Note: Optional service helper when you only need to build a link.
|
|
292
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* const url = makeRoute({ sortBy: 'name', sortDir: 'ASCENDING', columns });
|
|
296
|
+
*/
|
|
85
297
|
export const makeRoute = ({ sortBy, sortDir, columns }: mapRouteProps) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
|
|
298
|
+
const params = new URLSearchParams();
|
|
299
|
+
|
|
300
|
+
if (sortBy) {
|
|
301
|
+
// Use serializeSorting for compact empty / - prefix behavior.
|
|
302
|
+
const serializedSort = serializeSorting({ sortBy, sortDir });
|
|
303
|
+
if (serializedSort) {
|
|
304
|
+
params.set('sort', serializedSort);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const mappedColumns = mapColumnsSettingsToStrings(columns);
|
|
309
|
+
const serializedColumns = serializeValue(mappedColumns, 'array');
|
|
310
|
+
if (serializedColumns) {
|
|
311
|
+
params.set('columns', serializedColumns);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const queryString = params.toString();
|
|
315
|
+
const searchFragment = queryString ? `?${queryString}` : '';
|
|
316
|
+
|
|
93
317
|
return `${BASE_PATH}/${searchFragment}`;
|
|
94
318
|
};
|
|
95
319
|
|
|
96
320
|
#### Summary
|
|
97
321
|
|
|
98
|
-
import qs from 'qs';
|
|
99
|
-
import { get } from 'es-toolkit/compat';
|
|
100
|
-
|
|
101
322
|
import {
|
|
102
|
-
|
|
323
|
+
deserializeValue,
|
|
103
324
|
mapColumnsSettingsToStrings,
|
|
104
|
-
|
|
325
|
+
parseColumnsSettingsStrings,
|
|
105
326
|
parseSorting,
|
|
106
|
-
|
|
327
|
+
serializeSorting,
|
|
328
|
+
serializeValue,
|
|
107
329
|
} from '@rio-cloud/rio-uikit/routeUtils';
|
|
330
|
+
import type { SortDirectionType } from '@rio-cloud/rio-uikit/SortUtils';
|
|
331
|
+
import type { TableColumnsSettings } from '@rio-cloud/rio-uikit/TableSettingsDialog';
|
|
108
332
|
|
|
333
|
+
// TableSettingsDialog state example.
|
|
109
334
|
// Adapt to your configuration
|
|
110
335
|
const BASE_PATH = 'my-service';
|
|
111
336
|
const defaultColumnsDetails: Record<string, { width: number; defaultWidth?: number }> = {
|
|
@@ -115,60 +340,71 @@ defaultWidth: 250,
|
|
|
115
340
|
},
|
|
116
341
|
};
|
|
117
342
|
|
|
118
|
-
// Options for the "qs" library
|
|
119
|
-
const OPTIONS = {
|
|
120
|
-
comma: true, // required to parse comma separated string into array
|
|
121
|
-
arrayFormat: 'comma' as const, // required to stringify arrays into comma separated strings
|
|
122
|
-
indices: false, // don't use array indices
|
|
123
|
-
encode: false, // don't encode the entire string as it will be done individually for certain params
|
|
124
|
-
decode: false,
|
|
125
|
-
skipNulls: true, // required to remove empty params
|
|
126
|
-
};
|
|
127
|
-
|
|
128
343
|
// Sample code for parsing the route just for illustration how to use the utils functions
|
|
129
344
|
// Feel free to modify this to your needs.
|
|
130
345
|
// Note: the "parseRoute" and "makeRoute" functions may contain more props which are left out in this demo
|
|
131
346
|
type RouterLike = { location?: Location };
|
|
132
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Reads table settings state from a router-like object.
|
|
350
|
+
*
|
|
351
|
+
* Note: Optional service helper when you only need a one-off parse.
|
|
352
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* const state = parseRoute({ location: window.location });
|
|
356
|
+
*/
|
|
133
357
|
export const parseRoute = (router: RouterLike) => {
|
|
134
|
-
const location =
|
|
135
|
-
const
|
|
358
|
+
const location = (router?.location ?? {}) as Location;
|
|
359
|
+
const params = new URLSearchParams(location.search || '');
|
|
136
360
|
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
columns?: string[] | Record<string, string>;
|
|
140
|
-
};
|
|
361
|
+
const sortValue = deserializeValue(params.get('sort'), 'string');
|
|
362
|
+
const sorting = sortValue ? parseSorting(sortValue) : undefined;
|
|
141
363
|
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const sortBy = sorting && typeof sorting !== 'string' ? sorting.sortBy : undefined;
|
|
145
|
-
const sortDir = sorting && typeof sorting !== 'string' ? sorting.sortDir : undefined;
|
|
364
|
+
const columnsList = deserializeValue(params.get('columns'), 'array');
|
|
365
|
+
const columns = columnsList ? parseColumnsSettingsStrings(columnsList, defaultColumnsDetails) : undefined;
|
|
146
366
|
|
|
147
367
|
return {
|
|
148
|
-
sortBy,
|
|
149
|
-
sortDir,
|
|
150
|
-
columns
|
|
151
|
-
columns &&
|
|
152
|
-
parseColumnsSettingsStrings(
|
|
153
|
-
Array.isArray(columns) ? columns : Object.values(columns || {}),
|
|
154
|
-
defaultColumnsDetails
|
|
155
|
-
),
|
|
368
|
+
sortBy: sorting?.sortBy,
|
|
369
|
+
sortDir: sorting?.sortDir,
|
|
370
|
+
columns,
|
|
156
371
|
};
|
|
157
372
|
};
|
|
158
373
|
|
|
159
374
|
type mapRouteProps = {
|
|
160
375
|
sortBy: string;
|
|
161
|
-
sortDir:
|
|
162
|
-
columns:
|
|
376
|
+
sortDir: SortDirectionType;
|
|
377
|
+
columns: TableColumnsSettings;
|
|
163
378
|
};
|
|
164
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Builds a deep-link URL for a given table settings state.
|
|
382
|
+
*
|
|
383
|
+
* Note: Optional service helper when you only need to build a link.
|
|
384
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* const url = makeRoute({ sortBy: 'name', sortDir: 'ASCENDING', columns });
|
|
388
|
+
*/
|
|
165
389
|
export const makeRoute = ({ sortBy, sortDir, columns }: mapRouteProps) => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
|
|
390
|
+
const params = new URLSearchParams();
|
|
391
|
+
|
|
392
|
+
if (sortBy) {
|
|
393
|
+
// Use serializeSorting for compact empty / - prefix behavior.
|
|
394
|
+
const serializedSort = serializeSorting({ sortBy, sortDir });
|
|
395
|
+
if (serializedSort) {
|
|
396
|
+
params.set('sort', serializedSort);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const mappedColumns = mapColumnsSettingsToStrings(columns);
|
|
401
|
+
const serializedColumns = serializeValue(mappedColumns, 'array');
|
|
402
|
+
if (serializedColumns) {
|
|
403
|
+
params.set('columns', serializedColumns);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const queryString = params.toString();
|
|
407
|
+
const searchFragment = queryString ? `?${queryString}` : '';
|
|
408
|
+
|
|
173
409
|
return `${BASE_PATH}/${searchFragment}`;
|
|
174
410
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Lifecycle & execution hooks
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useAfterMount
|
|
6
|
+
*Captured:* 2026-02-23T13:48:47.599Z
|
|
7
7
|
|
|
8
8
|
The useAfterMount hook allows to use a side effect after the component has been mounted and rendered. The effect will not be triggered on mount and only when the dependencies change.
|
|
9
9
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* DOM behavior hooks
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useAutoAnimate
|
|
6
|
+
*Captured:* 2026-02-23T13:48:49.836Z
|
|
7
7
|
|
|
8
8
|
The useAutoAnimate hook is a thin re-export of the @formkit/auto-animate utility to quickly add enter/leave animations to a container. This page shows a simple example; for full configuration options, check the official documentation.
|
|
9
9
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Data aggregation hooks
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useAverage
|
|
6
|
+
*Captured:* 2026-02-23T13:49:02.789Z
|
|
7
7
|
|
|
8
8
|
Calculates the arithmetic mean of numeric values extracted from a list of objects using a dot-separated path. Supports localized number formats through optional locale configuration.
|
|
9
9
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* DOM behavior hooks
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useClickOutside
|
|
6
|
+
*Captured:* 2026-02-23T13:48:50.513Z
|
|
7
7
|
|
|
8
8
|
The useClickOutside hook allows to easily detect events outside a referenced element.
|
|
9
9
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Browser & device hooks
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useClipboard
|
|
6
|
+
*Captured:* 2026-02-23T13:48:55.827Z
|
|
7
7
|
|
|
8
8
|
The useClipboard hook allows to easily copy something to the browsers clipboard.
|
|
9
9
|
|
|
@@ -75,7 +75,7 @@ export default () => {
|
|
|
75
75
|
<span>Random UUID</span>
|
|
76
76
|
</label>
|
|
77
77
|
<div class="input-group">
|
|
78
|
-
<input id="random-uuid" class="form-control" type="text" value="
|
|
78
|
+
<input id="random-uuid" class="form-control" type="text" value="b8885748-6f29-46ff-b3de-a5eb3fe7ece8">
|
|
79
79
|
<div class="input-group-addon">
|
|
80
80
|
<button type="button" class="btn btn-muted btn-sm btn-icon-only btn-component position-absolute top-1 right-1" tabindex="0">
|
|
81
81
|
<span class="rioglyph rioglyph-duplicate">
|