Skip to content

Commit

Permalink
Merge pull request #46 from kawakamimoeki/fix_c_method
Browse files Browse the repository at this point in the history
Fix c method
  • Loading branch information
kawakamimoeki authored Oct 19, 2024
2 parents a960af8 + 7e96ca0 commit 20b20cc
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/clapton/javascripts/dist/c-for-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ var c = (function () {
}
get renderWrapper() {
let value = this.state[this.attribute];
if (!this.attributes.type) {
this.attributes.type = "text";
}
if (this.attributes.type === "datetime-local" && value) {
value = this.datetime_local_value(value);
}
Expand Down Expand Up @@ -383,6 +386,10 @@ var c = (function () {
};
const c = (name, ...props) => {
switch (name) {
case "bq":
return blockquote(...props);
case "box":
return div(...props);
case "blockquote":
return blockquote(...props);
case "div":
Expand All @@ -401,6 +408,8 @@ var c = (function () {
return em(...props);
case "form":
return form(...props);
case "h":
return h1(...props);
case "h1":
return h1(...props);
case "h2":
Expand Down Expand Up @@ -437,6 +446,15 @@ var c = (function () {
return input(...props);
case "text":
return text(...props);
case "radio":
props[3].type = "radio";
return input(...props);
case "datetime":
props[3].type = "datetime-local";
return input(...props);
case "check":
props[3].type = "checkbox";
return input(...props);
default:
return new Clapton.Element(name, ...props);
}
Expand Down
18 changes: 18 additions & 0 deletions lib/clapton/javascripts/dist/c.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ class Input extends Base {
}
get renderWrapper() {
let value = this.state[this.attribute];
if (!this.attributes.type) {
this.attributes.type = "text";
}
if (this.attributes.type === "datetime-local" && value) {
value = this.datetime_local_value(value);
}
Expand Down Expand Up @@ -380,6 +383,10 @@ const text = (...props) => {
};
const c = (name, ...props) => {
switch (name) {
case "bq":
return blockquote(...props);
case "box":
return div(...props);
case "blockquote":
return blockquote(...props);
case "div":
Expand All @@ -398,6 +405,8 @@ const c = (name, ...props) => {
return em(...props);
case "form":
return form(...props);
case "h":
return h1(...props);
case "h1":
return h1(...props);
case "h2":
Expand Down Expand Up @@ -434,6 +443,15 @@ const c = (name, ...props) => {
return input(...props);
case "text":
return text(...props);
case "radio":
props[3].type = "radio";
return input(...props);
case "datetime":
props[3].type = "datetime-local";
return input(...props);
case "check":
props[3].type = "checkbox";
return input(...props);
default:
return new Clapton.Element(name, ...props);
}
Expand Down
3 changes: 3 additions & 0 deletions lib/clapton/javascripts/dist/components-for-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ var Clapton = (function (exports) {
}
get renderWrapper() {
let value = this.state[this.attribute];
if (!this.attributes.type) {
this.attributes.type = "text";
}
if (this.attributes.type === "datetime-local" && value) {
value = this.datetime_local_value(value);
}
Expand Down
3 changes: 3 additions & 0 deletions lib/clapton/javascripts/dist/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ class Input extends Base {
}
get renderWrapper() {
let value = this.state[this.attribute];
if (!this.attributes.type) {
this.attributes.type = "text";
}
if (this.attributes.type === "datetime-local" && value) {
value = this.datetime_local_value(value);
}
Expand Down
15 changes: 15 additions & 0 deletions lib/clapton/javascripts/src/c-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ const text = (...props: any[]) => {

const c = (name: string, ...props: any[]) => {
switch (name) {
case "bq":
return blockquote(...props)
case "box":
return div(...props)
case "blockquote":
return blockquote(...props)
case "div":
Expand All @@ -128,6 +132,8 @@ const c = (name: string, ...props: any[]) => {
return em(...props)
case "form":
return form(...props)
case "h":
return h1(...props)
case "h1":
return h1(...props)
case "h2":
Expand Down Expand Up @@ -164,6 +170,15 @@ const c = (name: string, ...props: any[]) => {
return input(...props)
case "text":
return text(...props)
case "radio":
props[3].type = "radio"
return input(...props)
case "datetime":
props[3].type = "datetime-local"
return input(...props)
case "check":
props[3].type = "checkbox"
return input(...props)
default:
return new Clapton.Element(name, ...props)
}
Expand Down
3 changes: 3 additions & 0 deletions lib/clapton/javascripts/src/components/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export class Input extends Base {

get renderWrapper(): string {
let value = this.state[this.attribute]
if (!this.attributes.type) {
this.attributes.type = "text"
}
if (this.attributes.type === "datetime-local" && value) {
value = this.datetime_local_value(value)
}
Expand Down

0 comments on commit 20b20cc

Please sign in to comment.