@e-llm-studio/instant-learning 1.3.21 → 1.3.23
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/ILMarketplaceWrapper.js +28 -2
- package/dist/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/ILMarketplaceWrapper.js +27 -1
- package/dist/cjs/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/schema-driven/BPARenderer.js +4 -3
- package/dist/cjs/schema-driven/BPARenderer.js.map +1 -1
- package/dist/cjs/schema-driven/components/FileUploadField.js +55 -10
- package/dist/cjs/schema-driven/components/FileUploadField.js.map +1 -1
- package/dist/cjs/schema-driven/components/RepeatableSectionField.js +12 -6
- package/dist/cjs/schema-driven/components/RepeatableSectionField.js.map +1 -1
- package/dist/cjs/schema-driven/hooks/useSectionEditSession.js +42 -3
- package/dist/cjs/schema-driven/hooks/useSectionEditSession.js.map +1 -1
- package/dist/cjs/schema-driven/hooks/useUnifiedEditSession.js +30 -3
- package/dist/cjs/schema-driven/hooks/useUnifiedEditSession.js.map +1 -1
- package/dist/cjs/schema-driven/types.js.map +1 -1
- package/dist/cjs/schema-driven/utils/fileUploadService.js +33 -0
- package/dist/cjs/schema-driven/utils/fileUploadService.js.map +1 -1
- package/dist/schema-driven/BPARenderer.js +4 -3
- package/dist/schema-driven/BPARenderer.js.map +1 -1
- package/dist/schema-driven/components/FileUploadField.js +57 -12
- package/dist/schema-driven/components/FileUploadField.js.map +1 -1
- package/dist/schema-driven/components/RepeatableSectionField.js +12 -6
- package/dist/schema-driven/components/RepeatableSectionField.js.map +1 -1
- package/dist/schema-driven/hooks/useSectionEditSession.js +42 -3
- package/dist/schema-driven/hooks/useSectionEditSession.js.map +1 -1
- package/dist/schema-driven/hooks/useUnifiedEditSession.js +30 -3
- package/dist/schema-driven/hooks/useUnifiedEditSession.js.map +1 -1
- package/dist/schema-driven/types.js.map +1 -1
- package/dist/schema-driven/utils/fileUploadService.js +33 -1
- package/dist/schema-driven/utils/fileUploadService.js.map +1 -1
- package/dist/types/src/ILMarketplaceMockTest.d.ts.map +1 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts +19 -2
- package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/schema-driven/BPARenderer.d.ts.map +1 -1
- package/dist/types/src/schema-driven/components/FileUploadField.d.ts +1 -1
- package/dist/types/src/schema-driven/components/FileUploadField.d.ts.map +1 -1
- package/dist/types/src/schema-driven/components/RepeatableSectionField.d.ts.map +1 -1
- package/dist/types/src/schema-driven/hooks/useSectionEditSession.d.ts.map +1 -1
- package/dist/types/src/schema-driven/hooks/useUnifiedEditSession.d.ts.map +1 -1
- package/dist/types/src/schema-driven/types.d.ts +3 -1
- package/dist/types/src/schema-driven/types.d.ts.map +1 -1
- package/dist/types/src/schema-driven/utils/fileUploadService.d.ts +21 -0
- package/dist/types/src/schema-driven/utils/fileUploadService.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -41,10 +41,11 @@ const RhsFieldAttentionWrapper = ({ fieldIds, children }) => {
|
|
|
41
41
|
style: {
|
|
42
42
|
// Keep the shadow inside the form's horizontal padding, rather than
|
|
43
43
|
// letting a hard outline be clipped by the scroll container.
|
|
44
|
-
margin: "
|
|
45
|
-
|
|
44
|
+
margin: "8px 14px",
|
|
45
|
+
// Leave a little air between the field surface and its glow.
|
|
46
|
+
padding: "6px",
|
|
46
47
|
// A generous radius keeps the glow from reading like a sharp frame.
|
|
47
|
-
borderRadius:
|
|
48
|
+
borderRadius: 10,
|
|
48
49
|
// Child field/layout surfaces are often white and rectangular. Clip
|
|
49
50
|
// them to this radius so they cannot square off the rounded glow.
|
|
50
51
|
overflow: isHighlighted ? "hidden" : "visible",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BPARenderer.js","sources":["../../../src/schema-driven/BPARenderer.tsx"],"sourcesContent":["// src/schema-driven/BPARenderer.tsx\nimport React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';\nimport { Lock } from 'lucide-react';\nimport { resolveRegistryComponentOrFallback, isContainerComponent } from '../ComponentRegistry';\nimport { SchemaFieldNode } from './types';\nimport { useDynamicFormStore } from './store/useDynamicFormStore';\nimport { DynamicFormContext } from './hooks/useParentEditEnabled';\nimport { isNodeLocked, LOCKED_IN_EDIT_FLOW_TOOLTIP } from './utils/editLock';\nimport { useUnifiedEditSession } from './hooks/useUnifiedEditSession';\nimport { RHS_FIELD_ATTENTION_EVENT, RhsFieldAttentionDetail } from '../features/IL-OTJ/helpers/rhsFieldAttention';\n\ninterface BPAFieldWrapperProps {\n node: SchemaFieldNode;\n id: string;\n tierKey?: string;\n variantIndex?: number;\n uiState?: any;\n state?: any;\n handlers?: any;\n contextOverrides?: any; // Allows parent layout components to inject draft state\n unifiedEditSession?: any;\n unifiedEditOwner?: boolean;\n renderChildren?: (childVariantIndex?: number, childOverrides?: any, childTierKey?: string) => React.ReactNode;\n}\n\nconst RhsFieldAttentionWrapper: React.FC<{\n fieldIds: string[];\n children: React.ReactNode;\n}> = ({ fieldIds, children }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const timerRef = useRef<number | undefined>(undefined);\n const fieldIdsKey = fieldIds.join('|');\n const [isHighlighted, setIsHighlighted] = useState(false);\n\n useEffect(() => {\n const handleAttention = (event: Event) => {\n const { fieldId } = (event as CustomEvent<RhsFieldAttentionDetail>).detail || {};\n if (!fieldId || !fieldIds.includes(fieldId)) return;\n\n setIsHighlighted(true);\n containerRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n window.clearTimeout(timerRef.current);\n timerRef.current = window.setTimeout(() => setIsHighlighted(false), 3000);\n };\n\n window.addEventListener(RHS_FIELD_ATTENTION_EVENT, handleAttention);\n return () => {\n window.removeEventListener(RHS_FIELD_ATTENTION_EVENT, handleAttention);\n window.clearTimeout(timerRef.current);\n };\n }, [fieldIdsKey]);\n\n return (\n <div\n ref={containerRef}\n data-rhs-field-ids={fieldIds.join(' ')}\n style={{\n // Keep the shadow inside the form's horizontal padding, rather than\n // letting a hard outline be clipped by the scroll container.\n margin: '6px 10px',\n padding: '2px 2px 2px 2px',\n // A generous radius keeps the glow from reading like a sharp frame.\n borderRadius: 6,\n // Child field/layout surfaces are often white and rectangular. Clip\n // them to this radius so they cannot square off the rounded glow.\n overflow: isHighlighted ? 'hidden' : 'visible',\n position: 'relative',\n zIndex: isHighlighted ? 1 : 'auto',\n transition: 'box-shadow 220ms ease, background-color 220ms ease',\n // No spread-radius ring: use a soft, layered purple glow instead.\n boxShadow: isHighlighted\n ? '0 0 14px 2px rgba(124, 58, 237, 0.28), 0 0 30px 8px rgba(124, 58, 237, 0.18)'\n : 'none',\n backgroundColor: isHighlighted ? 'rgba(124, 58, 237, 0.035)' : 'transparent',\n }}\n >\n {children}\n </div>\n );\n};\n\nconst BPAFieldWrapper: React.FC<BPAFieldWrapperProps> = ({ node, id, tierKey, variantIndex, uiState, state, handlers, contextOverrides, unifiedEditSession, unifiedEditOwner, renderChildren }) => {\n const { getGlobalField, getVariantField, setGlobalField, setVariantField, getGlobalReasoning, getVariantReasoning, getGlobalMirage, getVariantMirage } = useDynamicFormStore();\n\n if (node.hidden) return null;\n\n const dataKey = node.data_key || id;\n // INFERENCE: If there is no variant index, it MUST be a global field.\n const isGlobal = dataKey.startsWith('global.') || variantIndex === undefined;\n const cleanKey = dataKey.replace('global.', '');\n\n // A parent layout (e.g. the group-edit FlexRow, or GlobalSetupAccordion) can\n // inject draft state for this leaf via contextOverrides: `value`/`onChange`\n // redirect the field to the parent's draft, `readOnly` gates editability, and\n // `parentValueOverride` feeds a dependent dropdown the parent's DRAFT value so\n // it can re-filter before anything is committed to the store.\n // A form-wide session wins over a section session, which lets one Edit unlock\n // multiple parent sections without teaching every field component about it.\n const override = {\n ...contextOverrides?.[cleanKey],\n ...unifiedEditSession?.getOverride(node, cleanKey, tierKey, variantIndex),\n };\n\n // 1. Resolve Value (Prioritize contextOverrides for draft state, then Mirage display, then Zustand Store)\n // Mirage values are temporary display-only values shown from skeleton messages without being persisted to state.\n let value = override?.value !== undefined \n ? override.value \n : isGlobal \n ? (getGlobalMirage(cleanKey) ?? getGlobalField(cleanKey)) \n : (tierKey && variantIndex !== undefined ? (getVariantMirage(tierKey, variantIndex, cleanKey) ?? getVariantField(tierKey, variantIndex, cleanKey)) : undefined);\n\n // Track if this value is from a mirage (temporary display) for visual styling.\n const isMirage = isGlobal \n ? getGlobalMirage(cleanKey) !== undefined \n : (tierKey && variantIndex !== undefined ? getVariantMirage(tierKey, variantIndex, cleanKey) !== undefined : false);\n\n // Safe fallbacks to prevent undefined.length crashes\n if (value == null) {\n if (node.type === 'array') value = [];\n else if (node.type === 'boolean') value = false;\n else if (node.type === 'object') value = {};\n else value = '';\n }\n\n // AI cognitive-decision reasoning stripped out of this leaf's value on write\n // (see PayloadUtils.applyResponseToStore) — surfaced separately so field\n // renderers can show a \"why this value\" card next to the input.\n const citation = isGlobal\n ? getGlobalReasoning(cleanKey)\n : (tierKey && variantIndex !== undefined ? getVariantReasoning(tierKey, variantIndex, cleanKey) : undefined);\n\n // 2. Generic OnChange Handler\n const onChange = (newValue: any) => {\n const finalValue = newValue?.target?.value !== undefined ? newValue.target.value : newValue;\n \n // Draft bindings may come from a local layout or the form-wide unified session.\n // Use the resolved override (not only contextOverrides) so both paths write to\n // their draft instead of prematurely committing to the store.\n if (override?.onChange) {\n override.onChange(finalValue);\n return;\n }\n\n if (isGlobal) setGlobalField(cleanKey, finalValue);\n else if (tierKey && variantIndex !== undefined) setVariantField(tierKey, variantIndex, cleanKey, finalValue);\n };\n\n // 3. Generic Array Handlers\n const arrayHandlers = node.type === 'array' ? {\n onAdd: () => onChange([...(value || []), { id: Date.now(), text: '' }]),\n onRemove: (tk: string, idx: number, cId: number | string) => onChange((value || []).filter((item: any) => item.id !== cId)),\n onEdit: (tk: string, idx: number, cId: number | string, text: string) => onChange((value || []).map((item: any) => item.id === cId ? { ...item, text } : item))\n } : {};\n\n const isAiStreaming = uiState?.isAiStreaming;\n // A parent-injected readOnly (group-edit gating) wins over the schema default.\n const readOnly = override?.readOnly !== undefined ? override.readOnly : (node.read_only || isAiStreaming);\n // `read_only_in_edit_flow`: frozen once the rule exists. Beats every other gate,\n // including a parent edit session's injected draft bindings (applied below, after\n // the `{...override}` spread, so an open session can't hand this field an editor).\n const lockedInEditFlow = isNodeLocked(node, uiState);\n const errorMessage = uiState?.validationErrors?.[cleanKey];\n const Component = resolveRegistryComponentOrFallback(node.bpa_ui_component);\n\n // Built as a variable (not inline in JSX) so it spreads last and wins, without\n // TS flagging the intentional duplicate keys.\n const lockedProps: Record<string, any> = lockedInEditFlow\n ? {\n readOnly: true,\n enableInlineEdit: false,\n hideEditControls: true,\n parentEditing: false,\n value,\n onChange: undefined,\n lockedInEditFlow: true,\n lockedTooltip: LOCKED_IN_EDIT_FLOW_TOOLTIP,\n }\n : {};\n\n const rendered = (\n <Suspense fallback={<div style={{ padding: 12, fontSize: 13, color: 'var(--il-muted, #9ca3af)' }}>Loading...</div>}>\n <Component \n id={id}\n schema={node}\n title={node.title}\n description={node.description}\n // Optional helper copy rendered under the field's title. Distinct from\n // `description`, which is the AI-facing authoring guideline in the JSON.\n subtitle={(node as any).subtitle}\n fieldName={node.title}\n placeholder={node.placeholder}\n maxLength={node.maxLength}\n required={node.is_required}\n tooltipDescription={node.tooltip || \"No tooltip provided.\"}\n value={value}\n onChange={onChange}\n citation={citation}\n readOnly={readOnly}\n enableInlineEdit={!node.read_only}\n enableViewToggle={(node as any).bpa_ui_view_toggle}\n accept={(node as any).accept}\n uploadType={(node as any).upload_type}\n maxUploads={(node as any).max_uploads}\n maxSize={(node as any).max_size}\n bordered={(node as any).bordered}\n collapsible={(node as any).collapsible}\n defaultOpen={(node as any).default_open ?? (node as any).defaultOpen}\n errorMessage={errorMessage}\n isAiStreaming={isAiStreaming}\n uiState={uiState}\n state={state}\n handlers={handlers}\n tierKey={tierKey}\n variantIndex={variantIndex}\n activeEditId={uiState?.activeEditId}\n setActiveEditId={uiState?.setActiveEditId}\n pendingEditId={uiState?.pendingEditId}\n setPendingEditId={uiState?.setPendingEditId}\n setSendMessageInChat={uiState?.setSendMessageInChat}\n renderChildren={renderChildren} // Pass the children renderer down to the layout component!\n parentValueOverride={override?.parentValueOverride} // draft parent value for dependent dropdowns\n // Container components need to see the overrides aimed at their DESCENDANTS\n // (keyed by leaf data_key, so they never appear in this node's own `override`)\n // to tell whether an ancestor edit session already governs their children.\n contextOverrides={contextOverrides}\n unifiedEditSession={unifiedEditSession}\n unifiedEditOwner={unifiedEditOwner}\n {...arrayHandlers}\n conditions={node.type === 'array' ? value : undefined}\n isMirage={isMirage} // Flag indicating this value is a temporary mirage display, not persisted state\n {...override} // Let a parent layout (e.g. a variant edit session) inject extra props —\n // hideEditControls, parentEditing, conditions, onAdd/onRemove/onEdit, enableInlineEdit —\n // without BPAFieldWrapper needing to know each field-specific prop name.\n // Frozen fields override whatever the session injected: no value/onChange\n // redirection to a draft, no pencil, no editable surface.\n {...lockedProps}\n >\n {/* Fallback for simple containers that don't explicitly call renderChildren */}\n {isContainerComponent(node.bpa_ui_component) && renderChildren ? renderChildren() : null}\n </Component>\n </Suspense>\n );\n\n const attentionWrapped = (\n <RhsFieldAttentionWrapper fieldIds={[id, dataKey, cleanKey]}>\n {rendered}\n </RhsFieldAttentionWrapper>\n );\n\n if (!lockedInEditFlow) return attentionWrapped;\n\n // The parent section/variant is mid-edit but this field is frozen — say so, rather\n // than leaving an inert input the user keeps clicking. `title` carries the same copy\n // as a native tooltip on the field itself.\n const parentIsEditing = !!override?.parentEditing || override?.readOnly === false;\n\n return (\n <div title={LOCKED_IN_EDIT_FLOW_TOOLTIP} style={{ position: 'relative', opacity: 0.85 }}>\n {parentIsEditing && (\n <div\n style={{\n display: 'flex', alignItems: 'center', gap: 6, marginBottom: 6,\n padding: '4px 8px', borderRadius: 6, width: 'fit-content',\n background: 'var(--il-secondary-bg, #f1f5f9)', border: '1px solid var(--il-border, #E2E8F0)',\n color: 'var(--il-muted, #64748B)', fontSize: 12, fontWeight: 500,\n fontFamily: '\"Plus Jakarta Sans\", sans-serif',\n }}\n >\n <Lock size={12} /> {LOCKED_IN_EDIT_FLOW_TOOLTIP}\n </div>\n )}\n {attentionWrapped}\n </div>\n );\n};\n\n// --- THE RECURSIVE RENDERER ---\ninterface BPARendererProps {\n properties: Record<string, SchemaFieldNode>;\n tierKey?: string;\n variantIndex?: number;\n uiState?: any;\n state?: any;\n handlers?: any;\n contextOverrides?: any;\n /** Root-schema `unified_edit`: one draft over all parent sections. */\n unifiedEdit?: boolean;\n /** Internal: retains the root draft while recursively rendering containers. */\n unifiedEditSession?: any;\n}\n\nexport const BPARenderer: React.FC<BPARendererProps> = ({ properties, tierKey, variantIndex, uiState, state, handlers, contextOverrides, unifiedEdit = false, unifiedEditSession }) => {\n const unifiedSession = useUnifiedEditSession(properties, uiState, state);\n const activeUnifiedSession = unifiedEditSession || (unifiedEdit ? unifiedSession : undefined);\n const sortedProps = useMemo(() => {\n if (!properties) return [];\n return Object.entries(properties).sort(([, a], [, b]) => \n ((a as SchemaFieldNode).ui_position ?? 0) - ((b as SchemaFieldNode).ui_position ?? 0)\n );\n }, [properties]);\n\n const renderedFields = (\n // Marks everything below as the dynamic-form mount, so registry components\n // that are ALSO used by legacy CreateRule can pick the right edit gate\n // (see useParentEditEnabled).\n <DynamicFormContext.Provider value={true}>\n {sortedProps.map(([key, rawNode], index) => {\n const node = rawNode as SchemaFieldNode;\n\n // Function that layout components (like VariantListWrapper) can call to trigger rendering of nested properties.\n // A variant list passes its resolved tierKey so nested fields read/write the\n // right variantData[tierKey][index] slot (not the outer, possibly-undefined tier).\n const renderChildren = (childVariantIndex?: number, childOverrides?: any, childTierKey?: string) => {\n if (!node.properties) return null;\n return (\n <BPARenderer\n properties={node.properties}\n tierKey={childTierKey !== undefined ? childTierKey : tierKey}\n variantIndex={childVariantIndex !== undefined ? childVariantIndex : variantIndex}\n uiState={uiState}\n state={state}\n handlers={handlers}\n // Preserve a form-wide session while allowing a local layout to add\n // its own bindings. Local bindings are still available in non-unified mode.\n contextOverrides={{ ...contextOverrides, ...childOverrides }}\n unifiedEditSession={activeUnifiedSession}\n />\n );\n };\n\n // Notice we DO NOT loop over variants here. We render the Wrapper once and give it `renderChildren`.\n return (\n <BPAFieldWrapper \n key={key} \n id={key} \n node={node} \n tierKey={tierKey} \n variantIndex={variantIndex} \n uiState={uiState} \n state={state} \n handlers={handlers} \n contextOverrides={contextOverrides}\n unifiedEditSession={activeUnifiedSession}\n // The first root section keeps the familiar header action and owns the\n // shared form-wide session. Other sections only receive its bindings.\n unifiedEditOwner={unifiedEdit && index === 0}\n renderChildren={renderChildren} \n />\n );\n })}\n </DynamicFormContext.Provider>\n );\n\n // The modal's click-capture guard permits interactions only inside the active\n // edit zone. Unified mode uses its own active id, so expose one matching root\n // zone; otherwise Save/Cancel and every child control are intercepted as an\n // outside click before their handlers run.\n return unifiedEdit ? <div data-edit-id=\"unified-form-edit\">{renderedFields}</div> : renderedFields;\n};\n"],"names":["useRef","useState","useEffect","RHS_FIELD_ATTENTION_EVENT","jsx","useDynamicFormStore","_a","isNodeLocked","resolveRegistryComponentOrFallback","LOCKED_IN_EDIT_FLOW_TOOLTIP","Suspense","jsxs","Lock","useUnifiedEditSession","useMemo","DynamicFormContext"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,wBAGD,GAAA,CAAC,EAAE,QAAA,EAAU,UAAe,KAAA;AAC/B,EAAM,MAAA,YAAA,GAAeA,aAAuB,IAAI,CAAA,CAAA;AAChD,EAAM,MAAA,QAAA,GAAWA,aAA2B,KAAS,CAAA,CAAA,CAAA;AACrD,EAAM,MAAA,WAAA,GAAc,QAAS,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACrC,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAIC,eAAS,KAAK,CAAA,CAAA;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;AAAA,UACJ,IAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA,OAAA;AAAA,UACA,KAAA;AAAA,UACA,QAAA;AAAA,UACA,gBAAA;AAAA,UACA,kBAAoB,EAAA,oBAAA;AAAA,UAGpB,gBAAA,EAAkB,eAAe,KAAU,KAAA,CAAA;AAAA,UAC3C,cAAA;AAAA,SAAA;AAAA,QAbK,GAAA;AAAA,OAcP,CAAA;AAAA,KAEH,CACH,EAAA,CAAA;AAAA,GAAA,CAAA;AAOF,EAAA,OAAO,8BAAeA,cAAA,CAAA,KAAA,EAAA,EAAI,cAAa,EAAA,mBAAA,EAAqB,0BAAe,CAAS,GAAA,cAAA,CAAA;AACtF;;;;"}
|
|
1
|
+
{"version":3,"file":"BPARenderer.js","sources":["../../../src/schema-driven/BPARenderer.tsx"],"sourcesContent":["// src/schema-driven/BPARenderer.tsx\nimport React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';\nimport { Lock } from 'lucide-react';\nimport { resolveRegistryComponentOrFallback, isContainerComponent } from '../ComponentRegistry';\nimport { SchemaFieldNode } from './types';\nimport { useDynamicFormStore } from './store/useDynamicFormStore';\nimport { DynamicFormContext } from './hooks/useParentEditEnabled';\nimport { isNodeLocked, LOCKED_IN_EDIT_FLOW_TOOLTIP } from './utils/editLock';\nimport { useUnifiedEditSession } from './hooks/useUnifiedEditSession';\nimport { RHS_FIELD_ATTENTION_EVENT, RhsFieldAttentionDetail } from '../features/IL-OTJ/helpers/rhsFieldAttention';\n\ninterface BPAFieldWrapperProps {\n node: SchemaFieldNode;\n id: string;\n tierKey?: string;\n variantIndex?: number;\n uiState?: any;\n state?: any;\n handlers?: any;\n contextOverrides?: any; // Allows parent layout components to inject draft state\n unifiedEditSession?: any;\n unifiedEditOwner?: boolean;\n renderChildren?: (childVariantIndex?: number, childOverrides?: any, childTierKey?: string) => React.ReactNode;\n}\n\nconst RhsFieldAttentionWrapper: React.FC<{\n fieldIds: string[];\n children: React.ReactNode;\n}> = ({ fieldIds, children }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const timerRef = useRef<number | undefined>(undefined);\n const fieldIdsKey = fieldIds.join('|');\n const [isHighlighted, setIsHighlighted] = useState(false);\n\n useEffect(() => {\n const handleAttention = (event: Event) => {\n const { fieldId } = (event as CustomEvent<RhsFieldAttentionDetail>).detail || {};\n if (!fieldId || !fieldIds.includes(fieldId)) return;\n\n setIsHighlighted(true);\n containerRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n window.clearTimeout(timerRef.current);\n timerRef.current = window.setTimeout(() => setIsHighlighted(false), 3000);\n };\n\n window.addEventListener(RHS_FIELD_ATTENTION_EVENT, handleAttention);\n return () => {\n window.removeEventListener(RHS_FIELD_ATTENTION_EVENT, handleAttention);\n window.clearTimeout(timerRef.current);\n };\n }, [fieldIdsKey]);\n\n return (\n <div\n ref={containerRef}\n data-rhs-field-ids={fieldIds.join(' ')}\n style={{\n // Keep the shadow inside the form's horizontal padding, rather than\n // letting a hard outline be clipped by the scroll container.\n margin: '8px 14px',\n // Leave a little air between the field surface and its glow.\n padding: '6px',\n // A generous radius keeps the glow from reading like a sharp frame.\n borderRadius: 10,\n // Child field/layout surfaces are often white and rectangular. Clip\n // them to this radius so they cannot square off the rounded glow.\n overflow: isHighlighted ? 'hidden' : 'visible',\n position: 'relative',\n zIndex: isHighlighted ? 1 : 'auto',\n transition: 'box-shadow 220ms ease, background-color 220ms ease',\n // No spread-radius ring: use a soft, layered purple glow instead.\n boxShadow: isHighlighted\n ? '0 0 14px 2px rgba(124, 58, 237, 0.28), 0 0 30px 8px rgba(124, 58, 237, 0.18)'\n : 'none',\n backgroundColor: isHighlighted ? 'rgba(124, 58, 237, 0.035)' : 'transparent',\n }}\n >\n {children}\n </div>\n );\n};\n\nconst BPAFieldWrapper: React.FC<BPAFieldWrapperProps> = ({ node, id, tierKey, variantIndex, uiState, state, handlers, contextOverrides, unifiedEditSession, unifiedEditOwner, renderChildren }) => {\n const { getGlobalField, getVariantField, setGlobalField, setVariantField, getGlobalReasoning, getVariantReasoning, getGlobalMirage, getVariantMirage } = useDynamicFormStore();\n\n if (node.hidden) return null;\n\n const dataKey = node.data_key || id;\n // INFERENCE: If there is no variant index, it MUST be a global field.\n const isGlobal = dataKey.startsWith('global.') || variantIndex === undefined;\n const cleanKey = dataKey.replace('global.', '');\n\n // A parent layout (e.g. the group-edit FlexRow, or GlobalSetupAccordion) can\n // inject draft state for this leaf via contextOverrides: `value`/`onChange`\n // redirect the field to the parent's draft, `readOnly` gates editability, and\n // `parentValueOverride` feeds a dependent dropdown the parent's DRAFT value so\n // it can re-filter before anything is committed to the store.\n // A form-wide session wins over a section session, which lets one Edit unlock\n // multiple parent sections without teaching every field component about it.\n const override = {\n ...contextOverrides?.[cleanKey],\n ...unifiedEditSession?.getOverride(node, cleanKey, tierKey, variantIndex),\n };\n\n // 1. Resolve Value (Prioritize contextOverrides for draft state, then Mirage display, then Zustand Store)\n // Mirage values are temporary display-only values shown from skeleton messages without being persisted to state.\n let value = override?.value !== undefined \n ? override.value \n : isGlobal \n ? (getGlobalMirage(cleanKey) ?? getGlobalField(cleanKey)) \n : (tierKey && variantIndex !== undefined ? (getVariantMirage(tierKey, variantIndex, cleanKey) ?? getVariantField(tierKey, variantIndex, cleanKey)) : undefined);\n\n // Track if this value is from a mirage (temporary display) for visual styling.\n const isMirage = isGlobal \n ? getGlobalMirage(cleanKey) !== undefined \n : (tierKey && variantIndex !== undefined ? getVariantMirage(tierKey, variantIndex, cleanKey) !== undefined : false);\n\n // Safe fallbacks to prevent undefined.length crashes\n if (value == null) {\n if (node.type === 'array') value = [];\n else if (node.type === 'boolean') value = false;\n else if (node.type === 'object') value = {};\n else value = '';\n }\n\n // AI cognitive-decision reasoning stripped out of this leaf's value on write\n // (see PayloadUtils.applyResponseToStore) — surfaced separately so field\n // renderers can show a \"why this value\" card next to the input.\n const citation = isGlobal\n ? getGlobalReasoning(cleanKey)\n : (tierKey && variantIndex !== undefined ? getVariantReasoning(tierKey, variantIndex, cleanKey) : undefined);\n\n // 2. Generic OnChange Handler\n const onChange = (newValue: any) => {\n const finalValue = newValue?.target?.value !== undefined ? newValue.target.value : newValue;\n \n // Draft bindings may come from a local layout or the form-wide unified session.\n // Use the resolved override (not only contextOverrides) so both paths write to\n // their draft instead of prematurely committing to the store.\n if (override?.onChange) {\n override.onChange(finalValue);\n return;\n }\n\n if (isGlobal) setGlobalField(cleanKey, finalValue);\n else if (tierKey && variantIndex !== undefined) setVariantField(tierKey, variantIndex, cleanKey, finalValue);\n };\n\n // 3. Generic Array Handlers\n const arrayHandlers = node.type === 'array' ? {\n onAdd: () => onChange([...(value || []), { id: Date.now(), text: '' }]),\n onRemove: (tk: string, idx: number, cId: number | string) => onChange((value || []).filter((item: any) => item.id !== cId)),\n onEdit: (tk: string, idx: number, cId: number | string, text: string) => onChange((value || []).map((item: any) => item.id === cId ? { ...item, text } : item))\n } : {};\n\n const isAiStreaming = uiState?.isAiStreaming;\n // A parent-injected readOnly (group-edit gating) wins over the schema default.\n const readOnly = override?.readOnly !== undefined ? override.readOnly : (node.read_only || isAiStreaming);\n // `read_only_in_edit_flow`: frozen once the rule exists. Beats every other gate,\n // including a parent edit session's injected draft bindings (applied below, after\n // the `{...override}` spread, so an open session can't hand this field an editor).\n const lockedInEditFlow = isNodeLocked(node, uiState);\n const errorMessage = uiState?.validationErrors?.[cleanKey];\n const Component = resolveRegistryComponentOrFallback(node.bpa_ui_component);\n\n // Built as a variable (not inline in JSX) so it spreads last and wins, without\n // TS flagging the intentional duplicate keys.\n const lockedProps: Record<string, any> = lockedInEditFlow\n ? {\n readOnly: true,\n enableInlineEdit: false,\n hideEditControls: true,\n parentEditing: false,\n value,\n onChange: undefined,\n lockedInEditFlow: true,\n lockedTooltip: LOCKED_IN_EDIT_FLOW_TOOLTIP,\n }\n : {};\n\n const rendered = (\n <Suspense fallback={<div style={{ padding: 12, fontSize: 13, color: 'var(--il-muted, #9ca3af)' }}>Loading...</div>}>\n <Component \n id={id}\n schema={node}\n title={node.title}\n description={node.description}\n // Optional helper copy rendered under the field's title. Distinct from\n // `description`, which is the AI-facing authoring guideline in the JSON.\n subtitle={(node as any).subtitle}\n fieldName={node.title}\n placeholder={node.placeholder}\n maxLength={node.maxLength}\n required={node.is_required}\n tooltipDescription={node.tooltip || \"No tooltip provided.\"}\n value={value}\n onChange={onChange}\n citation={citation}\n readOnly={readOnly}\n enableInlineEdit={!node.read_only}\n enableViewToggle={(node as any).bpa_ui_view_toggle}\n accept={(node as any).accept}\n uploadType={(node as any).upload_type}\n maxUploads={(node as any).max_uploads}\n maxSize={(node as any).max_size}\n bordered={(node as any).bordered}\n collapsible={(node as any).collapsible}\n defaultOpen={(node as any).default_open ?? (node as any).defaultOpen}\n errorMessage={errorMessage}\n isAiStreaming={isAiStreaming}\n uiState={uiState}\n state={state}\n handlers={handlers}\n tierKey={tierKey}\n variantIndex={variantIndex}\n activeEditId={uiState?.activeEditId}\n setActiveEditId={uiState?.setActiveEditId}\n pendingEditId={uiState?.pendingEditId}\n setPendingEditId={uiState?.setPendingEditId}\n setSendMessageInChat={uiState?.setSendMessageInChat}\n renderChildren={renderChildren} // Pass the children renderer down to the layout component!\n parentValueOverride={override?.parentValueOverride} // draft parent value for dependent dropdowns\n // Container components need to see the overrides aimed at their DESCENDANTS\n // (keyed by leaf data_key, so they never appear in this node's own `override`)\n // to tell whether an ancestor edit session already governs their children.\n contextOverrides={contextOverrides}\n unifiedEditSession={unifiedEditSession}\n unifiedEditOwner={unifiedEditOwner}\n {...arrayHandlers}\n conditions={node.type === 'array' ? value : undefined}\n isMirage={isMirage} // Flag indicating this value is a temporary mirage display, not persisted state\n {...override} // Let a parent layout (e.g. a variant edit session) inject extra props —\n // hideEditControls, parentEditing, conditions, onAdd/onRemove/onEdit, enableInlineEdit —\n // without BPAFieldWrapper needing to know each field-specific prop name.\n // Frozen fields override whatever the session injected: no value/onChange\n // redirection to a draft, no pencil, no editable surface.\n {...lockedProps}\n >\n {/* Fallback for simple containers that don't explicitly call renderChildren */}\n {isContainerComponent(node.bpa_ui_component) && renderChildren ? renderChildren() : null}\n </Component>\n </Suspense>\n );\n\n const attentionWrapped = (\n <RhsFieldAttentionWrapper fieldIds={[id, dataKey, cleanKey]}>\n {rendered}\n </RhsFieldAttentionWrapper>\n );\n\n if (!lockedInEditFlow) return attentionWrapped;\n\n // The parent section/variant is mid-edit but this field is frozen — say so, rather\n // than leaving an inert input the user keeps clicking. `title` carries the same copy\n // as a native tooltip on the field itself.\n const parentIsEditing = !!override?.parentEditing || override?.readOnly === false;\n\n return (\n <div title={LOCKED_IN_EDIT_FLOW_TOOLTIP} style={{ position: 'relative', opacity: 0.85 }}>\n {parentIsEditing && (\n <div\n style={{\n display: 'flex', alignItems: 'center', gap: 6, marginBottom: 6,\n padding: '4px 8px', borderRadius: 6, width: 'fit-content',\n background: 'var(--il-secondary-bg, #f1f5f9)', border: '1px solid var(--il-border, #E2E8F0)',\n color: 'var(--il-muted, #64748B)', fontSize: 12, fontWeight: 500,\n fontFamily: '\"Plus Jakarta Sans\", sans-serif',\n }}\n >\n <Lock size={12} /> {LOCKED_IN_EDIT_FLOW_TOOLTIP}\n </div>\n )}\n {attentionWrapped}\n </div>\n );\n};\n\n// --- THE RECURSIVE RENDERER ---\ninterface BPARendererProps {\n properties: Record<string, SchemaFieldNode>;\n tierKey?: string;\n variantIndex?: number;\n uiState?: any;\n state?: any;\n handlers?: any;\n contextOverrides?: any;\n /** Root-schema `unified_edit`: one draft over all parent sections. */\n unifiedEdit?: boolean;\n /** Internal: retains the root draft while recursively rendering containers. */\n unifiedEditSession?: any;\n}\n\nexport const BPARenderer: React.FC<BPARendererProps> = ({ properties, tierKey, variantIndex, uiState, state, handlers, contextOverrides, unifiedEdit = false, unifiedEditSession }) => {\n const unifiedSession = useUnifiedEditSession(properties, uiState, state);\n const activeUnifiedSession = unifiedEditSession || (unifiedEdit ? unifiedSession : undefined);\n const sortedProps = useMemo(() => {\n if (!properties) return [];\n return Object.entries(properties).sort(([, a], [, b]) => \n ((a as SchemaFieldNode).ui_position ?? 0) - ((b as SchemaFieldNode).ui_position ?? 0)\n );\n }, [properties]);\n\n const renderedFields = (\n // Marks everything below as the dynamic-form mount, so registry components\n // that are ALSO used by legacy CreateRule can pick the right edit gate\n // (see useParentEditEnabled).\n <DynamicFormContext.Provider value={true}>\n {sortedProps.map(([key, rawNode], index) => {\n const node = rawNode as SchemaFieldNode;\n\n // Function that layout components (like VariantListWrapper) can call to trigger rendering of nested properties.\n // A variant list passes its resolved tierKey so nested fields read/write the\n // right variantData[tierKey][index] slot (not the outer, possibly-undefined tier).\n const renderChildren = (childVariantIndex?: number, childOverrides?: any, childTierKey?: string) => {\n if (!node.properties) return null;\n return (\n <BPARenderer\n properties={node.properties}\n tierKey={childTierKey !== undefined ? childTierKey : tierKey}\n variantIndex={childVariantIndex !== undefined ? childVariantIndex : variantIndex}\n uiState={uiState}\n state={state}\n handlers={handlers}\n // Preserve a form-wide session while allowing a local layout to add\n // its own bindings. Local bindings are still available in non-unified mode.\n contextOverrides={{ ...contextOverrides, ...childOverrides }}\n unifiedEditSession={activeUnifiedSession}\n />\n );\n };\n\n // Notice we DO NOT loop over variants here. We render the Wrapper once and give it `renderChildren`.\n return (\n <BPAFieldWrapper \n key={key} \n id={key} \n node={node} \n tierKey={tierKey} \n variantIndex={variantIndex} \n uiState={uiState} \n state={state} \n handlers={handlers} \n contextOverrides={contextOverrides}\n unifiedEditSession={activeUnifiedSession}\n // The first root section keeps the familiar header action and owns the\n // shared form-wide session. Other sections only receive its bindings.\n unifiedEditOwner={unifiedEdit && index === 0}\n renderChildren={renderChildren} \n />\n );\n })}\n </DynamicFormContext.Provider>\n );\n\n // The modal's click-capture guard permits interactions only inside the active\n // edit zone. Unified mode uses its own active id, so expose one matching root\n // zone; otherwise Save/Cancel and every child control are intercepted as an\n // outside click before their handlers run.\n return unifiedEdit ? <div data-edit-id=\"unified-form-edit\">{renderedFields}</div> : renderedFields;\n};\n"],"names":["useRef","useState","useEffect","RHS_FIELD_ATTENTION_EVENT","jsx","useDynamicFormStore","_a","isNodeLocked","resolveRegistryComponentOrFallback","LOCKED_IN_EDIT_FLOW_TOOLTIP","Suspense","jsxs","Lock","useUnifiedEditSession","useMemo","DynamicFormContext"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,wBAGD,GAAA,CAAC,EAAE,QAAA,EAAU,UAAe,KAAA;AAC/B,EAAM,MAAA,YAAA,GAAeA,aAAuB,IAAI,CAAA,CAAA;AAChD,EAAM,MAAA,QAAA,GAAWA,aAA2B,KAAS,CAAA,CAAA,CAAA;AACrD,EAAM,MAAA,WAAA,GAAc,QAAS,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACrC,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAIC,eAAS,KAAK,CAAA,CAAA;AAExD,EAAAC,eAAA,CAAU,MAAM;AACd,IAAM,MAAA,eAAA,GAAkB,CAAC,KAAiB,KAAA;AAnC9C,MAAA,IAAA,EAAA,CAAA;AAoCM,MAAA,MAAM,EAAE,OAAA,EAAa,GAAA,KAAA,CAA+C,UAAU,EAAC,CAAA;AAC/E,MAAA,IAAI,CAAC,OAAW,IAAA,CAAC,QAAS,CAAA,QAAA,CAAS,OAAO,CAAG,EAAA,OAAA;AAE7C,MAAA,gBAAA,CAAiB,IAAI,CAAA,CAAA;AACrB,MAAA,CAAA,EAAA,GAAA,YAAA,CAAa,YAAb,IAAsB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,cAAA,CAAe,EAAE,QAAU,EAAA,QAAA,EAAU,OAAO,QAAS,EAAA,CAAA,CAAA;AAC3E,MAAO,MAAA,CAAA,YAAA,CAAa,SAAS,OAAO,CAAA,CAAA;AACpC,MAAA,QAAA,CAAS,UAAU,MAAO,CAAA,UAAA,CAAW,MAAM,gBAAiB,CAAA,KAAK,GAAG,GAAI,CAAA,CAAA;AAAA,KAC1E,CAAA;AAEA,IAAO,MAAA,CAAA,gB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CAAA;AAC7B,QACE,uBAAAX,cAAA;AAAA,UAAC,WAAA;AAAA,UAAA;AAAA,YACC,YAAY,IAAK,CAAA,UAAA;AAAA,YACjB,OAAA,EAAS,YAAiB,KAAA,KAAA,CAAA,GAAY,YAAe,GAAA,OAAA;AAAA,YACrD,YAAA,EAAc,iBAAsB,KAAA,KAAA,CAAA,GAAY,iBAAoB,GAAA,YAAA;AAAA,YACpE,OAAA;AAAA,YACA,KAAA;AAAA,YACA,QAAA;AAAA,YAGA,gBAAkB,EAAA,EAAE,GAAG,gBAAA,EAAkB,GAAG,cAAe,EAAA;AAAA,YAC3D,kBAAoB,EAAA,oBAAA;AAAA,WAAA;AAAA,SACtB,CAAA;AAAA,OAEL,CAAA;AAGA,MACE,uBAAAA,cAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UAEC,EAAI,EAAA,GAAA;AAAA,UACJ,IAAA;AAAA,UACA,OAAA;AAAA,UACA,YAAA;AAAA,UACA,OAAA;AAAA,UACA,KAAA;AAAA,UACA,QAAA;AAAA,UACA,gBAAA;AAAA,UACA,kBAAoB,EAAA,oBAAA;AAAA,UAGpB,gBAAA,EAAkB,eAAe,KAAU,KAAA,CAAA;AAAA,UAC3C,cAAA;AAAA,SAAA;AAAA,QAbK,GAAA;AAAA,OAcP,CAAA;AAAA,KAEH,CACH,EAAA,CAAA;AAAA,GAAA,CAAA;AAOF,EAAA,OAAO,8BAAeA,cAAA,CAAA,KAAA,EAAA,EAAI,cAAa,EAAA,mBAAA,EAAqB,0BAAe,CAAS,GAAA,cAAA,CAAA;AACtF;;;;"}
|
|
@@ -83,6 +83,8 @@ function FileUploadField(props) {
|
|
|
83
83
|
const [formatWarning, setFormatWarning] = React.useState(null);
|
|
84
84
|
const [sizeWarning, setSizeWarning] = React.useState(null);
|
|
85
85
|
const [limitWarning, setLimitWarning] = React.useState(null);
|
|
86
|
+
const [deleteWarning, setDeleteWarning] = React.useState(null);
|
|
87
|
+
const [deletingFileIds, setDeletingFileIds] = React.useState(() => /* @__PURE__ */ new Set());
|
|
86
88
|
const fileInputRef = React.useRef(null);
|
|
87
89
|
const { getGlobalField, getVariantField, clearAllMirages, getGlobalMirage, getVariantMirage } = useDynamicFormStore.useDynamicFormStore();
|
|
88
90
|
const dataKey = (schema == null ? void 0 : schema.data_key) || id;
|
|
@@ -263,6 +265,7 @@ function FileUploadField(props) {
|
|
|
263
265
|
setFormatWarning(null);
|
|
264
266
|
setSizeWarning(null);
|
|
265
267
|
setLimitWarning(null);
|
|
268
|
+
setDeleteWarning(null);
|
|
266
269
|
const remainingSlots = isFinite(effectiveMaxUploads) ? Math.max(0, effectiveMaxUploads - filesList.length) : Infinity;
|
|
267
270
|
if (remainingSlots <= 0) {
|
|
268
271
|
setLimitWarning(
|
|
@@ -477,18 +480,56 @@ function FileUploadField(props) {
|
|
|
477
480
|
if (!isEditing) return;
|
|
478
481
|
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
479
482
|
};
|
|
480
|
-
const
|
|
483
|
+
const handleDeleteFile = async (file, e) => {
|
|
481
484
|
e.stopPropagation();
|
|
482
485
|
if (!isEditing || !onChange) return;
|
|
486
|
+
if (deletingFileIds.has(file.id)) return;
|
|
483
487
|
setDuplicateWarning(null);
|
|
484
488
|
setFormatWarning(null);
|
|
485
489
|
setSizeWarning(null);
|
|
486
490
|
setLimitWarning(null);
|
|
491
|
+
setDeleteWarning(null);
|
|
487
492
|
if (fileInputRef.current) {
|
|
488
493
|
fileInputRef.current.value = "";
|
|
489
494
|
}
|
|
490
|
-
|
|
491
|
-
|
|
495
|
+
if (!file.url) {
|
|
496
|
+
if (file.status === "error") {
|
|
497
|
+
onChange(filesList.filter((item) => item.id !== file.id));
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
setDeleteWarning(`Cannot delete "${file.name}": its storage path is unavailable.`);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
setDeletingFileIds((currentIds) => new Set(currentIds).add(file.id));
|
|
504
|
+
try {
|
|
505
|
+
const result = await fileUploadService.deleteFileFromGCS({
|
|
506
|
+
projectId: resolvedProjectId || "",
|
|
507
|
+
fileUrl: file.url,
|
|
508
|
+
token: resolvedToken
|
|
509
|
+
});
|
|
510
|
+
if (result.error) {
|
|
511
|
+
setDeleteWarning(`Failed to delete "${file.name}": ${result.error.errorMessage}`);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (file.url) {
|
|
515
|
+
setSignedUrlMap((currentUrls) => {
|
|
516
|
+
const nextUrls = { ...currentUrls };
|
|
517
|
+
delete nextUrls[file.url];
|
|
518
|
+
return nextUrls;
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
onChange(filesList.filter((item) => item.id !== file.id));
|
|
522
|
+
} catch (error) {
|
|
523
|
+
setDeleteWarning(
|
|
524
|
+
`Failed to delete "${file.name}": ${(error == null ? void 0 : error.message) || "Unexpected error"}`
|
|
525
|
+
);
|
|
526
|
+
} finally {
|
|
527
|
+
setDeletingFileIds((currentIds) => {
|
|
528
|
+
const nextIds = new Set(currentIds);
|
|
529
|
+
nextIds.delete(file.id);
|
|
530
|
+
return nextIds;
|
|
531
|
+
});
|
|
532
|
+
}
|
|
492
533
|
};
|
|
493
534
|
const inlineSnapshotRef = React.useRef(null);
|
|
494
535
|
const handleInlineStart = () => {
|
|
@@ -496,6 +537,7 @@ function FileUploadField(props) {
|
|
|
496
537
|
setFormatWarning(null);
|
|
497
538
|
setSizeWarning(null);
|
|
498
539
|
setLimitWarning(null);
|
|
540
|
+
setDeleteWarning(null);
|
|
499
541
|
inlineSnapshotRef.current = JSON.parse(JSON.stringify(filesList));
|
|
500
542
|
setActiveEditId == null ? void 0 : setActiveEditId(id);
|
|
501
543
|
};
|
|
@@ -508,6 +550,7 @@ function FileUploadField(props) {
|
|
|
508
550
|
setFormatWarning(null);
|
|
509
551
|
setSizeWarning(null);
|
|
510
552
|
setLimitWarning(null);
|
|
553
|
+
setDeleteWarning(null);
|
|
511
554
|
setActiveEditId == null ? void 0 : setActiveEditId(null);
|
|
512
555
|
};
|
|
513
556
|
const handleInlineDone = () => {
|
|
@@ -642,10 +685,10 @@ function FileUploadField(props) {
|
|
|
642
685
|
onChange: handleNativeFileChange
|
|
643
686
|
}
|
|
644
687
|
),
|
|
645
|
-
(duplicateWarning || formatWarning || sizeWarning || limitWarning) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].warningBanner, role: "alert", children: [
|
|
688
|
+
(duplicateWarning || formatWarning || sizeWarning || limitWarning || deleteWarning) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].warningBanner, role: "alert", children: [
|
|
646
689
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].warningContent, children: [
|
|
647
690
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { size: 16, color: "#D97706", style: { flexShrink: 0 } }),
|
|
648
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].warningText, children: [duplicateWarning, formatWarning, sizeWarning, limitWarning].filter(Boolean).join(" ") })
|
|
691
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].warningText, children: [duplicateWarning, formatWarning, sizeWarning, limitWarning, deleteWarning].filter(Boolean).join(" ") })
|
|
649
692
|
] }),
|
|
650
693
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
651
694
|
"button",
|
|
@@ -656,6 +699,7 @@ function FileUploadField(props) {
|
|
|
656
699
|
setFormatWarning(null);
|
|
657
700
|
setSizeWarning(null);
|
|
658
701
|
setLimitWarning(null);
|
|
702
|
+
setDeleteWarning(null);
|
|
659
703
|
},
|
|
660
704
|
className: FileUploadField_module["default"].warningCloseBtn,
|
|
661
705
|
title: "Dismiss notification",
|
|
@@ -710,6 +754,7 @@ function FileUploadField(props) {
|
|
|
710
754
|
var _a2, _b2;
|
|
711
755
|
const extension = fileUploadService.getFileExtension(file.name || file.filename);
|
|
712
756
|
const isItemUploading = file.status === "uploading";
|
|
757
|
+
const isItemDeleting = deletingFileIds.has(file.id);
|
|
713
758
|
const hasError = file.status === "error";
|
|
714
759
|
const isImg = fileUploadService.isImageFile(file.name || file.filename, file.type);
|
|
715
760
|
const fileGcsUrl = file.url || "";
|
|
@@ -778,15 +823,15 @@ function FileUploadField(props) {
|
|
|
778
823
|
] })
|
|
779
824
|
] })
|
|
780
825
|
] }),
|
|
781
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].fileActionsRight, children: isItemUploading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 18, className: FileUploadField_module["default"].loadingSpinner }) : isEditing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
826
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].fileActionsRight, children: isItemUploading || isItemDeleting ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 18, className: FileUploadField_module["default"].loadingSpinner }) : isEditing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
782
827
|
"button",
|
|
783
828
|
{
|
|
784
829
|
type: "button",
|
|
785
830
|
className: FileUploadField_module["default"].removeButton,
|
|
786
|
-
title: "
|
|
787
|
-
"aria-label": `
|
|
788
|
-
onClick: (e) =>
|
|
789
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.
|
|
831
|
+
title: "Delete file",
|
|
832
|
+
"aria-label": `Delete ${file.name}`,
|
|
833
|
+
onClick: (e) => void handleDeleteFile(file, e),
|
|
834
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: 18 })
|
|
790
835
|
}
|
|
791
836
|
) : null })
|
|
792
837
|
]
|