mnfst 0.5.182 → 0.5.184
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/lib/manifest.combobox.js
CHANGED
|
@@ -236,6 +236,20 @@ function initializeComboboxPlugin() {
|
|
|
236
236
|
// ----- Source / options -----
|
|
237
237
|
const sourceId = cfg.source ? String(cfg.source).replace(/^#/, '') : null;
|
|
238
238
|
const src = sourceId ? document.getElementById(sourceId) : null;
|
|
239
|
+
|
|
240
|
+
// A named source that isn't in the DOM yet (it renders after us — a later sibling,
|
|
241
|
+
// an x-if branch, an async component) would otherwise leave the field menu-less and
|
|
242
|
+
// unable to resolve labels forever. Nothing is mutated before this point, so wait
|
|
243
|
+
// for it and cleanly re-enter build(); give up after ~5s → a source-less field.
|
|
244
|
+
if (sourceId && !src && !isAsync) {
|
|
245
|
+
if ((el.__cbSourceTries = (el.__cbSourceTries || 0) + 1) <= 100) {
|
|
246
|
+
el.__mnfstCombobox = false;
|
|
247
|
+
setTimeout(() => build(el, modifiers, expression, cleanup), 50);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// fell through: never appeared — proceed as a source-less (free-entry) field
|
|
251
|
+
}
|
|
252
|
+
|
|
239
253
|
let options = readOptions(src);
|
|
240
254
|
const hasMenu = !!src || isAsync;
|
|
241
255
|
if (editorNone && !hasMenu) return; // a button trigger needs a list
|
|
@@ -872,13 +886,24 @@ function initializeComboboxPlugin() {
|
|
|
872
886
|
if (cleanup) cleanup(() => mo.disconnect());
|
|
873
887
|
}
|
|
874
888
|
|
|
875
|
-
// ----- Seed initial
|
|
876
|
-
//
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
889
|
+
// ----- Seed the initial value from the value attribute — only when there's no
|
|
890
|
+
// x-model (it wins). Chips split on separators; a SINGLE field takes the
|
|
891
|
+
// whole value and resolves it to its label (async options fill in via the
|
|
892
|
+
// reread). Seeding never writes the model or fires change. -----
|
|
893
|
+
if (!modelExpr && !editorNone && el.value) {
|
|
880
894
|
seeding = true;
|
|
881
|
-
|
|
895
|
+
if (chips) {
|
|
896
|
+
// Fresh only — an adopted (prerendered) wrapper already recovered its chips.
|
|
897
|
+
if (!adopt) {
|
|
898
|
+
const seeds = el.value.split(/[,\n;]+/).map(s => s.trim()).filter(Boolean);
|
|
899
|
+
el.value = '';
|
|
900
|
+
seeds.forEach(s => commitText(s));
|
|
901
|
+
}
|
|
902
|
+
} else if (!multiple) {
|
|
903
|
+
// Runs fresh AND on hydration: el.value is the value attribute either way,
|
|
904
|
+
// so a single field re-derives its selection even in an adopted wrapper.
|
|
905
|
+
addValue(el.value.trim(), labelFor(el.value.trim()));
|
|
906
|
+
}
|
|
882
907
|
seeding = false;
|
|
883
908
|
}
|
|
884
909
|
// In chips/multiple the editor is a typing buffer. Clear value AND remove the
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"manifest.code.js": "sha384-G3MNfvQRWWY+gm4SGGrSsgQbDeil9MP+ON2DTk6Rcq9Nsex8woHMDt5EJHrFH0Nj",
|
|
8
8
|
"manifest.color.js": "sha384-6Rv3LxyTcZNjrhtayQfqRdCx0uSZ4BiEbgEI98I62eTvp8Aw7LBIoNJ0Je1oktwL",
|
|
9
9
|
"manifest.colorpicker.js": "sha384-N5ezEwgKrDodV4YdURxhdyZKmg1n/QhqvmAC4SEG03mw1pEAZAA8Gphp+NLAOxts",
|
|
10
|
-
"manifest.combobox.js": "sha384-
|
|
10
|
+
"manifest.combobox.js": "sha384-KMD5B1g0cbfmEK99ML/ejizkEY3zGoydE/VeWIqq5G9/V0y2YSzuedKfWlBMmv/O",
|
|
11
11
|
"manifest.components.js": "sha384-eZDib+RFdwd9mOUdi6o53eNS0LBlEEkZPDegxtkAcE+GrGIFxsuB4O0ymfixGNfM",
|
|
12
12
|
"manifest.data.js": "sha384-3lLvGnqcQr4Ium80MdaQTr8RytjVbs5rnxd0q41BF3ppcoQccMFAcvgFSyZP/0sl",
|
|
13
13
|
"manifest.datepicker.js": "sha384-52BBZdlLN+EATiUorwTEQOWGJZiSNu0voy9q+WQxxWpUeYsGGkuS0QPPXGx2akxG",
|