Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions src/composables/useInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ export function useInput(props, emit) {
: props.wwElementState.props.readonly;
});

const style = computed(() => {
const computedStyle = {
...wwLib.wwUtils.getTextStyleFromContent(props.content),
'--placeholder-color': props.content.placeholderColor,
};
delete computedStyle['whiteSpaceCollapse'];
delete computedStyle['whiteSpace'];
return computedStyle;
});

const min = computed(() => {
if (type.value === 'date') {
return props.content.minDate;
Expand Down Expand Up @@ -230,34 +220,6 @@ export function useInput(props, emit) {
return isReallyFocused.value;
});

watch(
isFocused,
value => {
if (value) {
emit('add-state', 'focus');
} else {
emit('remove-state', 'focus');
}
},
{
immediate: true,
}
);

watch(
isReadonly,
value => {
if (value) {
emit('add-state', 'readonly');
} else {
emit('remove-state', 'readonly');
}
},
{
immediate: true,
}
);

/* wwEditor:start */
watch(
() => props.content.precision,
Expand All @@ -281,7 +243,6 @@ export function useInput(props, emit) {
step,
inputType,
isReadonly,
style,
min,
max,
stepAttribute,
Expand Down
23 changes: 16 additions & 7 deletions src/wwElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
v-if="showCurrencySymbol"
ref="currencySymbolRef"
class="currency-symbol"
:style="[currencySymbolStyle, { padding: style.padding }]"
:style="currencySymbolStyle"
>
{{ currencySymbol }}
</span>
Expand Down Expand Up @@ -86,8 +86,6 @@ export default {
emits: [
'element-event',
'trigger-event',
'add-state',
'remove-state',
'update:content:effect',
'update:sidepanel-content',
],
Expand All @@ -113,7 +111,6 @@ export default {
step,
inputType,
isReadonly,
style,
min,
max,
stepAttribute,
Expand Down Expand Up @@ -504,7 +501,6 @@ export default {
required: props.content.required,
autocomplete: props.content.autocomplete ? 'on' : 'off',
placeholder: wwLib.wwLang.getText(props.content.placeholder),
style: style.value,
min: min.value,
max: max.value,
step: stepAttribute.value,
Expand All @@ -519,7 +515,7 @@ export default {
required: props.content.required,
placeholder: wwLib.wwLang.getText(props.content.placeholder),
rows: props.content.rows,
style: [style.value, { resize: props.content.resize ? '' : 'none' }],
style: { resize: props.content.resize ? '' : 'none' },
}));

const inputClasses = computed(() => ({
Expand Down Expand Up @@ -626,7 +622,6 @@ export default {
step,
inputType,
isReadonly,
style,
isEditing,
min,
max,
Expand Down Expand Up @@ -686,6 +681,9 @@ export default {
border: none;
position: relative;
isolation: isolate;
overflow: var(--ww-text-overflow, initial);
text-overflow: var(--ww-text-text-overflow, initial);
white-space: var(--ww-text-white-space, initial);

&::placeholder {
color: var(--placeholder-color, #000000ad);
Expand Down Expand Up @@ -730,7 +728,18 @@ export default {

&.currency-type {
background-color: transparent;
color: inherit;
font: inherit;
letter-spacing: inherit;
line-height: inherit;
text-align: inherit;
text-decoration: inherit;
text-decoration-color: inherit;
text-decoration-style: inherit;
text-shadow: inherit;
text-transform: inherit;
width: 100%;
word-spacing: inherit;
}
}
</style>
10 changes: 9 additions & 1 deletion ww-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ export default {
type: 'ww-text',
exclude: ['text'],
},
css({ content }) {
if (!content.placeholderColor) return [];

return [{ property: '--placeholder-color', value: content.placeholderColor }];
},
editor: {
label: { en: 'Form Input', fr: 'Entrée de Formulaire' },
icon: 'text-input',
Expand Down Expand Up @@ -59,7 +64,10 @@ export default {
}));
},
},
states: ['focus', 'readonly'],
states: [
{ label: 'focus', selector: '&:focus-within' },
{ label: 'readonly', selectors: ['&:read-only', '&:has(:read-only)'] },
],
actions: [{ label: 'Focus element', action: 'focusInput' }],
triggerEvents: [
{ name: 'change', label: { en: 'On change' }, event: { value: '' }, default: true },
Expand Down