@lax-wp/design-system 0.13.37 → 0.13.39-beta.0
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.
- package/dist/components/data-display/infinite-table/body/cell/InlineEditField.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/InlineEditField.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/InlineEditField.es.js +40 -39
- package/dist/components/data-display/infinite-table/body/cell/InlineEditField.es.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.cjs.js.map +1 -1
- package/dist/components/forms/master-data-input/MasterDataInputField.d.ts +3 -0
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js +35 -33
- package/dist/components/forms/master-data-input/MasterDataInputField.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineEditField.es.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/InlineEditField.tsx"],"sourcesContent":["import type { ICell, ValidateAndSaveResult } from '../../types';\nimport { validateCellValue } from '../../validateCell';\nimport { REGEX } from '../../../../../constants/table';\nimport { DateTimeField } from '../../../../forms/date-time-field/DateTimeField';\nimport { SelectField } from '../../../../forms/select-field/SelectField';\nimport { Toggle } from '../../../../forms/toggle/Toggle';\nimport { BoltOutlined } from '@mui/icons-material';\nimport cn from 'classnames';\nimport React, { useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { TableContext } from '../../context';\nimport { InlineCurrencyField } from './InlineCurrencyField';\nimport { MasterDataInlineField } from './MasterDataInlineField';\nimport { LoadingSpinnerIcon } from '../../../../icon';\n\ntype InlineEditFieldProps = {\n cell: ICell;\n id: string | number;\n inlineEditing: string | null;\n cellRef: React.RefObject<HTMLDivElement>;\n handleCellValueChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n handleUpdateCellData: (\n directValue?: string | boolean | null,\n meta?: { currency_code?: string | null; reference?: unknown | null; [key: string]: unknown | null } | null,\n ) => void;\n registerValidation?: (validateFn: () => ValidateAndSaveResult) => void;\n};\n\ntype TSelectedOption = { label: string; value: string };\ntype TSelectedOptions = TSelectedOption | TSelectedOption[] | null;\n\nconst _cursorPositionCache = new Map<string, { start: number; end: number }>();\nlet _blurringCellKey: string | null = null;\nlet _pendingFieldOpCellKey: string | null = null;\n\nconst createSyntheticChangeEvent = (value: string | number | boolean | null): React.ChangeEvent<HTMLInputElement> => {\n return {\n target: { value } as HTMLInputElement,\n } as React.ChangeEvent<HTMLInputElement>;\n};\n\nexport const InlineEditField: React.FC<InlineEditFieldProps> = ({ cell, id, inlineEditing, cellRef, handleCellValueChange, registerValidation }) => {\n const {\n openMasterDataModal,\n selectedMasterData,\n clearSelectedMasterData,\n getCurrencyForCell,\n getPendingEdit,\n addPendingEdit,\n onFieldOperationFlow,\n fieldOperationLoading,\n } = useContext(TableContext);\n\n const isFieldOperationLoading = fieldOperationLoading === `${id}-${cell?.column?.id}`;\n const isAnyFieldOperationLoading = Boolean(fieldOperationLoading);\n\n const callLiveFieldOperation = useCallback(\n (value: unknown, meta?: { reference?: unknown; currency_code?: string }) => {\n if (!onFieldOperationFlow) return;\n\n onFieldOperationFlow({\n value,\n fieldId: cell?.column?.id as string,\n rowId: String(id),\n rowData: cell?.row?.original as Record<string, unknown>,\n columnKey: (cell?.column?.key as string) || '',\n flowName: cell?.column?.live_field_source as string | undefined,\n isLiveField: cell?.column?.is_live_field as boolean | undefined,\n meta,\n });\n },\n [\n cell?.column?.id,\n cell?.column?.is_live_field,\n cell?.column?.key,\n cell?.column?.live_field_source,\n cell?.row?.original,\n id,\n onFieldOperationFlow,\n ],\n );\n\n const getCurrencyFromCell = () => {\n const rawData = cell?.row?.original?.__rawData as Record<string, Record<string, unknown>> | undefined;\n const headerKey = cell?.column?.Header as string | undefined;\n const columnKey = cell?.column?.key as string | undefined;\n\n const dataFromHeader = headerKey ? rawData?.[headerKey]?.currency_code : undefined;\n const dataFromKey = columnKey ? rawData?.[columnKey]?.currency_code : undefined;\n\n if (dataFromHeader && dataFromHeader !== '') {\n return dataFromHeader as string;\n }\n if (dataFromKey && dataFromKey !== '') {\n return dataFromKey as string;\n }\n\n return (cell?.column?.currencyCode as string) || 'USD';\n };\n\n const columnKey = (cell.column.key as string) || '';\n const currencyCellId = `${id}-${columnKey}`;\n const contextCurrency = getCurrencyForCell?.(currencyCellId);\n const initialPendingEdit = getPendingEdit?.(String(id), columnKey);\n\n const [fieldState, setFieldState] = useState<{ value: string | number | boolean | null; currencyCode: string }>({\n value: initialPendingEdit?.value !== undefined ? (initialPendingEdit.value as string | number | boolean | null) : ((cell.value as string | number | boolean | null) || ''),\n currencyCode: (initialPendingEdit?.meta?.currency_code as string) || contextCurrency || getCurrencyFromCell(),\n });\n const [validationError, setValidationError] = useState<string | null>(null);\n\n const computedValidationError = (() => {\n if (inlineEditing !== columnKey) return null;\n const valueToValidate = typeof fieldState.value === 'number' ? String(fieldState.value) : fieldState.value;\n const result = validateCellValue(valueToValidate, cell?.column as { type?: string; is_required?: boolean });\n return result.isValid ? null : result.error || null;\n })();\n\n const pendingError = getPendingEdit?.(String(id), columnKey)?.validationError;\n const displayValidationError = validationError || computedValidationError || pendingError || null;\n\n const previousInlineEditingRef = useRef<string | null>(null);\n\n useEffect(() => {\n const isEnteringEditMode = inlineEditing === columnKey && previousInlineEditingRef.current !== columnKey;\n\n if (isEnteringEditMode) {\n const currencyFromContext = getCurrencyForCell?.(`${id}-${columnKey}`);\n const pendingEdit = getPendingEdit?.(String(id), columnKey);\n const initialValue = pendingEdit?.value !== undefined ? pendingEdit.value : ((cell.value as string | boolean | null) || '');\n const initialCurrency = (pendingEdit?.meta?.currency_code as string) || currencyFromContext || getCurrencyFromCell();\n\n setFieldState({\n value: initialValue as string | number | boolean | null,\n currencyCode: initialCurrency,\n });\n }\n\n if (inlineEditing !== columnKey && previousInlineEditingRef.current === columnKey) {\n setValidationError(null);\n }\n\n previousInlineEditingRef.current = inlineEditing;\n }, [inlineEditing, columnKey, getCurrencyForCell, getPendingEdit, id, cell.value]);\n\n useEffect(() => {\n if (selectedMasterData && inlineEditing === columnKey && cell?.column?.masterDataColumnName && cell?.column?.masterDataName) {\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: selectedMasterData.value as string | boolean | null,\n meta: { reference: selectedMasterData.reference },\n originalValue: cell.value,\n });\n }\n handleCellValueChange(createSyntheticChangeEvent(selectedMasterData.value as string | number | boolean | null));\n callLiveFieldOperation(selectedMasterData.value, { reference: selectedMasterData.reference });\n clearSelectedMasterData?.();\n }\n }, [\n selectedMasterData,\n inlineEditing,\n columnKey,\n cell?.column?.masterDataColumnName,\n cell?.column?.masterDataName,\n addPendingEdit,\n id,\n cell.value,\n handleCellValueChange,\n callLiveFieldOperation,\n clearSelectedMasterData,\n ]);\n\n const validateRequiredField = (value: string | number | boolean | null): boolean => {\n if (cell?.column?.is_required) {\n const isEmpty = value === null || value === undefined || value === '' || (typeof value === 'string' && value.trim() === '');\n if (isEmpty) {\n setValidationError('Field required');\n return false;\n }\n }\n setValidationError(null);\n return true;\n };\n\n const validateUrlField = (value: string): boolean => {\n if (!validateRequiredField(value)) {\n return false;\n }\n if (value && value.trim() !== '' && !REGEX.url.test(value)) {\n setValidationError('Invalid URL format');\n return false;\n }\n setValidationError(null);\n return true;\n };\n\n const validateEmailField = (value: string): boolean => {\n if (!validateRequiredField(value)) {\n return false;\n }\n if (value && value.trim() !== '' && !REGEX.email.test(value)) {\n setValidationError('Email is not valid');\n return false;\n }\n setValidationError(null);\n return true;\n };\n\n const fieldStateRef = useRef(fieldState);\n useEffect(() => {\n fieldStateRef.current = fieldState;\n }, [fieldState]);\n\n const textInputRef = useRef<HTMLInputElement>(null);\n const cellEditKey = `${id}-${columnKey}`;\n\n useLayoutEffect(() => {\n const el = textInputRef.current;\n if (!el) return;\n const cached = _cursorPositionCache.get(cellEditKey);\n if (cached) {\n el.focus();\n try {\n el.setSelectionRange(cached.start, cached.end);\n } catch {\n // email/number inputs may not support setSelectionRange\n }\n } else if (_blurringCellKey !== cellEditKey) {\n el.focus();\n }\n }, [cellEditKey]);\n\n const debouncedSyncTimerRef = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n return () => {\n if (debouncedSyncTimerRef.current) clearTimeout(debouncedSyncTimerRef.current);\n };\n }, []);\n\n const syncToParent = useCallback(\n (value: string) => {\n handleCellValueChange(createSyntheticChangeEvent(value));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value,\n originalValue: cell.value,\n });\n }\n },\n [handleCellValueChange, addPendingEdit, id, columnKey, cell.value],\n );\n\n const debouncedSyncToParent = useCallback(\n (value: string) => {\n if (debouncedSyncTimerRef.current) clearTimeout(debouncedSyncTimerRef.current);\n debouncedSyncTimerRef.current = setTimeout(() => {\n syncToParent(value);\n }, 300);\n },\n [syncToParent],\n );\n\n const flushSyncToParent = useCallback(() => {\n if (debouncedSyncTimerRef.current) {\n clearTimeout(debouncedSyncTimerRef.current);\n debouncedSyncTimerRef.current = undefined;\n syncToParent(String(fieldStateRef.current.value ?? ''));\n }\n }, [syncToParent]);\n\n const handleBlurValidation = useCallback(() => {\n const columnType = (cell?.column?.type as string | undefined)?.toLowerCase();\n const currentValue = fieldStateRef.current.value;\n\n switch (columnType) {\n case 'url':\n validateUrlField(String(currentValue ?? ''));\n break;\n case 'e-mail':\n validateEmailField(String(currentValue ?? ''));\n break;\n default:\n validateRequiredField(currentValue);\n break;\n }\n }, [cell?.column?.type]);\n\n const validateAndGetValue = useCallback((): ValidateAndSaveResult => {\n const columnType = (cell?.column?.type as string | undefined)?.toLowerCase();\n const currentValue = fieldStateRef.current.value;\n const currentCurrency = fieldStateRef.current.currencyCode;\n\n let isValid = true;\n\n switch (columnType) {\n case 'url':\n isValid = validateUrlField(String(currentValue ?? ''));\n break;\n case 'e-mail':\n isValid = validateEmailField(String(currentValue ?? ''));\n break;\n default:\n isValid = validateRequiredField(currentValue);\n break;\n }\n\n if (!isValid) {\n return { isValid: false };\n }\n\n let meta: ValidateAndSaveResult['meta'] = null;\n if (columnType === 'currency') {\n const latestCurrency = getCurrencyForCell?.(currencyCellId) || currentCurrency;\n meta = { currency_code: latestCurrency };\n }\n\n return {\n isValid: true,\n value: (typeof currentValue === 'number' ? String(currentValue) : currentValue) as string | boolean | null,\n meta,\n };\n }, [cell?.column?.type, currencyCellId, getCurrencyForCell]);\n\n useEffect(() => {\n if (registerValidation && inlineEditing === columnKey) {\n registerValidation(validateAndGetValue);\n }\n }, [registerValidation, validateAndGetValue, inlineEditing, columnKey]);\n\n const renderFieldByType = () => {\n if (cell?.column?.is_master_data && cell?.column?.masterDataName && (cell?.column?.masterDataColumnName || cell?.column?.masterDataFormula)) {\n const currentPendingEdit = getPendingEdit?.(String(id), columnKey);\n const masterDataValue = selectedMasterData?.value ?? currentPendingEdit?.value ?? cell.value;\n\n return (\n <div onMouseDown={(e) => e.stopPropagation()} className='z-[120] h-full w-full'>\n <MasterDataInlineField\n id={`master-data-cell-${id}-${cell.column.id}`}\n value={masterDataValue as string | number | null}\n onChange={(value, reference) => {\n handleCellValueChange(createSyntheticChangeEvent(value));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: value as string | boolean | null,\n meta: { reference: reference || null },\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(value, { reference: reference || undefined });\n validateRequiredField((value as string | boolean | null) ?? '');\n }}\n placeholder={cell.column?.Header as string | undefined}\n masterDataName={cell.column.masterDataName as string}\n masterDataColumnName={cell.column.masterDataColumnName as string}\n masterDataFormula={cell.column.masterDataFormula as string | undefined}\n masterDataFilters={cell.column.masterDataFilters as Record<string, unknown> | undefined}\n onOpenMasterDataModal={openMasterDataModal as never}\n reference={currentPendingEdit?.meta?.reference as Record<string, unknown> | undefined}\n />\n </div>\n );\n }\n\n const columnType = (cell?.column?.type as string | undefined)?.toLowerCase();\n const rowCellMeta = columnKey\n ? (cell?.row?.original?.__cellMetadata as Record<string, { choices?: string[] }> | undefined)?.[columnKey]\n : undefined;\n\n switch (columnType) {\n case 'choice': {\n const choices = rowCellMeta?.choices ?? (cell?.column?.choices as string[] | undefined);\n return (\n <div onMouseDown={(e) => e.stopPropagation()}>\n <SelectField\n id={`select-cell-${id}-${cell.column.id}`}\n value={fieldState.value || null}\n selectOptions={\n choices?.map((choice: string) => ({\n label: choice,\n value: choice,\n })) || []\n }\n onChange={(selectedOptions: TSelectedOptions) => {\n const value = selectedOptions\n ? Array.isArray(selectedOptions)\n ? selectedOptions[0]?.value?.toString() || ''\n : selectedOptions?.value?.toString() || ''\n : '';\n setFieldState((prev) => ({ ...prev, value }));\n handleCellValueChange(createSyntheticChangeEvent(value));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value,\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(value);\n validateRequiredField(value);\n }}\n allowClear={true}\n inputStyles={{\n height: 'var(--row-height)',\n border: 'none',\n boxShadow: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n }}\n className='z-[120]'\n />\n </div>\n );\n }\n\n case 'datetime':\n case 'date':\n return (\n <div\n onMouseDown={(e) => {\n e.stopPropagation();\n if ((e.target as HTMLElement).tagName !== 'INPUT') {\n e.preventDefault();\n }\n }}\n >\n <DateTimeField\n id={`date-cell-${id}-${cell.column.id}`}\n value={(fieldState.value as string | undefined) || undefined}\n handleOnChange={(value) => {\n const newValue = value || '';\n setFieldState((prev) => ({ ...prev, value: newValue }));\n handleCellValueChange(createSyntheticChangeEvent(newValue));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: newValue,\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(newValue);\n validateRequiredField(newValue);\n }}\n showTime={columnType === 'datetime'}\n dateFormat={columnType === 'date' ? 'MM/DD/YYYY' : undefined}\n className='z-[120] w-full'\n />\n </div>\n );\n\n case 'currency': {\n const originalCurrencyCode = getCurrencyFromCell();\n return (\n <div onMouseDown={(e) => e.stopPropagation()} className='z-[120] h-full w-full'>\n <InlineCurrencyField\n id={currencyCellId}\n value={String(fieldState.value ?? '')}\n onChange={(numericValue, currency_code) => {\n setFieldState((prev) => ({\n value: numericValue,\n currencyCode: currency_code || prev.currencyCode,\n }));\n handleCellValueChange(createSyntheticChangeEvent(numericValue));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: numericValue,\n meta: { currency_code },\n originalValue: cell.value,\n originalMeta: { currency_code: originalCurrencyCode },\n });\n }\n validateRequiredField(numericValue);\n callLiveFieldOperation(numericValue, { currency_code });\n }}\n currencyCode={fieldState.currencyCode}\n inputStyle={{\n height: 'var(--row-height)',\n border: 'none',\n boxShadow: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n }}\n autoFocus\n disabled={isAnyFieldOperationLoading}\n />\n </div>\n );\n }\n\n case 'percentage':\n return (\n <label className='relative block h-full' onMouseDown={(e) => e.stopPropagation()}>\n <input\n ref={textInputRef}\n type='number'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n try {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n } catch {\n // number inputs may not support selection\n }\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n validateRequiredField(value);\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n className='border border-gray-300 h-full text-gray-900 dark:bg-black-800 dark:text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-white dark:focus:border-white block w-full px-2.5 py-1.5 font-inter font-medium disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400'\n id={`percentage-cell-${id}-${cell.column.id}`}\n style={{\n height: 'var(--row-height)',\n border: 'none',\n boxShadow: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n }}\n autoComplete='off'\n disabled={isAnyFieldOperationLoading}\n />\n <span className='absolute inset-y-0 right-3 flex items-center pointer-events-none h-full dark:text-black-100'>%</span>\n </label>\n );\n\n case 'boolean': {\n const currentBoolValue =\n fieldState.value === true ||\n fieldState.value === 'true' ||\n fieldState.value === 'Yes' ||\n fieldState.value === 'True' ||\n fieldState.value === 1;\n\n return (\n <div\n onMouseDown={(e) => e.stopPropagation()}\n className='h-full w-full flex items-center px-2.5 bg-white dark:bg-black-800 rounded border-2 focus:outline-primary-600 border border-primary-600 dark:border-black-700 z-[120]'\n >\n <Toggle\n id={`toggle-cell-${id}-${cell.column.id}`}\n isChecked={currentBoolValue}\n onChange={(checked) => {\n setFieldState((prev) => ({ ...prev, value: checked }));\n handleCellValueChange(createSyntheticChangeEvent(checked));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: checked,\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(checked);\n }}\n hideStatus={false}\n labelDirection='right'\n stopClickPropagation={true}\n statusText={currentBoolValue ? 'Yes' : 'No'}\n />\n </div>\n );\n }\n\n case 'url':\n return (\n <input\n ref={textInputRef}\n type='url'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n if (validationError) {\n validateUrlField(value);\n } else {\n validateRequiredField(value);\n }\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className='text-neutral-900 dark:text-white dark:bg-black-800 text-base font-medium h-full font-inter overflow-hidden whitespace-nowrap text-ellipsis px-2.5 py-1 w-full border rounded focus:outline-primary-600 dark:focus:outline-white z-[120] shadow-xl disabled:bg-neutral-50 dark:disabled:!bg-black-800'\n style={{\n height: 'var(--row-height)',\n }}\n disabled={isAnyFieldOperationLoading}\n />\n );\n\n case 'e-mail':\n return (\n <input\n ref={textInputRef}\n type='email'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n try {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n } catch {\n // email inputs may not support selection\n }\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n if (validationError) {\n validateEmailField(value);\n } else {\n validateRequiredField(value);\n }\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className='text-neutral-900 dark:text-white dark:bg-black-800 text-base font-medium h-full font-inter overflow-hidden whitespace-nowrap text-ellipsis px-2.5 py-1 w-full border rounded focus:outline-primary-600 dark:focus:outline-white z-[120] shadow-xl disabled:bg-neutral-50 dark:disabled:!bg-black-800'\n style={{\n height: 'var(--row-height)',\n }}\n disabled={isAnyFieldOperationLoading}\n />\n );\n\n default:\n return (\n <input\n ref={textInputRef}\n type='text'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n validateRequiredField(value);\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className='text-neutral-900 dark:text-white dark:bg-black-800 text-base font-medium h-full font-inter overflow-hidden whitespace-nowrap text-ellipsis px-2.5 py-1 w-full border rounded focus:outline-primary-600 dark:focus:outline-white z-[120] shadow-xl disabled:bg-neutral-50 dark:disabled:!bg-black-800'\n style={{\n height: 'var(--row-height)',\n }}\n disabled={isAnyFieldOperationLoading}\n />\n );\n }\n };\n\n return (\n <div ref={cellRef} className='relative h-full w-full overflow-visible'>\n <div\n className={cn(\n 'border p-0.5 rounded-lg h-full',\n displayValidationError ? 'border-error-600' : 'border-neutral-200 dark:border-black-700',\n isAnyFieldOperationLoading && 'pointer-events-none opacity-70',\n )}\n >\n {renderFieldByType()}\n </div>\n {Boolean(cell?.column?.is_live_field) && (\n <div className='absolute -top-1.5 -right-1.5 bg-white dark:bg-black-800 rounded-full w-5 h-5 flex items-center justify-center border border-primary-300 dark:border-primary-600 shadow-sm z-[125]'>\n {isFieldOperationLoading ? (\n <LoadingSpinnerIcon className='text-primary-600 dark:text-white' size={8} />\n ) : (\n <BoltOutlined\n sx={{\n fontSize: 12,\n color: 'var(--color-primary-600)',\n }}\n />\n )}\n </div>\n )}\n {displayValidationError && (\n <div className='absolute top-full left-0 mt-1 text-error-600 text-xs font-medium z-[130] bg-white dark:bg-black-800 px-2 py-1 rounded shadow-lg w-full'>\n {displayValidationError}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_cursorPositionCache","_blurringCellKey","_pendingFieldOpCellKey","createSyntheticChangeEvent","value","InlineEditField","cell","id","inlineEditing","cellRef","handleCellValueChange","registerValidation","openMasterDataModal","selectedMasterData","clearSelectedMasterData","getCurrencyForCell","getPendingEdit","addPendingEdit","onFieldOperationFlow","fieldOperationLoading","useContext","TableContext","isFieldOperationLoading","isAnyFieldOperationLoading","callLiveFieldOperation","useCallback","meta","getCurrencyFromCell","rawData","headerKey","columnKey","dataFromHeader","dataFromKey","currencyCellId","contextCurrency","initialPendingEdit","fieldState","setFieldState","useState","validationError","setValidationError","computedValidationError","valueToValidate","result","validateCellValue","pendingError","displayValidationError","previousInlineEditingRef","useRef","useEffect","currencyFromContext","pendingEdit","initialValue","initialCurrency","validateRequiredField","validateUrlField","REGEX","validateEmailField","fieldStateRef","textInputRef","cellEditKey","useLayoutEffect","el","cached","debouncedSyncTimerRef","syncToParent","debouncedSyncToParent","flushSyncToParent","handleBlurValidation","columnType","currentValue","validateAndGetValue","currentCurrency","isValid","renderFieldByType","currentPendingEdit","masterDataValue","jsx","e","MasterDataInlineField","reference","rowCellMeta","choices","SelectField","choice","selectedOptions","prev","DateTimeField","newValue","originalCurrencyCode","InlineCurrencyField","numericValue","currency_code","jsxs","currentBoolValue","Toggle","checked","cn","LoadingSpinnerIcon","BoltOut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AM,GAAG,IAE1E,gBAAArB;AAAA,MAACsB;AAAA,MAAA;AAAA,QACC,IAAI;AAAA,UACF,UAAU;AAAA,UACV,OAAO;AAAA,QAAA;AAAA,MACT;AAAA,IAAA,GAGN;AAAA,IAEDrD,KACC,gBAAA+B,EAAC,OAAA,EAAI,WAAU,0IACZ,UAAA/B,EAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"InlineEditField.es.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/InlineEditField.tsx"],"sourcesContent":["import type { ICell, ValidateAndSaveResult } from '../../types';\nimport { validateCellValue } from '../../validateCell';\nimport { REGEX } from '../../../../../constants/table';\nimport { DateTimeField } from '../../../../forms/date-time-field/DateTimeField';\nimport { SelectField } from '../../../../forms/select-field/SelectField';\nimport { Toggle } from '../../../../forms/toggle/Toggle';\nimport { BoltOutlined } from '@mui/icons-material';\nimport cn from 'classnames';\nimport React, { useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { TableContext } from '../../context';\nimport { InlineCurrencyField } from './InlineCurrencyField';\nimport { MasterDataInlineField } from './MasterDataInlineField';\nimport { LoadingSpinnerIcon } from '../../../../icon';\n\ntype InlineEditFieldProps = {\n cell: ICell;\n id: string | number;\n inlineEditing: string | null;\n cellRef: React.RefObject<HTMLDivElement>;\n handleCellValueChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n handleUpdateCellData: (\n directValue?: string | boolean | null,\n meta?: { currency_code?: string | null; reference?: unknown | null; [key: string]: unknown | null } | null,\n ) => void;\n registerValidation?: (validateFn: () => ValidateAndSaveResult) => void;\n};\n\ntype TSelectedOption = { label: string; value: string };\ntype TSelectedOptions = TSelectedOption | TSelectedOption[] | null;\n\nconst _cursorPositionCache = new Map<string, { start: number; end: number }>();\nlet _blurringCellKey: string | null = null;\nlet _pendingFieldOpCellKey: string | null = null;\n\nconst createSyntheticChangeEvent = (value: string | number | boolean | null): React.ChangeEvent<HTMLInputElement> => {\n return {\n target: { value } as HTMLInputElement,\n } as React.ChangeEvent<HTMLInputElement>;\n};\n\nexport const InlineEditField: React.FC<InlineEditFieldProps> = ({ cell, id, inlineEditing, cellRef, handleCellValueChange, registerValidation }) => {\n const {\n openMasterDataModal,\n selectedMasterData,\n clearSelectedMasterData,\n getCurrencyForCell,\n getPendingEdit,\n addPendingEdit,\n onFieldOperationFlow,\n fieldOperationLoading,\n } = useContext(TableContext);\n\n const isFieldOperationLoading = fieldOperationLoading === `${id}-${cell?.column?.id}`;\n const isAnyFieldOperationLoading = Boolean(fieldOperationLoading);\n\n const callLiveFieldOperation = useCallback(\n (value: unknown, meta?: { reference?: unknown; currency_code?: string }) => {\n if (!onFieldOperationFlow) return;\n\n onFieldOperationFlow({\n value,\n fieldId: cell?.column?.id as string,\n rowId: String(id),\n rowData: cell?.row?.original as Record<string, unknown>,\n columnKey: (cell?.column?.key as string) || '',\n flowName: cell?.column?.live_field_source as string | undefined,\n isLiveField: cell?.column?.is_live_field as boolean | undefined,\n meta,\n });\n },\n [\n cell?.column?.id,\n cell?.column?.is_live_field,\n cell?.column?.key,\n cell?.column?.live_field_source,\n cell?.row?.original,\n id,\n onFieldOperationFlow,\n ],\n );\n\n const getCurrencyFromCell = () => {\n const rawData = cell?.row?.original?.__rawData as Record<string, Record<string, unknown>> | undefined;\n const headerKey = cell?.column?.Header as string | undefined;\n const columnKey = cell?.column?.key as string | undefined;\n\n const dataFromHeader = headerKey ? rawData?.[headerKey]?.currency_code : undefined;\n const dataFromKey = columnKey ? rawData?.[columnKey]?.currency_code : undefined;\n\n if (dataFromHeader && dataFromHeader !== '') {\n return dataFromHeader as string;\n }\n if (dataFromKey && dataFromKey !== '') {\n return dataFromKey as string;\n }\n\n return (cell?.column?.currencyCode as string) || 'USD';\n };\n\n const columnKey = (cell.column.key as string) || '';\n const currencyCellId = `${id}-${columnKey}`;\n const contextCurrency = getCurrencyForCell?.(currencyCellId);\n const initialPendingEdit = getPendingEdit?.(String(id), columnKey);\n\n const [fieldState, setFieldState] = useState<{ value: string | number | boolean | null; currencyCode: string }>({\n value: initialPendingEdit?.value !== undefined ? (initialPendingEdit.value as string | number | boolean | null) : ((cell.value as string | number | boolean | null) || ''),\n currencyCode: (initialPendingEdit?.meta?.currency_code as string) || contextCurrency || getCurrencyFromCell(),\n });\n const [validationError, setValidationError] = useState<string | null>(null);\n\n const computedValidationError = (() => {\n if (inlineEditing !== columnKey) return null;\n const valueToValidate = typeof fieldState.value === 'number' ? String(fieldState.value) : fieldState.value;\n const result = validateCellValue(valueToValidate, cell?.column as { type?: string; is_required?: boolean });\n return result.isValid ? null : result.error || null;\n })();\n\n const pendingError = getPendingEdit?.(String(id), columnKey)?.validationError;\n const displayValidationError = validationError || computedValidationError || pendingError || null;\n\n const previousInlineEditingRef = useRef<string | null>(null);\n\n useEffect(() => {\n const isEnteringEditMode = inlineEditing === columnKey && previousInlineEditingRef.current !== columnKey;\n\n if (isEnteringEditMode) {\n const currencyFromContext = getCurrencyForCell?.(`${id}-${columnKey}`);\n const pendingEdit = getPendingEdit?.(String(id), columnKey);\n const initialValue = pendingEdit?.value !== undefined ? pendingEdit.value : ((cell.value as string | boolean | null) || '');\n const initialCurrency = (pendingEdit?.meta?.currency_code as string) || currencyFromContext || getCurrencyFromCell();\n\n setFieldState({\n value: initialValue as string | number | boolean | null,\n currencyCode: initialCurrency,\n });\n }\n\n if (inlineEditing !== columnKey && previousInlineEditingRef.current === columnKey) {\n setValidationError(null);\n }\n\n previousInlineEditingRef.current = inlineEditing;\n }, [inlineEditing, columnKey, getCurrencyForCell, getPendingEdit, id, cell.value]);\n\n useEffect(() => {\n if (selectedMasterData && inlineEditing === cell.column.key && (cell?.column?.masterDataColumnName || cell?.column?.masterDataFormula) && cell?.column?.masterDataName) {\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: selectedMasterData.value as string | boolean | null,\n meta: { reference: selectedMasterData.reference },\n originalValue: cell.value,\n });\n }\n handleCellValueChange(createSyntheticChangeEvent(selectedMasterData.value as string | number | boolean | null));\n callLiveFieldOperation(selectedMasterData.value, { reference: selectedMasterData.reference });\n clearSelectedMasterData?.();\n }\n }, [\n selectedMasterData,\n inlineEditing,\n columnKey,\n cell?.column?.masterDataFormula,\n cell?.column?.masterDataColumnName,\n cell?.column?.masterDataName,\n addPendingEdit,\n id,\n cell.value,\n handleCellValueChange,\n callLiveFieldOperation,\n clearSelectedMasterData,\n ]);\n\n const validateRequiredField = (value: string | number | boolean | null): boolean => {\n if (cell?.column?.is_required) {\n const isEmpty = value === null || value === undefined || value === '' || (typeof value === 'string' && value.trim() === '');\n if (isEmpty) {\n setValidationError('Field required');\n return false;\n }\n }\n setValidationError(null);\n return true;\n };\n\n const validateUrlField = (value: string): boolean => {\n if (!validateRequiredField(value)) {\n return false;\n }\n if (value && value.trim() !== '' && !REGEX.url.test(value)) {\n setValidationError('Invalid URL format');\n return false;\n }\n setValidationError(null);\n return true;\n };\n\n const validateEmailField = (value: string): boolean => {\n if (!validateRequiredField(value)) {\n return false;\n }\n if (value && value.trim() !== '' && !REGEX.email.test(value)) {\n setValidationError('Email is not valid');\n return false;\n }\n setValidationError(null);\n return true;\n };\n\n const fieldStateRef = useRef(fieldState);\n useEffect(() => {\n fieldStateRef.current = fieldState;\n }, [fieldState]);\n\n const textInputRef = useRef<HTMLInputElement>(null);\n const cellEditKey = `${id}-${columnKey}`;\n\n useLayoutEffect(() => {\n const el = textInputRef.current;\n if (!el) return;\n const cached = _cursorPositionCache.get(cellEditKey);\n if (cached) {\n el.focus();\n try {\n el.setSelectionRange(cached.start, cached.end);\n } catch {\n // email/number inputs may not support setSelectionRange\n }\n } else if (_blurringCellKey !== cellEditKey) {\n el.focus();\n }\n }, [cellEditKey]);\n\n const debouncedSyncTimerRef = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n return () => {\n if (debouncedSyncTimerRef.current) clearTimeout(debouncedSyncTimerRef.current);\n };\n }, []);\n\n const syncToParent = useCallback(\n (value: string) => {\n handleCellValueChange(createSyntheticChangeEvent(value));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value,\n originalValue: cell.value,\n });\n }\n },\n [handleCellValueChange, addPendingEdit, id, columnKey, cell.value],\n );\n\n const debouncedSyncToParent = useCallback(\n (value: string) => {\n if (debouncedSyncTimerRef.current) clearTimeout(debouncedSyncTimerRef.current);\n debouncedSyncTimerRef.current = setTimeout(() => {\n syncToParent(value);\n }, 300);\n },\n [syncToParent],\n );\n\n const flushSyncToParent = useCallback(() => {\n if (debouncedSyncTimerRef.current) {\n clearTimeout(debouncedSyncTimerRef.current);\n debouncedSyncTimerRef.current = undefined;\n syncToParent(String(fieldStateRef.current.value ?? ''));\n }\n }, [syncToParent]);\n\n const handleBlurValidation = useCallback(() => {\n const columnType = (cell?.column?.type as string | undefined)?.toLowerCase();\n const currentValue = fieldStateRef.current.value;\n\n switch (columnType) {\n case 'url':\n validateUrlField(String(currentValue ?? ''));\n break;\n case 'e-mail':\n validateEmailField(String(currentValue ?? ''));\n break;\n default:\n validateRequiredField(currentValue);\n break;\n }\n }, [cell?.column?.type]);\n\n const validateAndGetValue = useCallback((): ValidateAndSaveResult => {\n const columnType = (cell?.column?.type as string | undefined)?.toLowerCase();\n const currentValue = fieldStateRef.current.value;\n const currentCurrency = fieldStateRef.current.currencyCode;\n\n let isValid = true;\n\n switch (columnType) {\n case 'url':\n isValid = validateUrlField(String(currentValue ?? ''));\n break;\n case 'e-mail':\n isValid = validateEmailField(String(currentValue ?? ''));\n break;\n default:\n isValid = validateRequiredField(currentValue);\n break;\n }\n\n if (!isValid) {\n return { isValid: false };\n }\n\n let meta: ValidateAndSaveResult['meta'] = null;\n if (columnType === 'currency') {\n const latestCurrency = getCurrencyForCell?.(currencyCellId) || currentCurrency;\n meta = { currency_code: latestCurrency };\n }\n\n return {\n isValid: true,\n value: (typeof currentValue === 'number' ? String(currentValue) : currentValue) as string | boolean | null,\n meta,\n };\n }, [cell?.column?.type, currencyCellId, getCurrencyForCell]);\n\n useEffect(() => {\n if (registerValidation && inlineEditing === columnKey) {\n registerValidation(validateAndGetValue);\n }\n }, [registerValidation, validateAndGetValue, inlineEditing, columnKey]);\n\n const renderFieldByType = () => {\n if (cell?.column?.is_master_data && cell?.column?.masterDataName && (cell?.column?.masterDataColumnName || cell?.column?.masterDataFormula)) {\n const currentPendingEdit = getPendingEdit?.(String(id), columnKey);\n const masterDataValue = selectedMasterData?.value ?? currentPendingEdit?.value ?? cell.value;\n\n return (\n <div onMouseDown={(e) => e.stopPropagation()} className='z-[120] h-full w-full'>\n <MasterDataInlineField\n id={`master-data-cell-${id}-${cell.column.id}`}\n value={masterDataValue as string | number | null}\n onChange={(value, reference) => {\n handleCellValueChange(createSyntheticChangeEvent(value));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: value as string | boolean | null,\n meta: { reference: reference || null },\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(value, { reference: reference || undefined });\n validateRequiredField((value as string | boolean | null) ?? '');\n }}\n placeholder={cell.column?.Header as string | undefined}\n masterDataName={cell.column.masterDataName as string}\n masterDataColumnName={cell.column.masterDataColumnName as string}\n masterDataFormula={cell.column.masterDataFormula as string | undefined}\n masterDataFilters={cell.column.masterDataFilters as Record<string, unknown> | undefined}\n onOpenMasterDataModal={openMasterDataModal as never}\n reference={currentPendingEdit?.meta?.reference as Record<string, unknown> | undefined}\n />\n </div>\n );\n }\n\n const columnType = (cell?.column?.type as string | undefined)?.toLowerCase();\n const rowCellMeta = columnKey\n ? (cell?.row?.original?.__cellMetadata as Record<string, { choices?: string[] }> | undefined)?.[columnKey]\n : undefined;\n\n switch (columnType) {\n case 'choice': {\n const choices = rowCellMeta?.choices ?? (cell?.column?.choices as string[] | undefined);\n return (\n <div onMouseDown={(e) => e.stopPropagation()}>\n <SelectField\n id={`select-cell-${id}-${cell.column.id}`}\n value={fieldState.value || null}\n selectOptions={\n choices?.map((choice: string) => ({\n label: choice,\n value: choice,\n })) || []\n }\n onChange={(selectedOptions: TSelectedOptions) => {\n const value = selectedOptions\n ? Array.isArray(selectedOptions)\n ? selectedOptions[0]?.value?.toString() || ''\n : selectedOptions?.value?.toString() || ''\n : '';\n setFieldState((prev) => ({ ...prev, value }));\n handleCellValueChange(createSyntheticChangeEvent(value));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value,\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(value);\n validateRequiredField(value);\n }}\n allowClear={true}\n inputStyles={{\n height: 'var(--row-height)',\n border: 'none',\n boxShadow: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n }}\n className='z-[120]'\n />\n </div>\n );\n }\n\n case 'datetime':\n case 'date':\n return (\n <div\n onMouseDown={(e) => {\n e.stopPropagation();\n if ((e.target as HTMLElement).tagName !== 'INPUT') {\n e.preventDefault();\n }\n }}\n >\n <DateTimeField\n id={`date-cell-${id}-${cell.column.id}`}\n value={(fieldState.value as string | undefined) || undefined}\n handleOnChange={(value) => {\n const newValue = value || '';\n setFieldState((prev) => ({ ...prev, value: newValue }));\n handleCellValueChange(createSyntheticChangeEvent(newValue));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: newValue,\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(newValue);\n validateRequiredField(newValue);\n }}\n showTime={columnType === 'datetime'}\n dateFormat={columnType === 'date' ? 'MM/DD/YYYY' : undefined}\n className='z-[120] w-full'\n />\n </div>\n );\n\n case 'currency': {\n const originalCurrencyCode = getCurrencyFromCell();\n return (\n <div onMouseDown={(e) => e.stopPropagation()} className='z-[120] h-full w-full'>\n <InlineCurrencyField\n id={currencyCellId}\n value={String(fieldState.value ?? '')}\n onChange={(numericValue, currency_code) => {\n setFieldState((prev) => ({\n value: numericValue,\n currencyCode: currency_code || prev.currencyCode,\n }));\n handleCellValueChange(createSyntheticChangeEvent(numericValue));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: numericValue,\n meta: { currency_code },\n originalValue: cell.value,\n originalMeta: { currency_code: originalCurrencyCode },\n });\n }\n validateRequiredField(numericValue);\n callLiveFieldOperation(numericValue, { currency_code });\n }}\n currencyCode={fieldState.currencyCode}\n inputStyle={{\n height: 'var(--row-height)',\n border: 'none',\n boxShadow: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n }}\n autoFocus\n disabled={isAnyFieldOperationLoading}\n />\n </div>\n );\n }\n\n case 'percentage':\n return (\n <label className='relative block h-full' onMouseDown={(e) => e.stopPropagation()}>\n <input\n ref={textInputRef}\n type='number'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n try {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n } catch {\n // number inputs may not support selection\n }\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n validateRequiredField(value);\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n className='border border-gray-300 h-full text-gray-900 dark:bg-black-800 dark:text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-white dark:focus:border-white block w-full px-2.5 py-1.5 font-inter font-medium disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400'\n id={`percentage-cell-${id}-${cell.column.id}`}\n style={{\n height: 'var(--row-height)',\n border: 'none',\n boxShadow: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',\n }}\n autoComplete='off'\n disabled={isAnyFieldOperationLoading}\n />\n <span className='absolute inset-y-0 right-3 flex items-center pointer-events-none h-full dark:text-black-100'>%</span>\n </label>\n );\n\n case 'boolean': {\n const currentBoolValue =\n fieldState.value === true ||\n fieldState.value === 'true' ||\n fieldState.value === 'Yes' ||\n fieldState.value === 'True' ||\n fieldState.value === 1;\n\n return (\n <div\n onMouseDown={(e) => e.stopPropagation()}\n className='h-full w-full flex items-center px-2.5 bg-white dark:bg-black-800 rounded border-2 focus:outline-primary-600 border border-primary-600 dark:border-black-700 z-[120]'\n >\n <Toggle\n id={`toggle-cell-${id}-${cell.column.id}`}\n isChecked={currentBoolValue}\n onChange={(checked) => {\n setFieldState((prev) => ({ ...prev, value: checked }));\n handleCellValueChange(createSyntheticChangeEvent(checked));\n if (addPendingEdit) {\n addPendingEdit(String(id), columnKey, {\n value: checked,\n originalValue: cell.value,\n });\n }\n callLiveFieldOperation(checked);\n }}\n hideStatus={false}\n labelDirection='right'\n stopClickPropagation={true}\n statusText={currentBoolValue ? 'Yes' : 'No'}\n />\n </div>\n );\n }\n\n case 'url':\n return (\n <input\n ref={textInputRef}\n type='url'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n if (validationError) {\n validateUrlField(value);\n } else {\n validateRequiredField(value);\n }\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className='text-neutral-900 dark:text-white dark:bg-black-800 text-base font-medium h-full font-inter overflow-hidden whitespace-nowrap text-ellipsis px-2.5 py-1 w-full border rounded focus:outline-primary-600 dark:focus:outline-white z-[120] shadow-xl disabled:bg-neutral-50 dark:disabled:!bg-black-800'\n style={{\n height: 'var(--row-height)',\n }}\n disabled={isAnyFieldOperationLoading}\n />\n );\n\n case 'e-mail':\n return (\n <input\n ref={textInputRef}\n type='email'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n try {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n } catch {\n // email inputs may not support selection\n }\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n if (validationError) {\n validateEmailField(value);\n } else {\n validateRequiredField(value);\n }\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className='text-neutral-900 dark:text-white dark:bg-black-800 text-base font-medium h-full font-inter overflow-hidden whitespace-nowrap text-ellipsis px-2.5 py-1 w-full border rounded focus:outline-primary-600 dark:focus:outline-white z-[120] shadow-xl disabled:bg-neutral-50 dark:disabled:!bg-black-800'\n style={{\n height: 'var(--row-height)',\n }}\n disabled={isAnyFieldOperationLoading}\n />\n );\n\n default:\n return (\n <input\n ref={textInputRef}\n type='text'\n defaultValue={String(fieldState.value ?? '')}\n onChange={(e) => {\n _cursorPositionCache.set(cellEditKey, { start: e.target.selectionStart ?? 0, end: e.target.selectionEnd ?? 0 });\n const value = e.target.value;\n setFieldState((prev) => ({ ...prev, value }));\n fieldStateRef.current = { ...fieldStateRef.current, value };\n _pendingFieldOpCellKey = cellEditKey;\n validateRequiredField(value);\n debouncedSyncToParent(value);\n }}\n onBlur={() => {\n _blurringCellKey = cellEditKey;\n _cursorPositionCache.delete(cellEditKey);\n flushSyncToParent();\n handleBlurValidation();\n if (_pendingFieldOpCellKey === cellEditKey) {\n _pendingFieldOpCellKey = null;\n callLiveFieldOperation(fieldStateRef.current.value);\n }\n requestAnimationFrame(() => {\n _blurringCellKey = null;\n });\n }}\n onKeyDown={(e) => {\n e.stopPropagation();\n }}\n onMouseDown={(e) => e.stopPropagation()}\n className='text-neutral-900 dark:text-white dark:bg-black-800 text-base font-medium h-full font-inter overflow-hidden whitespace-nowrap text-ellipsis px-2.5 py-1 w-full border rounded focus:outline-primary-600 dark:focus:outline-white z-[120] shadow-xl disabled:bg-neutral-50 dark:disabled:!bg-black-800'\n style={{\n height: 'var(--row-height)',\n }}\n disabled={isAnyFieldOperationLoading}\n />\n );\n }\n };\n\n return (\n <div ref={cellRef} className='relative h-full w-full overflow-visible'>\n <div\n className={cn(\n 'border p-0.5 rounded-lg h-full',\n displayValidationError ? 'border-error-600' : 'border-neutral-200 dark:border-black-700',\n isAnyFieldOperationLoading && 'pointer-events-none opacity-70',\n )}\n >\n {renderFieldByType()}\n </div>\n {Boolean(cell?.column?.is_live_field) && (\n <div className='absolute -top-1.5 -right-1.5 bg-white dark:bg-black-800 rounded-full w-5 h-5 flex items-center justify-center border border-primary-300 dark:border-primary-600 shadow-sm z-[125]'>\n {isFieldOperationLoading ? (\n <LoadingSpinnerIcon className='text-primary-600 dark:text-white' size={8} />\n ) : (\n <BoltOutlined\n sx={{\n fontSize: 12,\n color: 'var(--color-primary-600)',\n }}\n />\n )}\n </div>\n )}\n {displayValidationError && (\n <div className='absolute top-full left-0 mt-1 text-error-600 text-xs font-medium z-[130] bg-white dark:bg-black-800 px-2 py-1 rounded shadow-lg w-full'>\n {displayValidationError}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_cursorPositionCache","_blurringCellKey","_pendingFieldOpCellKey","createSyntheticChangeEvent","value","InlineEditField","cell","id","inlineEditing","cellRef","handleCellValueChange","registerValidation","openMasterDataModal","selectedMasterData","clearSelectedMasterData","getCurrencyForCell","getPendingEdit","addPendingEdit","onFieldOperationFlow","fieldOperationLoading","useContext","TableContext","isFieldOperationLoading","isAnyFieldOperationLoading","callLiveFieldOperation","useCallback","meta","getCurrencyFromCell","rawData","headerKey","columnKey","dataFromHeader","dataFromKey","currencyCellId","contextCurrency","initialPendingEdit","fieldState","setFieldState","useState","validationError","setValidationError","computedValidationError","valueToValidate","result","validateCellValue","pendingError","displayValidationError","previousInlineEditingRef","useRef","useEffect","currencyFromContext","pendingEdit","initialValue","initialCurrency","validateRequiredField","validateUrlField","REGEX","validateEmailField","fieldStateRef","textInputRef","cellEditKey","useLayoutEffect","el","cached","debouncedSyncTimerRef","syncToParent","debouncedSyncToParent","flushSyncToParent","handleBlurValidation","columnType","currentValue","validateAndGetValue","currentCurrency","isValid","renderFieldByType","currentPendingEdit","masterDataValue","jsx","e","MasterDataInlineField","reference","rowCellMeta","choices","SelectField","choice","selectedOptions","prev","DateTimeField","newValue","originalCurrencyCode","InlineCurrencyField","numericValue","currency_code","jsxs","currentBoolValue","Toggle","checked","cn","LoadingSpinnerIcon","BoltOutlined"],"mappings":";;;;;;;;;;;;;AA+BA,MAAMA,wBAA2B,IAAA;AACjC,IAAIC,IAAkC,MAClCC,IAAwC;AAE5C,MAAMC,IAA6B,CAACC,OAC3B;AAAA,EACL,QAAQ,EAAE,OAAAA,EAAA;AAAM,IAIPC,KAAkD,CAAC,EAAE,MAAAC,GAAM,IAAAC,GAAI,eAAAC,GAAe,SAAAC,GAAS,uBAAAC,GAAuB,oBAAAC,QAAy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H;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../_virtual/index.cjs.js"),n=require("react"),Ie=require("antd"),Fe=require("react-i18next"),Ee=require("../../data-display/typography/Typography.cjs.js"),qe=require("../../data-display/label/Label.cjs.js"),q=require("@mui/icons-material"),Ne=require("../../icons/AIExtractedIndicator.cjs.js"),Be=require("../../icons/AIStarIcon.cjs.js"),Ae=require("../../icons/HelpIcon.cjs.js"),N=require("../../tooltip/Tooltip.cjs.js"),D=require("../../button/IconButton.cjs.js"),Re=require("../shared/InputLabel.cjs.js"),x=require("../../../utils/confidenceScoreUtils.cjs.js"),ze=require("../../icon/icons.generated.cjs.js"),T=n.forwardRef(({id:U,label:J,labelExtra:Q,placeholder:X,value:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../_virtual/index.cjs.js"),n=require("react"),Ie=require("antd"),Fe=require("react-i18next"),Ee=require("../../data-display/typography/Typography.cjs.js"),qe=require("../../data-display/label/Label.cjs.js"),q=require("@mui/icons-material"),Ne=require("../../icons/AIExtractedIndicator.cjs.js"),Be=require("../../icons/AIStarIcon.cjs.js"),Ae=require("../../icons/HelpIcon.cjs.js"),N=require("../../tooltip/Tooltip.cjs.js"),D=require("../../button/IconButton.cjs.js"),Re=require("../shared/InputLabel.cjs.js"),x=require("../../../utils/confidenceScoreUtils.cjs.js"),ze=require("../../icon/icons.generated.cjs.js"),T=n.forwardRef(({id:U,label:J,labelExtra:Q,placeholder:X,value:i,onChange:B,errorMessage:s,defaultValue:Y,required:A=!1,isRequiredConditional:Z=!1,masterDataName:g,masterDataColumnName:G,masterDataFormula:a,masterDataFilters:ee,tags:te,index:re,tooltip:R="",originalCase:ne=!1,color:c="",isGTN:k=!1,labelClassName:le,gtnName:z=null,isAiExtracted:se=!1,confidenceScore:v,confidenceType:f="high",confidenceTooltip:j,sourceMeta:ae=[],onConfidenceScoreClick:oe,disabled:V=!1,reference:ie={},isLiveField:ce=!1,onBlur:de,onAddGTNToDocument:S,riskDetails:d,isRiskAnalysisOpen:L=!1,RiskDetailsCard:$,primaryColorShades:ue,setDisableActions:M,showDeprecatedFieldWarning:O,MasterDataModal:W,parseMasterDataFormula:p,inputEmphasis:w="default"},xe)=>{const{t:fe}=Fe.useTranslation(),h=!!(L&&d?.color),be=w==="modified"&&!s&&!h,ge=w==="deleted"&&!s&&!h,pe=w==="success"&&!s&&!h,[m,y]=n.useState(!1),[o,b]=n.useState(null),[u,H]=n.useState(!1),[he,me]=n.useState(""),[C,P]=n.useState(null),[ke,ve]=n.useState(!1),I=n.useRef(null),F=xe||I;n.useEffect(()=>{const t=()=>{const r=F.current||I.current;r&&ve(r.scrollWidth>r.clientWidth)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[o,i]),n.useEffect(()=>{b(i)},[re,i]),n.useEffect(()=>{o!==null&&o!==i&&B(o,C)},[o,C]);const E=()=>{M?.(!u),H(!u)},je=t=>{if(t.keyCode===9||t.key==="Enter"){const r=F.current||I.current;r&&(b(he),r.blur())}},Se=(t,r)=>{let _=t;a&&p&&(_=p(a,r)),me(""),b(_),E(),P(r)},we=()=>{b(""),P(null)},ye=t=>{S&&z&&S({key:z,value:t})},Ce=()=>{const t="border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium",r="placeholder:text-neutral-900 dark:placeholder:text-black-400";return s?l(t,r,"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",c||"text-neutral-900 dark:text-black-200"):h&&d?.color?l(t,r,`border-${d.color}-300 bg-${d.color}-50`,c||"text-neutral-900 dark:text-black-200"):ge?l(t,r,"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]"):be?l(t,r,"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]"):pe?l(t,r,"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]"):l(t,r,"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600",c||"text-neutral-900 dark:text-black-200")},K=()=>o!==null?o:a&&p?p(a,ie):i;return n.useEffect(()=>{u&&!g&&(O?.(),H(!1))},[u,g,O]),e.jsxs("div",{className:l("flex gap-0.5 w-full relative",m&&k?"border rounded-lg border-primary-100 p-1":"",{"error-field":!!s}),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[k&&!m?e.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,e.jsxs("div",{className:l("flex flex-col w-full"),children:[e.jsx("label",{htmlFor:"text",className:`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${ne?"":"capitalize"} ${le||""}`,children:e.jsxs("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1",children:[e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 flex-wrap",children:[e.jsx(Re.InputLabel,{label:J||"",required:A||!1,isRequiredConditional:Z||!1}),ce&&e.jsx(q.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),se&&!x.shouldShowConfidenceScore(v)&&e.jsx(Ne.AIExtractedIndicator,{}),e.jsx(qe.Label,{labels:te}),R&&e.jsx(N,{placement:"top",title:`${R}${a?` | ${a}`:""}`,children:e.jsx("div",{className:"cursor-pointer",children:e.jsx(Ae.HelpIcon,{className:"w-icon-sm h-icon-sm"})})}),Q]}),e.jsxs("div",{className:"flex items-center gap-1 justify-self-end",children:[x.shouldShowConfidenceScore(v)&&f?e.jsx(N,{placement:"top-end",title:j??"",hideTooltip:j==null,className:"cursor-pointer",children:e.jsxs("div",{className:l("inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5",x.getConfidenceScoreBadgeClass(f)),onClick:()=>oe?.(ae),children:[e.jsx(Be.AIStarIcon,{size:12,fill:x.getConfidenceScoreBadgeColor(f),fillSecondary:x.getConfidenceScoreBadgeFill(f)}),e.jsxs("span",{className:l("text-xs font-medium leading-4",x.getConfidenceScoreBadgeTextColor(f)),children:[v,"%"]})]})}):null,k&&m&&S?e.jsx("button",{id:"btn-master-data-input-add-to-document",className:"cursor-pointer",onClick:()=>ye(i?.toString()||""),type:"button",children:e.jsx(Ie.Tooltip,{placement:"top",title:fe("Add to document"),children:e.jsx(q.NoteAddOutlined,{sx:{fontSize:16,color:ue?.[600]||"var(--color-primary-600)"}})})}):null]})]})}),e.jsxs("label",{className:"relative block mt-1",children:[e.jsx(N,{title:ke?K():"",children:e.jsx("input",{id:U,ref:F,required:A,placeholder:X,className:Ce(),onChange:t=>{B(t.target.value,C),b(t.target?.value)},onKeyDown:je,value:K(),defaultValue:Y,disabled:!0,autoComplete:"off",onBlur:de})}),e.jsx(D,{id:"btn-dynamic-data-input-rx-cross",onClick:we,className:"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:V,children:e.jsx(ze.CloseIcon,{className:"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm"})}),e.jsx(D,{id:"btn-dynamic-data-input-ai-outline-pic-center",onClick:E,className:"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent",variant:"ghost",disabled:V,children:e.jsx(q.TableChartRounded,{className:"text-neutral-500 dark:text-neutral-400 w-sm h-sm"})})]}),s&&e.jsx(Ee.Typography,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:s}),u&&W&&e.jsx(W,{isVisible:u,onSelected:Se,onClose:E,masterDataColumnName:G,masterDataFilters:ee,masterDataName:g,masterDataId:g,masterDataFormula:a,showFilters:!0,enableRootDrag:!0})]}),m&&d&&L&&$&&e.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:t=>t.stopPropagation(),onMouseDown:t=>t.preventDefault(),onKeyDown:t=>{t.key==="Escape"&&y(!1)},children:e.jsx($,{riskDetails:d})})]})});T.displayName="MasterDataInputField";exports.MasterDataInputField=T;
|
|
2
2
|
//# sourceMappingURL=MasterDataInputField.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterDataInputField.cjs.js","sources":["../../../../src/components/forms/master-data-input/MasterDataInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport {\n BoltOutlined,\n CloseRounded,\n NoteAddOutlined,\n TableChartRounded,\n} from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport IconButton from \"../../button/IconButton\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { CloseIcon, CloseSmallIcon } from \"../../icon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/** Visual emphasis for the input surface (background + border) */\nexport type MasterDataInputFieldEmphasis =\n | \"default\"\n | \"modified\"\n | \"deleted\"\n | \"success\";\n\n/**\n * Props for the MasterDataModal component\n */\nexport interface MasterDataModalProps {\n isVisible: boolean;\n onSelected?: (masterDataValue: any, masterDataRow?: any) => void;\n onClose: () => void;\n masterDataColumnName?: string;\n masterDataFilters?: any;\n masterDataName?: string;\n masterDataId: string | null;\n showFilters?: boolean;\n}\n\n/**\n * Props for the MasterDataInputField component\n */\nexport interface MasterDataInputFieldProps {\n /** Unique identifier for the input */\n id: string;\n /** Label text to display above the input */\n label: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Current value of the input */\n value: any;\n /** Callback function called when value changes */\n onChange: (value: any, masterDataRowValue?: any) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Callback to set error message */\n setErrorMessage: (message: string) => void;\n /** Callback to remove error message */\n removeErrorMessage: () => void;\n /** Default value for the input */\n defaultValue?: any;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Name of the master data source */\n masterDataName: string;\n /** Column name in the master data */\n masterDataColumnName: string;\n /** Formula for computing master data value */\n masterDataFormula?: string;\n /** Filters for master data */\n masterDataFilters?: any;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Index for array fields */\n index?: number;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Color for the input text */\n color?: string;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Reference data for formula computation */\n reference?: any;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function called when input loses focus */\n onBlur?: () => void;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Primary color shades for styling */\n primaryColorShades?: Record<number, string>;\n /** Callback to set disable actions state */\n setDisableActions?: (disabled: boolean) => void;\n /** Toast function for deprecated field warning */\n showDeprecatedFieldWarning?: () => void;\n /** Master data modal component */\n MasterDataModal?: React.ComponentType<MasterDataModalProps>;\n /** Function to parse master data formula */\n parseMasterDataFormula?: (formula: string, row: any) => string;\n /** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */\n inputEmphasis?: MasterDataInputFieldEmphasis;\n}\n\n/**\n * A highly customizable master data input component with label, validation, and styling support.\n * Features master data modal integration, GTN support, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <MasterDataInputField\n * id=\"master-field\"\n * label=\"Master Field\"\n * value={fieldValue}\n * onChange={(value, rowValue) => setFieldValue(value)}\n * setErrorMessage={(msg) => setError(msg)}\n * removeErrorMessage={() => setError('')}\n * masterDataName=\"customers\"\n * masterDataColumnName=\"name\"\n * required\n * />\n * ```\n */\nexport const MasterDataInputField = forwardRef<\n HTMLInputElement,\n MasterDataInputFieldProps\n>(\n (\n {\n id,\n label,\n labelExtra,\n placeholder,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n masterDataName,\n masterDataColumnName,\n masterDataFormula,\n masterDataFilters,\n tags,\n index,\n tooltip = \"\",\n originalCase = false,\n color = \"\",\n isGTN = false,\n labelClassName,\n gtnName = null,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n disabled = false,\n reference = {},\n isLiveField = false,\n onBlur,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n primaryColorShades,\n setDisableActions,\n showDeprecatedFieldWarning,\n MasterDataModal,\n parseMasterDataFormula,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" && !errorMessage && !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" && !errorMessage && !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" && !errorMessage && !showRiskSkin;\n const [isHovered, setIsHovered] = useState(false);\n const [inputValue, setInputValue] = useState<string | null>(null);\n const [showMasterDataModal, setShowMasterDataModal] = useState(false);\n const [suggestion, setSuggestion] = useState(\"\");\n const [masterDataRowValue, setMasterDataRowValue] = useState<any>(null);\n const [isTextOverflowing, setIsTextOverflowing] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Use forwarded ref or internal ref\n const combinedRef = (ref as React.RefObject<HTMLInputElement>) || inputRef;\n\n // Check if text is overflowing\n useEffect(() => {\n const checkOverflow = () => {\n const input = combinedRef.current || inputRef.current;\n if (input) {\n setIsTextOverflowing(input.scrollWidth > input.clientWidth);\n }\n };\n\n checkOverflow();\n // Recheck on window resize\n window.addEventListener('resize', checkOverflow);\n return () => window.removeEventListener('resize', checkOverflow);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue, value]);\n\n useEffect(() => {\n setInputValue(value);\n }, [index, value]);\n\n useEffect(() => {\n if (inputValue !== null && inputValue !== value) {\n onChange(inputValue, masterDataRowValue);\n }\n }, [inputValue, masterDataRowValue]);\n\n const toggleMasterDataModal = () => {\n if (showMasterDataModal) {\n setDisableActions?.(false);\n } else {\n setDisableActions?.(true);\n }\n setShowMasterDataModal(!showMasterDataModal);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.keyCode === 9 || event.key === \"Enter\") {\n const currentRef = combinedRef.current || inputRef.current;\n if (currentRef) {\n setInputValue(suggestion);\n currentRef.blur();\n }\n }\n };\n\n const handleSetMasterData = (masterDataValue: any, masterDataRow?: any) => {\n let _value = masterDataValue;\n\n if (masterDataFormula && parseMasterDataFormula) {\n _value = parseMasterDataFormula(masterDataFormula, masterDataRow);\n }\n\n setSuggestion(\"\");\n setInputValue(_value);\n toggleMasterDataModal();\n setMasterDataRowValue(masterDataRow);\n };\n\n const handleClear = () => {\n setInputValue(\"\");\n setMasterDataRowValue(null);\n };\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument && gtnName) {\n const keyValuePair = {\n key: gtnName,\n value: _value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n\n if (errorMessage) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (showRiskSkin && riskDetails?.color) {\n return cn(\n baseClasses,\n placeholderColor,\n `border-${riskDetails.color}-300 bg-${riskDetails.color}-50`,\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (emphasisDeletedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]\"\n );\n }\n if (emphasisModifiedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]\"\n );\n }\n if (emphasisSuccessSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]\"\n );\n }\n\n return cn(\n baseClasses,\n placeholderColor,\n \"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n };\n\n const resolveMasterDataValue = () => {\n if (inputValue !== null) {\n return inputValue;\n }\n if (masterDataFormula && parseMasterDataFormula) {\n return parseMasterDataFormula(masterDataFormula, reference);\n }\n\n return value;\n };\n\n useEffect(() => {\n if (showMasterDataModal && !masterDataName) {\n showDeprecatedFieldWarning?.();\n setShowMasterDataModal(false);\n }\n }, [showMasterDataModal, masterDataName, showDeprecatedFieldWarning]);\n\n return (\n <div\n className={cn(\n `flex gap-0.5 w-full relative`,\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 p-1\"\n : \"\",\n { \"error-field\": !!errorMessage }\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n\n <div className={cn(`flex flex-col w-full`)}>\n <label\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip\n placement=\"top\"\n title={`${tooltip}${masterDataFormula ? ` | ${masterDataFormula}` : \"\"}`}\n >\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-master-data-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(value?.toString() || \"\")}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n sx={{\n fontSize: 16,\n color:\n primaryColorShades?.[600] || \"var(--color-primary-600)\",\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n <label className=\"relative block mt-1\">\n <Tooltip\n title={isTextOverflowing ? resolveMasterDataValue() : \"\"}\n >\n <input\n id={id}\n ref={combinedRef}\n required={required}\n placeholder={placeholder}\n className={getClassName()}\n onChange={(e) => {\n onChange(e.target.value, masterDataRowValue);\n setInputValue(e.target?.value);\n }}\n onKeyDown={handleKeyDown}\n value={resolveMasterDataValue()}\n defaultValue={defaultValue}\n disabled={true}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n </Tooltip>\n\n <IconButton\n id={`btn-dynamic-data-input-rx-cross`}\n onClick={handleClear}\n className=\"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <CloseIcon className=\"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm\" />\n </IconButton>\n\n <IconButton\n id={`btn-dynamic-data-input-ai-outline-pic-center`}\n onClick={toggleMasterDataModal}\n className=\"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <TableChartRounded\n className=\"text-neutral-500 dark:text-neutral-400 w-sm h-sm\"\n />\n </IconButton>\n </label>\n\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n\n {showMasterDataModal && MasterDataModal && (\n <MasterDataModal\n isVisible={showMasterDataModal}\n onSelected={handleSetMasterData}\n onClose={toggleMasterDataModal}\n masterDataColumnName={masterDataColumnName}\n masterDataFilters={masterDataFilters}\n masterDataName={masterDataName}\n masterDataId={masterDataName}\n showFilters\n />\n )}\n </div>\n\n {isHovered &&\n riskDetails &&\n isRiskAnalysisOpen &&\n RiskDetailsCard && (\n <div\n role=\"tooltip\"\n tabIndex={0}\n className=\"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl\"\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.preventDefault()}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n setIsHovered(false);\n }\n }}\n >\n <RiskDetailsCard riskDetails={riskDetails} />\n </div>\n )}\n </div>\n );\n }\n);\n\nMasterDataInputField.displayName = \"MasterDataInputField\";\n\n"],"names":["MasterDataInputField","forwardRef","id","label","labelExtra","placeholder","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","masterDataName","masterDataColumnName","masterDataFormula","masterDataFilters","tags","index","tooltip","originalCase","color","isGTN","labelClassName","gtnName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","disabled","reference","isLiveField","onBlur","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","primaryColorShades","setDisableActions","showDeprecatedFieldWarning","MasterDataModal","parseMasterDataFormula","inputEmphasis","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isHovered","setIsHovered","useState","inputValue","setInputValue","showMasterDataModal","setShowMasterDataModal","suggestion","setSuggestion","masterDataRowValue","setMasterDataRowValue","isTextOverflowing","setIsTextOverflowing","inputRef","useRef","combinedRef","useEffect","checkOverflow","input","toggleMasterDataModal","handleKeyDown","event","currentRef","handleSetMasterData","masterDataValue","masterDataRow","_value","handleClear","handleAddGTNToDocument","getClassName","baseClasses","placeholderColor","cn","resolveMasterDataValue","jsxs","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","e","IconButton","CloseIcon","TableChartRounded","Typography"],"mappings":"0uBAgNaA,EAAuBC,EAAAA,WAIlC,CACE,CACE,GAAAC,EACA,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,sBAAAC,EAAwB,GACxB,eAAAC,EACA,qBAAAC,EACA,kBAAAC,EACA,kBAAAC,GACA,KAAAC,GAAA,MACAC,GACA,QAAAC,EAAU,GACV,aAAAC,GAAe,GACf,MAAAC,EAAQ,GACR,MAAAC,EAAQ,GACR,eAAAC,GACA,QAAAC,EAAU,KACV,cAAAC,GAAgB,GAChB,gBAAAC,EACA,eAAAC,EAAiB,OACjB,kBAAAC,EACA,WAAAC,GAAa,CAAA,EACb,uBAAAC,GACA,SAAAC,EAAW,GACX,UAAAC,GAAY,CAAA,EACZ,YAAAC,GAAc,GACd,OAAAC,GACA,mBAAAC,EACA,YAAAC,EACA,mBAAAC,EAAqB,GACrB,gBAAAC,EACA,mBAAAC,GACA,kBAAAC,EACA,2BAAAC,EACA,gBAAAC,EACA,uBAAAC,EACA,cAAAC,EAAgB,SAAA,EAElBC,KACG,CACH,KAAM,CAAE,EAAAC,EAAA,EAAMC,kBAAA,EACRC,EAAe,GAAQX,GAAsBD,GAAa,OAC1Da,GACJL,IAAkB,YAAc,CAACnC,GAA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,UAAA,CAAU,UAAU,0DAAA,CAA2D,CAAA,CAAA,EAGlFjB,EAAAA,IAACgB,EAAA,CACC,GAAI,+CACJ,QAAShC,EACT,UAAU,6EACV,QAAQ,QACR,SAAAxC,EAEA,SAAAwD,EAAAA,IAACkB,EAAAA,kBAAA,CACC,UAAU,kDAAA,CAAA,CACZ,CAAA,CACF,EACF,EAEChG,GACC8E,EAAAA,IAACmB,GAAAA,WAAA,CACC,UAAU,sBACV,WAAW,SACX,KAAK,cACL,QAAQ,SAEP,SAAAjG,CAAA,CAAA,EAIJgD,GAAuBf,GACtB6C,EAAAA,IAAC7C,EAAA,CACC,UAAWe,EACX,WAAYkB,GACZ,QAASJ,EACT,qBAAAzD,EACA,kBAAAE,GACA,eAAAH,EACA,aAAcA,EACd,YAAW,EAAA,CAAA,CACb,EAEJ,EAECuC,GACChB,GACAC,GACAC,GACEiD,EAAAA,IAAC,MAAA,CACC,KAAK,UACL,SAAU,EACV,UAAU,oFACV,QAAUe,GAAMA,EAAE,gBAAA,EAClB,YAAcA,GAAMA,EAAE,eAAA,EACtB,UAAYA,GAAM,CACZA,EAAE,MAAQ,UACZjD,EAAa,EAAK,CAEtB,EAEA,SAAAkC,EAAAA,IAACjD,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEAnC,EAAqB,YAAc"}
|
|
1
|
+
{"version":3,"file":"MasterDataInputField.cjs.js","sources":["../../../../src/components/forms/master-data-input/MasterDataInputField.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport cn from \"classnames\";\nimport { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { Tooltip as AntTooltip } from \"antd\";\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from \"../../data-display/typography/Typography\";\nimport { Label } from \"../../data-display/label/Label\";\nimport type { LabelType } from \"../../data-display/label/Label\";\nimport {\n BoltOutlined,\n CloseRounded,\n NoteAddOutlined,\n TableChartRounded,\n} from \"@mui/icons-material\";\nimport { AIExtractedIndicator } from \"../../icons/AIExtractedIndicator\";\nimport { AIStarIcon } from \"../../icons/AIStarIcon\";\nimport { HelpIcon } from \"../../icons/HelpIcon\";\nimport Tooltip from \"../../tooltip/Tooltip\";\nimport IconButton from \"../../button/IconButton\";\nimport { InputLabel } from \"../shared/InputLabel\";\nimport {\n getConfidenceScoreBadgeClass,\n getConfidenceScoreBadgeColor,\n getConfidenceScoreBadgeFill,\n getConfidenceScoreBadgeTextColor,\n shouldShowConfidenceScore,\n} from \"../../../utils/confidenceScoreUtils\";\nimport { CloseIcon, CloseSmallIcon } from \"../../icon\";\n\n/**\n * Confidence score type\n */\nexport type ConfidenceScoreType = \"low\" | \"medium\" | \"high\";\n\nexport type SourceMetaBBox = {\n b: number;\n l: number;\n r: number;\n t: number;\n};\n\nexport type SourceMetaItem = {\n bbox: SourceMetaBBox;\n confidence_score?: number;\n is_primary?: boolean;\n match_score?: number;\n match_type?: string;\n page_height: number;\n page_width: number;\n source_page: number;\n source_text?: string;\n};\n\n/**\n * Risk details interface for risk analysis integration\n */\nexport interface RiskDetails {\n color?: string;\n description?: string;\n hexBgColor?: string;\n hexBorderColor?: string;\n [key: string]: any;\n}\n\n/**\n * Risk details card component props - generic to allow consumer-specific risk types\n */\nexport interface RiskDetailsCardProps<T = any> {\n riskDetails: T;\n maxWidth?: string;\n showAllRisksSuggestions?: boolean;\n}\n\n/** Visual emphasis for the input surface (background + border) */\nexport type MasterDataInputFieldEmphasis =\n | \"default\"\n | \"modified\"\n | \"deleted\"\n | \"success\";\n\n/**\n * Props for the MasterDataModal component\n */\nexport interface MasterDataModalProps {\n isVisible: boolean;\n onSelected?: (masterDataValue: any, masterDataRow?: any) => void;\n onClose: () => void;\n masterDataColumnName?: string;\n masterDataFilters?: any;\n masterDataName?: string;\n masterDataId: string | null;\n masterDataFormula?: string;\n setFieldFilters?: any;\n showFilters?: boolean;\n enableRootDrag?: boolean;\n}\n\n/**\n * Props for the MasterDataInputField component\n */\nexport interface MasterDataInputFieldProps {\n /** Unique identifier for the input */\n id: string;\n /** Label text to display above the input */\n label: string;\n /** Optional extra content in the label row (e.g. actions, badges) */\n labelExtra?: React.ReactNode;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Current value of the input */\n value: any;\n /** Callback function called when value changes */\n onChange: (value: any, masterDataRowValue?: any) => void;\n /** Error message to display below the input */\n errorMessage?: string;\n /** Callback to set error message */\n setErrorMessage: (message: string) => void;\n /** Callback to remove error message */\n removeErrorMessage: () => void;\n /** Default value for the input */\n defaultValue?: any;\n /** Whether the field is required */\n required?: boolean;\n /** Whether the required indicator shows as conditional (yellow instead of red) */\n isRequiredConditional?: boolean;\n /** Name of the master data source */\n masterDataName: string;\n /** Column name in the master data */\n masterDataColumnName: string;\n /** Formula for computing master data value */\n masterDataFormula?: string;\n /** Filters for master data */\n masterDataFilters?: any;\n /** Tags/labels to display next to the label */\n tags?: (string | LabelType)[];\n /** Index for array fields */\n index?: number;\n /** Tooltip text for the help icon */\n tooltip?: string;\n /** Whether to preserve original case in the label */\n originalCase?: boolean;\n /** Color for the input text */\n color?: string;\n /** Whether this is a GTN (Global Term Name) field */\n isGTN?: boolean;\n /** GTN field name for document integration */\n gtnName?: any;\n /** Whether the value was AI extracted */\n isAiExtracted?: boolean;\n /** Confidence percentage shown as a badge */\n confidenceScore?: number;\n /** Confidence classification for badge styling */\n confidenceType?: ConfidenceScoreType;\n /** Optional tooltip content for confidence badge */\n confidenceTooltip?: React.ReactNode;\n /** Source meta for confidence score */\n sourceMeta?: SourceMetaItem[];\n /** Handler fired when confidence score badge is clicked */\n onConfidenceScoreClick?: (sourceMeta: SourceMetaItem[]) => void;\n /** Reference data for formula computation */\n reference?: any;\n /** Whether the input is disabled */\n disabled?: boolean;\n /** Additional CSS classes for the label */\n labelClassName?: string;\n /** Whether this is a live field */\n isLiveField?: boolean;\n /** Callback function called when input loses focus */\n onBlur?: () => void;\n /** Handler for adding GTN to document */\n onAddGTNToDocument?: (keyValuePair: { key: string; value: string }) => void;\n /** Risk details data */\n riskDetails?: RiskDetails;\n /** Whether risk analysis is open */\n isRiskAnalysisOpen?: boolean;\n /** Custom risk details card component */\n RiskDetailsCard?: React.ComponentType<RiskDetailsCardProps<any>>;\n /** Primary color shades for styling */\n primaryColorShades?: Record<number, string>;\n /** Callback to set disable actions state */\n setDisableActions?: (disabled: boolean) => void;\n /** Toast function for deprecated field warning */\n showDeprecatedFieldWarning?: () => void;\n /** Master data modal component */\n MasterDataModal?: React.ComponentType<MasterDataModalProps>;\n /** Function to parse master data formula */\n parseMasterDataFormula?: (formula: string, row: any) => string;\n /** Input surface style: `'modified'` — `--Warning-50` / `--Warning-200`; `'deleted'` — `--Error-50` / `--Error-200`, text `#475467`; `'success'` — `--Success-50` / `--Success-200`, text `#101828`. */\n inputEmphasis?: MasterDataInputFieldEmphasis;\n}\n\n/**\n * A highly customizable master data input component with label, validation, and styling support.\n * Features master data modal integration, GTN support, risk analysis support,\n * and comprehensive prop support for various use cases.\n *\n * @example\n * ```tsx\n * <MasterDataInputField\n * id=\"master-field\"\n * label=\"Master Field\"\n * value={fieldValue}\n * onChange={(value, rowValue) => setFieldValue(value)}\n * setErrorMessage={(msg) => setError(msg)}\n * removeErrorMessage={() => setError('')}\n * masterDataName=\"customers\"\n * masterDataColumnName=\"name\"\n * required\n * />\n * ```\n */\nexport const MasterDataInputField = forwardRef<\n HTMLInputElement,\n MasterDataInputFieldProps\n>(\n (\n {\n id,\n label,\n labelExtra,\n placeholder,\n value,\n onChange,\n errorMessage,\n defaultValue,\n required = false,\n isRequiredConditional = false,\n masterDataName,\n masterDataColumnName,\n masterDataFormula,\n masterDataFilters,\n tags,\n index,\n tooltip = \"\",\n originalCase = false,\n color = \"\",\n isGTN = false,\n labelClassName,\n gtnName = null,\n isAiExtracted = false,\n confidenceScore,\n confidenceType = \"high\",\n confidenceTooltip,\n sourceMeta = [],\n onConfidenceScoreClick,\n disabled = false,\n reference = {},\n isLiveField = false,\n onBlur,\n onAddGTNToDocument,\n riskDetails,\n isRiskAnalysisOpen = false,\n RiskDetailsCard,\n primaryColorShades,\n setDisableActions,\n showDeprecatedFieldWarning,\n MasterDataModal,\n parseMasterDataFormula,\n inputEmphasis = \"default\",\n },\n ref\n ) => {\n const { t } = useTranslation();\n const showRiskSkin = Boolean(isRiskAnalysisOpen && riskDetails?.color);\n const emphasisModifiedSkin =\n inputEmphasis === \"modified\" && !errorMessage && !showRiskSkin;\n const emphasisDeletedSkin =\n inputEmphasis === \"deleted\" && !errorMessage && !showRiskSkin;\n const emphasisSuccessSkin =\n inputEmphasis === \"success\" && !errorMessage && !showRiskSkin;\n const [isHovered, setIsHovered] = useState(false);\n const [inputValue, setInputValue] = useState<string | null>(null);\n const [showMasterDataModal, setShowMasterDataModal] = useState(false);\n const [suggestion, setSuggestion] = useState(\"\");\n const [masterDataRowValue, setMasterDataRowValue] = useState<any>(null);\n const [isTextOverflowing, setIsTextOverflowing] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Use forwarded ref or internal ref\n const combinedRef = (ref as React.RefObject<HTMLInputElement>) || inputRef;\n\n // Check if text is overflowing\n useEffect(() => {\n const checkOverflow = () => {\n const input = combinedRef.current || inputRef.current;\n if (input) {\n setIsTextOverflowing(input.scrollWidth > input.clientWidth);\n }\n };\n\n checkOverflow();\n // Recheck on window resize\n window.addEventListener('resize', checkOverflow);\n return () => window.removeEventListener('resize', checkOverflow);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [inputValue, value]);\n\n useEffect(() => {\n setInputValue(value);\n }, [index, value]);\n\n useEffect(() => {\n if (inputValue !== null && inputValue !== value) {\n onChange(inputValue, masterDataRowValue);\n }\n }, [inputValue, masterDataRowValue]);\n\n const toggleMasterDataModal = () => {\n if (showMasterDataModal) {\n setDisableActions?.(false);\n } else {\n setDisableActions?.(true);\n }\n setShowMasterDataModal(!showMasterDataModal);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.keyCode === 9 || event.key === \"Enter\") {\n const currentRef = combinedRef.current || inputRef.current;\n if (currentRef) {\n setInputValue(suggestion);\n currentRef.blur();\n }\n }\n };\n\n const handleSetMasterData = (masterDataValue: any, masterDataRow?: any) => {\n let _value = masterDataValue;\n\n if (masterDataFormula && parseMasterDataFormula) {\n _value = parseMasterDataFormula(masterDataFormula, masterDataRow);\n }\n\n setSuggestion(\"\");\n setInputValue(_value);\n toggleMasterDataModal();\n setMasterDataRowValue(masterDataRow);\n };\n\n const handleClear = () => {\n setInputValue(\"\");\n setMasterDataRowValue(null);\n };\n\n const handleAddGTNToDocument = (_value: string) => {\n if (onAddGTNToDocument && gtnName) {\n const keyValuePair = {\n key: gtnName,\n value: _value,\n };\n onAddGTNToDocument(keyValuePair);\n }\n };\n\n const getClassName = (): string => {\n const baseClasses =\n \"border h-8 text-sm rounded-lg block w-full p-2.5 pr-16 font-inter font-medium\";\n const placeholderColor = `placeholder:text-neutral-900 dark:placeholder:text-black-400`;\n\n if (errorMessage) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-red-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (showRiskSkin && riskDetails?.color) {\n return cn(\n baseClasses,\n placeholderColor,\n `border-${riskDetails.color}-300 bg-${riskDetails.color}-50`,\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n }\n if (emphasisDeletedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Error-200,#FECACA)] bg-[var(--Error-50,#FEF2F2)] !text-[#475467] dark:border-[var(--Error-200,#FECACA)] dark:bg-[var(--Error-50,#FEF2F2)] dark:!text-[#475467]\"\n );\n }\n if (emphasisModifiedSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Warning-200,#FEDF89)] bg-[var(--Warning-50,#FFFAEB)] text-neutral-900 dark:text-black-100 dark:border-[var(--Warning-200,#FEDF89)] dark:bg-[var(--Warning-50,#FFFAEB)]\"\n );\n }\n if (emphasisSuccessSkin) {\n return cn(\n baseClasses,\n placeholderColor,\n \"border-[var(--Success-200,#BBF7D0)] bg-[var(--Success-50,#F0FDF4)] !text-[#101828] dark:border-[var(--Success-200,#BBF7D0)] dark:bg-[var(--Success-50,#F0FDF4)] dark:!text-[#101828]\"\n );\n }\n\n return cn(\n baseClasses,\n placeholderColor,\n \"border-gray-300 bg-gray-200 dark:border-black-600 dark:bg-black-600\",\n color ? color : \"text-neutral-900 dark:text-black-200\"\n );\n };\n\n const resolveMasterDataValue = () => {\n if (inputValue !== null) {\n return inputValue;\n }\n if (masterDataFormula && parseMasterDataFormula) {\n return parseMasterDataFormula(masterDataFormula, reference);\n }\n\n return value;\n };\n\n useEffect(() => {\n if (showMasterDataModal && !masterDataName) {\n showDeprecatedFieldWarning?.();\n setShowMasterDataModal(false);\n }\n }, [showMasterDataModal, masterDataName, showDeprecatedFieldWarning]);\n\n return (\n <div\n className={cn(\n `flex gap-0.5 w-full relative`,\n isHovered && isGTN\n ? \"border rounded-lg border-primary-100 p-1\"\n : \"\",\n { \"error-field\": !!errorMessage }\n )}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n >\n {isGTN && !isHovered ? (\n <div className=\"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5\" />\n ) : null}\n\n <div className={cn(`flex flex-col w-full`)}>\n <label\n htmlFor=\"text\"\n className={`text-xs font-medium text-gray-600 inline-flex items-center gap-1 ${\n !originalCase ? \"capitalize\" : \"\"\n } ${labelClassName || \"\"}`}\n >\n <div className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] items-start gap-x-1\">\n <div className=\"inline-flex min-w-0 items-center gap-1 flex-wrap\">\n <InputLabel label={label || \"\"} required={required || false} isRequiredConditional={isRequiredConditional || false} />\n {isLiveField && (\n <BoltOutlined\n sx={{\n fontSize: 16,\n color: \"var(--color-primary-600)\",\n rotate: \"15deg\",\n }}\n />\n )}\n {isAiExtracted && !shouldShowConfidenceScore(confidenceScore) && <AIExtractedIndicator />}\n <Label labels={tags} />\n {tooltip && (\n <Tooltip\n placement=\"top\"\n title={`${tooltip}${masterDataFormula ? ` | ${masterDataFormula}` : \"\"}`}\n >\n <div className=\"cursor-pointer\">\n <HelpIcon className=\"w-icon-sm h-icon-sm\" />\n </div>\n </Tooltip>\n )}\n {labelExtra}\n </div>\n\n <div className=\"flex items-center gap-1 justify-self-end\">\n {(shouldShowConfidenceScore(confidenceScore) && confidenceType) ? (\n <Tooltip\n placement=\"top-end\"\n title={confidenceTooltip ?? \"\"}\n hideTooltip={confidenceTooltip === undefined || confidenceTooltip === null}\n className=\"cursor-pointer\"\n >\n <div\n className={cn(\n \"inline-flex min-w-[50px] items-center gap-1 rounded-md px-1 py-0.5\",\n getConfidenceScoreBadgeClass(confidenceType)\n )}\n onClick={() => onConfidenceScoreClick?.(sourceMeta)}\n >\n <AIStarIcon\n size={12}\n fill={getConfidenceScoreBadgeColor(confidenceType)}\n fillSecondary={getConfidenceScoreBadgeFill(confidenceType)}\n />\n <span className={cn(\"text-xs font-medium leading-4\", getConfidenceScoreBadgeTextColor(confidenceType))}>\n {confidenceScore}%\n </span>\n </div>\n </Tooltip>\n ) : null}\n {isGTN && isHovered && onAddGTNToDocument ? (\n <button\n id=\"btn-master-data-input-add-to-document\"\n className=\"cursor-pointer\"\n onClick={() => handleAddGTNToDocument(value?.toString() || \"\")}\n type=\"button\"\n >\n <AntTooltip placement=\"top\" title={t(\"Add to document\")}>\n <NoteAddOutlined\n sx={{\n fontSize: 16,\n color:\n primaryColorShades?.[600] || \"var(--color-primary-600)\",\n }}\n />\n </AntTooltip>\n </button>\n ) : null}\n </div>\n </div>\n </label>\n <label className=\"relative block mt-1\">\n <Tooltip\n title={isTextOverflowing ? resolveMasterDataValue() : \"\"}\n >\n <input\n id={id}\n ref={combinedRef}\n required={required}\n placeholder={placeholder}\n className={getClassName()}\n onChange={(e) => {\n onChange(e.target.value, masterDataRowValue);\n setInputValue(e.target?.value);\n }}\n onKeyDown={handleKeyDown}\n value={resolveMasterDataValue()}\n defaultValue={defaultValue}\n disabled={true}\n autoComplete=\"off\"\n onBlur={onBlur}\n />\n </Tooltip>\n\n <IconButton\n id={`btn-dynamic-data-input-rx-cross`}\n onClick={handleClear}\n className=\"absolute inset-y-0 right-1 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <CloseIcon className=\"w-6 h-6 text-neutral-500 dark:text-neutral-400 w-sm h-sm\" />\n </IconButton>\n\n <IconButton\n id={`btn-dynamic-data-input-ai-outline-pic-center`}\n onClick={toggleMasterDataModal}\n className=\"absolute inset-y-0 right-8 flex items-center px-2 focus:border-transparent\"\n variant=\"ghost\"\n disabled={disabled}\n >\n <TableChartRounded\n className=\"text-neutral-500 dark:text-neutral-400 w-sm h-sm\"\n />\n </IconButton>\n </label>\n\n {errorMessage && (\n <Typography\n className=\"text-error-500 mt-1\"\n appearance=\"custom\"\n size=\"extra-small\"\n variant=\"medium\"\n >\n {errorMessage}\n </Typography>\n )}\n\n {showMasterDataModal && MasterDataModal && (\n <MasterDataModal\n isVisible={showMasterDataModal}\n onSelected={handleSetMasterData}\n onClose={toggleMasterDataModal}\n masterDataColumnName={masterDataColumnName}\n masterDataFilters={masterDataFilters}\n masterDataName={masterDataName}\n masterDataId={masterDataName}\n masterDataFormula={masterDataFormula}\n showFilters\n enableRootDrag\n />\n )}\n </div>\n\n {isHovered &&\n riskDetails &&\n isRiskAnalysisOpen &&\n RiskDetailsCard && (\n <div\n role=\"tooltip\"\n tabIndex={0}\n className=\"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl\"\n onClick={(e) => e.stopPropagation()}\n onMouseDown={(e) => e.preventDefault()}\n onKeyDown={(e) => {\n if (e.key === \"Escape\") {\n setIsHovered(false);\n }\n }}\n >\n <RiskDetailsCard riskDetails={riskDetails} />\n </div>\n )}\n </div>\n );\n }\n);\n\nMasterDataInputField.displayName = \"MasterDataInputField\";\n\n"],"names":["MasterDataInputField","forwardRef","id","label","labelExtra","placeholder","value","onChange","errorMessage","defaultValue","required","isRequiredConditional","masterDataName","masterDataColumnName","masterDataFormula","masterDataFilters","tags","index","tooltip","originalCase","color","isGTN","labelClassName","gtnName","isAiExtracted","confidenceScore","confidenceType","confidenceTooltip","sourceMeta","onConfidenceScoreClick","disabled","reference","isLiveField","onBlur","onAddGTNToDocument","riskDetails","isRiskAnalysisOpen","RiskDetailsCard","primaryColorShades","setDisableActions","showDeprecatedFieldWarning","MasterDataModal","parseMasterDataFormula","inputEmphasis","ref","t","useTranslation","showRiskSkin","emphasisModifiedSkin","emphasisDeletedSkin","emphasisSuccessSkin","isHovered","setIsHovered","useState","inputValue","setInputValue","showMasterDataModal","setShowMasterDataModal","suggestion","setSuggestion","masterDataRowValue","setMasterDataRowValue","isTextOverflowing","setIsTextOverflowing","inputRef","useRef","combinedRef","useEffect","checkOverflow","input","toggleMasterDataModal","handleKeyDown","event","currentRef","handleSetMasterData","masterDataValue","masterDataRow","_value","handleClear","handleAddGTNToDocument","getClassName","baseClasses","placeholderColor","cn","resolveMasterDataValue","jsxs","jsx","InputLabel","BoltOutlined","shouldShowConfidenceScore","AIExtractedIndicator","Label","Tooltip","HelpIcon","getConfidenceScoreBadgeClass","AIStarIcon","getConfidenceScoreBadgeColor","getConfidenceScoreBadgeFill","getConfidenceScoreBadgeTextColor","AntTooltip","NoteAddOutlined","e","IconButton","CloseIcon","TableChartRounded","Typography"],"mappings":"0uBAmNaA,EAAuBC,EAAAA,WAIlC,CACE,CACE,GAAAC,EACA,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,sBAAAC,EAAwB,GACxB,eAAAC,EACA,qBAAAC,EACA,kBAAAC,EACA,kBAAAC,GACA,KAAAC,GAAA,MACAC,GACA,QAAAC,EAAU,GACV,aAAAC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AYA,GAAM,CACZA,EAAE,MAAQ,UACZjD,EAAa,EAAK,CAEtB,EAEA,SAAAkC,EAAAA,IAACjD,GAAgB,YAAAF,CAAA,CAA0B,CAAA,CAAA,CAC7C,CAAA,CAAA,CAIV,CACF,EAEAnC,EAAqB,YAAc"}
|
|
@@ -51,7 +51,10 @@ export interface MasterDataModalProps {
|
|
|
51
51
|
masterDataFilters?: any;
|
|
52
52
|
masterDataName?: string;
|
|
53
53
|
masterDataId: string | null;
|
|
54
|
+
masterDataFormula?: string;
|
|
55
|
+
setFieldFilters?: any;
|
|
54
56
|
showFilters?: boolean;
|
|
57
|
+
enableRootDrag?: boolean;
|
|
55
58
|
}
|
|
56
59
|
/**
|
|
57
60
|
* Props for the MasterDataInputField component
|