/** * Copyright (c) 2026-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { CheckSquareIcon, clsx, Dialog, EmptySquareIcon, MinusSquareIcon, Modal, ModalBody, ModalFooter, ModalFooterButton, ModalFooterStatus, ModalHeader, ModalTitle, PanelLoadingIndicator, SparkleIcon, } from '@finos/legend-art'; import { useApplicationStore } from '@finos/legend-application'; import { observer } from 'mobx-react-lite'; import { useState } from 'react'; import { isDataSpaceAISuggestionRowSelectedByDefault, type DataSpaceAISuggestionRow, } from '../../stores/DataSpaceAISuggestion.js'; export type DataSpaceAISuggestionSelection = { row: DataSpaceAISuggestionRow; value: string; }[]; type CheckboxState = 'all' | 'some' | 'none'; const getCheckboxState = ( selectedCount: number, totalCount: number, ): CheckboxState => totalCount > 0 && selectedCount === totalCount ? 'all' : selectedCount ? 'some' : 'none'; const DataSpaceAISuggestionCheckbox = observer( (props: { state: CheckboxState; onToggle: () => void; title: string }) => { const { state, onToggle, title } = props; return ( ); }, ); const DataSpaceAISuggestionRowEditor = observer( (props: { row: DataSpaceAISuggestionRow; value: string; isSelected: boolean; setSelected: (selected: boolean) => void; setValue: (value: string) => void; }) => { const { row, value, isSelected, setSelected, setValue } = props; const hasCurrentValue = Boolean(row.currentValue?.trim()); return (
setSelected(!isSelected)} title={ isSelected ? 'Keep the current value' : 'Use the suggested value' } /> {row.fieldLabel}
Current
{hasCurrentValue ? row.currentValue : '(empty)'}
Suggested