-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement file picker component
- Loading branch information
Showing
26 changed files
with
675 additions
and
17 deletions.
There are no files selected for viewing
Binary file modified
BIN
+960 Bytes
(100%)
e2e/visual/no-theme.spec.js-snapshots/no-theme---editor-1-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+719 Bytes
(100%)
e2e/visual/theming.spec.js-snapshots/theming---editor-1-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/form-js-editor/src/features/properties-panel/entries/AcceptEntry.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { get } from 'min-dash'; | ||
|
||
import { useService, useVariables } from '../hooks'; | ||
|
||
import { FeelTemplatingEntry, isFeelEntryEdited } from '@bpmn-io/properties-panel'; | ||
|
||
export function AcceptEntry(props) { | ||
const { editField, field } = props; | ||
|
||
const entries = []; | ||
|
||
entries.push({ | ||
id: 'accept', | ||
component: Accept, | ||
editField: editField, | ||
field: field, | ||
isEdited: isFeelEntryEdited, | ||
isDefaultVisible: (field) => field.type === 'filepicker', | ||
}); | ||
|
||
return entries; | ||
} | ||
|
||
function Accept(props) { | ||
const { editField, field, id } = props; | ||
|
||
const debounce = useService('debounce'); | ||
|
||
const variables = useVariables().map((name) => ({ name })); | ||
|
||
const path = ['accept']; | ||
|
||
const getValue = () => { | ||
return get(field, path, ''); | ||
}; | ||
|
||
const setValue = (value) => { | ||
return editField(field, path, value); | ||
}; | ||
|
||
return FeelTemplatingEntry({ | ||
debounce, | ||
element: field, | ||
getValue, | ||
id, | ||
label: 'Supported file formats', | ||
singleLine: true, | ||
setValue, | ||
variables, | ||
description, | ||
}); | ||
} | ||
|
||
// helpers ////////// | ||
|
||
const description = ( | ||
<> | ||
A comma-separated list of{' '} | ||
<a | ||
href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers" | ||
target="_blank"> | ||
file type specifiers | ||
</a> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/form-js-editor/src/features/properties-panel/entries/MultipleEntry.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { get } from 'min-dash'; | ||
|
||
import { useService, useVariables } from '../hooks'; | ||
|
||
import { FeelToggleSwitchEntry, isFeelEntryEdited } from '@bpmn-io/properties-panel'; | ||
|
||
export function MultipleEntry(props) { | ||
const { editField, field } = props; | ||
|
||
const entries = []; | ||
|
||
entries.push({ | ||
id: 'multiple', | ||
component: Multiple, | ||
editField: editField, | ||
field: field, | ||
isEdited: isFeelEntryEdited, | ||
isDefaultVisible: (field) => field.type === 'filepicker', | ||
}); | ||
|
||
return entries; | ||
} | ||
|
||
function Multiple(props) { | ||
const { editField, field, id } = props; | ||
|
||
const debounce = useService('debounce'); | ||
|
||
const variables = useVariables().map((name) => ({ name })); | ||
|
||
const path = ['multiple']; | ||
|
||
const getValue = () => { | ||
return get(field, path, ''); | ||
}; | ||
|
||
const setValue = (value) => { | ||
return editField(field, path, value); | ||
}; | ||
|
||
return FeelToggleSwitchEntry({ | ||
debounce, | ||
element: field, | ||
feel: 'optional', | ||
getValue, | ||
id, | ||
label: 'Upload multiple files', | ||
inline: true, | ||
setValue, | ||
variables, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.