@colisweb/rescript-toolkit 4.11.2 → 4.11.3
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/package.json
CHANGED
|
@@ -206,6 +206,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
206
206
|
and link =
|
|
207
207
|
| Legacy(legacyLink)
|
|
208
208
|
| App(appLink)
|
|
209
|
+
| Custom(React.element)
|
|
209
210
|
and groupInfo = {
|
|
210
211
|
label: React.element,
|
|
211
212
|
icon: React.element,
|
|
@@ -215,6 +216,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
215
216
|
route: Config.t,
|
|
216
217
|
icon?: React.element,
|
|
217
218
|
label: React.element,
|
|
219
|
+
disabledActiveLink?: bool,
|
|
218
220
|
}
|
|
219
221
|
and legacyLink = {
|
|
220
222
|
url: string,
|
|
@@ -239,6 +241,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
239
241
|
~onLinkClick=() => (),
|
|
240
242
|
) =>
|
|
241
243
|
switch link {
|
|
244
|
+
| Custom(element) => element
|
|
242
245
|
| Legacy(config) =>
|
|
243
246
|
let {label, url} = config
|
|
244
247
|
<a
|
|
@@ -267,6 +270,9 @@ module Make = (Config: RouterConfig) => {
|
|
|
267
270
|
</a>
|
|
268
271
|
| App(config) =>
|
|
269
272
|
let {label, route} = config
|
|
273
|
+
|
|
274
|
+
let disabledActiveLink = config.disabledActiveLink->Option.getWithDefault(false)
|
|
275
|
+
|
|
270
276
|
<Link
|
|
271
277
|
route
|
|
272
278
|
className={cx([
|
|
@@ -274,7 +280,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
274
280
|
isSubLink ? "ml-3" : "",
|
|
275
281
|
config.icon->Option.isNone ? "py-5" : "",
|
|
276
282
|
"sidenav-link",
|
|
277
|
-
isActive ? "bg-primary-100/75 text-neutral-700" : "",
|
|
283
|
+
isActive && !disabledActiveLink ? "bg-primary-100/75 text-neutral-700" : "",
|
|
278
284
|
])}
|
|
279
285
|
activeClassName="bg-primary-100/75 text-neutral-700"
|
|
280
286
|
onClick={_ => onLinkClick()}>
|
|
@@ -316,6 +322,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
316
322
|
let hasActiveSubRoute = links->Array.some(link => {
|
|
317
323
|
switch link {
|
|
318
324
|
| Legacy(_) => false
|
|
325
|
+
| Custom(_) => false
|
|
319
326
|
| App({route}) => isRouteEqual(currentRoute, route)
|
|
320
327
|
}
|
|
321
328
|
})
|
|
@@ -325,6 +332,7 @@ module Make = (Config: RouterConfig) => {
|
|
|
325
332
|
links->Array.getBy(link => {
|
|
326
333
|
switch link {
|
|
327
334
|
| Legacy(_) => false
|
|
335
|
+
| Custom(_) => false
|
|
328
336
|
| App({route}) =>
|
|
329
337
|
breadcrumbLinks->Array.some(breadcrumbLink => breadcrumbLink.route->isRouteEqual(route))
|
|
330
338
|
}
|