Flat button for icon shapes direct input

This commit is contained in:
David Larlet 2023-10-27 10:35:26 -04:00
parent c5a28755a2
commit 2f424b7539
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
2 changed files with 25 additions and 5 deletions

View file

@ -193,6 +193,15 @@ input[type="submit"] {
.dark a { .dark a {
color: #eeeeec; color: #eeeeec;
} }
[type="button"].flat,
.dark [type="button"].flat {
border: none;
background-color: inherit;
padding: 0;
text-align: left;
min-height: inherit;
text-decoration: underline;
}
.help-text, .helptext { .help-text, .helptext {
display: block; display: block;
padding: 7px 7px; padding: 7px 7px;

View file

@ -397,7 +397,11 @@ L.FormBuilder.DataLayerSwitcher = L.FormBuilder.Select.extend({
getOptions: function () { getOptions: function () {
const options = [] const options = []
this.builder.map.eachDataLayerReverse((datalayer) => { this.builder.map.eachDataLayerReverse((datalayer) => {
if (datalayer.isLoaded() && !datalayer.isDataReadOnly() && datalayer.canBrowse()) { if (
datalayer.isLoaded() &&
!datalayer.isDataReadOnly() &&
datalayer.canBrowse()
) {
options.push([L.stamp(datalayer), datalayer.getName()]) options.push([L.stamp(datalayer), datalayer.getName()])
} }
}) })
@ -628,7 +632,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({
closeButton.style.clear = 'both' closeButton.style.clear = 'both'
const customButton = L.DomUtil.createButton( const customButton = L.DomUtil.createButton(
'', 'flat',
this.pictogramsContainer, this.pictogramsContainer,
L._('Toggle direct input (advanced)'), L._('Toggle direct input (advanced)'),
function (e) { function (e) {
@ -728,7 +732,10 @@ L.FormBuilder.MultiChoice = L.FormBuilder.Element.extend({
fetch: function () { fetch: function () {
let value = (this.backup = this.toHTML()) let value = (this.backup = this.toHTML())
if (!this.container.querySelector(`input[type="radio"][value="${value}"]`)) if (!this.container.querySelector(`input[type="radio"][value="${value}"]`))
value = typeof(this.options.default) !== 'undefined' ? this.options.default : this.default value =
typeof this.options.default !== 'undefined'
? this.options.default
: this.default
this.container.querySelector(`input[type="radio"][value="${value}"]`).checked = true this.container.querySelector(`input[type="radio"][value="${value}"]`).checked = true
}, },
@ -838,7 +845,9 @@ L.FormBuilder.Range = L.FormBuilder.FloatInput.extend({
}, },
value: function () { value: function () {
return L.DomUtil.hasClass(this.wrapper, 'undefined') ? undefined : L.FormBuilder.FloatInput.prototype.value.call(this) return L.DomUtil.hasClass(this.wrapper, 'undefined')
? undefined
: L.FormBuilder.FloatInput.prototype.value.call(this)
}, },
buildHelpText: function () { buildHelpText: function () {
@ -853,7 +862,9 @@ L.FormBuilder.Range = L.FormBuilder.FloatInput.extend({
const step = this.options.step || 1, const step = this.options.step || 1,
digits = step < 1 ? 2 : 0 digits = step < 1 ? 2 : 0
for (let i = this.options.min; i <= this.options.max; i += this.options.step) { for (let i = this.options.min; i <= this.options.max; i += this.options.step) {
options += `<option value="${i.toFixed(digits)}" label="${i.toFixed(digits)}"></option>` options += `<option value="${i.toFixed(digits)}" label="${i.toFixed(
digits
)}"></option>`
} }
datalist.innerHTML = options datalist.innerHTML = options
L.FormBuilder.Input.prototype.buildHelpText.call(this) L.FormBuilder.Input.prototype.buildHelpText.call(this)