@sitecore-feaas/clientside 0.3.11-alpha.2 → 0.3.13

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.
@@ -4,7 +4,13 @@ import { FEAASElement, WebComponent } from '../components/FEAASElement.js'
4
4
  import { ReactJSX, ReactModules } from '../components/FEAASReactElement.js'
5
5
  import { kebabCase, reverseKebabCase } from '../utils/string.js'
6
6
  import { Component, FEAASComponentProps } from './react.js'
7
- import type { ExternalComponent, ExternalComponentOptions, JSONSchema, UISchema } from '@sitecore-feaas/sdk'
7
+ import type {
8
+ ExternalComponent,
9
+ ExternalComponentOptions,
10
+ JSONSchema,
11
+ ObjectSchema,
12
+ UISchema
13
+ } from '@sitecore-feaas/sdk'
8
14
 
9
15
  /** Checks if title exists in a property and if not, it generates it from (kebab-cased) property key */
10
16
  const addTitles = (properties: { [key: string]: any }) =>
@@ -203,7 +209,7 @@ export default class FEAASExternal extends FEAASElement<FEAASExternalProps, Reac
203
209
  )
204
210
  const id = options.name
205
211
  const { thumbnail, group, ui: uiSchema, ...schemaOptions } = options
206
- const schema = { ...schemaOptions, type: 'object' } as JSONSchema
212
+ const schema = { ...schemaOptions, type: 'object' } as ObjectSchema
207
213
  FEAASExternal.registered[id] = {
208
214
  component,
209
215
  name: id,
@@ -48,6 +48,8 @@ export class FEAASPicker extends FEAASElement<FEAASPickerProps, typeof FEAASPick
48
48
  const datasources = useSDK('datasources')
49
49
  const rules = useLibrary('stylesheet.styles')
50
50
  const component = components.find((c) => c.id == context?.getAttribute('component'))
51
+ const componentName = context?.getAttribute('data-external-id')
52
+ const externalComponent = useSDK('externalComponents').find((c) => c.name == componentName)
51
53
  var settings = context?.getAttribute('data')
52
54
  if (settings) {
53
55
  try {
@@ -62,15 +64,18 @@ export class FEAASPicker extends FEAASElement<FEAASPickerProps, typeof FEAASPick
62
64
  themeContext={context}
63
65
  placeholder={placeholder}
64
66
  component={component}
67
+ externalComponent={externalComponent}
65
68
  datasource={datasource}
66
69
  data={settings}
67
70
  versionId={context?.getAttribute('version')}
68
- mode={mode || (component ? 'component' : null)}
71
+ mode={mode || (component ? 'component' : componentName ? 'external' : null)}
69
72
  setAttribute={(context, attribute, value) => {
70
73
  if (attribute == 'data' && value) value = JSON.stringify(value)
71
74
  this.props.setAttribute(context, attribute, value)
72
75
  forceRender()
73
76
  }}
77
+ getAttribute={(c, property) => context?.getAttribute(property)}
78
+ dialog={dialog}
74
79
  context={context}
75
80
  variant={variant}
76
81
  onModeChange={(mode, dialog) => {