diff --git a/core/pom.xml b/core/pom.xml index 98df5b4eb..295b689f8 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -68,8 +68,8 @@ org.apache.maven.plugins maven-compiler-plugin - 7 - 7 + ${archetype.java.version} + ${archetype.java.version} diff --git a/core/src/main/java/com/themecleanflex/models/CardModel.java b/core/src/main/java/com/themecleanflex/models/CardModel.java new file mode 100644 index 000000000..6636bbd91 --- /dev/null +++ b/core/src/main/java/com/themecleanflex/models/CardModel.java @@ -0,0 +1,291 @@ +package com.themecleanflex.models; + +import com.peregrine.nodetypes.models.AbstractComponent; +import com.peregrine.nodetypes.models.IComponent; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Default; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; +import org.apache.sling.models.annotations.Model; + +import javax.inject.Inject; + +import com.peregrine.model.api.ImageInfo; +import java.awt.Dimension; + + +/* + //GEN[:DATA + { + "name": "Card", + "modelName": "Card", + "componentPath": "themecleanflex/components/cards/cards", + "package": "com.themecleanflex.models", + "classNameParent": "AbstractComponent", + "definitions": { + "Card": { + "type": "string", + "x-source": "inject", + "x-form-label": "Cards", + "x-form-fieldLabel": "title", + "x-form-type": "collection", + "x-collection-type": "Card", + "properties": { + "title": { + "type": "string", + "x-source": "inject", + "x-form-label": "Card Title", + "x-form-visible": "model.showtitle == 'true'", + "x-form-type": "text" + }, + "text": { + "type": "string", + "x-source": "inject", + "x-form-label": "Card Text", + "x-form-visible": "model.showtext == 'true'", + "x-form-type": "texteditor" + }, + "image": { + "type": "string", + "x-source": "inject", + "x-form-label": "Card Image", + "x-form-type": "pathbrowser", + "x-form-browserRoot": "/content/themecleanflex/assets", + "x-annotate": "size" + }, + "imagewidth": { + "type": "string", + "x-source": "inject", + "x-form-label": "Image Width", + "x-form-type": "materialrange", + "x-default": "100", + "x-form-min": "10", + "x-form-max": "100" + }, + "imagealttext": { + "type": "string", + "x-source": "inject", + "x-form-label": "Image Alt Text", + "x-form-type": "text" + }, + "buttontext": { + "type": "string", + "x-source": "inject", + "x-form-label": "Button Text", + "x-form-visible": "model.showbutton == 'true'", + "x-form-type": "text" + }, + "buttonlink": { + "type": "string", + "x-source": "inject", + "x-form-label": "Button Link", + "x-form-visible": "model.showbutton == 'true'", + "x-form-type": "pathbrowser", + "x-form-browserRoot": "/content/themecleanflex/pages" + }, + "buttoncolor": { + "type": "string", + "x-source": "inject", + "x-form-label": "Button Color", + "x-form-type": "materialselect", + "x-default": "primary", + "properties": { + "primary": { + "x-form-name": "Primary", + "x-form-value": "primary" + }, + "secondary": { + "x-form-name": "Secondary", + "x-form-value": "secondary" + }, + "success": { + "x-form-name": "Success", + "x-form-value": "success" + }, + "danger": { + "x-form-name": "Danger", + "x-form-value": "danger" + }, + "warning": { + "x-form-name": "Warning", + "x-form-value": "warning" + }, + "info": { + "x-form-name": "Info", + "x-form-value": "info" + } + } + }, + "buttonsize": { + "type": "string", + "x-source": "inject", + "x-form-label": "Button Size", + "x-form-type": "materialselect", + "x-default": "default", + "properties": { + "default": { + "x-form-name": "Default", + "x-form-value": "default" + }, + "large": { + "x-form-name": "Large", + "x-form-value": "large" + }, + "small": { + "x-form-name": "Small", + "x-form-value": "small" + } + } + }, + "buttonalign": { + "type": "string", + "x-source": "inject", + "x-form-label": "Button Alignment", + "x-form-type": "materialselect", + "x-default": "center", + "properties": { + "left": { + "x-form-name": "Left", + "x-form-value": "left" + }, + "center": { + "x-form-name": "Center", + "x-form-value": "center" + }, + "right": { + "x-form-name": "Right", + "x-form-value": "right" + } + } + } + } + } + } +} +//GEN] +*/ + +//GEN[:DEF +@Model( + adaptables = Resource.class, + defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, + adapters = IComponent.class +) +//GEN] +public class CardModel extends AbstractComponent { + + public CardModel(final Resource r) { super(r); } + + //GEN[:INJECT + /* {"type":"string","x-source":"inject","x-form-label":"Card Title","x-form-visible":"model.showtitle == 'true'","x-form-type":"text"} */ + @Inject + private String title; + + /* {"type":"string","x-source":"inject","x-form-label":"Card Text","x-form-visible":"model.showtext == 'true'","x-form-type":"texteditor"} */ + @Inject + private String text; + + /* {"type":"string","x-source":"inject","x-form-label":"Card Image","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-annotate":"size"} */ + @Inject + private String image; + + @Inject + @ImageInfo(name="image") + private Dimension imageSize; + + /* {"type":"string","x-source":"inject","x-form-label":"Image Width","x-form-type":"materialrange","x-default":"100","x-form-min":"10","x-form-max":"100"} */ + @Inject + @Default(values ="100") + private String imagewidth; + + /* {"type":"string","x-source":"inject","x-form-label":"Image Alt Text","x-form-type":"text"} */ + @Inject + private String imagealttext; + + /* {"type":"string","x-source":"inject","x-form-label":"Button Text","x-form-visible":"model.showbutton == 'true'","x-form-type":"text"} */ + @Inject + private String buttontext; + + /* {"type":"string","x-source":"inject","x-form-label":"Button Link","x-form-visible":"model.showbutton == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/pages"} */ + @Inject + private String buttonlink; + + /* {"type":"string","x-source":"inject","x-form-label":"Button Color","x-form-type":"materialselect","x-default":"primary","properties":{"primary":{"x-form-name":"Primary","x-form-value":"primary"},"secondary":{"x-form-name":"Secondary","x-form-value":"secondary"},"success":{"x-form-name":"Success","x-form-value":"success"},"danger":{"x-form-name":"Danger","x-form-value":"danger"},"warning":{"x-form-name":"Warning","x-form-value":"warning"},"info":{"x-form-name":"Info","x-form-value":"info"}}} */ + @Inject + @Default(values ="primary") + private String buttoncolor; + + /* {"type":"string","x-source":"inject","x-form-label":"Button Size","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"large":{"x-form-name":"Large","x-form-value":"large"},"small":{"x-form-name":"Small","x-form-value":"small"}}} */ + @Inject + @Default(values ="default") + private String buttonsize; + + /* {"type":"string","x-source":"inject","x-form-label":"Button Alignment","x-form-type":"materialselect","x-default":"center","properties":{"left":{"x-form-name":"Left","x-form-value":"left"},"center":{"x-form-name":"Center","x-form-value":"center"},"right":{"x-form-name":"Right","x-form-value":"right"}}} */ + @Inject + @Default(values ="center") + private String buttonalign; + + +//GEN] + + //GEN[:GETTERS + /* {"type":"string","x-source":"inject","x-form-label":"Card Title","x-form-visible":"model.showtitle == 'true'","x-form-type":"text"} */ + public String getTitle() { + return title; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Card Text","x-form-visible":"model.showtext == 'true'","x-form-type":"texteditor"} */ + public String getText() { + return text; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Card Image","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-annotate":"size"} */ + public String getImage() { + return image; + } + + public Dimension getImageSize() { + return imageSize; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Image Width","x-form-type":"materialrange","x-default":"100","x-form-min":"10","x-form-max":"100"} */ + public String getImagewidth() { + return imagewidth; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Image Alt Text","x-form-type":"text"} */ + public String getImagealttext() { + return imagealttext; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Button Text","x-form-visible":"model.showbutton == 'true'","x-form-type":"text"} */ + public String getButtontext() { + return buttontext; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Button Link","x-form-visible":"model.showbutton == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/pages"} */ + public String getButtonlink() { + return buttonlink; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Button Color","x-form-type":"materialselect","x-default":"primary","properties":{"primary":{"x-form-name":"Primary","x-form-value":"primary"},"secondary":{"x-form-name":"Secondary","x-form-value":"secondary"},"success":{"x-form-name":"Success","x-form-value":"success"},"danger":{"x-form-name":"Danger","x-form-value":"danger"},"warning":{"x-form-name":"Warning","x-form-value":"warning"},"info":{"x-form-name":"Info","x-form-value":"info"}}} */ + public String getButtoncolor() { + return buttoncolor; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Button Size","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"large":{"x-form-name":"Large","x-form-value":"large"},"small":{"x-form-name":"Small","x-form-value":"small"}}} */ + public String getButtonsize() { + return buttonsize; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Button Alignment","x-form-type":"materialselect","x-default":"center","properties":{"left":{"x-form-name":"Left","x-form-value":"left"},"center":{"x-form-name":"Center","x-form-value":"center"},"right":{"x-form-name":"Right","x-form-value":"right"}}} */ + public String getButtonalign() { + return buttonalign; + } + + +//GEN] + + //GEN[:CUSTOMGETTERS + //GEN] + +} diff --git a/core/src/main/java/com/themecleanflex/models/CardsModel.java b/core/src/main/java/com/themecleanflex/models/CardsModel.java index 9b3572142..a5a43b3cc 100644 --- a/core/src/main/java/com/themecleanflex/models/CardsModel.java +++ b/core/src/main/java/com/themecleanflex/models/CardsModel.java @@ -122,6 +122,7 @@ "x-form-label": "Cards", "x-form-fieldLabel": "title", "x-form-type": "collection", + "x-collection-type": "Card", "properties": { "title": { "type": "string", @@ -142,7 +143,8 @@ "x-source": "inject", "x-form-label": "Card Image", "x-form-type": "pathbrowser", - "x-form-browserRoot": "/content/themecleanflex/assets" + "x-form-browserRoot": "/content/themecleanflex/assets", + "x-annotate": "size" }, "imagewidth": { "type": "string", @@ -577,9 +579,9 @@ public class CardsModel extends AbstractComponent { @Default(values ="1") private String cardsperrowmobile; - /* {"type":"string","x-source":"inject","x-form-label":"Cards","x-form-fieldLabel":"title","x-form-type":"collection","properties":{"title":{"type":"string","x-source":"inject","x-form-label":"Card Title","x-form-visible":"model.showtitle == 'true'","x-form-type":"text"},"text":{"type":"string","x-source":"inject","x-form-label":"Card Text","x-form-visible":"model.showtext == 'true'","x-form-type":"texteditor"},"image":{"type":"string","x-source":"inject","x-form-label":"Card Image","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets"},"imagewidth":{"type":"string","x-source":"inject","x-form-label":"Image Width","x-form-type":"materialrange","x-default":"100","x-form-min":"10","x-form-max":"100"},"imagealttext":{"type":"string","x-source":"inject","x-form-label":"Image Alt Text","x-form-type":"text"},"buttontext":{"type":"string","x-source":"inject","x-form-label":"Button Text","x-form-visible":"model.showbutton == 'true'","x-form-type":"text"},"buttonlink":{"type":"string","x-source":"inject","x-form-label":"Button Link","x-form-visible":"model.showbutton == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/pages"},"buttoncolor":{"type":"string","x-source":"inject","x-form-label":"Button Color","x-form-type":"materialselect","x-default":"primary","properties":{"primary":{"x-form-name":"Primary","x-form-value":"primary"},"secondary":{"x-form-name":"Secondary","x-form-value":"secondary"},"success":{"x-form-name":"Success","x-form-value":"success"},"danger":{"x-form-name":"Danger","x-form-value":"danger"},"warning":{"x-form-name":"Warning","x-form-value":"warning"},"info":{"x-form-name":"Info","x-form-value":"info"}}},"buttonsize":{"type":"string","x-source":"inject","x-form-label":"Button Size","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"large":{"x-form-name":"Large","x-form-value":"large"},"small":{"x-form-name":"Small","x-form-value":"small"}}},"buttonalign":{"type":"string","x-source":"inject","x-form-label":"Button Alignment","x-form-type":"materialselect","x-default":"center","properties":{"left":{"x-form-name":"Left","x-form-value":"left"},"center":{"x-form-name":"Center","x-form-value":"center"},"right":{"x-form-name":"Right","x-form-value":"right"}}}}} */ + /* {"type":"string","x-source":"inject","x-form-label":"Cards","x-form-fieldLabel":"title","x-form-type":"collection","x-collection-type":"Card","properties":{"title":{"type":"string","x-source":"inject","x-form-label":"Card Title","x-form-visible":"model.showtitle == 'true'","x-form-type":"text"},"text":{"type":"string","x-source":"inject","x-form-label":"Card Text","x-form-visible":"model.showtext == 'true'","x-form-type":"texteditor"},"image":{"type":"string","x-source":"inject","x-form-label":"Card Image","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-annotate":"size"},"imagewidth":{"type":"string","x-source":"inject","x-form-label":"Image Width","x-form-type":"materialrange","x-default":"100","x-form-min":"10","x-form-max":"100"},"imagealttext":{"type":"string","x-source":"inject","x-form-label":"Image Alt Text","x-form-type":"text"},"buttontext":{"type":"string","x-source":"inject","x-form-label":"Button Text","x-form-visible":"model.showbutton == 'true'","x-form-type":"text"},"buttonlink":{"type":"string","x-source":"inject","x-form-label":"Button Link","x-form-visible":"model.showbutton == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/pages"},"buttoncolor":{"type":"string","x-source":"inject","x-form-label":"Button Color","x-form-type":"materialselect","x-default":"primary","properties":{"primary":{"x-form-name":"Primary","x-form-value":"primary"},"secondary":{"x-form-name":"Secondary","x-form-value":"secondary"},"success":{"x-form-name":"Success","x-form-value":"success"},"danger":{"x-form-name":"Danger","x-form-value":"danger"},"warning":{"x-form-name":"Warning","x-form-value":"warning"},"info":{"x-form-name":"Info","x-form-value":"info"}}},"buttonsize":{"type":"string","x-source":"inject","x-form-label":"Button Size","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"large":{"x-form-name":"Large","x-form-value":"large"},"small":{"x-form-name":"Small","x-form-value":"small"}}},"buttonalign":{"type":"string","x-source":"inject","x-form-label":"Button Alignment","x-form-type":"materialselect","x-default":"center","properties":{"left":{"x-form-name":"Left","x-form-value":"left"},"center":{"x-form-name":"Center","x-form-value":"center"},"right":{"x-form-name":"Right","x-form-value":"right"}}}}} */ @Inject - private List cards; + private List cards; /* {"type":"string","x-source":"inject","x-form-label":"Anchor Name","x-form-type":"text"} */ @Inject @@ -737,8 +739,8 @@ public String getCardsperrowmobile() { return cardsperrowmobile; } - /* {"type":"string","x-source":"inject","x-form-label":"Cards","x-form-fieldLabel":"title","x-form-type":"collection","properties":{"title":{"type":"string","x-source":"inject","x-form-label":"Card Title","x-form-visible":"model.showtitle == 'true'","x-form-type":"text"},"text":{"type":"string","x-source":"inject","x-form-label":"Card Text","x-form-visible":"model.showtext == 'true'","x-form-type":"texteditor"},"image":{"type":"string","x-source":"inject","x-form-label":"Card Image","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets"},"imagewidth":{"type":"string","x-source":"inject","x-form-label":"Image Width","x-form-type":"materialrange","x-default":"100","x-form-min":"10","x-form-max":"100"},"imagealttext":{"type":"string","x-source":"inject","x-form-label":"Image Alt Text","x-form-type":"text"},"buttontext":{"type":"string","x-source":"inject","x-form-label":"Button Text","x-form-visible":"model.showbutton == 'true'","x-form-type":"text"},"buttonlink":{"type":"string","x-source":"inject","x-form-label":"Button Link","x-form-visible":"model.showbutton == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/pages"},"buttoncolor":{"type":"string","x-source":"inject","x-form-label":"Button Color","x-form-type":"materialselect","x-default":"primary","properties":{"primary":{"x-form-name":"Primary","x-form-value":"primary"},"secondary":{"x-form-name":"Secondary","x-form-value":"secondary"},"success":{"x-form-name":"Success","x-form-value":"success"},"danger":{"x-form-name":"Danger","x-form-value":"danger"},"warning":{"x-form-name":"Warning","x-form-value":"warning"},"info":{"x-form-name":"Info","x-form-value":"info"}}},"buttonsize":{"type":"string","x-source":"inject","x-form-label":"Button Size","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"large":{"x-form-name":"Large","x-form-value":"large"},"small":{"x-form-name":"Small","x-form-value":"small"}}},"buttonalign":{"type":"string","x-source":"inject","x-form-label":"Button Alignment","x-form-type":"materialselect","x-default":"center","properties":{"left":{"x-form-name":"Left","x-form-value":"left"},"center":{"x-form-name":"Center","x-form-value":"center"},"right":{"x-form-name":"Right","x-form-value":"right"}}}}} */ - public List getCards() { + /* {"type":"string","x-source":"inject","x-form-label":"Cards","x-form-fieldLabel":"title","x-form-type":"collection","x-collection-type":"Card","properties":{"title":{"type":"string","x-source":"inject","x-form-label":"Card Title","x-form-visible":"model.showtitle == 'true'","x-form-type":"text"},"text":{"type":"string","x-source":"inject","x-form-label":"Card Text","x-form-visible":"model.showtext == 'true'","x-form-type":"texteditor"},"image":{"type":"string","x-source":"inject","x-form-label":"Card Image","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-annotate":"size"},"imagewidth":{"type":"string","x-source":"inject","x-form-label":"Image Width","x-form-type":"materialrange","x-default":"100","x-form-min":"10","x-form-max":"100"},"imagealttext":{"type":"string","x-source":"inject","x-form-label":"Image Alt Text","x-form-type":"text"},"buttontext":{"type":"string","x-source":"inject","x-form-label":"Button Text","x-form-visible":"model.showbutton == 'true'","x-form-type":"text"},"buttonlink":{"type":"string","x-source":"inject","x-form-label":"Button Link","x-form-visible":"model.showbutton == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/pages"},"buttoncolor":{"type":"string","x-source":"inject","x-form-label":"Button Color","x-form-type":"materialselect","x-default":"primary","properties":{"primary":{"x-form-name":"Primary","x-form-value":"primary"},"secondary":{"x-form-name":"Secondary","x-form-value":"secondary"},"success":{"x-form-name":"Success","x-form-value":"success"},"danger":{"x-form-name":"Danger","x-form-value":"danger"},"warning":{"x-form-name":"Warning","x-form-value":"warning"},"info":{"x-form-name":"Info","x-form-value":"info"}}},"buttonsize":{"type":"string","x-source":"inject","x-form-label":"Button Size","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"large":{"x-form-name":"Large","x-form-value":"large"},"small":{"x-form-name":"Small","x-form-value":"small"}}},"buttonalign":{"type":"string","x-source":"inject","x-form-label":"Button Alignment","x-form-type":"materialselect","x-default":"center","properties":{"left":{"x-form-name":"Left","x-form-value":"left"},"center":{"x-form-name":"Center","x-form-value":"center"},"right":{"x-form-name":"Right","x-form-value":"right"}}}}} */ + public List getCards() { return cards; } diff --git a/core/src/main/java/com/themecleanflex/models/DatalistModel.java b/core/src/main/java/com/themecleanflex/models/DatalistModel.java new file mode 100644 index 000000000..dd7aaf984 --- /dev/null +++ b/core/src/main/java/com/themecleanflex/models/DatalistModel.java @@ -0,0 +1,879 @@ +package com.themecleanflex.models; + +import com.peregrine.nodetypes.models.AbstractComponent; +import com.peregrine.nodetypes.models.IComponent; +import com.peregrine.nodetypes.models.Container; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Default; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; +import java.util.List; + +import javax.inject.Inject; +import javax.inject.Named; + +/* + //GEN[:DATA + { + "definitions": { + "Datalist": { + "type": "object", + "x-type": "component", + "properties": { + "endpointurl": { + "type": "string", + "x-source": "inject", + "x-form-label": "URL to load JSON data for table", + "x-form-type": "text", + "x-default": "" + }, + "loadfunction": { + "type": "string", + "x-source": "inject", + "x-form-label": "Javascript function to call to load data", + "x-form-hint": "Function must accept (endpointurl)", + "x-form-type": "text" + }, + "deletefunction": { + "type": "string", + "x-source": "inject", + "x-form-label": "Javascript function to call to delete rows", + "x-form-hint": "Function must accept (tableData, activeSelections, endpointurl)", + "x-form-type": "text" + }, + "columns": { + "type": "string", + "x-source": "inject", + "x-form-label": "Table Configuration", + "x-form-fieldLabel": "header", + "x-form-type": "collection", + "properties": { + "header": { + "type": "string", + "x-source": "inject", + "x-form-label": "Column Header", + "x-form-type": "text" + }, + "value": { + "type": "string", + "x-source": "inject", + "x-form-label": "Data Value", + "x-form-type": "text" + }, + "textalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Text alignment", + "x-form-type": "materialselect", + "x-default": "left", + "properties": { + "left": { + "x-form-name": "left", + "x-form-value": "left" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "right": { + "x-form-name": "right", + "x-form-value": "right" + } + } + } + } + }, + "rowalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Row alignment", + "x-form-type": "materialselect", + "x-default": "top", + "properties": { + "top": { + "x-form-name": "top", + "x-form-value": "top" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "bottom": { + "x-form-name": "bottom", + "x-form-value": "bottom" + } + } + }, + "mobiletablestyle": { + "type": "string", + "x-source": "inject", + "x-form-label": "Mobile table style", + "x-form-type": "materialselect", + "x-default": "default", + "properties": { + "default": { + "x-form-name": "default", + "x-form-value": "default" + }, + "scroll": { + "x-form-name": "scroll", + "x-form-value": "scroll" + } + } + }, + "stripedrows": { + "type": "string", + "x-source": "inject", + "x-form-label": "Striped Rows", + "x-form-type": "materialswitch", + "x-default": false + }, + "densetable": { + "type": "string", + "x-source": "inject", + "x-form-label": "Dense Table", + "x-form-type": "materialswitch", + "x-default": false + }, + "scrollabletable": { + "type": "string", + "x-source": "inject", + "x-form-label": "Scrollable Table", + "x-form-type": "materialswitch", + "x-default": false + }, + "stickyheader": { + "type": "string", + "x-source": "inject", + "x-form-label": "Sticky Header", + "x-form-type": "materialswitch", + "x-form-visible": "model.scrollabletable == 'true'", + "x-default": false + }, + "tableheight": { + "type": "string", + "x-source": "inject", + "x-form-label": "Table Height", + "x-form-type": "materialrange", + "x-form-min": 100, + "x-form-max": 500, + "x-default": 300, + "x-form-visible": "model.scrollabletable == 'true'" + }, + "selectable": { + "type": "string", + "x-source": "inject", + "x-form-label": "Selectable Table", + "x-form-type": "materialswitch", + "x-default": false + }, + "cellborders": { + "type": "string", + "x-source": "inject", + "x-form-label": "Add borders around individual cells", + "x-form-type": "materialswitch", + "x-default": false + }, + "caption": { + "type": "string", + "x-source": "inject", + "x-form-label": "Table caption", + "x-form-type": "materialswitch", + "x-default": false + }, + "captiontext": { + "type": "string", + "x-source": "inject", + "x-form-label": "Caption text", + "x-form-type": "text", + "x-form-visible": "model.caption == 'true'" + }, + "captionplacement": { + "type": "string", + "x-source": "inject", + "x-form-label": "Caption placement", + "x-form-type": "materialselect", + "x-default": "bottom", + "x-form-visible": "model.caption == 'true'", + "properties": { + "top": { + "x-form-name": "top", + "x-form-value": "top" + }, + "bottom": { + "x-form-name": "bottom", + "x-form-value": "bottom" + } + } + }, + "captionalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Caption alignment", + "x-form-type": "materialselect", + "x-default": "left", + "x-form-visible": "model.caption == 'true'", + "properties": { + "left": { + "x-form-name": "left", + "x-form-value": "left" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "right": { + "x-form-name": "right", + "x-form-value": "right" + } + } + }, + "bgref": { + "x-form-type": "reference", + "type": "object", + "x-type": "component", + "properties": { + "anchorname": { + "type": "string", + "x-source": "inject", + "x-form-label": "Anchor Name", + "x-form-type": "text" + }, + "extraclasses": { + "type": "string", + "x-source": "inject", + "x-form-label": "Additonal Classes", + "x-form-type": "text" + }, + "htmlelement": { + "type": "string", + "x-source": "inject", + "x-form-label": "Semantic Element", + "x-form-type": "materialselect", + "x-default": "section", + "properties": { + "section": { + "x-form-name": "section", + "x-form-value": "section" + }, + "article": { + "x-form-name": "article", + "x-form-value": "article" + }, + "main": { + "x-form-name": "main", + "x-form-value": "main" + }, + "div": { + "x-form-name": "div", + "x-form-value": "div" + }, + "header": { + "x-form-name": "header", + "x-form-value": "header" + }, + "nav": { + "x-form-name": "nav", + "x-form-value": "nav" + }, + "footer": { + "x-form-name": "footer", + "x-form-value": "footer" + } + } + }, + "colorscheme": { + "type": "string", + "x-source": "inject", + "x-form-label": "Block Color Scheme", + "x-form-type": "materialradio", + "x-default": "", + "properties": { + "none": { + "x-form-name": "None", + "x-form-value": "" + }, + "light": { + "x-form-name": "Light", + "x-form-value": "light" + }, + "dark": { + "x-form-name": "Dark", + "x-form-value": "dark" + } + } + }, + "custombackground": { + "type": "string", + "x-source": "inject", + "x-form-label": "Custom Background", + "x-form-type": "materialswitch", + "x-default": "false" + }, + "backgroundtype": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Type", + "x-form-type": "materialradio", + "x-form-visible": "model.custombackground == 'true'", + "properties": { + "color": { + "x-form-name": "Color", + "x-form-value": "color" + }, + "gradient": { + "x-form-name": "Gradient", + "x-form-value": "gradient" + }, + "image": { + "x-form-name": "Image", + "x-form-value": "image" + }, + "video": { + "x-form-name": "Video", + "x-form-value": "video" + } + } + }, + "bgvideo": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Video", + "x-form-type": "pathbrowser", + "x-form-visible": "model.backgroundtype == 'video' and model.custombackground == 'true'", + "x-default": "https://www.youtube.com/embed/Ju86mknumYM", + "x-form-browserRoot": "/content/themecleanflex/assets" + }, + "bgimage": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Image", + "x-form-type": "pathbrowser", + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-form-browserRoot": "/content/themecleanflex/assets" + }, + "bgxposition": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background X Position", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 100, + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "50" + }, + "bgyposition": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Y Position", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 100, + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "50" + }, + "bgsize": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Size Style", + "x-form-type": "text", + "x-default": "cover" + }, + "overlay": { + "type": "string", + "x-source": "inject", + "x-form-label": "Overlay", + "x-form-type": "materialswitch", + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + "overlaycolor": { + "type": "string", + "x-source": "inject", + "x-form-label": "Overlay Color", + "x-form-type": "color", + "x-form-visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "#ffffff" + }, + "overlayopacity": { + "type": "string", + "x-source": "inject", + "x-form-label": "Overlay opacity", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 100, + "x-form-visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "50" + }, + "bgcolor": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Color", + "x-form-type": "color", + "x-form-visible": "(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'", + "x-default": "#ffffff" + }, + "color2": { + "type": "string", + "x-source": "inject", + "x-form-label": "Color 2", + "x-form-type": "color", + "x-form-visible": "model.backgroundtype == 'gradient' and model.custombackground == 'true'", + "x-default": "#c0c0c0" + }, + "blockwidth": { + "type": "string", + "x-source": "inject", + "x-form-label": "Block Width", + "x-form-type": "materialradio", + "x-default": "default", + "properties": { + "default": { + "x-form-name": "Default", + "x-form-value": "default" + }, + "full": { + "x-form-name": "Full Width", + "x-form-value": "full" + }, + "article": { + "x-form-name": "Article Width", + "x-form-value": "article" + } + } + }, + "fullheight": { + "type": "string", + "x-source": "inject", + "x-form-label": "Full Height", + "x-form-type": "materialswitch", + "x-default": "false" + }, + "toppadding": { + "type": "string", + "x-source": "inject", + "x-form-label": "Top Padding", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 300, + "x-form-visible": "model.fullheight != 'true'" + }, + "bottompadding": { + "type": "string", + "x-source": "inject", + "x-form-label": "Bottom Padding", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 300, + "x-form-visible": "model.fullheight != 'true'" + }, + "contentname": { + "type": "string", + "x-source": "inject", + "x-form-label": "Content Name", + "x-form-type": "text" + } + } + } + } + } + }, + "name": "Datalist", + "componentPath": "themecleanflex/components/datalist", + "package": "com.themecleanflex.models", + "modelName": "Datalist", + "classNameParent": "AbstractComponent" +} +//GEN] +*/ + +//GEN[:DEF +@Model( + adaptables = Resource.class, + resourceType = "themecleanflex/components/datalist", + defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, + adapters = IComponent.class +) +@Exporter( + name = "jackson", + extensions = "json" +) + +//GEN] +public class DatalistModel extends AbstractComponent { + + public DatalistModel(Resource r) { super(r); } + + //GEN[:INJECT + /* {"type":"string","x-source":"inject","x-form-label":"URL to load JSON data for table","x-form-type":"text","x-default":""} */ + @Inject + @Default(values ="") + private String endpointurl; + + /* {"type":"string","x-source":"inject","x-form-label":"Javascript function to call to load data","x-form-hint":"Function must accept (endpointurl)","x-form-type":"text"} */ + @Inject + private String loadfunction; + + /* {"type":"string","x-source":"inject","x-form-label":"Javascript function to call to delete rows","x-form-hint":"Function must accept (tableData, activeSelections, endpointurl)","x-form-type":"text"} */ + @Inject + private String deletefunction; + + /* {"type":"string","x-source":"inject","x-form-label":"Table Configuration","x-form-fieldLabel":"header","x-form-type":"collection","properties":{"header":{"type":"string","x-source":"inject","x-form-label":"Column Header","x-form-type":"text"},"value":{"type":"string","x-source":"inject","x-form-label":"Data Value","x-form-type":"text"},"textalignment":{"type":"string","x-source":"inject","x-form-label":"Text alignment","x-form-type":"materialselect","x-default":"left","properties":{"left":{"x-form-name":"left","x-form-value":"left"},"center":{"x-form-name":"center","x-form-value":"center"},"right":{"x-form-name":"right","x-form-value":"right"}}}}} */ + @Inject + private List columns; + + /* {"type":"string","x-source":"inject","x-form-label":"Row alignment","x-form-type":"materialselect","x-default":"top","properties":{"top":{"x-form-name":"top","x-form-value":"top"},"center":{"x-form-name":"center","x-form-value":"center"},"bottom":{"x-form-name":"bottom","x-form-value":"bottom"}}} */ + @Inject + @Default(values ="top") + private String rowalignment; + + /* {"type":"string","x-source":"inject","x-form-label":"Mobile table style","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"default","x-form-value":"default"},"scroll":{"x-form-name":"scroll","x-form-value":"scroll"}}} */ + @Inject + @Default(values ="default") + private String mobiletablestyle; + + /* {"type":"string","x-source":"inject","x-form-label":"Striped Rows","x-form-type":"materialswitch","x-default":false} */ + @Inject + private String stripedrows; + + /* {"type":"string","x-source":"inject","x-form-label":"Dense Table","x-form-type":"materialswitch","x-default":false} */ + @Inject + private String densetable; + + /* {"type":"string","x-source":"inject","x-form-label":"Scrollable Table","x-form-type":"materialswitch","x-default":false} */ + @Inject + private String scrollabletable; + + /* {"type":"string","x-source":"inject","x-form-label":"Sticky Header","x-form-type":"materialswitch","x-form-visible":"model.scrollabletable == 'true'","x-default":false} */ + @Inject + private String stickyheader; + + /* {"type":"string","x-source":"inject","x-form-label":"Table Height","x-form-type":"materialrange","x-form-min":100,"x-form-max":500,"x-default":300,"x-form-visible":"model.scrollabletable == 'true'"} */ + @Inject + @Default(values ="300") + private String tableheight; + + /* {"type":"string","x-source":"inject","x-form-label":"Selectable Table","x-form-type":"materialswitch","x-default":false} */ + @Inject + private String selectable; + + /* {"type":"string","x-source":"inject","x-form-label":"Add borders around individual cells","x-form-type":"materialswitch","x-default":false} */ + @Inject + private String cellborders; + + /* {"type":"string","x-source":"inject","x-form-label":"Table caption","x-form-type":"materialswitch","x-default":false} */ + @Inject + private String caption; + + /* {"type":"string","x-source":"inject","x-form-label":"Caption text","x-form-type":"text","x-form-visible":"model.caption == 'true'"} */ + @Inject + private String captiontext; + + /* {"type":"string","x-source":"inject","x-form-label":"Caption placement","x-form-type":"materialselect","x-default":"bottom","x-form-visible":"model.caption == 'true'","properties":{"top":{"x-form-name":"top","x-form-value":"top"},"bottom":{"x-form-name":"bottom","x-form-value":"bottom"}}} */ + @Inject + @Default(values ="bottom") + private String captionplacement; + + /* {"type":"string","x-source":"inject","x-form-label":"Caption alignment","x-form-type":"materialselect","x-default":"left","x-form-visible":"model.caption == 'true'","properties":{"left":{"x-form-name":"left","x-form-value":"left"},"center":{"x-form-name":"center","x-form-value":"center"},"right":{"x-form-name":"right","x-form-value":"right"}}} */ + @Inject + @Default(values ="left") + private String captionalignment; + + /* {"type":"string","x-source":"inject","x-form-label":"Anchor Name","x-form-type":"text"} */ + @Inject + private String anchorname; + + /* {"type":"string","x-source":"inject","x-form-label":"Additonal Classes","x-form-type":"text"} */ + @Inject + private String extraclasses; + + /* {"type":"string","x-source":"inject","x-form-label":"Semantic Element","x-form-type":"materialselect","x-default":"section","properties":{"section":{"x-form-name":"section","x-form-value":"section"},"article":{"x-form-name":"article","x-form-value":"article"},"main":{"x-form-name":"main","x-form-value":"main"},"div":{"x-form-name":"div","x-form-value":"div"},"header":{"x-form-name":"header","x-form-value":"header"},"nav":{"x-form-name":"nav","x-form-value":"nav"},"footer":{"x-form-name":"footer","x-form-value":"footer"}}} */ + @Inject + @Default(values ="section") + private String htmlelement; + + /* {"type":"string","x-source":"inject","x-form-label":"Block Color Scheme","x-form-type":"materialradio","x-default":"","properties":{"none":{"x-form-name":"None","x-form-value":""},"light":{"x-form-name":"Light","x-form-value":"light"},"dark":{"x-form-name":"Dark","x-form-value":"dark"}}} */ + @Inject + @Default(values ="") + private String colorscheme; + + /* {"type":"string","x-source":"inject","x-form-label":"Custom Background","x-form-type":"materialswitch","x-default":"false"} */ + @Inject + @Default(values ="false") + private String custombackground; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Type","x-form-type":"materialradio","x-form-visible":"model.custombackground == 'true'","properties":{"color":{"x-form-name":"Color","x-form-value":"color"},"gradient":{"x-form-name":"Gradient","x-form-value":"gradient"},"image":{"x-form-name":"Image","x-form-value":"image"},"video":{"x-form-name":"Video","x-form-value":"video"}}} */ + @Inject + private String backgroundtype; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Video","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'video' and model.custombackground == 'true'","x-default":"https://www.youtube.com/embed/Ju86mknumYM","x-form-browserRoot":"/content/themecleanflex/assets"} */ + @Inject + @Default(values ="https://www.youtube.com/embed/Ju86mknumYM") + private String bgvideo; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Image","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-form-browserRoot":"/content/themecleanflex/assets"} */ + @Inject + private String bgimage; + + /* {"type":"string","x-source":"inject","x-form-label":"Background X Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + @Inject + @Default(values ="50") + private String bgxposition; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Y Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + @Inject + @Default(values ="50") + private String bgyposition; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Size Style","x-form-type":"text","x-default":"cover"} */ + @Inject + @Default(values ="cover") + private String bgsize; + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay","x-form-type":"materialswitch","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'"} */ + @Inject + private String overlay; + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay Color","x-form-type":"color","x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"#ffffff"} */ + @Inject + @Default(values ="#ffffff") + private String overlaycolor; + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay opacity","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + @Inject + @Default(values ="50") + private String overlayopacity; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Color","x-form-type":"color","x-form-visible":"(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'","x-default":"#ffffff"} */ + @Inject + @Default(values ="#ffffff") + private String bgcolor; + + /* {"type":"string","x-source":"inject","x-form-label":"Color 2","x-form-type":"color","x-form-visible":"model.backgroundtype == 'gradient' and model.custombackground == 'true'","x-default":"#c0c0c0"} */ + @Inject + @Default(values ="#c0c0c0") + private String color2; + + /* {"type":"string","x-source":"inject","x-form-label":"Block Width","x-form-type":"materialradio","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"full":{"x-form-name":"Full Width","x-form-value":"full"},"article":{"x-form-name":"Article Width","x-form-value":"article"}}} */ + @Inject + @Default(values ="default") + private String blockwidth; + + /* {"type":"string","x-source":"inject","x-form-label":"Full Height","x-form-type":"materialswitch","x-default":"false"} */ + @Inject + @Default(values ="false") + private String fullheight; + + /* {"type":"string","x-source":"inject","x-form-label":"Top Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + @Inject + private String toppadding; + + /* {"type":"string","x-source":"inject","x-form-label":"Bottom Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + @Inject + private String bottompadding; + + /* {"type":"string","x-source":"inject","x-form-label":"Content Name","x-form-type":"text"} */ + @Inject + private String contentname; + + +//GEN] + + //GEN[:GETTERS + /* {"type":"string","x-source":"inject","x-form-label":"URL to load JSON data for table","x-form-type":"text","x-default":""} */ + public String getEndpointurl() { + return endpointurl; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Javascript function to call to load data","x-form-hint":"Function must accept (endpointurl)","x-form-type":"text"} */ + public String getLoadfunction() { + return loadfunction; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Javascript function to call to delete rows","x-form-hint":"Function must accept (tableData, activeSelections, endpointurl)","x-form-type":"text"} */ + public String getDeletefunction() { + return deletefunction; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Table Configuration","x-form-fieldLabel":"header","x-form-type":"collection","properties":{"header":{"type":"string","x-source":"inject","x-form-label":"Column Header","x-form-type":"text"},"value":{"type":"string","x-source":"inject","x-form-label":"Data Value","x-form-type":"text"},"textalignment":{"type":"string","x-source":"inject","x-form-label":"Text alignment","x-form-type":"materialselect","x-default":"left","properties":{"left":{"x-form-name":"left","x-form-value":"left"},"center":{"x-form-name":"center","x-form-value":"center"},"right":{"x-form-name":"right","x-form-value":"right"}}}}} */ + public List getColumns() { + return columns; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Row alignment","x-form-type":"materialselect","x-default":"top","properties":{"top":{"x-form-name":"top","x-form-value":"top"},"center":{"x-form-name":"center","x-form-value":"center"},"bottom":{"x-form-name":"bottom","x-form-value":"bottom"}}} */ + public String getRowalignment() { + return rowalignment; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Mobile table style","x-form-type":"materialselect","x-default":"default","properties":{"default":{"x-form-name":"default","x-form-value":"default"},"scroll":{"x-form-name":"scroll","x-form-value":"scroll"}}} */ + public String getMobiletablestyle() { + return mobiletablestyle; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Striped Rows","x-form-type":"materialswitch","x-default":false} */ + public String getStripedrows() { + return stripedrows; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Dense Table","x-form-type":"materialswitch","x-default":false} */ + public String getDensetable() { + return densetable; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Scrollable Table","x-form-type":"materialswitch","x-default":false} */ + public String getScrollabletable() { + return scrollabletable; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Sticky Header","x-form-type":"materialswitch","x-form-visible":"model.scrollabletable == 'true'","x-default":false} */ + public String getStickyheader() { + return stickyheader; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Table Height","x-form-type":"materialrange","x-form-min":100,"x-form-max":500,"x-default":300,"x-form-visible":"model.scrollabletable == 'true'"} */ + public String getTableheight() { + return tableheight; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Selectable Table","x-form-type":"materialswitch","x-default":false} */ + public String getSelectable() { + return selectable; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Add borders around individual cells","x-form-type":"materialswitch","x-default":false} */ + public String getCellborders() { + return cellborders; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Table caption","x-form-type":"materialswitch","x-default":false} */ + public String getCaption() { + return caption; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Caption text","x-form-type":"text","x-form-visible":"model.caption == 'true'"} */ + public String getCaptiontext() { + return captiontext; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Caption placement","x-form-type":"materialselect","x-default":"bottom","x-form-visible":"model.caption == 'true'","properties":{"top":{"x-form-name":"top","x-form-value":"top"},"bottom":{"x-form-name":"bottom","x-form-value":"bottom"}}} */ + public String getCaptionplacement() { + return captionplacement; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Caption alignment","x-form-type":"materialselect","x-default":"left","x-form-visible":"model.caption == 'true'","properties":{"left":{"x-form-name":"left","x-form-value":"left"},"center":{"x-form-name":"center","x-form-value":"center"},"right":{"x-form-name":"right","x-form-value":"right"}}} */ + public String getCaptionalignment() { + return captionalignment; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Anchor Name","x-form-type":"text"} */ + public String getAnchorname() { + return anchorname; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Additonal Classes","x-form-type":"text"} */ + public String getExtraclasses() { + return extraclasses; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Semantic Element","x-form-type":"materialselect","x-default":"section","properties":{"section":{"x-form-name":"section","x-form-value":"section"},"article":{"x-form-name":"article","x-form-value":"article"},"main":{"x-form-name":"main","x-form-value":"main"},"div":{"x-form-name":"div","x-form-value":"div"},"header":{"x-form-name":"header","x-form-value":"header"},"nav":{"x-form-name":"nav","x-form-value":"nav"},"footer":{"x-form-name":"footer","x-form-value":"footer"}}} */ + public String getHtmlelement() { + return htmlelement; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Block Color Scheme","x-form-type":"materialradio","x-default":"","properties":{"none":{"x-form-name":"None","x-form-value":""},"light":{"x-form-name":"Light","x-form-value":"light"},"dark":{"x-form-name":"Dark","x-form-value":"dark"}}} */ + public String getColorscheme() { + return colorscheme; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Custom Background","x-form-type":"materialswitch","x-default":"false"} */ + public String getCustombackground() { + return custombackground; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Type","x-form-type":"materialradio","x-form-visible":"model.custombackground == 'true'","properties":{"color":{"x-form-name":"Color","x-form-value":"color"},"gradient":{"x-form-name":"Gradient","x-form-value":"gradient"},"image":{"x-form-name":"Image","x-form-value":"image"},"video":{"x-form-name":"Video","x-form-value":"video"}}} */ + public String getBackgroundtype() { + return backgroundtype; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Video","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'video' and model.custombackground == 'true'","x-default":"https://www.youtube.com/embed/Ju86mknumYM","x-form-browserRoot":"/content/themecleanflex/assets"} */ + public String getBgvideo() { + return bgvideo; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Image","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-form-browserRoot":"/content/themecleanflex/assets"} */ + public String getBgimage() { + return bgimage; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background X Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + public String getBgxposition() { + return bgxposition; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Y Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + public String getBgyposition() { + return bgyposition; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Size Style","x-form-type":"text","x-default":"cover"} */ + public String getBgsize() { + return bgsize; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay","x-form-type":"materialswitch","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'"} */ + public String getOverlay() { + return overlay; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay Color","x-form-type":"color","x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"#ffffff"} */ + public String getOverlaycolor() { + return overlaycolor; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay opacity","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + public String getOverlayopacity() { + return overlayopacity; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Color","x-form-type":"color","x-form-visible":"(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'","x-default":"#ffffff"} */ + public String getBgcolor() { + return bgcolor; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Color 2","x-form-type":"color","x-form-visible":"model.backgroundtype == 'gradient' and model.custombackground == 'true'","x-default":"#c0c0c0"} */ + public String getColor2() { + return color2; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Block Width","x-form-type":"materialradio","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"full":{"x-form-name":"Full Width","x-form-value":"full"},"article":{"x-form-name":"Article Width","x-form-value":"article"}}} */ + public String getBlockwidth() { + return blockwidth; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Full Height","x-form-type":"materialswitch","x-default":"false"} */ + public String getFullheight() { + return fullheight; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Top Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + public String getToppadding() { + return toppadding; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Bottom Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + public String getBottompadding() { + return bottompadding; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Content Name","x-form-type":"text"} */ + public String getContentname() { + return contentname; + } + + +//GEN] + + //GEN[:CUSTOMGETTERS + //GEN] + +} diff --git a/core/src/main/java/com/themecleanflex/models/FormModel.java b/core/src/main/java/com/themecleanflex/models/FormModel.java new file mode 100644 index 000000000..49d2e4843 --- /dev/null +++ b/core/src/main/java/com/themecleanflex/models/FormModel.java @@ -0,0 +1,680 @@ +package com.themecleanflex.models; + +import com.peregrine.nodetypes.models.AbstractComponent; +import com.peregrine.nodetypes.models.IComponent; +import com.peregrine.nodetypes.models.Container; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.Default; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; +import org.apache.sling.models.annotations.Exporter; +import org.apache.sling.models.annotations.Model; +import java.util.List; + +import javax.inject.Inject; +import javax.inject.Named; + +/* + //GEN[:DATA + { + "definitions": { + "Form": { + "type": "object", + "x-type": "component", + "properties": { + "schema": { + "type": "string", + "x-source": "inject", + "x-form-label": "Form Model", + "x-form-type": "textarea", + "x-form-hint": "JSON description passed to vue-form-generator, see vue form generator fields documentation", + "x-form-max": "16000" + }, + "endpointurl": { + "type": "string", + "x-source": "inject", + "x-form-label": "Form submit endpoint URL", + "x-form-type": "text", + "x-default": "" + }, + "submitfunction": { + "type": "string", + "x-source": "inject", + "x-form-label": "Javascript function to call on submit", + "x-form-hint": "Function must accept (model, formdata)", + "x-form-type": "text", + "x-default": "" + }, + "submittext": { + "type": "string", + "x-source": "inject", + "x-form-label": "Submit Button Text", + "x-form-type": "text", + "x-default": "Submit" + }, + "submitsize": { + "type": "string", + "x-source": "inject", + "x-form-label": "Submit button size", + "x-form-type": "materialselect", + "x-default": "normal", + "properties": { + "section": { + "x-form-name": "normal", + "x-form-value": "normal" + }, + "small": { + "x-form-name": "small", + "x-form-value": "small" + }, + "large": { + "x-form-name": "large", + "x-form-value": "large" + }, + "full": { + "x-form-name": "full width", + "x-form-value": "full" + } + } + }, + "submitalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Submit button alignment", + "x-form-type": "materialselect", + "x-default": "start", + "properties": { + "start": { + "x-form-name": "start", + "x-form-value": "start" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "end": { + "x-form-name": "end", + "x-form-value": "end" + } + } + }, + "failmessage": { + "type": "string", + "x-source": "inject", + "x-form-label": "Failure Message", + "x-form-type": "text", + "x-default": "Error processing form" + }, + "successpage": { + "type": "string", + "x-source": "inject", + "x-form-type": "pathbrowser", + "x-form-label": "Submit Success Page", + "x-form-browserRoot": "/content/themecleanflex/pages" + }, + "bgref": { + "x-form-type": "reference", + "type": "object", + "x-type": "component", + "properties": { + "anchorname": { + "type": "string", + "x-source": "inject", + "x-form-label": "Anchor Name", + "x-form-type": "text" + }, + "extraclasses": { + "type": "string", + "x-source": "inject", + "x-form-label": "Additonal Classes", + "x-form-type": "text" + }, + "htmlelement": { + "type": "string", + "x-source": "inject", + "x-form-label": "Semantic Element", + "x-form-type": "materialselect", + "x-default": "section", + "properties": { + "section": { + "x-form-name": "section", + "x-form-value": "section" + }, + "article": { + "x-form-name": "article", + "x-form-value": "article" + }, + "main": { + "x-form-name": "main", + "x-form-value": "main" + }, + "div": { + "x-form-name": "div", + "x-form-value": "div" + }, + "header": { + "x-form-name": "header", + "x-form-value": "header" + }, + "nav": { + "x-form-name": "nav", + "x-form-value": "nav" + }, + "footer": { + "x-form-name": "footer", + "x-form-value": "footer" + } + } + }, + "colorscheme": { + "type": "string", + "x-source": "inject", + "x-form-label": "Block Color Scheme", + "x-form-type": "materialradio", + "x-default": "", + "properties": { + "none": { + "x-form-name": "None", + "x-form-value": "" + }, + "light": { + "x-form-name": "Light", + "x-form-value": "light" + }, + "dark": { + "x-form-name": "Dark", + "x-form-value": "dark" + } + } + }, + "custombackground": { + "type": "string", + "x-source": "inject", + "x-form-label": "Custom Background", + "x-form-type": "materialswitch", + "x-default": "false" + }, + "backgroundtype": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Type", + "x-form-type": "materialradio", + "x-form-visible": "model.custombackground == 'true'", + "properties": { + "color": { + "x-form-name": "Color", + "x-form-value": "color" + }, + "gradient": { + "x-form-name": "Gradient", + "x-form-value": "gradient" + }, + "image": { + "x-form-name": "Image", + "x-form-value": "image" + }, + "video": { + "x-form-name": "Video", + "x-form-value": "video" + } + } + }, + "bgvideo": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Video", + "x-form-type": "pathbrowser", + "x-form-visible": "model.backgroundtype == 'video' and model.custombackground == 'true'", + "x-default": "https://www.youtube.com/embed/Ju86mknumYM", + "x-form-browserRoot": "/content/themecleanflex/assets" + }, + "bgimage": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Image", + "x-form-type": "pathbrowser", + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-form-browserRoot": "/content/themecleanflex/assets" + }, + "bgxposition": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background X Position", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 100, + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "50" + }, + "bgyposition": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Y Position", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 100, + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "50" + }, + "bgsize": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Size Style", + "x-form-type": "text", + "x-default": "cover" + }, + "overlay": { + "type": "string", + "x-source": "inject", + "x-form-label": "Overlay", + "x-form-type": "materialswitch", + "x-form-visible": "model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + "overlaycolor": { + "type": "string", + "x-source": "inject", + "x-form-label": "Overlay Color", + "x-form-type": "color", + "x-form-visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "#ffffff" + }, + "overlayopacity": { + "type": "string", + "x-source": "inject", + "x-form-label": "Overlay opacity", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 100, + "x-form-visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'", + "x-default": "50" + }, + "bgcolor": { + "type": "string", + "x-source": "inject", + "x-form-label": "Background Color", + "x-form-type": "color", + "x-form-visible": "(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'", + "x-default": "#ffffff" + }, + "color2": { + "type": "string", + "x-source": "inject", + "x-form-label": "Color 2", + "x-form-type": "color", + "x-form-visible": "model.backgroundtype == 'gradient' and model.custombackground == 'true'", + "x-default": "#c0c0c0" + }, + "blockwidth": { + "type": "string", + "x-source": "inject", + "x-form-label": "Block Width", + "x-form-type": "materialradio", + "x-default": "default", + "properties": { + "default": { + "x-form-name": "Default", + "x-form-value": "default" + }, + "full": { + "x-form-name": "Full Width", + "x-form-value": "full" + }, + "article": { + "x-form-name": "Article Width", + "x-form-value": "article" + } + } + }, + "fullheight": { + "type": "string", + "x-source": "inject", + "x-form-label": "Full Height", + "x-form-type": "materialswitch", + "x-default": "false" + }, + "toppadding": { + "type": "string", + "x-source": "inject", + "x-form-label": "Top Padding", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 300, + "x-form-visible": "model.fullheight != 'true'" + }, + "bottompadding": { + "type": "string", + "x-source": "inject", + "x-form-label": "Bottom Padding", + "x-form-type": "materialrange", + "x-form-min": 0, + "x-form-max": 300, + "x-form-visible": "model.fullheight != 'true'" + }, + "contentname": { + "type": "string", + "x-source": "inject", + "x-form-label": "Content Name", + "x-form-type": "text" + } + } + } + } + } + }, + "name": "Form", + "componentPath": "themecleanflex/components/form", + "package": "com.themecleanflex.models", + "modelName": "Form", + "classNameParent": "AbstractComponent" +} +//GEN] +*/ + +//GEN[:DEF +@Model( + adaptables = Resource.class, + resourceType = "themecleanflex/components/form", + defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, + adapters = IComponent.class +) +@Exporter( + name = "jackson", + extensions = "json" +) + +//GEN] +public class FormModel extends AbstractComponent { + + public FormModel(Resource r) { super(r); } + + //GEN[:INJECT + /* {"type":"string","x-source":"inject","x-form-label":"Form Model","x-form-type":"textarea","x-form-hint":"JSON description passed to vue-form-generator, see vue form generator fields documentation","x-form-max":"16000"} */ + @Inject + private String schema; + + /* {"type":"string","x-source":"inject","x-form-label":"Form submit endpoint URL","x-form-type":"text","x-default":""} */ + @Inject + @Default(values ="") + private String endpointurl; + + /* {"type":"string","x-source":"inject","x-form-label":"Javascript function to call on submit","x-form-hint":"Function must accept (model, formdata)","x-form-type":"text","x-default":""} */ + @Inject + @Default(values ="") + private String submitfunction; + + /* {"type":"string","x-source":"inject","x-form-label":"Submit Button Text","x-form-type":"text","x-default":"Submit"} */ + @Inject + @Default(values ="Submit") + private String submittext; + + /* {"type":"string","x-source":"inject","x-form-label":"Submit button size","x-form-type":"materialselect","x-default":"normal","properties":{"section":{"x-form-name":"normal","x-form-value":"normal"},"small":{"x-form-name":"small","x-form-value":"small"},"large":{"x-form-name":"large","x-form-value":"large"},"full":{"x-form-name":"full width","x-form-value":"full"}}} */ + @Inject + @Default(values ="normal") + private String submitsize; + + /* {"type":"string","x-source":"inject","x-form-label":"Submit button alignment","x-form-type":"materialselect","x-default":"start","properties":{"start":{"x-form-name":"start","x-form-value":"start"},"center":{"x-form-name":"center","x-form-value":"center"},"end":{"x-form-name":"end","x-form-value":"end"}}} */ + @Inject + @Default(values ="start") + private String submitalignment; + + /* {"type":"string","x-source":"inject","x-form-label":"Failure Message","x-form-type":"text","x-default":"Error processing form"} */ + @Inject + @Default(values ="Error processing form") + private String failmessage; + + /* {"type":"string","x-source":"inject","x-form-type":"pathbrowser","x-form-label":"Submit Success Page","x-form-browserRoot":"/content/themecleanflex/pages"} */ + @Inject + private String successpage; + + /* {"type":"string","x-source":"inject","x-form-label":"Anchor Name","x-form-type":"text"} */ + @Inject + private String anchorname; + + /* {"type":"string","x-source":"inject","x-form-label":"Additonal Classes","x-form-type":"text"} */ + @Inject + private String extraclasses; + + /* {"type":"string","x-source":"inject","x-form-label":"Semantic Element","x-form-type":"materialselect","x-default":"section","properties":{"section":{"x-form-name":"section","x-form-value":"section"},"article":{"x-form-name":"article","x-form-value":"article"},"main":{"x-form-name":"main","x-form-value":"main"},"div":{"x-form-name":"div","x-form-value":"div"},"header":{"x-form-name":"header","x-form-value":"header"},"nav":{"x-form-name":"nav","x-form-value":"nav"},"footer":{"x-form-name":"footer","x-form-value":"footer"}}} */ + @Inject + @Default(values ="section") + private String htmlelement; + + /* {"type":"string","x-source":"inject","x-form-label":"Block Color Scheme","x-form-type":"materialradio","x-default":"","properties":{"none":{"x-form-name":"None","x-form-value":""},"light":{"x-form-name":"Light","x-form-value":"light"},"dark":{"x-form-name":"Dark","x-form-value":"dark"}}} */ + @Inject + @Default(values ="") + private String colorscheme; + + /* {"type":"string","x-source":"inject","x-form-label":"Custom Background","x-form-type":"materialswitch","x-default":"false"} */ + @Inject + @Default(values ="false") + private String custombackground; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Type","x-form-type":"materialradio","x-form-visible":"model.custombackground == 'true'","properties":{"color":{"x-form-name":"Color","x-form-value":"color"},"gradient":{"x-form-name":"Gradient","x-form-value":"gradient"},"image":{"x-form-name":"Image","x-form-value":"image"},"video":{"x-form-name":"Video","x-form-value":"video"}}} */ + @Inject + private String backgroundtype; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Video","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'video' and model.custombackground == 'true'","x-default":"https://www.youtube.com/embed/Ju86mknumYM","x-form-browserRoot":"/content/themecleanflex/assets"} */ + @Inject + @Default(values ="https://www.youtube.com/embed/Ju86mknumYM") + private String bgvideo; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Image","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-form-browserRoot":"/content/themecleanflex/assets"} */ + @Inject + private String bgimage; + + /* {"type":"string","x-source":"inject","x-form-label":"Background X Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + @Inject + @Default(values ="50") + private String bgxposition; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Y Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + @Inject + @Default(values ="50") + private String bgyposition; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Size Style","x-form-type":"text","x-default":"cover"} */ + @Inject + @Default(values ="cover") + private String bgsize; + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay","x-form-type":"materialswitch","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'"} */ + @Inject + private String overlay; + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay Color","x-form-type":"color","x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"#ffffff"} */ + @Inject + @Default(values ="#ffffff") + private String overlaycolor; + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay opacity","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + @Inject + @Default(values ="50") + private String overlayopacity; + + /* {"type":"string","x-source":"inject","x-form-label":"Background Color","x-form-type":"color","x-form-visible":"(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'","x-default":"#ffffff"} */ + @Inject + @Default(values ="#ffffff") + private String bgcolor; + + /* {"type":"string","x-source":"inject","x-form-label":"Color 2","x-form-type":"color","x-form-visible":"model.backgroundtype == 'gradient' and model.custombackground == 'true'","x-default":"#c0c0c0"} */ + @Inject + @Default(values ="#c0c0c0") + private String color2; + + /* {"type":"string","x-source":"inject","x-form-label":"Block Width","x-form-type":"materialradio","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"full":{"x-form-name":"Full Width","x-form-value":"full"},"article":{"x-form-name":"Article Width","x-form-value":"article"}}} */ + @Inject + @Default(values ="default") + private String blockwidth; + + /* {"type":"string","x-source":"inject","x-form-label":"Full Height","x-form-type":"materialswitch","x-default":"false"} */ + @Inject + @Default(values ="false") + private String fullheight; + + /* {"type":"string","x-source":"inject","x-form-label":"Top Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + @Inject + private String toppadding; + + /* {"type":"string","x-source":"inject","x-form-label":"Bottom Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + @Inject + private String bottompadding; + + /* {"type":"string","x-source":"inject","x-form-label":"Content Name","x-form-type":"text"} */ + @Inject + private String contentname; + + +//GEN] + + //GEN[:GETTERS + /* {"type":"string","x-source":"inject","x-form-label":"Form Model","x-form-type":"textarea","x-form-hint":"JSON description passed to vue-form-generator, see vue form generator fields documentation","x-form-max":"16000"} */ + public String getSchema() { + return schema; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Form submit endpoint URL","x-form-type":"text","x-default":""} */ + public String getEndpointurl() { + return endpointurl; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Javascript function to call on submit","x-form-hint":"Function must accept (model, formdata)","x-form-type":"text","x-default":""} */ + public String getSubmitfunction() { + return submitfunction; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Submit Button Text","x-form-type":"text","x-default":"Submit"} */ + public String getSubmittext() { + return submittext; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Submit button size","x-form-type":"materialselect","x-default":"normal","properties":{"section":{"x-form-name":"normal","x-form-value":"normal"},"small":{"x-form-name":"small","x-form-value":"small"},"large":{"x-form-name":"large","x-form-value":"large"},"full":{"x-form-name":"full width","x-form-value":"full"}}} */ + public String getSubmitsize() { + return submitsize; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Submit button alignment","x-form-type":"materialselect","x-default":"start","properties":{"start":{"x-form-name":"start","x-form-value":"start"},"center":{"x-form-name":"center","x-form-value":"center"},"end":{"x-form-name":"end","x-form-value":"end"}}} */ + public String getSubmitalignment() { + return submitalignment; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Failure Message","x-form-type":"text","x-default":"Error processing form"} */ + public String getFailmessage() { + return failmessage; + } + + /* {"type":"string","x-source":"inject","x-form-type":"pathbrowser","x-form-label":"Submit Success Page","x-form-browserRoot":"/content/themecleanflex/pages"} */ + public String getSuccesspage() { + return successpage; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Anchor Name","x-form-type":"text"} */ + public String getAnchorname() { + return anchorname; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Additonal Classes","x-form-type":"text"} */ + public String getExtraclasses() { + return extraclasses; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Semantic Element","x-form-type":"materialselect","x-default":"section","properties":{"section":{"x-form-name":"section","x-form-value":"section"},"article":{"x-form-name":"article","x-form-value":"article"},"main":{"x-form-name":"main","x-form-value":"main"},"div":{"x-form-name":"div","x-form-value":"div"},"header":{"x-form-name":"header","x-form-value":"header"},"nav":{"x-form-name":"nav","x-form-value":"nav"},"footer":{"x-form-name":"footer","x-form-value":"footer"}}} */ + public String getHtmlelement() { + return htmlelement; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Block Color Scheme","x-form-type":"materialradio","x-default":"","properties":{"none":{"x-form-name":"None","x-form-value":""},"light":{"x-form-name":"Light","x-form-value":"light"},"dark":{"x-form-name":"Dark","x-form-value":"dark"}}} */ + public String getColorscheme() { + return colorscheme; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Custom Background","x-form-type":"materialswitch","x-default":"false"} */ + public String getCustombackground() { + return custombackground; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Type","x-form-type":"materialradio","x-form-visible":"model.custombackground == 'true'","properties":{"color":{"x-form-name":"Color","x-form-value":"color"},"gradient":{"x-form-name":"Gradient","x-form-value":"gradient"},"image":{"x-form-name":"Image","x-form-value":"image"},"video":{"x-form-name":"Video","x-form-value":"video"}}} */ + public String getBackgroundtype() { + return backgroundtype; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Video","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'video' and model.custombackground == 'true'","x-default":"https://www.youtube.com/embed/Ju86mknumYM","x-form-browserRoot":"/content/themecleanflex/assets"} */ + public String getBgvideo() { + return bgvideo; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Image","x-form-type":"pathbrowser","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-form-browserRoot":"/content/themecleanflex/assets"} */ + public String getBgimage() { + return bgimage; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background X Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + public String getBgxposition() { + return bgxposition; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Y Position","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + public String getBgyposition() { + return bgyposition; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Size Style","x-form-type":"text","x-default":"cover"} */ + public String getBgsize() { + return bgsize; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay","x-form-type":"materialswitch","x-form-visible":"model.backgroundtype == 'image' and model.custombackground == 'true'"} */ + public String getOverlay() { + return overlay; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay Color","x-form-type":"color","x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"#ffffff"} */ + public String getOverlaycolor() { + return overlaycolor; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Overlay opacity","x-form-type":"materialrange","x-form-min":0,"x-form-max":100,"x-form-visible":"model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'","x-default":"50"} */ + public String getOverlayopacity() { + return overlayopacity; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Background Color","x-form-type":"color","x-form-visible":"(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'","x-default":"#ffffff"} */ + public String getBgcolor() { + return bgcolor; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Color 2","x-form-type":"color","x-form-visible":"model.backgroundtype == 'gradient' and model.custombackground == 'true'","x-default":"#c0c0c0"} */ + public String getColor2() { + return color2; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Block Width","x-form-type":"materialradio","x-default":"default","properties":{"default":{"x-form-name":"Default","x-form-value":"default"},"full":{"x-form-name":"Full Width","x-form-value":"full"},"article":{"x-form-name":"Article Width","x-form-value":"article"}}} */ + public String getBlockwidth() { + return blockwidth; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Full Height","x-form-type":"materialswitch","x-default":"false"} */ + public String getFullheight() { + return fullheight; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Top Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + public String getToppadding() { + return toppadding; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Bottom Padding","x-form-type":"materialrange","x-form-min":0,"x-form-max":300,"x-form-visible":"model.fullheight != 'true'"} */ + public String getBottompadding() { + return bottompadding; + } + + /* {"type":"string","x-source":"inject","x-form-label":"Content Name","x-form-type":"text"} */ + public String getContentname() { + return contentname; + } + + +//GEN] + + //GEN[:CUSTOMGETTERS + //GEN] + +} diff --git a/core/src/main/java/com/themecleanflex/models/MediablockModel.java b/core/src/main/java/com/themecleanflex/models/MediablockModel.java index ba332d754..ce4eeb1a2 100644 --- a/core/src/main/java/com/themecleanflex/models/MediablockModel.java +++ b/core/src/main/java/com/themecleanflex/models/MediablockModel.java @@ -1,7 +1,9 @@ package com.themecleanflex.models; +import com.peregrine.model.api.ImageInfo; import com.peregrine.nodetypes.models.AbstractComponent; import com.peregrine.nodetypes.models.IComponent; + import javax.inject.Inject; import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Default; @@ -9,6 +11,8 @@ import org.apache.sling.models.annotations.Exporter; import org.apache.sling.models.annotations.Model; +import java.awt.Dimension; + /* //GEN[:DATA { @@ -359,6 +363,10 @@ public class MediablockModel extends AbstractComponent { @Default(values ="") private String imagesrc; + @Inject + @ImageInfo(name = "imagesrc") + private Dimension imagesrcSize; + /* {"type":"string","x-source":"inject","x-form-label":"Video Source","x-form-visible":"model.mediatype == 'video'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":""} */ @Inject @Default(values ="") @@ -484,6 +492,10 @@ public String getImagesrc() { return imagesrc; } + public Dimension getImagesrcSize() { + return imagesrcSize; + } + /* {"type":"string","x-source":"inject","x-form-label":"Video Source","x-form-visible":"model.mediatype == 'video'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":""} */ public String getVideosrc() { return videosrc; diff --git a/core/src/main/java/com/themecleanflex/models/TeaserverticalModel.java b/core/src/main/java/com/themecleanflex/models/TeaserverticalModel.java index 4721b5de1..e934c63ee 100644 --- a/core/src/main/java/com/themecleanflex/models/TeaserverticalModel.java +++ b/core/src/main/java/com/themecleanflex/models/TeaserverticalModel.java @@ -1,7 +1,9 @@ package com.themecleanflex.models; +import com.peregrine.model.api.ImageInfo; import com.peregrine.nodetypes.models.AbstractComponent; import com.peregrine.nodetypes.models.IComponent; + import java.util.List; import javax.inject.Inject; import org.apache.sling.api.resource.Resource; @@ -10,6 +12,8 @@ import org.apache.sling.models.annotations.Exporter; import org.apache.sling.models.annotations.Model; +import java.awt.Dimension; + /* //GEN[:DATA { @@ -243,7 +247,8 @@ "x-form-visible": "model.mediatype == 'image' and model.showmedia == 'true'", "x-form-type": "pathbrowser", "x-form-browserRoot": "/content/themecleanflex/assets", - "x-default": "" + "x-default": "", + "x-annotate": "size" }, "videosrc": { "type": "string", @@ -631,11 +636,15 @@ public class TeaserverticalModel extends AbstractComponent { @Inject private String mediatype; - /* {"type":"string","x-source":"inject","x-form-label":"Image Source","x-form-visible":"model.mediatype == 'image' and model.showmedia == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":""} */ + /* {"type":"string","x-source":"inject","x-form-label":"Image Source","x-form-visible":"model.mediatype == 'image' and model.showmedia == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":"","x-annotate":"size"} */ @Inject @Default(values ="") private String imagesrc; + @Inject + @ImageInfo(name="imagesrc") + private Dimension imagesrcSize; + /* {"type":"string","x-source":"inject","x-form-label":"Video Source","x-form-visible":"model.mediatype == 'video' and model.showmedia == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":""} */ @Inject @Default(values ="") @@ -831,11 +840,15 @@ public String getMediatype() { return mediatype; } - /* {"type":"string","x-source":"inject","x-form-label":"Image Source","x-form-visible":"model.mediatype == 'image' and model.showmedia == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":""} */ + /* {"type":"string","x-source":"inject","x-form-label":"Image Source","x-form-visible":"model.mediatype == 'image' and model.showmedia == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":"","x-annotate":"size"} */ public String getImagesrc() { return imagesrc; } + public Dimension getImagesrcSize() { + return imagesrcSize; + } + /* {"type":"string","x-source":"inject","x-form-label":"Video Source","x-form-visible":"model.mediatype == 'video' and model.showmedia == 'true'","x-form-type":"pathbrowser","x-form-browserRoot":"/content/themecleanflex/assets","x-default":""} */ public String getVideosrc() { return videosrc; diff --git a/docs/datalist.md b/docs/datalist.md new file mode 100644 index 000000000..ca1ef6555 --- /dev/null +++ b/docs/datalist.md @@ -0,0 +1,108 @@ +# Datalist Implementation + +### Quickstart +The easiest way to get started with the Datalist is to use the $formsapp javascript connected to a form. This will store data into your local browser storage that will then be displayed in the datalist. + +Create a new page and add a Form component. Edit the form to use the following form model: + + { + "fields": [ + { + "type": "input", + "inputType": "text", + "label": "First Name", + "model": "firstName", + "id": "first_name", + "placeholder": "Your name", + "featured": true, + "required": true + },{ + "type": "input", + "inputType": "text", + "label": "Last Name", + "model": "lastName", + "id": "last_name", + "placeholder": "Your name", + "featured": true, + "required": true + } + ]} + +- Endpoint URL: list +- Submit Function: $formsapp.save + +Add a Datalist component. You can leave the *endpoint URL*, *load function*, and *delete function* blank. Add two columns +in the *Table Configuration* with the following values: +- Header: **First Name** +- Data Value: **firstName** +- Header: **Last Name** +- Data Value: **lastName** + +Now, if you submit a first and last name through the form and refresh the page, your values should show up in the table. +If you edit the Datalist component and turn on *Selectable Table* you will get the option to delete rows from the table. + +### Datalist Javascript Events + +#### datalist-storage-update +The datalist component has an event listener for the datalist-storage-update event. If this event is fired, it will trigger a reload of the backing data. You can use this event in other javascript functions to force a reload when data has been changed. + +See the **themecleanflex/pages/js/formsapp.js** save() function for an example of this in action. + +### Datalist Component Configuration + +#### Datalist Data Retrieval +If a endpoint URL is indicated, then the datalist will do an axios GET request with the table data to this URL. + +The endpoint should return a list of objects. +ex. + + [{ + "firstName": "Kyle", + "lastName": "Watson" + },{ + "firstName": "Shane", + "lastName": "Mcgrath" + },{ + "firstName": "Ben", + "lastName": "Kahn" + }] + +#### Javascript Function to Get Data +Instead of the default GET endpoint behaviour, the user can configure a custom function to be called instead. This function can be part of any object as long as it can be accessed through the javascript window object. +This function will be passed one parameter +- Path - the endpoint URL specified in the configuration + +#### Javascript Function to Delete Data +If the table is selectable, the user can configure a custom function to delete data. If the load function is defined, this function must also be defined for table delete action to work correctly. +The function will be passed three parameters: +- Table Data - the data array currently backing the table +- Active - a boolean array denoting which rows of the table data array are currently selected +- Path - the endpoint URL specified in the configuration + +This function is expected to return a new data array with the selected rows removed. + +#### Table Configuration +Add columns with any header value with the data value being a property in the objects returned by the endpoint/local storage. +Each column takes three configuration options: +- Header - The name to be displayed in the column header +- Data Value - The data in the backing model to display in this column +- Column Alignment - The horizontal alignment to render text in the cell. + +#### Row Alignment +Defines the default row vertical alignment for the table. + +#### Striped Rows + +Adjusts colors of every other row in the table. + +#### Dense Table + +Lowers the spacing of the table cells. + +#### Scrollable Table + +Allows user to scroll through table results. Can adjust the height of the container and make the headers stick to the top of table when scrolling or not. + +#### Selectable Table + +Allows user to select table rows and perform actions on the rows selected. diff --git a/docs/forms.md b/docs/forms.md new file mode 100644 index 000000000..fe65dcbad --- /dev/null +++ b/docs/forms.md @@ -0,0 +1,100 @@ +# Forms Implementation + +### Quickstart + +Check out the Datalist documentation for a quickstart using a form that saves to your local browser storage and shows the results in a table. + +This section will describe setting up a contact form that posts to an external URL. + +Create a new page and add the Form - Contact sample component. This component has a form model configured with a first name, last name, email, and text area. + + { + "fields": [ + { + "type": "input", + "inputType": "text", + "label": "First Name", + "model": "first_name", + "id": "first_name", + "placeholder": "First Name" + },{ + "type": "input", + "inputType": "text", + "label": "Last Name", + "model": "last_name", + "id": "last_name", + "placeholder": "Last Name" + },{ + "type": "input", + "inputType": "text", + "label": "Email", + "model": "email", + "id": "email", + "placeholder": "Email", + "featured": true, + "required": true + },{ + "type": "textArea", + "label": "Text", + "model": "text", + "id": "text", + "rows": 4, + "placeholder": "Enter text here", + "featured": true, + "required": true + } + ]} + +Edit the component configuration and update the following: +- Endpoint URL: *url you would like to post to* +- Failure Message: "Error processing form" +- Success Page: *path to page when form submits successfully* + +Now the form will attempt to do an AJAX post to the endpoint URL. If you put an invalid URL, you can see that the failure message will show up when the form attempts to submit. If the submission is successful (the POST request gets a 200 OK HTTP status), then peregrine will forward the user to the configured success page. + +### Form Javascript Events + +#### form-clear +The form component has an event listener for the + +### Form Component Configuration + +#### Form Model +The Form Model takes a Vue Form Generator JSON configuration. For an example and a list of the configuration options for each type of field see the [Vue Form Generator fields documentation](https://vue-generators.gitbook.io/vue-generators/fields) + +Here is an example form with a single field called name: + + { + "fields": [ + { + "type": "input", + "inputType": "text", + "label": "Name", + "model": "name", + "id": "user_name", + "placeholder": "Your name", + "featured": true, + "required": true + } + ]} + +#### Form Submit Endpoint URL +The form will do an ajax POST with the form data to this URL. If the response is successful, it will forward the user to the configured Submit Success Page. + +#### Javascript Function to Call on Submit +Instead of the default POST behaviour, the user can configure a custom function to be called instead. This function can be part of any object as long as it can be accessed through the javascript window object. +It will be passed two parameters: +- model - the Vue object model with the component configuration +- formData - an object containing the form data + +#### Submit Button Text + +Configure the text for the submit button, defaults to "Submit" + +#### Failure Message + +If there is an error processing the form, this message will be shown in an error box above the form. + +#### Submit Success Page + +If not empty, on successful form submission it will forward the user to this page. diff --git a/fragments/cards/hatch.js b/fragments/cards/hatch.js index 8b605b5ed..78226fe67 100644 --- a/fragments/cards/hatch.js +++ b/fragments/cards/hatch.js @@ -53,6 +53,7 @@ module.exports = { f.bindAttribute($.find('v-lazy-image').first(), 'class', "model.showcard === 'true' || model.cardborder === 'true' ? 'card-img w-full' : 'card-img mb-3 w-full'") f.bindAttribute($.find('v-lazy-image').first(), 'src', f.pathToUrl('item.image')) f.bindAttribute($.find('v-lazy-image').first(), 'alt', 'item.imagealttext') + f.bindAttribute($.find('v-lazy-image').first(), 'src-placeholder', 'placeholderSrc(item)') f.addIf($.find('v-lazy-image').first(), 'item.image') //Title diff --git a/fragments/cards/model.json b/fragments/cards/model.json index 7c2a79489..32834cb9b 100644 --- a/fragments/cards/model.json +++ b/fragments/cards/model.json @@ -108,6 +108,7 @@ "x-form-label": "Cards", "x-form-fieldLabel": "title", "x-form-type": "collection", + "x-collection-type": "Card", "properties": { "title": { "type": "string", @@ -128,7 +129,8 @@ "x-source": "inject", "x-form-label": "Card Image", "x-form-type": "pathbrowser", - "x-form-browserRoot": "/content/themecleanflex/assets" + "x-form-browserRoot": "/content/themecleanflex/assets", + "x-annotate": "size" }, "imagewidth": { "type": "string", diff --git a/fragments/cards/template.vue b/fragments/cards/template.vue index 79f271abd..9670fbef0 100644 --- a/fragments/cards/template.vue +++ b/fragments/cards/template.vue @@ -36,7 +36,7 @@
+ v-bind:src-placeholder="placeholderSrc(item)" v-if="item.image">
element === true).length === 0, + }` + f.bindAttribute(selectedContainer, 'class', selectedContainerClasses, false) + const mobileSelectAction = selectedContainer.find('.action').eq(0) + f.addIf(mobileSelectAction, '(model.mobiletablestyle === "" || model.mobiletablestyle === "default") && isMobile' ) + f.bindEvent(mobileSelectAction, 'click', 'toggleAllRows'); + f.addIf(mobileSelectAction.find('.unchecked'), '(!active.every(element => element === true) || active.length === 0)'); + f.addElse(mobileSelectAction.find('.checked')); + const selectedText = selectedContainer.find('.selected-text').eq(0) + f.mapField(selectedText, '`${active.filter(element => element === true).length} selected`', false) + const actionDelete = selectedContainer.find('.selected-actions svg').eq(0) + f.bindEvent(actionDelete, 'click', 'deleteAction'); + + const desktopContainer = $.find('div.overflow-x-scroll').eq(0); + const desktopContainerClasses = `{ + 'overflow-y-scroll': model.scrollabletable === 'true', + 'hidden': isMobile, + }` + f.bindAttribute(desktopContainer, 'class', desktopContainerClasses, false) + f.addStyle(desktopContainer, 'height', "(model.scrollabletable === 'true') ? model.tableheight + 'px' : 'auto'", false) + + const mobileContainer = $.find('div.mobile-table').eq(0); + const mobileContainerClasses = `{ + 'hidden': !isMobile, + }` + f.bindAttribute(mobileContainer, 'class', mobileContainerClasses, false) + + //default mobile style + const mobileDefaultBody = mobileContainer.find('tbody').eq(0); + f.addIf(mobileDefaultBody, 'model.mobiletablestyle === "" || model.mobiletablestyle === "default"' ) + + const mobileDefaultTr = mobileContainer.find('tr.item-row').eq(0) + f.addFor(mobileDefaultTr, 'model.columns', 'col') + mobileDefaultTr.attr(':key', `data.path || j`) + f.addStyle(mobileDefaultTr, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + + const mobileDefaultAction = mobileDefaultBody.find('td.action-head').eq(0) + f.addStyle(mobileDefaultAction, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + f.addIf(mobileDefaultAction, 'i === 0') + f.addIf(mobileDefaultAction.find('.unchecked'), '!active[j]'); + f.addIf(mobileDefaultAction.find('.checked'), 'active[j]') + f.addStyle(mobileDefaultAction.find('.checked'), 'fill',"active[j] ? 'var(--text-secondary-color) !important' : ''"); + f.bindEvent(mobileDefaultAction.find('.action').eq(0), 'click', 'toggleRow(j)'); + + const mobileDefaultActionSpacer = mobileDefaultBody.find('td.mobile-action-spacer').eq(0) + f.addIf(mobileDefaultActionSpacer, 'i !== 0') + f.addStyle(mobileDefaultActionSpacer, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + + f.mapField(mobileDefaultBody.find('td.mobile-header').eq(0), 'col.header', false) + mobileDefaultBody.find('td.mobile-header').eq(0).attr(':key', `col.path || i`) + + f.mapField(mobileDefaultBody.find('td.mobile-item').eq(0), 'data[col.value]', false) + f.addStyle(mobileDefaultBody.find('td.mobile-item').eq(0), 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + f.addStyle(mobileDefaultBody.find('td.mobile-item').eq(0), 'color',"active[j] ? 'var(--text-secondary-color) !important' : ''"); + + f.wrap(mobileDefaultTr, 'template') + + const mobileTemplate = mobileDefaultBody.find('template').first(); + mobileTemplate.attr('v-for', `(data, j) in storageData`) + f.addIf(mobileTemplate, 'rowHasData(data,model.columns)') + + //scroll mobile style + const scrollMobileBody = mobileContainer.find('tbody').eq(1) + f.addElse(scrollMobileBody) + const mobileScrollActionTr = scrollMobileBody.find('tr.action-row').eq(0) + const mobileScrollAction = scrollMobileBody.find('td.action-item').eq(0) + f.addFor(mobileScrollAction, 'storageData', 'data') + f.addIf(mobileScrollAction, 'rowHasData(data,model.columns)') + f.addIf(mobileScrollAction.find('.unchecked'), '!active[i]'); + f.addIf(mobileScrollAction.find('.checked'), 'active[i]'); + f.addStyle(mobileScrollAction, 'background', "active[i] ? 'var(--color-red-500) !important' : ''") + f.addStyle(mobileScrollAction.find('.checked'), 'fill',"active[i] ? 'var(--text-secondary-color) !important' : ''"); + f.bindEvent(mobileScrollAction.find('.action').eq(0), 'click', 'toggleRow(i)'); + + const mobileScrollActionAll = mobileScrollActionTr.find('td.action-item-all').eq(0) + f.addIf(mobileScrollActionAll.find('.unchecked'), '(!active.every(element => element === true) || active.length === 0)'); + f.addElse(mobileScrollActionAll.find('.checked')); + f.bindEvent(mobileScrollActionAll.find('.action').eq(0), 'click', 'toggleAllRows'); + + const mobileScrollBodyTr = scrollMobileBody.find('tr.item-row').first() + f.addFor(mobileScrollBodyTr, 'model.columns', 'col') + + const mobileScrollTd = mobileScrollBodyTr.find('td').first() + mobileScrollTd.attr('v-for', `(data, j) in storageData`) + mobileScrollTd.attr(':key', `data.path || j`) + f.addIf(mobileScrollTd, 'rowHasData(data,model.columns)') + f.mapField(mobileScrollTd, 'data[col.value]', false) + f.addStyle(mobileScrollTd, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + + mobileScrollBodyTr.prepend("{{col.header}}") + + const mobileTdClasses = `{ + 'border': model.cellborders === 'true', + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' + }` + f.bindAttribute($.find('.mobile-table td'), 'class', mobileTdClasses, false) + + //desktop + const table = $.find('table') + const tableClasses = `{ + 'striped': model.stripedrows === 'true' + }` + f.bindAttribute(table, 'class', tableClasses, false) + + const thText = $.find('th.header-item').first() + f.addFor(thText, 'model.columns', 'col') + const thTextClasses = `{ + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'sticky': model.stickyheader === 'true', + 'top-0': model.stickyheader === 'true', + 'text-left': (col && col.textalignment === 'left') || (col && col.textalignment === ''), + 'text-center': col && col.textalignment === 'center', + 'text-right': col && col.textalignment === 'right', + }` + f.bindAttribute(thText, 'class', thTextClasses, false) + f.mapField(thText.find('span'), 'col.header', false) + + const thAction = $.find('th.action-head').first() + f.addIf(thAction, "model.selectable === 'true'") + f.addIf(thAction.find('.unchecked'), '(!active.every(element => element === true) || active.length === 0)'); + f.addElse(thAction.find('.checked')); + f.bindEvent(thAction.find('.action').eq(0), 'click', 'toggleAllRows'); + f.bindAttribute(thAction, 'class', thTextClasses, false) + + const tbody = $.find('tbody').first() + const tr = tbody.find('tr').first() + const tdItem = tr.find('td.item').first() + tr.attr('v-for', `(data, j) in storageData`) + tr.attr(':key', `data.path || j`) + f.addIf(tr, 'rowHasData(data,model.columns)') + + f.addFor(tdItem, 'model.columns', 'col') + f.mapField(tdItem.find('span.item-text'), 'data[col.value]', false) + + const tdClasses = `{ + 'border': model.cellborders === 'true', + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'text-left': (col && col.textalignment === 'left') || (col && col.textalignment === ''), + 'text-center': col && col.textalignment === 'center', + 'text-right': col && col.textalignment === 'right', + 'align-top': model.rowalignment === 'top' || model.rowalignment === '', + 'align-center': model.rowalignment === 'center', + 'align-bottom': model.rowalignment === 'bottom' + }` + f.bindAttribute(tdItem, 'class', tdClasses, false) + f.addStyle(tdItem, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + + f.addStyle(tdItem.find('span.item-text'), 'color',"active[j] ? 'var(--text-secondary-color) !important' : ''"); + + const tdAction = $.find('td.action-item').first() + f.addStyle(tdAction, 'background', "active[j] ? 'var(--color-red-500) !important' : ''") + f.addIf(tdAction, "model.selectable === 'true'") + f.addIf(tdAction.find('.unchecked'), '!active[j]'); + f.addIf(tdAction.find('.checked'), 'active[j]'); + f.addStyle(tdAction.find('.checked'), 'fill',"active[j] ? 'var(--text-secondary-color) !important' : ''"); + f.bindEvent(tdAction.find('.action').eq(0), 'click', 'toggleRow(j)'); + f.bindAttribute(tdAction, 'class', tdClasses, false) + + const caption = $.find('caption') + const captionClasses = `{ + 'text-left': model.captionalignment === 'left', + 'text-center': model.captionalignment === 'center', + 'text-right': model.captionalignment === 'right', + 'p-3': model.densetable !== 'true', + 'p-1': model.densetable === 'true', + 'hidden': model.caption !== 'true' + }` + f.bindAttribute(caption, 'class', captionClasses, false) + f.addStyle(caption, 'caption-side', "model.captionplacement", false); + f.mapField(caption, 'model.captiontext') + + f.addElse($); + $.parent().prepend('
no content defined for component
') + } +} \ No newline at end of file diff --git a/fragments/datalist/model.json b/fragments/datalist/model.json new file mode 100644 index 000000000..aa60263de --- /dev/null +++ b/fragments/datalist/model.json @@ -0,0 +1,222 @@ +{ + "definitions": { + "Datalist": { + "type": "object", + "x-type": "component", + "properties": { + "endpointurl": { + "type": "string", + "x-source": "inject", + "x-form-label": "URL to load JSON data for table", + "x-form-type": "text", + "x-default": "" + }, + "loadfunction": { + "type": "string", + "x-source": "inject", + "x-form-label": "Javascript function to call to load data", + "x-form-hint": "Function must accept (endpointurl)", + "x-form-type": "text" + }, + "deletefunction": { + "type": "string", + "x-source": "inject", + "x-form-label": "Javascript function to call to delete rows", + "x-form-hint": "Function must accept (tableData, activeSelections, endpointurl)", + "x-form-type": "text" + }, + "columns": { + "type": "string", + "x-source": "inject", + "x-form-label": "Table Configuration", + "x-form-fieldLabel": "header", + "x-form-type": "collection", + "properties": { + "header": { + "type": "string", + "x-source": "inject", + "x-form-label": "Column Header", + "x-form-type": "text" + }, + "value": { + "type": "string", + "x-source": "inject", + "x-form-label": "Data Value", + "x-form-type": "text" + }, + "textalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Text alignment", + "x-form-type": "materialselect", + "x-default": "left", + "properties":{ + "left": { + "x-form-name": "left", + "x-form-value": "left" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "right": { + "x-form-name": "right", + "x-form-value": "right" + } + } + } + } + }, + "rowalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Row alignment", + "x-form-type": "materialselect", + "x-default": "top", + "properties":{ + "top": { + "x-form-name": "top", + "x-form-value": "top" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "bottom": { + "x-form-name": "bottom", + "x-form-value": "bottom" + } + } + }, + "mobiletablestyle": { + "type": "string", + "x-source": "inject", + "x-form-label": "Mobile table style", + "x-form-type": "materialselect", + "x-default": "default", + "properties":{ + "default": { + "x-form-name": "default", + "x-form-value": "default" + }, + "scroll": { + "x-form-name": "scroll", + "x-form-value": "scroll" + } + } + }, + "stripedrows": { + "type": "string", + "x-source": "inject", + "x-form-label": "Striped Rows", + "x-form-type": "materialswitch", + "x-default": false + }, + "densetable": { + "type": "string", + "x-source": "inject", + "x-form-label": "Dense Table", + "x-form-type": "materialswitch", + "x-default": false + }, + "scrollabletable": { + "type": "string", + "x-source": "inject", + "x-form-label": "Scrollable Table", + "x-form-type": "materialswitch", + "x-default": false + }, + "stickyheader": { + "type": "string", + "x-source": "inject", + "x-form-label": "Sticky Header", + "x-form-type": "materialswitch", + "x-form-visible": "model.scrollabletable == 'true'", + "x-default": false + }, + "tableheight": { + "type": "string", + "x-source": "inject", + "x-form-label": "Table Height", + "x-form-type": "materialrange", + "x-form-min": 100, + "x-form-max": 500, + "x-default": 300, + "x-form-visible": "model.scrollabletable == 'true'" + }, + "selectable": { + "type": "string", + "x-source": "inject", + "x-form-label": "Selectable Table", + "x-form-type": "materialswitch", + "x-default": false + }, + "cellborders": { + "type": "string", + "x-source": "inject", + "x-form-label": "Add borders around individual cells", + "x-form-type": "materialswitch", + "x-default": false + }, + "caption": { + "type": "string", + "x-source": "inject", + "x-form-label": "Table caption", + "x-form-type": "materialswitch", + "x-default": false + }, + "captiontext": { + "type": "string", + "x-source": "inject", + "x-form-label": "Caption text", + "x-form-type": "text", + "x-form-visible": "model.caption == 'true'" + }, + "captionplacement": { + "type": "string", + "x-source": "inject", + "x-form-label": "Caption placement", + "x-form-type": "materialselect", + "x-default": "bottom", + "x-form-visible": "model.caption == 'true'", + "properties":{ + "top": { + "x-form-name": "top", + "x-form-value": "top" + }, + "bottom": { + "x-form-name": "bottom", + "x-form-value": "bottom" + } + } + }, + "captionalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Caption alignment", + "x-form-type": "materialselect", + "x-default": "left", + "x-form-visible": "model.caption == 'true'", + "properties":{ + "left": { + "x-form-name": "left", + "x-form-value": "left" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "right": { + "x-form-name": "right", + "x-form-value": "right" + } + } + }, + "bgref": { + "$ref": "fragments/block/model.json#/definitions/Block", + "x-form-type": "reference" + } + } + } + } +} diff --git a/fragments/datalist/sample.json b/fragments/datalist/sample.json new file mode 100644 index 000000000..010210861 --- /dev/null +++ b/fragments/datalist/sample.json @@ -0,0 +1,7 @@ +{ + "title": "Datalist", + "group": "", + "model": { + "text": "example" + } +} \ No newline at end of file diff --git a/fragments/datalist/template.html b/fragments/datalist/template.html new file mode 100644 index 000000000..37de190ef --- /dev/null +++ b/fragments/datalist/template.html @@ -0,0 +1,102 @@ +
+
+ + + + +
0 Selected
+
+ +
+
+
+ + + + + + + + + + + + + + +
+
+ + +
+
+ +
+ + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + +
+
+ +
\ No newline at end of file diff --git a/fragments/datalist/template.vue b/fragments/datalist/template.vue new file mode 100644 index 000000000..f6e4497c2 --- /dev/null +++ b/fragments/datalist/template.vue @@ -0,0 +1,427 @@ + + + diff --git a/fragments/form/hatch.js b/fragments/form/hatch.js new file mode 100644 index 000000000..2a4f91dfc --- /dev/null +++ b/fragments/form/hatch.js @@ -0,0 +1,45 @@ +module.exports = { + convert: function($, f) { + f.wrap($, 'themecleanflex-components-block') + f.bindAttribute($.parent(),'model','model') + + const failureP = $.find('p').eq(0) + f.mapField(failureP,'failureText',false) + f.addIf(failureP, "failureText"); + const schemaErrorP = $.find('p').eq(1) + f.mapField(schemaErrorP,'schemaError',false) + f.addIf(schemaErrorP, "schemaError"); + + const messageContainer = $.find('div').eq(0); + f.addIf(messageContainer, "( failureText || schemaError )"); + + const submit = $.find('input').first() + f.bindAttribute(submit,'value','model.submittext') + + const formContainer = $.find('form').eq(0); + let formContainerClasses = `{ + 'justify-button-start': model.submitalignment === 'start', + 'justify-button-center': model.submitalignment === 'center', + 'justify-button-end': model.submitalignment === 'end', + 'normal-button': model.submitsize === 'normal', + 'sm-button': model.submitsize === 'small', + 'lg-button': model.submitsize === 'large', + 'full-button': model.submitsize === 'full', + }` + f.bindAttribute(formContainer, 'class', formContainerClasses, false); + + const div2 = $.find('div').eq(1) + f.replace(div2, '') + + const formEl = $.find('form') + f.bindEvent(formEl,'submit.prevent.stop','onSubmit') + + const form = $.find('vue-form-generator').first() + f.bindAttribute(form,'class','`w-full`', false) + f.bindAttribute(form,'model','formModel') + f.bindAttribute(form,'schema','schema') + f.bindAttribute(form,'options','formOptions') + + f.bindPath($) + } +} \ No newline at end of file diff --git a/fragments/form/model.json b/fragments/form/model.json new file mode 100644 index 000000000..bb1fd7f4b --- /dev/null +++ b/fragments/form/model.json @@ -0,0 +1,104 @@ +{ + "definitions": { + "Form": { + "type": "object", + "x-type": "component", + "properties": { + "schema": { + "type": "string", + "x-source": "inject", + "x-form-label": "Form Model", + "x-form-type": "textarea", + "x-form-hint": "JSON description passed to vue-form-generator, see vue form generator fields documentation", + "x-form-max": "16000" + }, + "endpointurl": { + "type": "string", + "x-source": "inject", + "x-form-label": "Form submit endpoint URL", + "x-form-type": "text", + "x-default": "" + }, + "submitfunction": { + "type": "string", + "x-source": "inject", + "x-form-label": "Javascript function to call on submit", + "x-form-hint": "Function must accept (model, formdata)", + "x-form-type": "text", + "x-default": "" + }, + "submittext": { + "type": "string", + "x-source": "inject", + "x-form-label": "Submit Button Text", + "x-form-type": "text", + "x-default": "Submit" + }, + "submitsize": { + "type": "string", + "x-source": "inject", + "x-form-label": "Submit button size", + "x-form-type": "materialselect", + "x-default": "normal", + "properties":{ + "section": { + "x-form-name": "normal", + "x-form-value": "normal" + }, + "small": { + "x-form-name": "small", + "x-form-value": "small" + }, + "large": { + "x-form-name": "large", + "x-form-value": "large" + }, + "full": { + "x-form-name": "full width", + "x-form-value": "full" + } + } + }, + "submitalignment": { + "type": "string", + "x-source": "inject", + "x-form-label": "Submit button alignment", + "x-form-type": "materialselect", + "x-default": "start", + "properties":{ + "start": { + "x-form-name": "start", + "x-form-value": "start" + }, + "center": { + "x-form-name": "center", + "x-form-value": "center" + }, + "end": { + "x-form-name": "end", + "x-form-value": "end" + } + } + }, + "failmessage": { + "type": "string", + "x-source": "inject", + "x-form-label": "Failure Message", + "x-form-type": "text", + "x-default": "Error processing form" + }, + "successpage": { + "type": "string", + "x-source": "inject", + "x-form-type": "pathbrowser", + "x-form-label": "Submit Success Page", + "x-form-browserRoot": "/content/themecleanflex/pages" + }, + "bgref": { + "$ref": "fragments/block/model.json#/definitions/Block", + "x-form-type": "reference" + } + } + } + } +} diff --git a/fragments/form/sample-all.json b/fragments/form/sample-all.json new file mode 100644 index 000000000..21529522d --- /dev/null +++ b/fragments/form/sample-all.json @@ -0,0 +1,7 @@ +{ + "title": "Form - Input Types", + "group": "Features", + "model": { + "schema": "{\n\"groups\":[\n{\n\"legend\":\"Text Inputs\",\n\"fields\": [\n {\n \"type\": \"label\",\n \"label\": \"Label\",\n \"model\": \"label\"\n },{\n \"type\": \"input\",\n \"inputType\": \"text\",\n \"label\": \"Text\",\n \"model\": \"text\",\n \"id\": \"text\",\n \"placeholder\": \"Text\"\n },{\n \"type\": \"textArea\",\n \"label\": \"Text Area\",\n \"model\": \"textarea\",\n \"id\": \"textarea\",\n \"rows\": 4,\n \"placeholder\": \"Enter text here\"\n }\n ]\n},\n{\n\"legend\":\"Other Inputs\",\n\"fields\": [\n {\n \"type\": \"radios\",\n \"label\": \"Radios\",\n \"model\": \"radios\",\n \"values\": [\n \"Option 1\",\n \"Option 2\"\n ]\n },{\n \"type\": \"checkbox\",\n \"label\": \"Checkbox\",\n \"model\": \"checkbox\",\n \"default\": true\n },{\n \"type\": \"checklist\",\n \"label\": \"Checklist\",\n \"model\": \"checklist\",\n \"listBox\": true,\n \"values\": [\n \"Option 1\",\n \"Option 2\"\n ]\n },{\n \"type\": \"select\",\n \"label\": \"Select\",\n \"model\": \"select\",\n \"values\": [\n \"Option 1\",\n \"Option 2\"\n ]\n },{\n \"type\": \"submit\",\n \"buttonText\": \"Submit Button\",\n \"validateBeforeSubmit\": false\n }\n]}]}" + } +} \ No newline at end of file diff --git a/fragments/form/sample-contact.json b/fragments/form/sample-contact.json new file mode 100644 index 000000000..40ba62b26 --- /dev/null +++ b/fragments/form/sample-contact.json @@ -0,0 +1,7 @@ +{ + "title": "Form - Contact", + "group": "Features", + "model": { + "schema": "{\n\"fields\": [\n {\n \"type\": \"input\",\n \"inputType\": \"text\",\n \"label\": \"First Name\",\n \"model\": \"first_name\",\n \"id\": \"first_name\",\n \"placeholder\": \"First Name\"\n },{\n \"type\": \"input\",\n \"inputType\": \"text\",\n \"label\": \"Last Name\",\n \"model\": \"last_name\",\n \"id\": \"last_name\",\n \"placeholder\": \"Last Name\"\n },{\n \"type\": \"input\",\n \"inputType\": \"text\",\n \"label\": \"Email\",\n \"model\": \"email\",\n \"id\": \"email\",\n \"placeholder\": \"Email\",\n \"featured\": true,\n \"required\": true\n },{\n \"type\": \"textArea\",\n \"label\": \"Text\",\n \"model\": \"text\",\n \"id\": \"text\",\n \"rows\": 4,\n \"placeholder\": \"Enter text here\",\n \"featured\": true,\n \"required\": true\n }\n]}" + } +} \ No newline at end of file diff --git a/fragments/form/sample.json b/fragments/form/sample.json new file mode 100644 index 000000000..b395deebf --- /dev/null +++ b/fragments/form/sample.json @@ -0,0 +1,7 @@ +{ + "title": "Form", + "group": "Features", + "model": { + "schema": "{\n\"fields\": [\n {\n \"type\": \"input\",\n \"inputType\": \"text\",\n \"label\": \"Name\",\n \"model\": \"name\",\n \"id\": \"user_name\",\n \"placeholder\": \"Your name\",\n \"featured\": true,\n \"required\": true\n }\n]}" + } +} \ No newline at end of file diff --git a/fragments/form/template.html b/fragments/form/template.html new file mode 100644 index 000000000..0a283a21c --- /dev/null +++ b/fragments/form/template.html @@ -0,0 +1,10 @@ +
+
+

+

+
+
+
+ +
+
\ No newline at end of file diff --git a/fragments/form/template.vue b/fragments/form/template.vue new file mode 100644 index 000000000..afc8481c0 --- /dev/null +++ b/fragments/form/template.vue @@ -0,0 +1,107 @@ + + + + diff --git a/fragments/media/model.json b/fragments/media/model.json index 948dec5f8..48e6156c4 100644 --- a/fragments/media/model.json +++ b/fragments/media/model.json @@ -27,7 +27,8 @@ "x-form-visible": "model.mediatype == 'image'", "x-form-type": "pathbrowser", "x-form-browserRoot": "/content/themecleanflex/assets", - "x-default": "" + "x-default": "", + "x-annotate": "size" }, "videosrc": { "type": "string", diff --git a/fragments/mediavisible/model.json b/fragments/mediavisible/model.json index e22504ca1..58e146c9e 100644 --- a/fragments/mediavisible/model.json +++ b/fragments/mediavisible/model.json @@ -34,7 +34,8 @@ "x-form-visible": "model.mediatype == 'image' and model.showmedia == 'true'", "x-form-type": "pathbrowser", "x-form-browserRoot": "/content/themecleanflex/assets", - "x-default": "" + "x-default": "", + "x-annotate": "size" }, "videosrc": { "type": "string", diff --git a/pom.xml b/pom.xml index 8160f4bf5..8d6e80fd9 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ 3.0.2 1.4.1 3.6.1 - 2.5.4 + 4.2.1 3.0.0 2.5.2 2.20 @@ -80,7 +80,7 @@ 6.1.23 - 7 + 11 4.12 diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/cards/template.vue b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/cards/template.vue index 79f271abd..9670fbef0 100644 --- a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/cards/template.vue +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/cards/template.vue @@ -36,7 +36,7 @@
+ v-bind:src-placeholder="placeholderSrc(item)" v-if="item.image">
+ + + \ No newline at end of file diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/datalist/dialog.json b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/datalist/dialog.json new file mode 100644 index 000000000..714589ea6 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/datalist/dialog.json @@ -0,0 +1,481 @@ +{ + "fields": [ + { + "type": "input", + "inputType": "text", + "placeholder": "endpointurl", + "label": "URL to load JSON data for table", + "model": "endpointurl" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "loadfunction", + "label": "Javascript function to call to load data", + "model": "loadfunction", + "hint": "Function must accept (endpointurl)" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "deletefunction", + "label": "Javascript function to call to delete rows", + "model": "deletefunction", + "hint": "Function must accept (tableData, activeSelections, endpointurl)" + }, + { + "type": "collection", + "multifield": true, + "fieldLabel": [ + "header", + "value" + ], + "fields": [ + { + "type": "input", + "inputType": "text", + "placeholder": "header", + "label": "Column Header", + "model": "header" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "value", + "label": "Data Value", + "model": "value" + }, + { + "type": "material-select", + "values": [ + { + "name": "left", + "value": "left" + }, + { + "name": "center", + "value": "center" + }, + { + "name": "right", + "value": "right" + } + ], + "placeholder": "textalignment", + "label": "Text alignment", + "model": "textalignment" + } + ], + "placeholder": "columns", + "label": "Table Configuration", + "model": "columns" + }, + { + "type": "material-select", + "values": [ + { + "name": "top", + "value": "top" + }, + { + "name": "center", + "value": "center" + }, + { + "name": "bottom", + "value": "bottom" + } + ], + "placeholder": "rowalignment", + "label": "Row alignment", + "model": "rowalignment" + }, + { + "type": "material-select", + "values": [ + { + "name": "default", + "value": "default" + }, + { + "name": "scroll", + "value": "scroll" + } + ], + "placeholder": "mobiletablestyle", + "label": "Mobile table style", + "model": "mobiletablestyle" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "stripedrows", + "label": "Striped Rows", + "model": "stripedrows" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "densetable", + "label": "Dense Table", + "model": "densetable" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "scrollabletable", + "label": "Scrollable Table", + "model": "scrollabletable" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "stickyheader", + "label": "Sticky Header", + "model": "stickyheader", + "visible": "model.scrollabletable == 'true'" + }, + { + "type": "material-range", + "placeholder": "tableheight", + "label": "Table Height", + "model": "tableheight", + "visible": "model.scrollabletable == 'true'", + "min": 100, + "max": 500 + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "selectable", + "label": "Selectable Table", + "model": "selectable" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "cellborders", + "label": "Add borders around individual cells", + "model": "cellborders" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "caption", + "label": "Table caption", + "model": "caption" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "captiontext", + "label": "Caption text", + "model": "captiontext", + "visible": "model.caption == 'true'" + }, + { + "type": "material-select", + "values": [ + { + "name": "top", + "value": "top" + }, + { + "name": "bottom", + "value": "bottom" + } + ], + "placeholder": "captionplacement", + "label": "Caption placement", + "model": "captionplacement", + "visible": "model.caption == 'true'" + }, + { + "type": "material-select", + "values": [ + { + "name": "left", + "value": "left" + }, + { + "name": "center", + "value": "center" + }, + { + "name": "right", + "value": "right" + } + ], + "placeholder": "captionalignment", + "label": "Caption alignment", + "model": "captionalignment", + "visible": "model.caption == 'true'" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "anchorname", + "label": "Anchor Name", + "model": "anchorname" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "extraclasses", + "label": "Additonal Classes", + "model": "extraclasses" + }, + { + "type": "material-select", + "values": [ + { + "name": "section", + "value": "section" + }, + { + "name": "article", + "value": "article" + }, + { + "name": "main", + "value": "main" + }, + { + "name": "div", + "value": "div" + }, + { + "name": "header", + "value": "header" + }, + { + "name": "nav", + "value": "nav" + }, + { + "name": "footer", + "value": "footer" + } + ], + "placeholder": "htmlelement", + "label": "Semantic Element", + "model": "htmlelement" + }, + { + "type": "material-radios", + "values": [ + { + "name": "None", + "value": "" + }, + { + "name": "Light", + "value": "light" + }, + { + "name": "Dark", + "value": "dark" + } + ], + "placeholder": "colorscheme", + "label": "Block Color Scheme", + "model": "colorscheme" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "custombackground", + "label": "Custom Background", + "model": "custombackground" + }, + { + "type": "material-radios", + "values": [ + { + "name": "Color", + "value": "color" + }, + { + "name": "Gradient", + "value": "gradient" + }, + { + "name": "Image", + "value": "image" + }, + { + "name": "Video", + "value": "video" + } + ], + "placeholder": "backgroundtype", + "label": "Background Type", + "model": "backgroundtype", + "visible": "model.custombackground == 'true'" + }, + { + "type": "pathbrowser", + "browserRoot": "/content/themecleanflex/assets", + "placeholder": "bgvideo", + "label": "Background Video", + "model": "bgvideo", + "visible": "model.backgroundtype == 'video' and model.custombackground == 'true'" + }, + { + "type": "pathbrowser", + "browserRoot": "/content/themecleanflex/assets", + "placeholder": "bgimage", + "label": "Background Image", + "model": "bgimage", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + { + "type": "material-range", + "placeholder": "bgxposition", + "label": "Background X Position", + "model": "bgxposition", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "min": 0, + "max": 100 + }, + { + "type": "material-range", + "placeholder": "bgyposition", + "label": "Background Y Position", + "model": "bgyposition", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "min": 0, + "max": 100 + }, + { + "type": "input", + "inputType": "text", + "placeholder": "bgsize", + "label": "Background Size Style", + "model": "bgsize" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "overlay", + "label": "Overlay", + "model": "overlay", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + { + "type": "input", + "inputType": "color", + "placeholder": "overlaycolor", + "label": "Overlay Color", + "model": "overlaycolor", + "visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + { + "type": "material-range", + "placeholder": "overlayopacity", + "label": "Overlay opacity", + "model": "overlayopacity", + "visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'", + "min": 0, + "max": 100 + }, + { + "type": "input", + "inputType": "color", + "placeholder": "bgcolor", + "label": "Background Color", + "model": "bgcolor", + "visible": "(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'" + }, + { + "type": "input", + "inputType": "color", + "placeholder": "color2", + "label": "Color 2", + "model": "color2", + "visible": "model.backgroundtype == 'gradient' and model.custombackground == 'true'" + }, + { + "type": "material-radios", + "values": [ + { + "name": "Default", + "value": "default" + }, + { + "name": "Full Width", + "value": "full" + }, + { + "name": "Article Width", + "value": "article" + } + ], + "placeholder": "blockwidth", + "label": "Block Width", + "model": "blockwidth" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "fullheight", + "label": "Full Height", + "model": "fullheight" + }, + { + "type": "material-range", + "placeholder": "toppadding", + "label": "Top Padding", + "model": "toppadding", + "visible": "model.fullheight != 'true'", + "min": 0, + "max": 300 + }, + { + "type": "material-range", + "placeholder": "bottompadding", + "label": "Bottom Padding", + "model": "bottompadding", + "visible": "model.fullheight != 'true'", + "min": 0, + "max": 300 + }, + { + "type": "input", + "inputType": "text", + "placeholder": "contentname", + "label": "Content Name", + "model": "contentname" + } + ] +} \ No newline at end of file diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/datalist/template.vue b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/datalist/template.vue new file mode 100644 index 000000000..f6e4497c2 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/datalist/template.vue @@ -0,0 +1,427 @@ + + + diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/.content.xml b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/.content.xml new file mode 100644 index 000000000..5dc3a7d97 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/.content.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/dialog.json b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/dialog.json new file mode 100644 index 000000000..b57d1f269 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/dialog.json @@ -0,0 +1,338 @@ +{ + "fields": [ + { + "type": "material-textarea", + "rows": 10, + "max": "16000", + "placeholder": "schema", + "label": "Form Model", + "model": "schema", + "hint": "JSON description passed to vue-form-generator, see vue form generator fields documentation" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "endpointurl", + "label": "Form submit endpoint URL", + "model": "endpointurl" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "submitfunction", + "label": "Javascript function to call on submit", + "model": "submitfunction", + "hint": "Function must accept (model, formdata)" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "submittext", + "label": "Submit Button Text", + "model": "submittext" + }, + { + "type": "material-select", + "values": [ + { + "name": "normal", + "value": "normal" + }, + { + "name": "small", + "value": "small" + }, + { + "name": "large", + "value": "large" + }, + { + "name": "full width", + "value": "full" + } + ], + "placeholder": "submitsize", + "label": "Submit button size", + "model": "submitsize" + }, + { + "type": "material-select", + "values": [ + { + "name": "start", + "value": "start" + }, + { + "name": "center", + "value": "center" + }, + { + "name": "end", + "value": "end" + } + ], + "placeholder": "submitalignment", + "label": "Submit button alignment", + "model": "submitalignment" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "failmessage", + "label": "Failure Message", + "model": "failmessage" + }, + { + "type": "pathbrowser", + "browserRoot": "/content/themecleanflex/pages", + "placeholder": "successpage", + "label": "Submit Success Page", + "model": "successpage" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "anchorname", + "label": "Anchor Name", + "model": "anchorname" + }, + { + "type": "input", + "inputType": "text", + "placeholder": "extraclasses", + "label": "Additonal Classes", + "model": "extraclasses" + }, + { + "type": "material-select", + "values": [ + { + "name": "section", + "value": "section" + }, + { + "name": "article", + "value": "article" + }, + { + "name": "main", + "value": "main" + }, + { + "name": "div", + "value": "div" + }, + { + "name": "header", + "value": "header" + }, + { + "name": "nav", + "value": "nav" + }, + { + "name": "footer", + "value": "footer" + } + ], + "placeholder": "htmlelement", + "label": "Semantic Element", + "model": "htmlelement" + }, + { + "type": "material-radios", + "values": [ + { + "name": "None", + "value": "" + }, + { + "name": "Light", + "value": "light" + }, + { + "name": "Dark", + "value": "dark" + } + ], + "placeholder": "colorscheme", + "label": "Block Color Scheme", + "model": "colorscheme" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "custombackground", + "label": "Custom Background", + "model": "custombackground" + }, + { + "type": "material-radios", + "values": [ + { + "name": "Color", + "value": "color" + }, + { + "name": "Gradient", + "value": "gradient" + }, + { + "name": "Image", + "value": "image" + }, + { + "name": "Video", + "value": "video" + } + ], + "placeholder": "backgroundtype", + "label": "Background Type", + "model": "backgroundtype", + "visible": "model.custombackground == 'true'" + }, + { + "type": "pathbrowser", + "browserRoot": "/content/themecleanflex/assets", + "placeholder": "bgvideo", + "label": "Background Video", + "model": "bgvideo", + "visible": "model.backgroundtype == 'video' and model.custombackground == 'true'" + }, + { + "type": "pathbrowser", + "browserRoot": "/content/themecleanflex/assets", + "placeholder": "bgimage", + "label": "Background Image", + "model": "bgimage", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + { + "type": "material-range", + "placeholder": "bgxposition", + "label": "Background X Position", + "model": "bgxposition", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "min": 0, + "max": 100 + }, + { + "type": "material-range", + "placeholder": "bgyposition", + "label": "Background Y Position", + "model": "bgyposition", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'", + "min": 0, + "max": 100 + }, + { + "type": "input", + "inputType": "text", + "placeholder": "bgsize", + "label": "Background Size Style", + "model": "bgsize" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "overlay", + "label": "Overlay", + "model": "overlay", + "visible": "model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + { + "type": "input", + "inputType": "color", + "placeholder": "overlaycolor", + "label": "Overlay Color", + "model": "overlaycolor", + "visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'" + }, + { + "type": "material-range", + "placeholder": "overlayopacity", + "label": "Overlay opacity", + "model": "overlayopacity", + "visible": "model.overlay == 'true' and model.backgroundtype == 'image' and model.custombackground == 'true'", + "min": 0, + "max": 100 + }, + { + "type": "input", + "inputType": "color", + "placeholder": "bgcolor", + "label": "Background Color", + "model": "bgcolor", + "visible": "(model.backgroundtype == 'color' or model.backgroundtype == 'gradient') and model.custombackground == 'true'" + }, + { + "type": "input", + "inputType": "color", + "placeholder": "color2", + "label": "Color 2", + "model": "color2", + "visible": "model.backgroundtype == 'gradient' and model.custombackground == 'true'" + }, + { + "type": "material-radios", + "values": [ + { + "name": "Default", + "value": "default" + }, + { + "name": "Full Width", + "value": "full" + }, + { + "name": "Article Width", + "value": "article" + } + ], + "placeholder": "blockwidth", + "label": "Block Width", + "model": "blockwidth" + }, + { + "type": "materialswitch", + "textOn": "yes", + "textOff": "no", + "valueOn": "true", + "valueOff": "false", + "placeholder": "fullheight", + "label": "Full Height", + "model": "fullheight" + }, + { + "type": "material-range", + "placeholder": "toppadding", + "label": "Top Padding", + "model": "toppadding", + "visible": "model.fullheight != 'true'", + "min": 0, + "max": 300 + }, + { + "type": "material-range", + "placeholder": "bottompadding", + "label": "Bottom Padding", + "model": "bottompadding", + "visible": "model.fullheight != 'true'", + "min": 0, + "max": 300 + }, + { + "type": "input", + "inputType": "text", + "placeholder": "contentname", + "label": "Content Name", + "model": "contentname" + } + ] +} \ No newline at end of file diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/template.vue b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/template.vue new file mode 100644 index 000000000..79df0f412 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/form/template.vue @@ -0,0 +1,106 @@ + + + + diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/media/template.vue b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/media/template.vue index df3f8de27..9308ca715 100644 --- a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/media/template.vue +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/media/template.vue @@ -4,7 +4,8 @@
- +
@@ -31,6 +32,10 @@ if (mediatype === 'image' && (imagesrc == null || imagesrc == "")) return true; if (mediatype === 'video' && (videosrc == null || videosrc == "")) return true; return false + }, + placeholderSrc() { + const size = this.model.imagesrcSize + return size ? `data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size.width} ${size.height}"%3E%3C/svg%3E` : null } } } diff --git a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/page/renderer.html b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/page/renderer.html index 769f5acbc..000567364 100644 --- a/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/page/renderer.html +++ b/ui.apps/src/main/content/jcr_root/apps/themecleanflex/components/page/renderer.html @@ -31,6 +31,10 @@ // } // } + if(window.VueFormGenerator) { + var VueFormGenerator = window.VueFormGenerator + Vue.component('vue-form-generator', VueFormGenerator.component) + } Vue.use(window.VLazyImage.VLazyImagePlugin) $peregrineApp.loadComponent('pagerendervue-components-placeholder') $peregrineApp.loadComponent('themecleanflex-components-block') diff --git a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palette.css b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palette.css index 46ec62178..78d49d197 100644 --- a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palette.css +++ b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palette.css @@ -218,3 +218,42 @@ color: var(--btn-primary-color); background-color: var(--btn-primary-bg); } + +#peregrine-app [class$="-components-form"] input[type="submit"]{ + color: var(--btn-color) !important; + background: var(--btn-bg) !important; +} + +#peregrine-app [class$="-components-form"] input[type="submit"]:focus { + color: var(--btn-focus-color) !important; + background: var(--btn-focus-bg) !important; + box-shadow: 0 0 0 3px var(--btn-focus-border-color) !important; + outline: 2px solid transparent !important; /* Windows High Contrast Mode */ +} + +#peregrine-app [class$="-components-form"] input[type="submit"]:hover { + color: var(--btn-hover-color) !important; + background: var(--btn-hover-bg) !important; +} +#peregrine-app table thead th, +#peregrine-app table thead th *, +#peregrine-app table td.mobile-header, +#peregrine-app table td.mobile-header * { + background: var(--bg-primary); + color: var(--text-primary-color); + fill: var(--text-primary-color); +} +#peregrine-app table.striped tbody tr:nth-of-type(2n+1) td:not(.mobile-header){ + background: transparent; +} +#peregrine-app table.striped tbody tr:nth-of-type(2n) td:not(.mobile-header){ + background: var(--bg-secondary); +} +#peregrine-app [class$="-components-datalist"].theme-dark table.striped tbody tr:nth-of-type(2n) td:not(.mobile-header), +#peregrine-app [class$="-components-datalist"].theme-dark table.striped tbody tr:nth-of-type(2n) td:not(.mobile-header) *{ + color: var(--text-secondary-color); + fill: var(--text-secondary-color); +} +#peregrine-app [class$="-components-datalist"] .action-btn:hover { + fill: var(--text-secondary-color); +} \ No newline at end of file diff --git a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/dawn.css b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/dawn.css index f0d816201..f69ce54fc 100644 --- a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/dawn.css +++ b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/dawn.css @@ -148,7 +148,39 @@ #peregrine-app [class$='components-quote'] { --border-primary-color: var(--color-accent-1-700); } + + #peregrine-app .theme-dark[class$="-components-form"] input, + #peregrine-app .theme-dark[class$="-components-form"] textarea, + #peregrine-app .theme-dark[class$="-components-form"] .form-control, + #peregrine-app .theme-dark[class$="-components-form"] .form-control *{ + --text-primary-color: rgba(0,0,0,0.87); + --text-secondary-color: rgba(0,0,0,0.6); + } + +#peregrine-app [class$="components-datalist"] table th, +#peregrine-app [class$="components-datalist"] table th *, +#peregrine-app [class$="components-datalist"] table td.mobile-header, +#peregrine-app [class$="components-datalist"] table td.mobile-header * { + --bg-primary: var(--color-accent-1-700); + --text-primary-color: rgba(255,255,255); +} +#peregrine-app .theme-light[class$="components-datalist"] table.striped tbody td, +#peregrine-app .theme-light[class$="components-datalist"] table.striped tbody td *{ + --bg-secondary: rgba(255,255,255,0.6); +} +#peregrine-app .theme-dark[class$="components-datalist"] table th, +#peregrine-app .theme-dark[class$="components-datalist"] table th *, +#peregrine-app .theme-dark[class$="components-datalist"] table td.mobile-header, +#peregrine-app .theme-dark[class$="components-datalist"] table td.mobile-header * { + --bg-primary: #fff; + --text-primary-color: rgba(0,0,0,0.87); +} +#peregrine-app .theme-dark[class$="components-datalist"] table.striped tbody td, +#peregrine-app .theme-dark[class$="components-datalist"] table.striped tbody td *{ + --bg-secondary: #f8f8f8; + --text-secondary-color: rgba(0,0,0,0.87); +} #peregrine-app .theme-dark[class$="-components-navigation"] a:hover{ color: var(--color-accent-1-700); - } \ No newline at end of file + } diff --git a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/ocean.css b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/ocean.css index 748880faf..06c7023f8 100644 --- a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/ocean.css +++ b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/css/palettes/ocean.css @@ -133,6 +133,38 @@ --border-primary-color: var(--color-accent-1-700); } +#peregrine-app .theme-dark[class$="-components-form"] input, +#peregrine-app .theme-dark[class$="-components-form"] textarea, +#peregrine-app .theme-dark[class$="-components-form"] .form-control, +#peregrine-app .theme-dark[class$="-components-form"] .form-control *{ + --text-primary-color: rgba(0,0,0,0.87); + --text-secondary-color: rgba(0,0,0,0.6); +} + +#peregrine-app [class$="components-datalist"] table th, +#peregrine-app [class$="components-datalist"] table th *, +#peregrine-app [class$="components-datalist"] table td.mobile-header, +#peregrine-app [class$="components-datalist"] table td.mobile-header * { + --bg-primary: var(--color-accent-1-700); + --text-primary-color: rgba(255,255,255); +} +#peregrine-app .theme-light[class$="components-datalist"] table.striped tbody td, +#peregrine-app .theme-light[class$="components-datalist"] table.striped tbody td *{ + --bg-secondary: rgba(255,255,255,0.6); +} +#peregrine-app .theme-dark[class$="components-datalist"] table th, +#peregrine-app .theme-dark[class$="components-datalist"] table th *, +#peregrine-app .theme-dark[class$="components-datalist"] table td.mobile-header, +#peregrine-app .theme-dark[class$="components-datalist"] table td.mobile-header * { + --bg-primary: #fff; + --text-primary-color: rgba(0,0,0,0.87); +} +#peregrine-app .theme-dark[class$="components-datalist"] table.striped tbody td, +#peregrine-app .theme-dark[class$="components-datalist"] table.striped tbody td *{ + --bg-secondary: #e8f2ff; + --text-secondary-color: rgba(0,0,0,0.87); +} + #peregrine-app .theme-dark[class$="-components-navigation"] a:hover{ color: var(--color-accent-1-700); } \ No newline at end of file diff --git a/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/js/formsapp.js b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/js/formsapp.js new file mode 100644 index 000000000..e16f89f76 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/content/themecleanflex/pages/js/formsapp.js @@ -0,0 +1,38 @@ +$formsapp = { + save(model, data) { + var records = localStorage.getItem(model.endpointurl); + if(!records) { + records = []; + } else { + records = JSON.parse(records); + } + records.push(data); + localStorage.setItem(model.endpointurl, JSON.stringify(records, true, 2)); + window.dispatchEvent(new CustomEvent('datalist-storage-update',{})); + window.dispatchEvent(new CustomEvent('form-clear',{})); + return true + }, + + load(path) { + var records = localStorage.getItem(path); + if(!records) { + return []; + } else { + return JSON.parse(records); + } + }, + + delete(data, active, path) { + // data loaded from local storage, find rows and delete them, then reset local storage + console.log('deleting rows'); + let newData = data; + for( let i = active.length-1; i >= 0; i--) { + // iterate from end and delete active rows as we find them + if( active[i] ) { + newData.splice(i,1); + } + } + localStorage.setItem(path,JSON.stringify(newData)); + return newData; + } +} diff --git a/ui.apps/src/main/content/jcr_root/content/themecleanflex/templates/.content.xml b/ui.apps/src/main/content/jcr_root/content/themecleanflex/templates/.content.xml index 5b6798665..11c6bf4ee 100644 --- a/ui.apps/src/main/content/jcr_root/content/themecleanflex/templates/.content.xml +++ b/ui.apps/src/main/content/jcr_root/content/themecleanflex/templates/.content.xml @@ -8,7 +8,8 @@ jcr:primaryType="per:PageContent" sling:resourceType="themecleanflex/components/page" jcr:title="themecleanflex root template" - siteCSS="[/content/themecleanflex/pages/css/commons.css,/content/themecleanflex/pages/css/palettes/default.css,/content/themecleanflex/pages/css/palette.css,/etc/felibs/themecleanflex.css,/content/themecleanflex/pages/css/custom.css,https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap]" + siteJS="[/etc/felibs/admin/dependencies/vfg.js,/content/themecleanflex/pages/js/formsapp.js]" + siteCSS="[/etc/felibs/admin/dependencies/vfg.css,/content/themecleanflex/pages/css/commons.css,/content/themecleanflex/pages/css/palettes/default.css,/content/themecleanflex/pages/css/palette.css,/etc/felibs/themecleanflex.css,/content/themecleanflex/pages/css/custom.css,https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap]" prefetchDNS="[https://www.youtube.com,https://s.ytimg.com,https://www.google.com,https://fonts.gstatic.com,https://www.youtube-nocookie.com]"/>