saasufy-components 7.7.1 → 7.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/input-provider.js +2 -2
- package/model-input.js +2 -2
- package/package.json +1 -1
- package/utils.js +14 -2
package/input-provider.js
CHANGED
|
@@ -137,11 +137,11 @@ class InputProvider extends HTMLElement {
|
|
|
137
137
|
let {
|
|
138
138
|
fieldNames: optionNames,
|
|
139
139
|
fieldValues: optionValues
|
|
140
|
-
} = convertStringToFieldParams(options, true);
|
|
140
|
+
} = convertStringToFieldParams(options, true, true);
|
|
141
141
|
|
|
142
142
|
let optionElements = optionNames
|
|
143
143
|
.map((optionName) => {
|
|
144
|
-
let optionValue = optionValues[optionName]
|
|
144
|
+
let optionValue = optionValues[optionName] ?? optionName;
|
|
145
145
|
if (optionName === placeholder) {
|
|
146
146
|
return `<option value="" selected class="select-default-option">${optionName}</option>`;
|
|
147
147
|
}
|
package/model-input.js
CHANGED
|
@@ -210,11 +210,11 @@ class ModelInput extends SocketConsumer {
|
|
|
210
210
|
let {
|
|
211
211
|
fieldNames: optionNames,
|
|
212
212
|
fieldValues: optionValues
|
|
213
|
-
} = convertStringToFieldParams(options, true);
|
|
213
|
+
} = convertStringToFieldParams(options, true, true);
|
|
214
214
|
|
|
215
215
|
let optionElements = optionNames
|
|
216
216
|
.map((optionName) => {
|
|
217
|
-
let optionValue = optionValues[optionName]
|
|
217
|
+
let optionValue = optionValues[optionName] ?? optionName;
|
|
218
218
|
if (optionName === placeholder) {
|
|
219
219
|
return `<option value="" selected class="select-default-option">${optionName}</option>`;
|
|
220
220
|
}
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -413,6 +413,13 @@ export const fieldPartsRegExpWithEmpty = /((^|(?<=,))((?=,)|$)|"[^"]*"|'[^']*'|\
|
|
|
413
413
|
|
|
414
414
|
export const quotedContentRegExp = /^\s*["']?(.*?)["']?\s*$/;
|
|
415
415
|
|
|
416
|
+
export const unescapedEqualRegExp = /(?<!\\)=/;
|
|
417
|
+
export const escapedEqualRegExp = /\\=/g;
|
|
418
|
+
|
|
419
|
+
export function unescapeEqualSigns(value) {
|
|
420
|
+
return value.replace(escapedEqualRegExp, '=');
|
|
421
|
+
}
|
|
422
|
+
|
|
416
423
|
export function toBoolean(value) {
|
|
417
424
|
return !!value && value !== 'false' && value !== 'null' && value !== 'undefined';
|
|
418
425
|
}
|
|
@@ -433,11 +440,16 @@ export function getTypeCastFunction(type) {
|
|
|
433
440
|
return typeCastFunctions[type] || ((value) => value);
|
|
434
441
|
}
|
|
435
442
|
|
|
436
|
-
export function convertStringToFieldParams(string, allowEmpty) {
|
|
443
|
+
export function convertStringToFieldParams(string, allowEmpty, unescapeEqual) {
|
|
437
444
|
let partsRegExp = allowEmpty ? fieldPartsRegExpWithEmpty : fieldPartsRegExp;
|
|
438
445
|
let parts = ((string || '').match(partsRegExp) || []).map(field => field.trim());
|
|
439
446
|
let fieldTypeValues = parts.map((part) => {
|
|
440
|
-
let subParts
|
|
447
|
+
let subParts;
|
|
448
|
+
if (unescapeEqual) {
|
|
449
|
+
subParts = part.split(unescapedEqualRegExp).map(unescapeEqualSigns);
|
|
450
|
+
} else {
|
|
451
|
+
subParts = part.split(unescapedEqualRegExp);
|
|
452
|
+
}
|
|
441
453
|
let nameType = (subParts[0] || '').split(':');
|
|
442
454
|
let name = nameType[0];
|
|
443
455
|
let type = nameType[1] || 'text';
|