mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
wa feedbacks
This commit is contained in:
parent
c9fb1f3118
commit
8c2c42701e
6 changed files with 232 additions and 59 deletions
|
|
@ -139,6 +139,20 @@ export function Steps({ componentMeta, darkMode, ...restProps }) {
|
||||||
return (
|
return (
|
||||||
<Popover className={`${darkMode && 'dark-theme theme-dark'}`} style={{ minWidth: '248px' }}>
|
<Popover className={`${darkMode && 'dark-theme theme-dark'}`} style={{ minWidth: '248px' }}>
|
||||||
<Popover.Body>
|
<Popover.Body>
|
||||||
|
<div className="field mb-3" data-cy={`input-and-label-column-name`}>
|
||||||
|
<label data-cy={`label-column-name`} className="font-weight-500 mb-1 font-size-12">
|
||||||
|
{'Id'}
|
||||||
|
</label>
|
||||||
|
<CodeHinter
|
||||||
|
type={'basic'}
|
||||||
|
initialValue={item?.id + ''}
|
||||||
|
theme={darkMode ? 'monokai' : 'default'}
|
||||||
|
mode="javascript"
|
||||||
|
lineNumbers={false}
|
||||||
|
placeholder={'Option label'}
|
||||||
|
onChange={(value) => handleLabelChange('id', value, index)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="field mb-3" data-cy={`input-and-label-column-name`}>
|
<div className="field mb-3" data-cy={`input-and-label-column-name`}>
|
||||||
<label data-cy={`label-column-name`} className="font-weight-500 mb-1 font-size-12">
|
<label data-cy={`label-column-name`} className="font-weight-500 mb-1 font-size-12">
|
||||||
{'Label'}
|
{'Label'}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export const stepsConfig = {
|
||||||
validation: {
|
validation: {
|
||||||
schema: {
|
schema: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
element: { type: 'object', object: { id: { type: 'number' } } },
|
element: { type: 'object' },
|
||||||
},
|
},
|
||||||
defaultValue: `[{ name: 'step 1'}, {name: 'step 2'}]`,
|
defaultValue: `[{ name: 'step 1'}, {name: 'step 2'}]`,
|
||||||
},
|
},
|
||||||
|
|
@ -97,12 +97,12 @@ export const stepsConfig = {
|
||||||
{
|
{
|
||||||
handle: 'setVisibility',
|
handle: 'setVisibility',
|
||||||
displayName: 'Set visibility',
|
displayName: 'Set visibility',
|
||||||
params: [
|
params: [{ handle: 'visible', displayName: 'Value', defaultValue: '{{false}}', type: 'toggle' }],
|
||||||
{
|
},
|
||||||
handle: 'option',
|
{
|
||||||
displayName: 'Option',
|
handle: 'setDisabled',
|
||||||
},
|
displayName: 'Set disabled',
|
||||||
],
|
params: [{ handle: 'disable', displayName: 'Value', defaultValue: '{{true}}', type: 'toggle' }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
handle: 'resetSteps',
|
handle: 'resetSteps',
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,22 @@ export const Steps = function Button({ properties, styles, fireEvent, setExposed
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setExposedVariable('isVisible', isVisible);
|
||||||
|
}, [isVisible]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsVisible(visibility);
|
||||||
|
}, [visibility]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setExposedVariable('isDisabled', isDisabled);
|
||||||
|
}, [isDisabled]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsDisabled(!disabledState);
|
||||||
|
}, [disabledState]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setExposedVariable('setStep', (stepId) => setActiveStepId(stepId));
|
setExposedVariable('setStep', (stepId) => setActiveStepId(stepId));
|
||||||
setExposedVariable('setVisibility', (visibility) => setIsVisible(visibility));
|
setExposedVariable('setVisibility', (visibility) => setIsVisible(visibility));
|
||||||
|
|
@ -56,6 +72,10 @@ export const Steps = function Button({ properties, styles, fireEvent, setExposed
|
||||||
setExposedVariable('currentStepId', activeStepId);
|
setExposedVariable('currentStepId', activeStepId);
|
||||||
}, [activeStepId]);
|
}, [activeStepId]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setActiveStepId(currentStepId);
|
||||||
|
}, [currentStepId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setExposedVariable('steps', steps);
|
setExposedVariable('steps', steps);
|
||||||
setExposedVariable('setStepVisible', (stepId, visibility) => {
|
setExposedVariable('setStepVisible', (stepId, visibility) => {
|
||||||
|
|
@ -87,27 +107,19 @@ export const Steps = function Button({ properties, styles, fireEvent, setExposed
|
||||||
});
|
});
|
||||||
}, [JSON.stringify(steps), JSON.stringify(stepsArr)]);
|
}, [JSON.stringify(steps), JSON.stringify(stepsArr)]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setExposedVariable('isVisible', isVisible);
|
|
||||||
}, [isVisible]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setIsVisible(visibility);
|
|
||||||
}, [visibility]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setExposedVariable('isDisabled', isDisabled);
|
|
||||||
}, [isDisabled]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setIsDisabled(!disabledState);
|
|
||||||
}, [disabledState]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
isVisible && (
|
isVisible && (
|
||||||
<div
|
<div
|
||||||
className={`steps ${theme == 'numbers' && 'steps-counter '}`}
|
className={`steps ${theme == 'numbers' && 'steps-counter '}`}
|
||||||
style={{ color: textColor, height, boxShadow, opacity: isDisabled ? 0.5 : 1 }}
|
style={{
|
||||||
|
color: textColor,
|
||||||
|
height,
|
||||||
|
boxShadow,
|
||||||
|
opacity: isDisabled ? 0.5 : 1,
|
||||||
|
...(theme === 'plain' && {
|
||||||
|
alignItems: 'center',
|
||||||
|
}),
|
||||||
|
}}
|
||||||
data-cy={dataCy}
|
data-cy={dataCy}
|
||||||
>
|
>
|
||||||
{filteredSteps?.map((item, index) => {
|
{filteredSteps?.map((item, index) => {
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,30 @@ export const stepsConfig = {
|
||||||
description: 'Step-by-step navigation aid',
|
description: 'Step-by-step navigation aid',
|
||||||
component: 'Steps',
|
component: 'Steps',
|
||||||
properties: {
|
properties: {
|
||||||
|
variant: {
|
||||||
|
type: 'switch',
|
||||||
|
displayName: 'Variant',
|
||||||
|
validation: { schema: { type: 'string' }, defaultValue: 'titles' },
|
||||||
|
options: [
|
||||||
|
{ displayName: 'Label', value: 'titles' },
|
||||||
|
{ displayName: 'Numbers', value: 'numbers' },
|
||||||
|
{ displayName: 'Plain', value: 'plain' },
|
||||||
|
],
|
||||||
|
accordian: 'label',
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
type: 'code',
|
||||||
|
displayName: 'Schema',
|
||||||
|
conditionallyRender: {
|
||||||
|
key: 'advanced',
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
accordian: 'Options',
|
||||||
|
},
|
||||||
steps: {
|
steps: {
|
||||||
type: 'code',
|
type: 'code',
|
||||||
displayName: 'Steps',
|
displayName: '',
|
||||||
|
showLabel: false,
|
||||||
validation: {
|
validation: {
|
||||||
schema: {
|
schema: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
|
@ -15,6 +36,27 @@ export const stepsConfig = {
|
||||||
defaultValue: `[{ name: 'step 1'}, {name: 'step 2'}]`,
|
defaultValue: `[{ name: 'step 1'}, {name: 'step 2'}]`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
visibility: {
|
||||||
|
type: 'toggle',
|
||||||
|
displayName: 'Visibility',
|
||||||
|
validation: { schema: { type: 'boolean' }, defaultValue: true },
|
||||||
|
section: 'additionalActions',
|
||||||
|
},
|
||||||
|
// disabledState: {
|
||||||
|
// type: 'toggle',
|
||||||
|
// displayName: 'Disable',
|
||||||
|
// validation: { schema: { type: 'boolean' }, defaultValue: true },
|
||||||
|
// section: 'additionalActions',
|
||||||
|
// },
|
||||||
|
advanced: {
|
||||||
|
type: 'toggle',
|
||||||
|
displayName: 'Dynamic options',
|
||||||
|
validation: {
|
||||||
|
schema: { type: 'boolean' },
|
||||||
|
defaultValue: true,
|
||||||
|
},
|
||||||
|
accordian: 'Options',
|
||||||
|
},
|
||||||
currentStep: {
|
currentStep: {
|
||||||
type: 'code',
|
type: 'code',
|
||||||
displayName: 'Current step',
|
displayName: 'Current step',
|
||||||
|
|
@ -30,6 +72,7 @@ export const stepsConfig = {
|
||||||
schema: { type: 'boolean' },
|
schema: { type: 'boolean' },
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
},
|
},
|
||||||
|
section: 'additionalActions',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultSize: {
|
defaultSize: {
|
||||||
|
|
@ -40,46 +83,132 @@ export const stepsConfig = {
|
||||||
showOnDesktop: { type: 'toggle', displayName: 'Show on desktop' },
|
showOnDesktop: { type: 'toggle', displayName: 'Show on desktop' },
|
||||||
showOnMobile: { type: 'toggle', displayName: 'Show on mobile' },
|
showOnMobile: { type: 'toggle', displayName: 'Show on mobile' },
|
||||||
},
|
},
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
handle: 'setStep',
|
||||||
|
displayName: 'Set step',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
handle: 'option',
|
||||||
|
displayName: 'Option',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'setVisibility',
|
||||||
|
displayName: 'Set visibility',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
handle: 'option',
|
||||||
|
displayName: 'Option',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'setDisabled',
|
||||||
|
displayName: 'Set disabled',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
handle: 'option',
|
||||||
|
displayName: 'Option',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'resetSteps',
|
||||||
|
displayName: 'Reset steps',
|
||||||
|
params: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'setStepVisible',
|
||||||
|
displayName: 'Set step visible',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
handle: 'id',
|
||||||
|
displayName: 'Step id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'visibility',
|
||||||
|
displayName: 'visibility',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'setStepDisable',
|
||||||
|
displayName: 'Set step disable',
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
handle: 'id',
|
||||||
|
displayName: 'Step id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
handle: 'disabled',
|
||||||
|
displayName: 'disabled',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
events: {
|
events: {
|
||||||
onSelect: { displayName: 'On select' },
|
onSelect: { displayName: 'On select' },
|
||||||
},
|
},
|
||||||
styles: {
|
styles: {
|
||||||
color: {
|
incompletedAccent: {
|
||||||
type: 'color',
|
type: 'color',
|
||||||
displayName: 'Color',
|
displayName: 'Incompleted accent',
|
||||||
validation: {
|
validation: {
|
||||||
schema: { type: 'string' },
|
schema: { type: 'string' },
|
||||||
defaultValue: '#000000',
|
defaultValue: '#E4E7EB',
|
||||||
},
|
},
|
||||||
|
accordian: 'steps',
|
||||||
},
|
},
|
||||||
textColor: {
|
incompletedLabel: {
|
||||||
type: 'color',
|
type: 'color',
|
||||||
displayName: 'Text color',
|
displayName: 'Incompleted label',
|
||||||
validation: {
|
validation: {
|
||||||
schema: { type: 'string' },
|
schema: { type: 'string' },
|
||||||
defaultValue: '#000000',
|
defaultValue: '#1B1F24',
|
||||||
},
|
},
|
||||||
|
accordian: 'steps',
|
||||||
},
|
},
|
||||||
theme: {
|
completedAccent: {
|
||||||
type: 'select',
|
type: 'color',
|
||||||
displayName: 'Theme',
|
displayName: 'Completed accent',
|
||||||
|
validation: {
|
||||||
|
schema: { type: 'string' },
|
||||||
|
defaultValue: '#4368E3',
|
||||||
|
},
|
||||||
|
accordian: 'steps',
|
||||||
|
},
|
||||||
|
completedLabel: {
|
||||||
|
type: 'color',
|
||||||
|
displayName: 'Completed label',
|
||||||
|
validation: {
|
||||||
|
schema: { type: 'string' },
|
||||||
|
defaultValue: '#FBFCFD',
|
||||||
|
},
|
||||||
|
accordian: 'steps',
|
||||||
|
},
|
||||||
|
currentStepLabel: {
|
||||||
|
type: 'color',
|
||||||
|
displayName: 'Current step label',
|
||||||
|
validation: {
|
||||||
|
schema: { type: 'string' },
|
||||||
|
defaultValue: '#1B1F24',
|
||||||
|
},
|
||||||
|
accordian: 'steps',
|
||||||
|
},
|
||||||
|
padding: {
|
||||||
|
type: 'switch',
|
||||||
|
displayName: 'Padding',
|
||||||
|
validation: {
|
||||||
|
schema: { type: 'union', schemas: [{ type: 'string' }, { type: 'number' }] },
|
||||||
|
defaultValue: 'default',
|
||||||
|
},
|
||||||
options: [
|
options: [
|
||||||
{ name: 'titles', value: 'titles' },
|
{ displayName: 'Default', value: 'default' },
|
||||||
{ name: 'numbers', value: 'numbers' },
|
{ displayName: 'None', value: 'none' },
|
||||||
{ name: 'plain', value: 'plain' },
|
|
||||||
],
|
],
|
||||||
validation: {
|
accordian: 'container',
|
||||||
schema: { type: 'string' },
|
|
||||||
defaultValue: 'titles',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
visibility: {
|
|
||||||
type: 'toggle',
|
|
||||||
displayName: 'Visibility',
|
|
||||||
validation: {
|
|
||||||
schema: { type: 'boolean' },
|
|
||||||
defaultValue: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
exposedVariables: {
|
exposedVariables: {
|
||||||
|
|
@ -92,17 +221,35 @@ export const stepsConfig = {
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
steps: {
|
steps: {
|
||||||
value: `{{ [{ name: 'step 1', tooltip: 'some tooltip', id: 1},{ name: 'step 2', tooltip: 'some tooltip', id: 2},{ name: 'step 3', tooltip: 'some tooltip', id: 3},{ name: 'step 4', tooltip: 'some tooltip', id: 4},{ name: 'step 5', tooltip: 'some tooltip', id: 5}]}}`,
|
value: [
|
||||||
|
{ name: 'step 1', tooltip: 'some tooltip', id: 1, visible: { value: true }, disabled: { value: false } },
|
||||||
|
{ name: 'step 2', tooltip: 'some tooltip', id: 2, visible: { value: true }, disabled: { value: false } },
|
||||||
|
{ name: 'step 3', tooltip: 'some tooltip', id: 3, visible: { value: true }, disabled: { value: false } },
|
||||||
|
{ name: 'step 4', tooltip: 'some tooltip', id: 4, visible: { value: true }, disabled: { value: false } },
|
||||||
|
{ name: 'step 5', tooltip: 'some tooltip', id: 5, visible: { value: true }, disabled: { value: false } },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
schema: {
|
||||||
|
value: `{{ [{ name: 'step 1', tooltip: 'some tooltip', id: 1,visible: true, disabled: false},{ name: 'step 2', tooltip: 'some tooltip', id: 2,visible: true, disabled: false},{ name: 'step 3', tooltip: 'some tooltip', id: 3,visible: true, disabled: false},{ name: 'step 4', tooltip: 'some tooltip', id: 4,visible: true, disabled: false},{ name: 'step 5', tooltip: 'some tooltip', id: 5,visible: true, disabled: false}]}}`,
|
||||||
|
},
|
||||||
|
variant: { value: 'titles' },
|
||||||
currentStep: { value: '{{3}}' },
|
currentStep: { value: '{{3}}' },
|
||||||
stepsSelectable: { value: true },
|
stepsSelectable: { value: true },
|
||||||
|
advanced: { value: `{{false}}` },
|
||||||
|
// disabledState: { value: '{{false}}' },
|
||||||
|
visibility: { value: '{{true}}' },
|
||||||
},
|
},
|
||||||
events: [],
|
events: [],
|
||||||
styles: {
|
styles: {
|
||||||
visibility: { value: '{{true}}' },
|
visibility: { value: '{{true}}' },
|
||||||
theme: { value: 'titles' },
|
|
||||||
color: { value: '' },
|
color: { value: '' },
|
||||||
textColor: { value: '' },
|
textColor: { value: '' },
|
||||||
|
padding: { value: 'default' },
|
||||||
|
incompletedAccent: { value: '#E4E7EB' },
|
||||||
|
incompletedLabel: { value: '#1B1F24' },
|
||||||
|
completedAccent: { value: '#4368E3' },
|
||||||
|
completedLabel: { value: '#1B1F24' },
|
||||||
|
currentStepLabel: { value: '#1B1F24' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1da04eef696345ce9f35d42af92e5d6de992cd85
|
Subproject commit 26447ec13d91119d001319ac940264bbc39a3b54
|
||||||
|
|
@ -31,7 +31,7 @@ export const stepsConfig = {
|
||||||
validation: {
|
validation: {
|
||||||
schema: {
|
schema: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
element: { type: 'object', object: { id: { type: 'number' } } },
|
element: { type: 'object' },
|
||||||
},
|
},
|
||||||
defaultValue: `[{ name: 'step 1'}, {name: 'step 2'}]`,
|
defaultValue: `[{ name: 'step 1'}, {name: 'step 2'}]`,
|
||||||
},
|
},
|
||||||
|
|
@ -97,12 +97,12 @@ export const stepsConfig = {
|
||||||
{
|
{
|
||||||
handle: 'setVisibility',
|
handle: 'setVisibility',
|
||||||
displayName: 'Set visibility',
|
displayName: 'Set visibility',
|
||||||
params: [
|
params: [{ handle: 'visible', displayName: 'Value', defaultValue: '{{false}}', type: 'toggle' }],
|
||||||
{
|
},
|
||||||
handle: 'option',
|
{
|
||||||
displayName: 'Option',
|
handle: 'setDisabled',
|
||||||
},
|
displayName: 'Set disabled',
|
||||||
],
|
params: [{ handle: 'disable', displayName: 'Value', defaultValue: '{{true}}', type: 'toggle' }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
handle: 'resetSteps',
|
handle: 'resetSteps',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue