Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{{/ for }}
{{ else }}
<select disabled=""><option>Years</option></select>
{{/ if }}
<div>
{{# for(vehicle of this.vehicles) }}
<h2>{{ vehicle.name }}</h2>
<img width="200px">
{{/ for }}
</div>
`;
static props = {
makeId: type.maybeConvert(String),
makes: {
get() {
return ajax({
type: "GET",
url: "/makes"
}).then(resp => resp.data);
}
},
modelId: {
type: String,
value({ lastSet, listenTo, resolve }) {
listenTo(lastSet, resolve);
listenTo("makeId", () => resolve(""));
}
},
<div>
<p>Select {{ this.listName }}:</p>
{{# for(option of this.options) }}
<label>
{{ option }}
<input type="checkbox">
</label>
{{/ for }}
</div>
`;
static props = {
listName: { type: type.maybeConvert(String), default: "many" },
options: type.maybeConvert(ObservableArray),
update: Function
};
};
customElements.define("select-many", SelectMany);
class MeatPicker extends StacheElement {
static view = `
{{ let showOptions=null }}
<div>
<label>
Vegetarian
</label></div>
<div>
<p>Select {{ this.listName }}:</p>
<select>
{{# for(option of this.options) }}
<option>{{ option }}</option>
{{/ for }}
</select>
</div>
`;
static props = {
listName: { type: type.maybeConvert(String), default: "one" },
options: type.maybeConvert(ObservableArray),
default: type.maybeConvert(String),
update: Function
};
};
customElements.define("select-one", SelectOne);
class SelectMany extends StacheElement {
static view = `
<div>
<p>Select {{ this.listName }}:</p>
{{# for(option of this.options) }}
<label>
{{ option }}
</label></div>
static get props() {
return {
id: type.maybeConvert(Number),
name: type.maybeConvert(String),
complete: type.maybeConvert(Boolean)
};
}
}
<label>
Number (type: "any"):
<input type="number">
</label>
<p>
Number (type: "any"):
{{# eq(typeof(this.favoriteNumberAnyType), "string" }}
"{{ this.favoriteNumberAnyType }}"
{{ else }}
{{ this.favoriteNumberAnyType }}
{{/ eq }}
</p>
`;
static props = {
favoriteNumber: type.maybeConvert(Number),
favoriteNumberAnyType: type.Any
};
typeof(val) {
return typeof val;
}
};
customElements.define("number-inputs", NumberInputs);
<option>Green peppers</option>
<option>Pineapple</option>
<option>Spinach</option>
<p>
Selected toppings:
{{# for( topping of this.toppings) }}
{{ topping }}
{{/ for }}
</p>
`;
static props = {
toppings: type.maybeConvert(ObservableArray)
};
};
customElements.define("pizza-toppings-picker", PizzaToppingsPicker);
<option>9</option>
<option>10</option>
<option>11</option>
<p>Selected index: {{ this.selectedIndex }}</p>
<label>
Selected Month:
<input>
</label>
`;
static props = {
selectedIndex: type.maybeConvert(Number),
months: {
get default() {
return [
"Jan",
"Feb",
"March",
"April",
"May",
"June",
"July",
"Aug",
"Sept",
"Oct",
"Nov",
"Dec"
static get items() {
return type.maybeConvert(Todo);
}
}
static get props() {
return {
id: {type: type.maybeConvert(Number), identity: true},
name: type.maybeConvert(String),
complete: type.maybeConvert(Boolean)
};
}
}
static view = `
{{# for(number of this.availableNumbers }}
<label>
<input type="checkbox">
checked:bind="boolean-to-inList({{ number }}, numbers)"
</label>
{{/ for }}
<p>
selected numbers: {{# for(number of this.selectedNumbers) }}{{ number }} {{/ for }}
</p>
`;
static props = {
availableNumbers: {
type: type.maybeConvert(ObservableArray),
get default() {
return [ "one", "two", "three" ];
}
},
selectedNumbers: {
type: type.maybeConvert(ObservableArray),
get default() {
return [];
}
}
};
};
customElements.define("checkbox-inlist", CheckboxInlist);