Skip to content

Commit

Permalink
Added file/filelist
Browse files Browse the repository at this point in the history
  • Loading branch information
grassick committed Jan 6, 2023
1 parent d823cc1 commit 96b6609
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
4 changes: 4 additions & 0 deletions lib/properties/PropertyEditorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class PropertyEditorComponent extends react_1.default.Component {
? R("option", { key: "id[]", value: "id[]" }, "Reference List")
: undefined, lodash_1.default.includes(features, "joinType") ? R("option", { key: "join", value: "join" }, "Join") : undefined, lodash_1.default.includes(features, "dataurlType")
? R("option", { key: "dataurl", value: "dataurl" }, "Data URL (inline file storage)")
: undefined, lodash_1.default.includes(features, "fileType")
? R("option", { key: "file", value: "file" }, "File")
: undefined, lodash_1.default.includes(features, "filelistType")
? R("option", { key: "filelist", value: "filelist" }, "File list")
: undefined)), ["enum", "enumset"].includes(this.props.property.type)
? R(ui.FormGroup, { label: "Values" }, R(EnumValuesEditorComponent, {
value: this.props.property.enumValues || [],
Expand Down
2 changes: 1 addition & 1 deletion lib/properties/PropertyListComponent.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface PropertyListComponentProps {
propertyIdGenerator?: () => string;
/** Variables that may be used in expressions */
variables?: Variable[];
features?: ("sql" | "idField" | "uniqueCode" | "idType" | "joinType" | "code" | "expr" | "conditionExpr" | "section" | "table" | "unique" | "onDelete" | "dataurlType" | "indexed" | "reverseSql" | "required")[];
features?: ("sql" | "idField" | "uniqueCode" | "idType" | "joinType" | "code" | "expr" | "conditionExpr" | "section" | "table" | "unique" | "onDelete" | "dataurlType" | "fileType" | "filelistType" | "indexed" | "reverseSql" | "required")[];
/** function that returns the UI of the roles, called with a single argument, the array containing roles */
createRoleDisplayElem?: (roles: any[]) => ReactNode;
/** function that returns the UI of the roles for editing, gets passed two arguments
Expand Down
4 changes: 3 additions & 1 deletion lib/properties/PropertyListComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ PropertyComponent.iconMap = {
boolean: "fa fa-toggle-on",
id: "fa fa-arrow-right",
join: "fa fa-link",
dataurl: "fa fa-file"
dataurl: "fa fa-file",
file: "fa fa-file",
filelist: "fa fa-file"
};
PropertyComponent.contextTypes = { clipboard: prop_types_1.default.object };
const WrappedPropertyListComponent = (0, NestedListClipboardEnhancement_1.default)(InnerPropertyListComponent);
Expand Down
24 changes: 16 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/properties/PropertyEditorComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ export default class PropertyEditorComponent extends React.Component<PropertyEdi
_.includes(features, "joinType") ? R("option", { key: "join", value: "join" }, "Join") : undefined,
_.includes(features, "dataurlType")
? R("option", { key: "dataurl", value: "dataurl" }, "Data URL (inline file storage)")
: undefined,
_.includes(features, "fileType")
? R("option", { key: "file", value: "file" }, "File")
: undefined,
_.includes(features, "filelistType")
? R("option", { key: "filelist", value: "filelist" }, "File list")
: undefined
)
),
Expand Down
8 changes: 7 additions & 1 deletion src/properties/PropertyListComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export interface PropertyListComponentProps {
* unique: allow unique flag on properties
* onDelete: allow undefined, "cascade" or "restrict"
* dataurlType: allow dataurl type fields
* fileType: allow file type fields
* filelistType: allow filelist type fields
* indexed: allow indexed flag on properties
* required: allow required flag on properties
*/
Expand All @@ -71,6 +73,8 @@ export interface PropertyListComponentProps {
| "unique"
| "onDelete"
| "dataurlType"
| "fileType"
| "filelistType"
| "indexed"
| "reverseSql"
| "required"
Expand Down Expand Up @@ -326,7 +330,9 @@ class PropertyComponent extends React.Component<{
boolean: "fa fa-toggle-on",
id: "fa fa-arrow-right",
join: "fa fa-link",
dataurl: "fa fa-file"
dataurl: "fa fa-file",
file: "fa fa-file",
filelist: "fa fa-file"
}

static contextTypes = { clipboard: PropTypes.object }
Expand Down

0 comments on commit 96b6609

Please sign in to comment.