fix: Fix module location for some utils.
This commit is contained in:
parent
5aedf51d0c
commit
5526a3f4d2
5 changed files with 27 additions and 4 deletions
|
@ -200,6 +200,19 @@ export function usableOption(options, option) {
|
||||||
return options[option] !== undefined && options[option] !== ''
|
return options[option] !== undefined && options[option] !== ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes a template string by replacing placeholders with corresponding
|
||||||
|
* data values.
|
||||||
|
*
|
||||||
|
* Supports dot notation for nested objects and optional static fallbacks.
|
||||||
|
* If a value is not found, the placeholder is replaced with an empty string
|
||||||
|
* or left unchanged when 'ignore' is true.
|
||||||
|
*
|
||||||
|
* @param {string} str - The template string with placeholders.
|
||||||
|
* @param {Object} data - The data object from which to pull replacement values.
|
||||||
|
* @param {boolean} [ignore=false] - If true, leaves placeholders unchanged when no value is found.
|
||||||
|
* @returns {string} The processed string with placeholders replaced.
|
||||||
|
*/
|
||||||
export function greedyTemplate(str, data, ignore) {
|
export function greedyTemplate(str, data, ignore) {
|
||||||
function getValue(data, path) {
|
function getValue(data, path) {
|
||||||
let value = data
|
let value = data
|
||||||
|
@ -310,6 +323,16 @@ export function isDataImage(value) {
|
||||||
return value && value.length && value.startsWith('data:image')
|
return value && value.length && value.startsWith('data:image')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes the input string by converting to lowercase
|
||||||
|
* and removing diacritics.
|
||||||
|
*
|
||||||
|
* If the input is nullish, it defaults to an empty string.
|
||||||
|
*
|
||||||
|
* @param {string} s - The string to be normalized.
|
||||||
|
* @returns {string} - The normalized string with lowercase
|
||||||
|
* characters and no diacritics.
|
||||||
|
*/
|
||||||
export function normalize(s) {
|
export function normalize(s) {
|
||||||
return (s || '')
|
return (s || '')
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|
|
@ -153,7 +153,7 @@ U.AutoComplete = L.Class.extend({
|
||||||
this.displaySelected(choice)
|
this.displaySelected(choice)
|
||||||
this.hide()
|
this.hide()
|
||||||
if (this.options.callback) {
|
if (this.options.callback) {
|
||||||
U.Utils.bind(this.options.callback, this)(choice)
|
L.Util.bind(this.options.callback, this)(choice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -128,7 +128,7 @@ L.DomUtil.createCopiableInput = (parent, label, value) => {
|
||||||
'',
|
'',
|
||||||
wrapper,
|
wrapper,
|
||||||
'',
|
'',
|
||||||
() => U.Utils.copyToClipboard(input.value),
|
() => L.Util.copyToClipboard(input.value),
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
button.title = L._('copy')
|
button.title = L._('copy')
|
||||||
|
|
|
@ -1032,7 +1032,7 @@ U.Map = L.Map.extend({
|
||||||
{
|
{
|
||||||
label: L._('Copy link'),
|
label: L._('Copy link'),
|
||||||
callback: () => {
|
callback: () => {
|
||||||
U.Utils.copyToClipboard(data.permissions.anonymous_edit_url)
|
L.Util.copyToClipboard(data.permissions.anonymous_edit_url)
|
||||||
this.ui.alert({
|
this.ui.alert({
|
||||||
content: L._('Secret edit link copied to clipboard!'),
|
content: L._('Secret edit link copied to clipboard!'),
|
||||||
level: 'info',
|
level: 'info',
|
||||||
|
|
|
@ -760,7 +760,7 @@ U.DataLayer = L.Evented.extend({
|
||||||
U.Utils.sortFeatures(features, this.map.getOption('sortKey'), L.lang)
|
U.Utils.sortFeatures(features, this.map.getOption('sortKey'), L.lang)
|
||||||
this._index = []
|
this._index = []
|
||||||
for (let i = 0; i < features.length; i++) {
|
for (let i = 0; i < features.length; i++) {
|
||||||
this._index.push(U.Utils.stamp(features[i]))
|
this._index.push(L.Util.stamp(features[i]))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue