Merge pull request #859 from lowdefy/fix-selectors

fix(blocksAntd): Fix selector option labels and filter function.
This commit is contained in:
Sam 2021-09-23 17:41:57 +02:00 committed by GitHub
commit ce11882e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 4416 additions and 603 deletions

View File

@ -80,7 +80,7 @@ const AutoCompleteInput = ({
key={i}
value={i}
>
{`${opt}`}
{renderHtml({ html: `${opt}`, methods })}
</Option>
) : (
<Option
@ -92,7 +92,7 @@ const AutoCompleteInput = ({
value={i}
>
{type.isNone(opt.label)
? `${opt.value}`
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Option>
)

View File

@ -72,7 +72,7 @@ const ButtonSelector = ({
{uniqueValueOptions.map((opt, i) =>
type.isPrimitive(opt) ? (
<Radio.Button id={`${blockId}_${i}`} key={i} value={i}>
{`${opt}`}
{renderHtml({ html: `${opt}`, methods })}
</Radio.Button>
) : (
<Radio.Button
@ -83,7 +83,7 @@ const ButtonSelector = ({
className={methods.makeCssClass(opt.style)}
>
{type.isNone(opt.label)
? `${opt.value}`
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Radio.Button>
)

View File

@ -73,7 +73,7 @@ const CheckboxSelector = ({
{uniqueValueOptions.map((opt, i) =>
type.isPrimitive(opt) ? (
<Checkbox id={`${blockId}_${i}`} key={i} value={i}>
{`${opt}`}
{renderHtml({ html: `${opt}`, methods })}
</Checkbox>
) : (
<Checkbox
@ -84,7 +84,7 @@ const CheckboxSelector = ({
className={methods.makeCssClass(opt.style)}
>
{type.isNone(opt.label)
? `${opt.value}`
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Checkbox>
)

View File

@ -113,7 +113,7 @@ const MultipleSelector = ({
key={i}
value={i}
>
{`${opt}`}
{renderHtml({ html: `${opt}`, methods })}
</Option>
) : (
<Option
@ -125,7 +125,7 @@ const MultipleSelector = ({
value={i}
>
{type.isNone(opt.label)
? `${opt.value}`
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Option>
)

View File

@ -73,7 +73,7 @@ const RadioSelector = ({
{uniqueValueOptions.map((opt, i) =>
type.isPrimitive(opt) ? (
<Radio id={`${blockId}_${opt}`} key={i} value={i}>
{`${opt}`}
{renderHtml({ html: `${opt}`, methods })}
</Radio>
) : (
<Radio
@ -84,7 +84,7 @@ const RadioSelector = ({
className={methods.makeCssClass(opt.style)}
>
{type.isNone(opt.label)
? `${opt.value}`
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Radio>
)

View File

@ -102,7 +102,7 @@ const Selector = ({
key={i}
value={i}
>
{`${opt}`}
{renderHtml({ html: `${opt}`, methods })}
</Option>
) : (
<Option
@ -114,7 +114,7 @@ const Selector = ({
value={i}
>
{type.isNone(opt.label)
? `${opt.value}`
? renderHtml({ html: `${opt.value}`, methods })
: renderHtml({ html: opt.label, methods })}
</Option>
)

View File

@ -36,14 +36,88 @@ Array [
id="properties.allowClear: false_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.allowClear: false_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -74,14 +148,88 @@ Array [
id="properties.autoFocus: true_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.autoFocus: true_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -112,14 +260,88 @@ Array [
id="properties.backfill: true_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.backfill: true_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -150,14 +372,92 @@ Array [
id="properties.inputStyle: CSS style applied_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
Object {
"border": "1px solid red",
},
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{\\"style\\":{\\"border\\":\\"1px solid red\\"}}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.inputStyle: CSS style applied_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
Object {
"border": "1px solid red",
},
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{\\"style\\":{\\"border\\":\\"1px solid red\\"}}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{\\"style\\":{\\"border\\":\\"1px solid red\\"}}",
@ -750,21 +1050,160 @@ Array [
id="properties.options: html_0"
value={0}
>
&lt;div&gt;Some main text&lt;/div&gt;&lt;div style="font-size: 6px;"&gt;Some small subtext&lt;/div&gt;
<HtmlComponent
html=<div>
Some main text
</div>
<div style="font-size: 6px;">
Some small subtext
</div>
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.options: html_1"
value={1}
>
&lt;div style="color: green;"&gt;Option green&lt;/div&gt;
<HtmlComponent
html=<div style="color: green;">
Option green
</div>
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.options: html_2"
value={2}
>
Option 3
<HtmlComponent
html="Option 3"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -919,14 +1358,88 @@ Array [
id="properties.options-string_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.options-string_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -1085,14 +1598,96 @@ Array [
id="properties.optionsStyle: CSS style applied_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
Object {
"color": "blue",
},
],
Array [
Object {
"color": "blue",
},
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{\\"style\\":{\\"color\\":\\"blue\\"}}",
},
Object {
"type": "return",
"value": "{\\"style\\":{\\"color\\":\\"blue\\"}}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{\\"style\\":{\\"color\\":\\"blue\\"}}"
id="properties.optionsStyle: CSS style applied_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
Object {
"color": "blue",
},
],
Array [
Object {
"color": "blue",
},
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{\\"style\\":{\\"color\\":\\"blue\\"}}",
},
Object {
"type": "return",
"value": "{\\"style\\":{\\"color\\":\\"blue\\"}}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -1146,14 +1741,88 @@ Array [
id="properties.size: large_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.size: large_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",
@ -1184,14 +1853,88 @@ Array [
id="properties.size: small_0"
value={0}
>
Option 1
<HtmlComponent
html="Option 1"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
<mockConstructor
className="{}"
id="properties.size: small_1"
value={1}
>
Option 2
<HtmlComponent
html="Option 2"
methods={
Object {
"makeCssClass": [MockFunction] {
"calls": Array [
Array [
undefined,
],
Array [
undefined,
],
Array [
undefined,
],
],
"results": Array [
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
Object {
"type": "return",
"value": "{}",
},
],
},
"registerEvent": [Function],
"registerMethod": [Function],
"setValue": [Function],
"triggerEvent": [Function],
}
}
/>
</mockConstructor>,
],
"className": "{}",