@conduction/nextcloud-vue 2.56.0-beta.70 → 2.56.0-beta.71

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.
Files changed (38) hide show
  1. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  2. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +67 -1
  3. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  4. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  5. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
  6. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  7. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  8. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
  9. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  10. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  11. package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
  12. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
  13. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
  14. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
  15. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
  16. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
  17. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
  18. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
  19. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
  20. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
  21. package/dist/esm/l10n/en.json.js +59 -59
  22. package/dist/esm/l10n/nl.json.js +59 -59
  23. package/dist/esm/library-style.js +1 -1
  24. package/dist/esm/nextcloud-vue.css +55 -55
  25. package/dist/esm/utils/parentCrumb.js +86 -0
  26. package/dist/esm/utils/parentCrumb.js.map +1 -0
  27. package/dist/nextcloud-vue.cjs.js +813 -576
  28. package/dist/nextcloud-vue.cjs.js.map +2 -2
  29. package/dist/nextcloud-vue.css +55 -55
  30. package/l10n/en.json +59 -59
  31. package/l10n/nl.json +59 -59
  32. package/package.json +1 -1
  33. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +67 -1
  34. package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
  35. package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
  36. package/src/components/CnStorePage/CnStorePage.vue +8 -8
  37. package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
  38. package/src/utils/parentCrumb.js +83 -0
@@ -46898,31 +46898,31 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
46898
46898
  }
46899
46899
 
46900
46900
 
