Skip to content

Commit

Permalink
feat: Update Composer logic to leverage the uiSchema when initializin…
Browse files Browse the repository at this point in the history
…g the IntellisenseField. (#4263)

* using only ui schema for mappings

* lint

Co-authored-by: Geoff Cox (Microsoft) <gcox@microsoft.com>
  • Loading branch information
LouisEugeneMSFT and GeoffCoxMSFT authored Sep 29, 2020
1 parent 9852341 commit 1b2b274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions Composer/packages/adaptive-form/src/components/FormRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ export const getRowProps = (rowProps: FormRowProps, field: string) => {
const { required = [] } = schema;
const fieldSchema = resolvePropSchema(schema, field, definitions);

const intellisenseScopes: string[] = [];
if (field === 'property') {
intellisenseScopes.push('variable-scopes');
}

const newUiOptions = (uiOptions.properties?.[field] as UIOptions) ?? {};
newUiOptions.intellisenseScopes = intellisenseScopes;

return {
id: `${id}.${field}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { FieldProps } from '@bfc/extension-client';
import { FieldProps, useShellApi } from '@bfc/extension-client';
import { IntellisenseTextField } from '@bfc/intellisense';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import React from 'react';
Expand All @@ -12,12 +12,15 @@ import { FieldLabel } from '../FieldLabel';
export const IntellisenseField: React.FC<FieldProps<string>> = function IntellisenseField(props) {
const { id, value = '', onChange, label, description, uiOptions, required } = props;

const { projectId } = useShellApi();

return (
<>
<FieldLabel description={description} helpLink={uiOptions?.helpLink} id={id} label={label} required={required} />

<IntellisenseTextField
id={`intellisense-${id}`}
projectId={projectId}
scopes={uiOptions.intellisenseScopes || []}
url={getIntellisenseUrl()}
value={value}
Expand Down

0 comments on commit 1b2b274

Please sign in to comment.