@ditojs/admin 2.2.16 → 2.3.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.
@@ -416,13 +416,19 @@ export function getViewSchema(schema, context) {
416
416
  : null
417
417
  }
418
418
 
419
- export function getViewEditPath(schema, context) {
419
+ export function hasViewSchema(schema, context) {
420
+ return !!getViewSchema(schema, context)
421
+ }
422
+
423
+ export function getViewEditPath(schema, id, context) {
420
424
  const view = getViewSchema(schema, context)
421
- return view
422
- ? isSingleComponentView(view)
425
+ if (view) {
426
+ const path = isSingleComponentView(view)
423
427
  ? `/${view.path}`
424
428
  : `/${view.path}/${view.path}`
425
- : null
429
+ return `${path}/${id}`
430
+ }
431
+ return null
426
432
  }
427
433
 
428
434
  export function getFormSchemas(schema, context, modifyForm) {
@@ -595,7 +601,7 @@ export function computeValue(schema, data, name, dataPath, {
595
601
  const { compute } = schema
596
602
  if (compute) {
597
603
  const value = compute(
598
- DitoContext.get(component, {
604
+ new DitoContext(component, {
599
605
  schema,
600
606
  // Override value to prevent endless recursion through calling the
601
607
  // getter for `this.value` in `DitoContext`:
@@ -691,7 +697,7 @@ export function processData(schema, sourceSchema, data, dataPath, {
691
697
 
692
698
  // NOTE: We don't cache this context, since `value` is changing.
693
699
  const getContext = () =>
694
- DitoContext.get(component, {
700
+ new DitoContext(component, {
695
701
  schema,
696
702
  value,
697
703
  name,
@@ -782,7 +788,7 @@ export function processSchemaData(
782
788
  index !== null
783
789
  ? getDataPath(componentDataPath, index)
784
790
  : componentDataPath
785
- const context = DitoContext.get(options.component, {
791
+ const context = new DitoContext(options.component, {
786
792
  schema: componentSchema,
787
793
  data,
788
794
  value: item,