46901
- .cn-checklist-run__form[data-v-5f2c19ee] {
46901
+ .cn-checklist-run__form[data-v-e9adfb50] {
46902
46902
  display: flex;
46903
46903
  flex-direction: column;
46904
46904
  gap: 12px;
46905
46905
  }
46906
- .cn-checklist-run__position[data-v-5f2c19ee] {
46906
+ .cn-checklist-run__position[data-v-e9adfb50] {
46907
46907
  color: var(--color-text-maxcontrast);
46908
46908
  font-size: 13px;
46909
46909
  line-height: 17px;
46910
46910
  margin: 0;
46911
46911
  }
46912
- .cn-checklist-run__progress[data-v-5f2c19ee] {
46912
+ .cn-checklist-run__progress[data-v-e9adfb50] {
46913
46913
  background: var(--color-border);
46914
46914
  border-radius: 3px;
46915
46915
  display: block;
46916
46916
  height: 6px;
46917
46917
  overflow: hidden;
46918
46918
  }
46919
- .cn-checklist-run__progress-fill[data-v-5f2c19ee] {
46919
+ .cn-checklist-run__progress-fill[data-v-e9adfb50] {
46920
46920
  background: var(--color-primary-element);
46921
46921
  display: block;
46922
46922
  height: 100%;
46923
46923
  }
46924
- .cn-checklist-run__live[data-v-5f2c19ee],
46925
- .cn-checklist-run__sr[data-v-5f2c19ee] {
46924
+ .cn-checklist-run__live[data-v-e9adfb50],
46925
+ .cn-checklist-run__sr[data-v-e9adfb50] {
46926
46926
  clip-path: inset(50%);
46927
46927
  height: 1px;
46928
46928
  overflow: hidden;
@@ -46930,8 +46930,8 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
46930
46930
  white-space: nowrap;
46931
46931
  width: 1px;
46932
46932
  }
46933
- .cn-checklist-run__question[data-v-5f2c19ee],
46934
- .cn-checklist-run__photos[data-v-5f2c19ee] {
46933
+ .cn-checklist-run__question[data-v-e9adfb50],
46934
+ .cn-checklist-run__photos[data-v-e9adfb50] {
46935
46935
  background: var(--color-main-background);
46936
46936
  border: 1px solid var(--color-border);
46937
46937
  border-radius: var(--border-radius-large, 12px);
@@ -46941,17 +46941,17 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
46941
46941
  margin: 0;
46942
46942
  padding: 12px 14px;
46943
46943
  }
46944
- .cn-checklist-run__photos-title[data-v-5f2c19ee] {
46944
+ .cn-checklist-run__photos-title[data-v-e9adfb50] {
46945
46945
  font-size: 15px;
46946
46946
  line-height: 1.2;
46947
46947
  }
46948
- .cn-checklist-run__legend[data-v-5f2c19ee] {
46948
+ .cn-checklist-run__legend[data-v-e9adfb50] {
46949
46949
  font-size: 15px;
46950
46950
  font-weight: 600;
46951
46951
  line-height: 1.2;
46952
46952
  padding: 0 4px;
46953
46953
  }
46954
- .cn-checklist-run__help[data-v-5f2c19ee] {
46954
+ .cn-checklist-run__help[data-v-e9adfb50] {
46955
46955
  color: var(--color-text-maxcontrast);
46956
46956
  font-size: 14px;
46957
46957
  line-height: 1.2;
@@ -46960,7 +46960,7 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
46960
46960
 
46961
46961
  /* An option reads as text, not as a field label (a theme makes every label
46962
46962
  bold with !important); 15px, 31px apart, as the board draws it (DqInspectie). */
46963
- .cn-checklist-run__choice[data-v-5f2c19ee] {
46963
+ .cn-checklist-run__choice[data-v-e9adfb50] {
46964
46964
  align-items: center;
46965
46965
  display: flex;
46966
46966
  font-size: 15px;
@@ -46970,7 +46970,7 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
46970
46970
  }
46971
46971
 
46972
46972
  /* The board draws the radio with the browser's own 3px 3px 0 5px margin. */
46973
- .cn-checklist-run__choice input[data-v-5f2c19ee] {
46973
+ .cn-checklist-run__choice input[data-v-e9adfb50] {
46974
46974
  accent-color: var(--color-primary-element);
46975
46975
  height: 20px;
46976
46976
  margin: 3px 3px 0 5px;
@@ -46978,32 +46978,32 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
46978
46978
  }
46979
46979
 
46980
46980
  /* The board look sizes every radio 18px with a (0,4,1) rule. */
46981
- .cn-checklist-run__choice.cn-checklist-run__choice.cn-checklist-run__choice input[type="radio"][data-v-5f2c19ee] {
46981
+ .cn-checklist-run__choice.cn-checklist-run__choice.cn-checklist-run__choice input[type="radio"][data-v-e9adfb50] {
46982
46982
  height: 20px;
46983
46983
  min-height: 20px;
46984
46984
  min-width: 20px;
46985
46985
  width: 20px;
46986
46986
  }
46987
- .cn-checklist-run__text[data-v-5f2c19ee],
46988
- .cn-checklist-run__number[data-v-5f2c19ee] {
46987
+ .cn-checklist-run__text[data-v-e9adfb50],
46988
+ .cn-checklist-run__number[data-v-e9adfb50] {
46989
46989
  box-sizing: border-box;
46990
46990
  width: 100%;
46991
46991
  }
46992
46992
 
46993
46993
  /* A note is two 15px lines on the normal line height, 8px 12px in: 54px, as
46994
46994
  the board draws it. A theme pads every textarea 5px 12px with !important. */
46995
- .cn-checklist-run__text.cn-checklist-run__text[data-v-5f2c19ee] {
46995
+ .cn-checklist-run__text.cn-checklist-run__text[data-v-e9adfb50] {
46996
46996
  padding: 8px 12px !important;
46997
46997
  line-height: normal;
46998
46998
  margin: 0;
46999
46999
  }
47000
- .cn-checklist-run__group[data-v-5f2c19ee] {
47000
+ .cn-checklist-run__group[data-v-e9adfb50] {
47001
47001
  font-size: 14px;
47002
47002
  font-weight: 600;
47003
47003
  line-height: normal;
47004
47004
  margin: 0;
47005
47005
  }
47006
- .cn-checklist-run__note-label[data-v-5f2c19ee] {
47006
+ .cn-checklist-run__note-label[data-v-e9adfb50] {
47007
47007
  display: flex;
47008
47008
  flex-direction: column;
47009
47009
  gap: 4px;
@@ -47011,7 +47011,7 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
47011
47011
  font-weight: 600 !important;
47012
47012
  line-height: 1.2;
47013
47013
  }
47014
- .cn-checklist-run__photo-list[data-v-5f2c19ee] {
47014
+ .cn-checklist-run__photo-list[data-v-e9adfb50] {
47015
47015
  margin: 0;
47016
47016
  padding-inline-start: 18px;
47017
47017
  }
@@ -47020,7 +47020,7 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
47020
47020
  (DqInspectie, 272px), its 14px/600 label after a camera. The doubled class
47021
47021
  outranks Nextcloud's `button:not(.button-vue)` margin, padding and height,
47022
47022
  and a theme's bold label weight set with !important. */
47023
- .cn-checklist-run__photo-button.cn-checklist-run__photo-button[data-v-5f2c19ee] {
47023
+ .cn-checklist-run__photo-button.cn-checklist-run__photo-button[data-v-e9adfb50] {
47024
47024
  align-items: center;
47025
47025
  align-self: stretch;
47026
47026
  background: var(--color-main-background);
@@ -47038,18 +47038,18 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
47038
47038
  min-height: 34px;
47039
47039
  padding: 0 14px;
47040
47040
  }
47041
- .cn-checklist-run__photo-button[data-v-5f2c19ee]:focus-visible {
47041
+ .cn-checklist-run__photo-button[data-v-e9adfb50]:focus-visible {
47042
47042
  outline: 2px solid var(--color-primary-element);
47043
47043
  outline-offset: 2px;
47044
47044
  }
47045
- .cn-checklist-run__photo-input[data-v-5f2c19ee] {
47045
+ .cn-checklist-run__photo-input[data-v-e9adfb50] {
47046
47046
  clip-path: inset(50%);
47047
47047
  height: 1px;
47048
47048
  overflow: hidden;
47049
47049
  position: absolute;
47050
47050
  width: 1px;
47051
47051
  }
47052
- .cn-checklist-run__nav[data-v-5f2c19ee] {
47052
+ .cn-checklist-run__nav[data-v-e9adfb50] {
47053
47053
  display: flex;
47054
47054
  justify-content: space-between;
47055
47055
  }
@@ -47057,31 +47057,31 @@ button.cn-linked-widget__link.cn-linked-widget__link[data-v-3b6ef042],
47057
47057
  /* Previous and Next are as wide as the board draws them: the board pads the
47058
47058
  button 14px and the label not at all (Vorige 70.3px); NcButton's label
47059
47059
  padding made them 4px wider. */
47060
- .cn-checklist-run__nav[data-v-5f2c19ee] .button-vue__text {
47060
+ .cn-checklist-run__nav[data-v-e9adfb50] .button-vue__text {
47061
47061
  padding-inline: 0;
47062
47062
  }
47063
- .cn-checklist-run__status[data-v-5f2c19ee] {
47063
+ .cn-checklist-run__status[data-v-e9adfb50] {
47064
47064
  align-items: center;
47065
47065
  display: flex;
47066
47066
  flex-wrap: wrap;
47067
47067
  gap: 4px 16px;
47068
47068
  justify-content: space-between;
47069
47069
  }
47070
- .cn-checklist-run__time-left[data-v-5f2c19ee] {
47070
+ .cn-checklist-run__time-left[data-v-e9adfb50] {
47071
47071
  font-variant-numeric: tabular-nums;
47072
47072
  font-weight: 600;
47073
47073
  }
47074
- .cn-checklist-run__time-left--warning[data-v-5f2c19ee] {
47074
+ .cn-checklist-run__time-left--warning[data-v-e9adfb50] {
47075
47075
  color: var(--color-error-text, var(--color-error));
47076
47076
  }
47077
- .cn-checklist-run__saved[data-v-5f2c19ee] {
47077
+ .cn-checklist-run__saved[data-v-e9adfb50] {
47078
47078
  color: var(--color-text-maxcontrast);
47079
47079
  }
47080
- .cn-checklist-run__error[data-v-5f2c19ee] {
47080
+ .cn-checklist-run__error[data-v-e9adfb50] {
47081
47081
  color: var(--color-error-text, var(--color-error));
47082
47082
  margin: 0;
47083
47083
  }
47084
- .cn-checklist-run__empty[data-v-5f2c19ee] {
47084
+ .cn-checklist-run__empty[data-v-e9adfb50] {
47085
47085
  color: var(--color-text-maxcontrast);
47086
47086
  }
47087
47087
 
@@ -64267,12 +64267,12 @@ tbody tr[data-v-74e66abe]:last-child > * {
64267
64267
  }
64268
64268
 
64269
64269
 
64270
- .cn-store-publish[data-v-3b9daec5] {
64270
+ .cn-store-publish[data-v-daaf434a] {
64271
64271
  display: flex;
64272
64272
  flex-direction: column;
64273
64273
  gap: 14px;
64274
64274
  }
64275
- .cn-store-publish__objects[data-v-3b9daec5] {
64275
+ .cn-store-publish__objects[data-v-daaf434a] {
64276
64276
  display: flex;
64277
64277
  flex-direction: column;
64278
64278
  gap: 6px;
@@ -64281,30 +64281,30 @@ tbody tr[data-v-74e66abe]:last-child > * {
64281
64281
  border: 1px solid var(--color-border);
64282
64282
  border-radius: 8px;
64283
64283
  }
64284
- .cn-store-publish__objects legend[data-v-3b9daec5] {
64284
+ .cn-store-publish__objects legend[data-v-daaf434a] {
64285
64285
  padding: 0 4px;
64286
64286
  font-weight: 600;
64287
64287
  }
64288
- .cn-store-publish__object[data-v-3b9daec5] {
64288
+ .cn-store-publish__object[data-v-daaf434a] {
64289
64289
  display: flex;
64290
64290
  align-items: center;
64291
64291
  gap: 8px;
64292
64292
  }
64293
- .cn-store-publish__note[data-v-3b9daec5] {
64293
+ .cn-store-publish__note[data-v-daaf434a] {
64294
64294
  margin: 0;
64295
64295
  color: var(--color-text-maxcontrast);
64296
64296
  }
64297
- .cn-store-publish__row[data-v-3b9daec5] {
64297
+ .cn-store-publish__row[data-v-daaf434a] {
64298
64298
  display: flex;
64299
64299
  flex-wrap: wrap;
64300
64300
  gap: 12px;
64301
64301
  }
64302
- .cn-store-publish__row[data-v-3b9daec5] > * {
64302
+ .cn-store-publish__row[data-v-daaf434a] > * {
64303
64303
  flex: 1 1 160px;
64304
64304
  }
64305
64305
 
64306
64306
 
64307
- .cn-store-page[data-v-4a663d17] {
64307
+ .cn-store-page[data-v-45414193] {
64308
64308
  padding: 16px;
64309
64309
  max-width: 1200px;
64310
64310
  }
@@ -64312,10 +64312,10 @@ tbody tr[data-v-74e66abe]:last-child > * {
64312
64312
  /* Clear the Nextcloud navigation toggle button (44px wide, absolutely
64313
64313
  positioned at the left edge of .app-content) plus 12px breathing room, as
64314
64314
  CnPageHeader does. Only the header shifts; the body keeps the full width. */
64315
- .cn-store-page__header[data-v-4a663d17] {
64315
+ .cn-store-page__header[data-v-45414193] {
64316
64316
  padding-inline-start: 56px;
64317
64317
  }
64318
- .cn-store-page__heading[data-v-4a663d17] {
64318
+ .cn-store-page__heading[data-v-45414193] {
64319
64319
  display: flex;
64320
64320
  flex-wrap: wrap;
64321
64321
  align-items: center;
@@ -64323,29 +64323,29 @@ tbody tr[data-v-74e66abe]:last-child > * {
64323
64323
  gap: 12px;
64324
64324
  margin: 0 0 4px;
64325
64325
  }
64326
- .cn-store-page__title[data-v-4a663d17] {
64326
+ .cn-store-page__title[data-v-45414193] {
64327
64327
  margin: 0;
64328
64328
  }
64329
- .cn-store-page__intro[data-v-4a663d17] {
64329
+ .cn-store-page__intro[data-v-45414193] {
64330
64330
  color: var(--color-text-maxcontrast);
64331
64331
  margin: 0 0 16px;
64332
64332
  }
64333
- .cn-store-page__controls[data-v-4a663d17] {
64333
+ .cn-store-page__controls[data-v-45414193] {
64334
64334
  display: flex;
64335
64335
  flex-wrap: wrap;
64336
64336
  gap: 12px;
64337
64337
  align-items: flex-end;
64338
64338
  margin-bottom: 16px;
64339
64339
  }
64340
- .cn-store-page__kinds[data-v-4a663d17] {
64340
+ .cn-store-page__kinds[data-v-45414193] {
64341
64341
  display: flex;
64342
64342
  flex-wrap: wrap;
64343
64343
  gap: 8px;
64344
64344
  }
64345
- .cn-store-page__loading[data-v-4a663d17] {
64345
+ .cn-store-page__loading[data-v-45414193] {
64346
64346
  margin: 32px auto;
64347
64347
  }
64348
- .cn-store-page__grid[data-v-4a663d17] {
64348
+ .cn-store-page__grid[data-v-45414193] {
64349
64349
  display: grid;
64350
64350
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
64351
64351
  gap: 16px;
@@ -64353,7 +64353,7 @@ tbody tr[data-v-74e66abe]:last-child > * {
64353
64353
  padding: 0;
64354
64354
  margin: 16px 0 0;
64355
64355
  }
64356
- .cn-store-page__card[data-v-4a663d17] {
64356
+ .cn-store-page__card[data-v-45414193] {
64357
64357
  border: 1px solid var(--color-border);
64358
64358
  border-radius: var(--border-radius-large);
64359
64359
  background-color: var(--color-main-background);
@@ -64362,38 +64362,38 @@ tbody tr[data-v-74e66abe]:last-child > * {
64362
64362
  flex-direction: column;
64363
64363
  gap: 8px;
64364
64364
  }
64365
- .cn-store-page__card-title[data-v-4a663d17] {
64365
+ .cn-store-page__card-title[data-v-45414193] {
64366
64366
  margin: 0;
64367
64367
  font-size: 1rem;
64368
64368
  }
64369
- .cn-store-page__card-kind[data-v-4a663d17] {
64369
+ .cn-store-page__card-kind[data-v-45414193] {
64370
64370
  margin: 0;
64371
64371
  color: var(--color-text-maxcontrast);
64372
64372
  font-size: 0.85rem;
64373
64373
  }
64374
- .cn-store-page__card-description[data-v-4a663d17] {
64374
+ .cn-store-page__card-description[data-v-45414193] {
64375
64375
  margin: 0;
64376
64376
  flex: 1;
64377
64377
  }
64378
- .cn-store-page__card-footer[data-v-4a663d17] {
64378
+ .cn-store-page__card-footer[data-v-45414193] {
64379
64379
  display: flex;
64380
64380
  align-items: center;
64381
64381
  justify-content: space-between;
64382
64382
  gap: 8px;
64383
64383
  }
64384
- .cn-store-page__card-version[data-v-4a663d17] {
64384
+ .cn-store-page__card-version[data-v-45414193] {
64385
64385
  color: var(--color-text-maxcontrast);
64386
64386
  font-size: 0.85rem;
64387
64387
  }
64388
64388
 
64389
64389
  /* Who published a configuration set matters more than its version does, since
64390
64390
  installing one applies somebody else's schemas and flows to this instance. */
64391
- .cn-store-page__card-publisher[data-v-4a663d17] {
64391
+ .cn-store-page__card-publisher[data-v-45414193] {
64392
64392
  color: var(--color-text-maxcontrast);
64393
64393
  font-size: 0.85rem;
64394
64394
  margin-inline-end: auto;
64395
64395
  }
64396
- .cn-store-page__builtin-title[data-v-4a663d17] {
64396
+ .cn-store-page__builtin-title[data-v-45414193] {
64397
64397
  margin: 24px 0 0;
64398
64398
  }
64399
64399
 
@@ -0,0 +1,86 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ *
5
+ * parentCrumb: the breadcrumb entry for the record a sub-record belongs to.
6
+ *
7
+ * A crumb that carries `parent` names a `visibilityContext` entry of the
8
+ * detail page. The page reads that record beside the loaded one; this
9
+ * helper turns it into a crumb with the parent's label and a link to its
10
+ * page.
11
+ *
12
+ * @module utils/parentCrumb
13
+ */
14
+
15
+ /**
16
+ * Read a dotted path from an object.
17
+ *
18
+ * @param {object|null} obj The object to read.
19
+ * @param {string} path A dotted path, e.g. `identifier` or `@self.name`.
20
+ * @return {unknown} The value, or undefined.
21
+ */
22
+ function readPath(obj, path) {
23
+ return path.split('.').reduce((o, part) => (o === null || o === undefined ? undefined : o[part]), obj)
24
+ }
25
+
26
+ /**
27
+ * A non-empty string for a value, or ''.
28
+ *
29
+ * @param {unknown} value Any value.
30
+ * @return {string} The text.
31
+ */
32
+ function text(value) {
33
+ if (typeof value === 'number') {
34
+ return String(value)
35
+ }
36
+ return typeof value === 'string' ? value.trim() : ''
37
+ }
38
+
39
+ /**
40
+ * The crumb for a record's parent.
41
+ *
42
+ * The crumb is dropped (null) when the record holds no reference to a
43
+ * parent. Its label is the parent's `labelField` value, else the parent's
44
+ * name or title, else the crumb's own `label` (translated); without any of
45
+ * those it is dropped too. The link goes to `route` with the parent's id in
46
+ * `param` (default `id`), or to `href` with `{id}` filled in.
47
+ *
48
+ * @param {object} crumb `{ parent, labelField?, label?, route?, params?, param?, href?, icon? }`.
49
+ * @param {Array<{key: string, id: string}>} refs The page's context references.
50
+ * @param {object} rows The context records read so far, by name.
51
+ * @param {(key: string) => string} translate The host translate function.
52
+ * @return {{label: string, to?: object, href?: string, icon?: string}|null} The crumb, or null.
53
+ * @spec openspec/changes/detail-parent-crumb/specs/detail-page/spec.md#requirement-a-sub-record-trail-can-show-its-parent-record
54
+ */
55
+ function parentCrumb(crumb, refs, rows, translate) {
56
+ const ref = (refs || []).find((r) => r.key === crumb.parent);
57
+ if (!ref || !ref.id) {
58
+ return null
59
+ }
60
+ const row = rows && rows[crumb.parent] && typeof rows[crumb.parent] === 'object' ? rows[crumb.parent] : null;
61
+ let label = '';
62
+ if (row) {
63
+ label = (typeof crumb.labelField === 'string' && crumb.labelField !== '' ? text(readPath(row, crumb.labelField)) : '')
64
+ || text(readPath(row, '@self.name')) || text(row.name) || text(row.title);
65
+ }
66
+ if (label === '' && typeof crumb.label === 'string' && crumb.label !== '') {
67
+ label = translate(crumb.label);
68
+ }
69
+ if (label === '') {
70
+ return null
71
+ }
72
+ const entry = { label };
73
+ if (typeof crumb.icon === 'string' && crumb.icon !== '') {
74
+ entry.icon = crumb.icon;
75
+ }
76
+ if (crumb.route) {
77
+ const param = typeof crumb.param === 'string' && crumb.param !== '' ? crumb.param : 'id';
78
+ entry.to = { name: crumb.route, params: { ...(crumb.params || {}), [param]: ref.id } };
79
+ } else if (typeof crumb.href === 'string' && crumb.href !== '') {
80
+ entry.href = crumb.href.split('{id}').join(encodeURIComponent(ref.id));
81
+ }
82
+ return entry
83
+ }
84
+
85
+ export { parentCrumb };
86
+ //# sourceMappingURL=parentCrumb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parentCrumb.js","sources":["../../../src/utils/parentCrumb.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * parentCrumb: the breadcrumb entry for the record a sub-record belongs to.\n *\n * A crumb that carries `parent` names a `visibilityContext` entry of the\n * detail page. The page reads that record beside the loaded one; this\n * helper turns it into a crumb with the parent's label and a link to its\n * page.\n *\n * @module utils/parentCrumb\n */\n\n/**\n * Read a dotted path from an object.\n *\n * @param {object|null} obj The object to read.\n * @param {string} path A dotted path, e.g. `identifier` or `@self.name`.\n * @return {unknown} The value, or undefined.\n */\nfunction readPath(obj, path) {\n\treturn path.split('.').reduce((o, part) => (o === null || o === undefined ? undefined : o[part]), obj)\n}\n\n/**\n * A non-empty string for a value, or ''.\n *\n * @param {unknown} value Any value.\n * @return {string} The text.\n */\nfunction text(value) {\n\tif (typeof value === 'number') {\n\t\treturn String(value)\n\t}\n\treturn typeof value === 'string' ? value.trim() : ''\n}\n\n/**\n * The crumb for a record's parent.\n *\n * The crumb is dropped (null) when the record holds no reference to a\n * parent. Its label is the parent's `labelField` value, else the parent's\n * name or title, else the crumb's own `label` (translated); without any of\n * those it is dropped too. The link goes to `route` with the parent's id in\n * `param` (default `id`), or to `href` with `{id}` filled in.\n *\n * @param {object} crumb `{ parent, labelField?, label?, route?, params?, param?, href?, icon? }`.\n * @param {Array<{key: string, id: string}>} refs The page's context references.\n * @param {object} rows The context records read so far, by name.\n * @param {(key: string) => string} translate The host translate function.\n * @return {{label: string, to?: object, href?: string, icon?: string}|null} The crumb, or null.\n * @spec openspec/changes/detail-parent-crumb/specs/detail-page/spec.md#requirement-a-sub-record-trail-can-show-its-parent-record\n */\nexport function parentCrumb(crumb, refs, rows, translate) {\n\tconst ref = (refs || []).find((r) => r.key === crumb.parent)\n\tif (!ref || !ref.id) {\n\t\treturn null\n\t}\n\tconst row = rows && rows[crumb.parent] && typeof rows[crumb.parent] === 'object' ? rows[crumb.parent] : null\n\tlet label = ''\n\tif (row) {\n\t\tlabel = (typeof crumb.labelField === 'string' && crumb.labelField !== '' ? text(readPath(row, crumb.labelField)) : '')\n\t\t\t|| text(readPath(row, '@self.name')) || text(row.name) || text(row.title)\n\t}\n\tif (label === '' && typeof crumb.label === 'string' && crumb.label !== '') {\n\t\tlabel = translate(crumb.label)\n\t}\n\tif (label === '') {\n\t\treturn null\n\t}\n\tconst entry = { label }\n\tif (typeof crumb.icon === 'string' && crumb.icon !== '') {\n\t\tentry.icon = crumb.icon\n\t}\n\tif (crumb.route) {\n\t\tconst param = typeof crumb.param === 'string' && crumb.param !== '' ? crumb.param : 'id'\n\t\tentry.to = { name: crumb.route, params: { ...(crumb.params || {}), [param]: ref.id } }\n\t} else if (typeof crumb.href === 'string' && crumb.href !== '') {\n\t\tentry.href = crumb.href.split('{id}').join(encodeURIComponent(ref.id))\n\t}\n\treturn entry\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE;AAC7B,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,SAAS,GAAG,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC;AACvG,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI,CAAC,KAAK,EAAE;AACrB,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAChC,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,EAAE;AACF,CAAC,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE;AACrD,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;AAC1D,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAA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