Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Gervwyk committed Aug 24, 2022
2 parents b1753fc + 5b1bf42 commit e04cfdf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 84 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/utils/installServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ async function installServer({ context, directory }) {
await spawnProcess({
command: context.packageManagerCmd,
args: args[context.packageManager],
stdOutLineHandler: (line) => context.print.debug(line),
processOptions: {
cwd: directory,
},
silent: false,
});
} catch (error) {
console.log(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@

import React from 'react';
import { AutoComplete } from 'antd';
import { blockDefaultProps, renderHtml } from '@lowdefy/block-utils';
import { blockDefaultProps } from '@lowdefy/block-utils';
import { type } from '@lowdefy/helpers';

import Label from '../Label/Label.js';
import getUniqueValues from '../../getUniqueValues.js';

const Option = AutoComplete.Option;

Expand All @@ -35,7 +34,6 @@ const AutoCompleteInput = ({
validation,
value,
}) => {
const uniqueValueOptions = getUniqueValues(properties.options || []);
return (
<Label
blockId={blockId}
Expand All @@ -51,7 +49,7 @@ const AutoCompleteInput = ({
autoFocus={properties.autoFocus}
backfill={properties.backfill}
bordered={properties.bordered}
className={methods.makeCssClass(properties.inputStyle)}
className={methods.makeCssClass([{ width: '100%' }, properties.inputStyle])}
defaultOpen={properties.defaultOpen}
disabled={properties.disabled || loading}
placeholder={properties.placeholder || 'Type or select item'}
Expand All @@ -63,45 +61,24 @@ const AutoCompleteInput = ({
.indexOf(input.toLowerCase()) >= 0
}
onChange={(newVal) => {
let val = type.isPrimitive(uniqueValueOptions[newVal])
? uniqueValueOptions[newVal]
: uniqueValueOptions[newVal].value;
if (type.isNone(val)) {
val = newVal;
}
methods.setValue(val);
methods.setValue(newVal);
methods.triggerEvent({ name: 'onChange' });
}}
onSearch={(newVal) => {
methods.triggerEvent({ name: 'onSearch', event: { value: newVal } });
}}
value={type.isNone(value) ? undefined : value}
value={type.isNone(value) ? undefined : `${value}`}
>
{(properties.options || []).map((opt, i) =>
type.isPrimitive(opt) ? (
<Option
className={methods.makeCssClass(properties.optionsStyle)}
id={`${blockId}_${i}`}
key={i}
value={`${i}`}
>
{renderHtml({ html: `${opt}`, methods })}
</Option>
) : (
<Option
className={methods.makeCssClass([properties.optionsStyle, opt.style])}
disabled={opt.disabled}
filterstring={opt.filterString}
id={`${blockId}_${i}`}
key={i}
value={`${i}`}
>
{type.isNone(opt.label)
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Option>
)
)}
{(properties.options || []).map((opt, i) => (
<Option
className={methods.makeCssClass(properties.optionsStyle)}
id={`${blockId}_${i}`}
key={i}
value={`${opt}`}
>
{`${opt}`}
</Option>
))}
</AutoComplete>
),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,52 +101,11 @@
},
"options": {
"default": [],
"oneOf": [
{
"type": "array",
"description": "Options can either be an array of string values, on an array of label, value pairs - supports html.",
"items": {
"type": "string"
}
},
{
"type": "array",
"description": "Options can either be an array of string values, on an array of label, value pairs.",
"items": {
"type": "object",
"required": ["value"],
"properties": {
"label": {
"type": "string",
"description": "Value label shown to user - supports html."
},
"value": {
"description": "Value selected. Can be of any type.",
"type": "string",
"docs": {
"displayType": "yaml"
}
},
"disabled": {
"type": "boolean",
"default": false,
"description": "Disable the option if true."
},
"filterString": {
"type": "string",
"description": "String to match against when filtering selector options during. If no filterString is provided the filter method matches against options.label."
},
"style": {
"type": "object",
"description": "Css style to applied to option.",
"docs": {
"displayType": "yaml"
}
}
}
}
}
]
"type": "array",
"description": "Options can either be an array of string values.",
"items": {
"type": "string"
}
},
"optionsStyle": {
"type": "object",
Expand Down

0 comments on commit e04cfdf

Please sign in to comment.