Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
});
// DUPE with TextField.
const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage));
const pField = AlloyFormField.parts().field({
// TODO: Alloy should not allow dom changing of an HTML select!
dom: { },
selectAttributes: {
size: spec.size
},
options: translatedOptions,
factory: AlloyHtmlSelect,
selectBehaviours: Behaviour.derive([
Disabling.config({ disabled: spec.disabled }),
Tabstopping.config({ }),
AddEventsBehaviour.config('selectbox-change', [
AlloyEvents.run(NativeEvents.change(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
})
])
])
});
const chevron: Option = spec.size > 1 ? Option.none() :
Option.some({
dom: {
tag: 'div',
classes: ['tox-selectfield__icon-js'],
innerHtml: Icons.get('chevron-down', providersBackstage.icons)
}const renderTextField = function (spec: TextField, providersBackstage: UiFactoryBackstageProviders) {
const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage));
const baseInputBehaviours = [
Disabling.config({ disabled: spec.disabled }),
Keying.config({
mode: 'execution',
useEnter: spec.multiline !== true,
useControlEnter: spec.multiline === true,
execute: (comp) => {
AlloyTriggers.emit(comp, formSubmitEvent);
return Option.some(true);
},
}),
AddEventsBehaviour.config('textfield-change', [
AlloyEvents.run(NativeEvents.input(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
}),
AlloyEvents.run(SystemEvents.postPaste(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
})return Option.some(true);
};
const pField = AlloyFormField.parts().field({
factory: { sketch: Fun.identity },
dom: {
tag: 'input',
classes: ['tox-checkbox__input'],
attributes: {
type: 'checkbox'
}
},
behaviours: Behaviour.derive([
ComposingConfigs.self(),
Disabling.config({ disabled: spec.disabled }),
Tabstopping.config({}),
Focusing.config({ }),
repBehaviour,
Keying.config({
mode: 'special',
onEnter: toggleCheckboxHandler,
onSpace: toggleCheckboxHandler,
stopSpaceKeyup: true
}),
AddEventsBehaviour.config('checkbox-events', [
AlloyEvents.run(NativeEvents.change(), (component, _) => {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
})
])
]),
});const toolbarButton = (disabled: boolean) => Disabling.config({
disabled,
disableClass: 'tox-tbtn--disabled',
useNative: false
});const getFieldPart = (isField1) => AlloyFormField.parts().field({
factory: AlloyInput,
inputClasses: ['tox-textfield'],
inputBehaviours: Behaviour.derive([
Disabling.config({ disabled: spec.disabled }),
Tabstopping.config({}),
AddEventsBehaviour.config('size-input-events', [
AlloyEvents.run(NativeEvents.focusin(), function (component, simulatedEvent) {
AlloyTriggers.emitWith(component, ratioEvent, { isField1 });
}),
AlloyEvents.run(NativeEvents.change(), function (component, simulatedEvent) {
AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name });
})
])
]),
selectOnFocus: false
});const createSpacer = (): Memento.MementoRecord => {
return Memento.record({
dom: {
tag: 'div',
classes: [ 'tox-spacer' ]
},
behaviours: Behaviour.derive([ Disabling.config({ }) ])
});
};optUrlPicker.each((picker) => {
picker(urlData).get((chosenData) => {
Representing.setValue(field, chosenData);
AlloyTriggers.emitWith(comp, formChangeEvent, { name: spec.name });
});
});
});
};
return AlloyFormField.sketch({
dom: renderFormFieldDom(),
components: pLabel.toArray().concat([
controlHWrapper()
]),
fieldBehaviours: Behaviour.derive([
Disabling.config({
disabled: spec.disabled,
onDisabled: (comp) => {
AlloyFormField.getField(comp).each(Disabling.disable);
memUrlPickerButton.getOpt(comp).each(Disabling.disable);
},
onEnabled: (comp) => {
AlloyFormField.getField(comp).each(Disabling.enable);
memUrlPickerButton.getOpt(comp).each(Disabling.enable);
}
}),
AddEventsBehaviour.config('url-input-events', [
AlloyEvents.run(browseUrlEvent, openUrlPicker)
])
])
});
};const navigationButton = function (direction, directionName, enabled) {
return Button.sketch({
dom: UiDomFactory.dom('<span class="${prefix}-icon-' + directionName + ' ${prefix}-icon"></span>'),
action (button) {
AlloyTriggers.emitWith(button, navigateEvent, { direction });
},
buttonBehaviours: Behaviour.derive([
Disabling.config({
disableClass: Styles.resolve('toolbar-navigation-disabled'),
disabled: !enabled
})
])
});
};const renderField = (s) => {
return {
uid: s.uid,
dom: {
tag: 'div',
classes: [ 'tox-dropzone-container' ]
},
behaviours: Behaviour.derive([
RepresentingConfigs.memory([ ]),
ComposingConfigs.self(),
Disabling.config({}),
Toggling.config({
toggleClass: 'dragenter',
toggleOnExecute: false
}),
AddEventsBehaviour.config('dropzone-events', [
AlloyEvents.run('dragenter', sequence([ stopper, Toggling.toggle ])),
AlloyEvents.run('dragleave', sequence([ stopper, Toggling.toggle ])),
AlloyEvents.run('dragover', stopper),
AlloyEvents.run('drop', sequence([ stopper, onDrop ])),
AlloyEvents.run(NativeEvents.change(), onSelect)
]),
]),
components: [
{
dom: {
tag: 'div',