From b25932645883d9bf806d7a8b8384192b2e451fb6 Mon Sep 17 00:00:00 2001 From: labkey-nicka Date: Tue, 19 Aug 2025 12:16:39 -0700 Subject: [PATCH 01/11] Bump @labkey/api --- packages/components/package-lock.json | 8 ++++---- packages/components/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 1544dfb6ba..9dd491e6cc 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -10,7 +10,7 @@ "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.42.1", + "@labkey/api": "1.42.2-fb-assay-batch-run-files.0", "@testing-library/dom": "~10.4.0", "@testing-library/jest-dom": "~6.6.3", "@testing-library/react": "~16.3.0", @@ -3492,9 +3492,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.42.1", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.42.1.tgz", - "integrity": "sha512-rT+Q/ZM6bE6bU8HDj/7f3DIFuq538e+LZAvBw8P3qJjuAnyO+O+ItZz/YukAKCXXiN2GdedOXDJbt1Ms0bgLsg==", + "version": "1.42.2-fb-assay-batch-run-files.0", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.42.2-fb-assay-batch-run-files.0.tgz", + "integrity": "sha512-HPVaVxkVE0ia4j+GKNHjABpzu5UorL+CkF8T1JCckRVSdpUnJxMMPKWLVf41XFvVzPaCgzYTtcjORIEn42L3dA==", "license": "Apache-2.0" }, "node_modules/@labkey/build": { diff --git a/packages/components/package.json b/packages/components/package.json index b58560ed0d..6bdb2bbcff 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -50,7 +50,7 @@ "homepage": "https://github.com/LabKey/labkey-ui-components#readme", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.42.1", + "@labkey/api": "1.42.2-fb-assay-batch-run-files.0", "@testing-library/dom": "~10.4.0", "@testing-library/jest-dom": "~6.6.3", "@testing-library/react": "~16.3.0", From 20f89cf9cedd25a38413859f7f68c50118cc0281 Mon Sep 17 00:00:00 2001 From: labkey-nicka Date: Sat, 23 Aug 2025 13:19:30 -0700 Subject: [PATCH 02/11] Bump @labkey/api --- packages/components/package-lock.json | 8 ++++---- packages/components/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 9dd491e6cc..301728d8c6 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -10,7 +10,7 @@ "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.42.2-fb-assay-batch-run-files.0", + "@labkey/api": "1.42.2-fb-assay-batch-run-files.1", "@testing-library/dom": "~10.4.0", "@testing-library/jest-dom": "~6.6.3", "@testing-library/react": "~16.3.0", @@ -3492,9 +3492,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.42.2-fb-assay-batch-run-files.0", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.42.2-fb-assay-batch-run-files.0.tgz", - "integrity": "sha512-HPVaVxkVE0ia4j+GKNHjABpzu5UorL+CkF8T1JCckRVSdpUnJxMMPKWLVf41XFvVzPaCgzYTtcjORIEn42L3dA==", + "version": "1.42.2-fb-assay-batch-run-files.1", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.42.2-fb-assay-batch-run-files.1.tgz", + "integrity": "sha512-0wxiDTcYLiOgYeNhZp/mAPzxGZ/c01BqS7gBAO++RECmZjt/Gv86p+54haz9LrgZ+msUcJ6zNmo5etIxKov6rQ==", "license": "Apache-2.0" }, "node_modules/@labkey/build": { diff --git a/packages/components/package.json b/packages/components/package.json index 6bdb2bbcff..2fc5daa9ee 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -50,7 +50,7 @@ "homepage": "https://github.com/LabKey/labkey-ui-components#readme", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.42.2-fb-assay-batch-run-files.0", + "@labkey/api": "1.42.2-fb-assay-batch-run-files.1", "@testing-library/dom": "~10.4.0", "@testing-library/jest-dom": "~6.6.3", "@testing-library/react": "~16.3.0", From d2f0eccc51bdb273101cbb61a3fad3e5ddb7b543 Mon Sep 17 00:00:00 2001 From: labkey-nicka Date: Thu, 28 Aug 2025 10:27:07 -0700 Subject: [PATCH 03/11] FileInput: support string initialValue --- .../components/forms/input/FileInput.tsx | 61 ++++++++----------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/packages/components/src/internal/components/forms/input/FileInput.tsx b/packages/components/src/internal/components/forms/input/FileInput.tsx index 9e557cd9f3..edf6e2ea30 100644 --- a/packages/components/src/internal/components/forms/input/FileInput.tsx +++ b/packages/components/src/internal/components/forms/input/FileInput.tsx @@ -74,21 +74,11 @@ class FileInputImpl extends DisableableInput { constructor(props: FileInputImplProps) { super(props); - this.processFiles = this.processFiles.bind(this); - this.onChange = this.onChange.bind(this); - this.onDrag = this.onDrag.bind(this); - this.onDragLeave = this.onDragLeave.bind(this); - this.onDrop = this.onDrop.bind(this); - this.onRemove = this.onRemove.bind(this); - this.setFormValue = this.setFormValue.bind(this); this.toggleDisabled = this.toggleDisabled.bind(this); this.fileInput = React.createRef(); this.state = { - // FileInput only accepts query-shaped row data as the initialValue - // as that is what is accepted by FileColumnRenderer. Without this there is likely insufficient - // metadata to render and act on the associated file value. - data: Map.isMap(props.initialValue) ? props.initialValue : undefined, + data: props.initialValue, isHover: false, file: null, error: '', @@ -98,6 +88,8 @@ class FileInputImpl extends DisableableInput { if (Map.isMap(props.initialValue)) { // call setValue so to populate form data (for diff compare) props.setValue?.(props.initialValue.get('value')); + } else if (typeof props.initialValue === 'string') { + props.setValue?.(props.initialValue); } } @@ -107,7 +99,7 @@ class FileInputImpl extends DisableableInput { return this.props.name ?? this.props.queryColumn.fieldKey; } - processFiles(fileList: FileList, transferItems?: DataTransferItemList): void { + processFiles = (fileList: FileList, transferItems?: DataTransferItemList): void => { const { acceptedFormats, maxFileSize, emptyFileNotAllowed } = this.props; if (fileList.length > 1) { this.setState({ error: 'Only one file allowed' }); @@ -139,9 +131,9 @@ class FileInputImpl extends DisableableInput { return; } this.setFormValue(file); - } + }; - setFormValue(file: File): void { + setFormValue = (file: File): void => { const { formsy, onChange, setValue } = this.props; this.setState({ data: undefined, file, error: '' }); onChange?.({ [this.getInputName()]: file }); @@ -149,42 +141,42 @@ class FileInputImpl extends DisableableInput { if (formsy) { setValue?.(file); } - } + }; - onChange(event: React.FormEvent): void { + onChange = (event: React.FormEvent): void => { cancelEvent(event); this.processFiles(this.fileInput.current.files); - } + }; - onDrag(event: React.DragEvent): void { + onDrag = (event: React.DragEvent): void => { cancelEvent(event); if (!this.state.isHover) { this.setState({ isHover: true }); } - } + }; - onDragLeave(event: React.DragEvent): void { + onDragLeave = (event: React.DragEvent): void => { cancelEvent(event); if (this.state.isHover) { this.setState({ isHover: false }); } - } + }; - onDrop(event: React.DragEvent): void { + onDrop = (event: React.DragEvent): void => { cancelEvent(event); if (event.dataTransfer && event.dataTransfer.files) { this.processFiles(event.dataTransfer.files, event.dataTransfer.items); this.setState({ isHover: false }); } - } + }; - onRemove(): void { + onRemove = (): void => { // A value of null is supported by server APIs to clear/remove a file field's value. this.setFormValue(null); - } + }; render() { const { @@ -197,19 +189,16 @@ class FileInputImpl extends DisableableInput { showLabel, toggleDisabledTooltip, } = this.props; - const { data, file, isDisabled, isHover } = this.state; + const { data, error, file, isDisabled, isHover } = this.state; const name = this.getInputName(); const inputId = `${name}-fileUpload`; // Issue 53394: needs to be a distinct input id so it doesn't collide with other elements on the page for this fieldKey let body; - if (file) { - const attachedFileClass = classNames('attached-file__inline-container', { - 'file-upload__is-hover': isHover, - }); + if (file || typeof data === 'string') { body = (
{ > - {file.name} -
{this.state.error}
+ {file ? file.name : data} +
{error}
); - } else if (data?.get('value')) { + } else if (Map.isMap(data) && data.get('value')) { body = ( { <> {