style option added

This commit is contained in:
David Botton 2022-06-27 15:22:25 -04:00
parent 9c0151e6b5
commit b87e63d8e0
4 changed files with 492 additions and 417 deletions

View file

@ -349,19 +349,16 @@ result or if time out DEFAULT-ANSWER. see JQUERY-QUERY (Internal)"))
(let ((hook (format nil "~A:~A" (html-id obj) event))) (let ((hook (format nil "~A:~A" (html-id obj) event)))
(cond (handler (cond (handler
(bind-event-script (bind-event-script
obj event (format nil "~Aws.send('E:~A '~A)~A~A~A" obj event (format nil "~Aws.send('E:~A '~A)~A~@[~A~]~@[~A~]"
eval-script eval-script
hook hook
call-back-script call-back-script
post-eval post-eval
(if one-time (when one-time
(format nil "; ~A.off('~A')" (format nil "; ~A.off('~A')"
(jquery obj) (jquery obj)
event) event))
"") (when cancel-event "; return false")))
(if cancel-event
"; return false"
"")))
(setf (gethash hook (connection-data obj)) handler)) (setf (gethash hook (connection-data obj)) handler))
(t (t
(unbind-event-script obj event) (unbind-event-script obj event)

File diff suppressed because it is too large Load diff

View file

@ -132,7 +132,7 @@ after attachment is changed to one unique to this session."))
(defsetf style set-style) (defsetf style set-style)
(defgeneric set-styles (clog-element style-list) (defgeneric set-styles (clog-element style-list)
(:documentation "Set css styles using a list of list of name value pairs.")) (:documentation "Set css styles using a list of lists of name value pairs."))
(defmethod set-styles ((obj clog-element) style-list) (defmethod set-styles ((obj clog-element) style-list)
(jquery-execute obj (format nil "css({~{~A~^,~}})" (jquery-execute obj (format nil "css({~{~A~^,~}})"
@ -1470,25 +1470,19 @@ parent in the DOM."))
(defmethod set-geometry ((obj clog-element) &key left top right bottom (defmethod set-geometry ((obj clog-element) &key left top right bottom
width height (units :px)) width height (units :px))
(jquery-execute obj (format nil "css({~A~A~A~A~A~A})" (jquery-execute obj (format nil "css({~@[~a~]~@[~a~]~@[~a~]~@[~a~]~@[~a~]~@[~a~]})"
(if left (when left
(format nil "'left':'~A~A'," left units) (format nil "'left':'~A~A'," left units))
"") (when top
(if top (format nil "'top':'~A~A'," top units))
(format nil "'top':'~A~A'," top units) (when right
"") (format nil "'right':'~A~A'," right units))
(if right (when bottom
(format nil "'right':'~A~A'," right units) (format nil "'bottom':'~A~A'," bottom units))
"") (when width
(if bottom (format nil "'width':'~A~A'," width units))
(format nil "'bottom':'~A~A'," bottom units) (when height
"") (format nil "'height':'~A~A'," height units)))))
(if width
(format nil "'width':'~A~A'," width units)
"")
(if height
(format nil "'height':'~A~A'," height units)
""))))
;;;;;;;;;; ;;;;;;;;;;
;; left ;; ;; left ;;

View file

@ -62,7 +62,7 @@ never be GC'd. File upload items will be a four part list
(defgeneric create-form (clog-obj (defgeneric create-form (clog-obj
&key action method target encoding &key action method target encoding
class html-id auto-place) style hidden class html-id auto-place)
(:documentation "Create a new CLOG-Form as child of CLOG-OBJ that organizes (:documentation "Create a new CLOG-Form as child of CLOG-OBJ that organizes
a collection of form elements in to a single form if :AUTO-PLACE (default t) a collection of form elements in to a single form if :AUTO-PLACE (default t)
place-inside-bottom-of CLOG-OBJ. In CLOG a form's on-submit handler should be place-inside-bottom-of CLOG-OBJ. In CLOG a form's on-submit handler should be
@ -78,22 +78,29 @@ doing file upload use multipart/form-data"))
(method :none) (method :none)
(target "_self") (target "_self")
(encoding "application/x-www-form-urlencoded") (encoding "application/x-www-form-urlencoded")
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil) (html-id nil)
(auto-place t)) (auto-place t))
(create-child obj (create-child obj
(format nil "<form action='~A' ~A enctype='~A' target='~A'~A/>" (format nil "<form action='~A' ~A enctype='~A' target='~A'~@[~A~]~@[~A~]/>"
action action
(if (eq method :none) (if (eq method :none)
"onSubmit='return false;'" "onSubmit='return false;'"
(format nil "method='~A'" method)) (format nil "method='~A'" method))
encoding encoding
target target
(if class (when class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"")) (when (or hidden style)
:clog-type 'clog-form :html-id html-id :auto-place auto-place)) (format nil " style='~@[~a~]~@[~a~]'"
(when hidden "visibility:hidden;")
style)))
:clog-type 'clog-form
:html-id html-id
:auto-place auto-place))
;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;
;; form-element-count ;; ;; form-element-count ;;
@ -202,7 +209,7 @@ elements."))
(defgeneric create-form-element (clog-obj element-type (defgeneric create-form-element (clog-obj element-type
&key name value label class &key name value label class
hidden html-id) style hidden html-id)
(:documentation "Create a new clog-form-element as child of CLOG-OBJ. (:documentation "Create a new clog-form-element as child of CLOG-OBJ.
It is importamt that clog-form-elements are a child or descendant of a It is importamt that clog-form-elements are a child or descendant of a
clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME.")) clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME."))
@ -212,24 +219,21 @@ clog-form in the DOM. The radio ELEMENT-TYPE groups by NAME."))
(value nil) (value nil)
(label nil) (label nil)
(class nil) (class nil)
(style nil)
(hidden nil) (hidden nil)
(html-id nil)) (html-id nil))
(let ((element (create-child (let ((element (create-child
obj (format nil "<input type='~A'~A~A~A~A/>" obj (format nil "<input type='~A'~@[~A~]~@[~A~]~@[~A~]~@[~A~]/>"
(escape-string element-type) (escape-string element-type)
(if class (when class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
(if hidden (format nil " style='~@[~a~]~@[~a~]'"
" style='visibility:hidden;'" (when hidden "visibility:hidden;")
"") style))
(if value (when value (format nil " value='~A'" value))
(format nil " value='~A'" value) (when name (format nil " name='~A'" name)))
"")
(if name
(format nil " name='~A'" name)
""))
:clog-type 'clog-form-element :clog-type 'clog-form-element
:html-id html-id :html-id html-id
:auto-place t))) :auto-place t)))
@ -746,21 +750,25 @@ virtual keyboards."))
;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;
(defgeneric create-label (clog-obj &key content label-for class html-id) (defgeneric create-label (clog-obj &key content
style hidden label-for class html-id)
(:documentation "Create a new clog-label as child of CLOG-OBJ.")) (:documentation "Create a new clog-label as child of CLOG-OBJ."))
(defmethod create-label ((obj clog-obj) &key (content "") (defmethod create-label ((obj clog-obj) &key (content "")
(label-for nil) (label-for nil)
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(create-child obj (format nil "<label for='~A'~A>~A</label>" (create-child obj (format nil "<label for='~@[~A~]'~@[~A~]~@[~A~]>~A</label>"
(if label-for (when label-for (html-id label-for))
(html-id label-for) (when class
"")
(if class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
(format nil " style='~@[~a~]~@[~a~]'"
(when hidden "visibility:hidden;")
style))
(escape-string content)) (escape-string content))
:clog-type 'clog-label :html-id html-id :auto-place t)) :clog-type 'clog-label :html-id html-id :auto-place t))
@ -785,20 +793,24 @@ virtual keyboards."))
;; create-fieldset ;; ;; create-fieldset ;;
;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
(defgeneric create-fieldset (clog-obj &key legend class html-id) (defgeneric create-fieldset (clog-obj &key legend hidden style class html-id)
(:documentation "Create a new clog-fieldset as child of CLOG-OBJ.")) (:documentation "Create a new clog-fieldset as child of CLOG-OBJ."))
(defmethod create-fieldset ((obj clog-obj) &key (legend nil) (defmethod create-fieldset ((obj clog-obj) &key (legend nil)
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(create-child obj (format nil "<fieldset~A>~A</fieldset>" (create-child obj (format nil "<fieldset~@[~A~]~@[~A~]>~@[~A~]</fieldset>"
(if class (when class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
(if legend (format nil " style='~@[~a~]~@[~a~]'"
(format nil "<legend>~A</legend>" legend) (when hidden "visibility:hidden;")
"")) style))
(when legend
(format nil "<legend>~A</legend>" legend)))
:clog-type 'clog-fieldset :html-id html-id :auto-place t)) :clog-type 'clog-fieldset :html-id html-id :auto-place t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -813,7 +825,8 @@ virtual keyboards."))
;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;
(defgeneric create-text-area (clog-obj (defgeneric create-text-area (clog-obj
&key columns rows name value label class html-id) &key columns rows name value label
style hidden class html-id)
(:documentation "Create a new clog-text-area as child of CLOG-OBJ.")) (:documentation "Create a new clog-text-area as child of CLOG-OBJ."))
(defmethod create-text-area ((obj clog-obj) (defmethod create-text-area ((obj clog-obj)
@ -822,16 +835,21 @@ virtual keyboards."))
(name "") (name "")
(value "") (value "")
(label nil) (label nil)
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(let ((element (let ((element
(create-child obj (create-child obj
(format nil "<textarea name='~A' cols='~A' rows='~A'~A>~A</textarea>" (format nil "<textarea name='~A' cols='~A' rows='~A'~@[~A~]~@[~A~]>~A</textarea>"
name columns rows name columns rows
(if class (when class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
(format nil " style='~@[~a~]~@[~a~]'"
(when hidden "visibility:hidden;")
style))
(escape-string value)) (escape-string value))
:clog-type 'clog-text-area :html-id html-id :auto-place t))) :clog-type 'clog-text-area :html-id html-id :auto-place t)))
@ -928,18 +946,24 @@ virtual keyboards."))
;; create-legend ;; ;; create-legend ;;
;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;
(defgeneric create-legend (clog-obj &key content class html-id) (defgeneric create-legend (clog-obj &key content
style hidden class html-id)
(:documentation "Create a new clog-legend as child of CLOG-OBJ.")) (:documentation "Create a new clog-legend as child of CLOG-OBJ."))
(defmethod create-legend ((obj clog-obj) &key (content "") (defmethod create-legend ((obj clog-obj) &key (content "")
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(create-child obj (format nil "<legend~A>~A</legend>" (create-child obj (format nil "<legend~@[~A~]~@[~A~]>~A</legend>"
(if class (when class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
content) (format nil " style='~@[~a~]~@[~a~]'"
(when hidden "visibility:hidden;")
style))
(escape-string content))
:clog-type 'clog-legend :html-id html-id :auto-place t)) :clog-type 'clog-legend :html-id html-id :auto-place t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -999,27 +1023,29 @@ optionally fill in with contents of data-list."))
;; create-select ;; ;; create-select ;;
;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;
(defgeneric create-select (clog-obj &key name multiple label class html-id) (defgeneric create-select (clog-obj &key name multiple label
style hidden class html-id)
(:documentation "Create a new clog-select as child of CLOG-OBJ.")) (:documentation "Create a new clog-select as child of CLOG-OBJ."))
(defmethod create-select ((obj clog-obj) (defmethod create-select ((obj clog-obj)
&key (name nil) &key (name nil)
(multiple nil) (multiple nil)
(label nil) (label nil)
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(let ((element (create-child (let ((element (create-child
obj (format nil "<select~A~A~A/>" obj (format nil "<select~@[~A~]~@[~A~]~@[~A~]~@[~A~]/>"
(if multiple (when multiple " multiple")
" multiple" (when name (format nil " name='~A'" name))
"") (when class
(if name
(format nil " name='~A'" name)
"")
(if class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"")) (when (or hidden style)
(format nil " style='~@[~a~]~@[~a~]'"
(when hidden "visibility:hidden;")
style)))
:clog-type 'clog-select :html-id html-id :auto-place t))) :clog-type 'clog-select :html-id html-id :auto-place t)))
(when label (when label
(label-for label element)) (label-for label element))
@ -1033,13 +1059,9 @@ optionally fill in with contents of data-list."))
(:documentation "Add option VALUE to select.")) (:documentation "Add option VALUE to select."))
(defmethod add-select-option ((obj clog-select) value content &key selected disabled) (defmethod add-select-option ((obj clog-select) value content &key selected disabled)
(create-child obj (format nil "<option~A~A value='~A'>~A</option>" (create-child obj (format nil "<option~@[~A~]~@[~A~] value='~A'>~A</option>"
(if selected (when selected " selected")
" selected" (when disabled " disabled")
"")
(if disabled
" disabled"
"")
(escape-string value) (escape-string value)
(escape-string content)) (escape-string content))
:clog-type 'clog-element :auto-place t)) :clog-type 'clog-element :auto-place t))
@ -1091,7 +1113,8 @@ or CLOG Data-List objects."));
;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;
(defgeneric create-option (clog-obj (defgeneric create-option (clog-obj
&key content value selected disabled class html-id) &key content value selected disabled
style hidden class html-id)
(:documentation "Create a new clog-option as child of CLOG-OBJ.")) (:documentation "Create a new clog-option as child of CLOG-OBJ."))
(defmethod create-option ((obj clog-obj) &key (defmethod create-option ((obj clog-obj) &key
@ -1099,22 +1122,22 @@ or CLOG Data-List objects."));
(value nil) (value nil)
(selected nil) (selected nil)
(disabled nil) (disabled nil)
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(create-child obj (format nil "<option~A~A~A~A>~A</option>" (create-child obj (format nil "<option~@[~A~]~@[~A~]~@[~A~]~@[~A~]~@[~A~]>~A</option>"
(if selected (when selected " selected")
" selected" (when disabled " disabled")
"") (when value (format nil " value='~A'"
(if disabled (escape-string value)))
" disabled" (when class
"")
(if value
(format nil " value='~A'" value)
"")
(if class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
(format nil " style='~@[~a~]~@[~a~]'"
(when hidden "visibility:hidden;")
style))
content) content)
:clog-type 'clog-option :html-id html-id :auto-place t)) :clog-type 'clog-option :html-id html-id :auto-place t))
@ -1146,20 +1169,24 @@ or CLOG Data-List objects."));
;; create-optgroup ;; ;; create-optgroup ;;
;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
(defgeneric create-optgroup (clog-obj &key content disabled html-id) (defgeneric create-optgroup (clog-obj &key content disabled
style hidden class html-id)
(:documentation "Create a new clog-optgroup as child of CLOG-OBJ.")) (:documentation "Create a new clog-optgroup as child of CLOG-OBJ."))
(defmethod create-optgroup ((obj clog-obj) &key (content "") (defmethod create-optgroup ((obj clog-obj) &key (content "")
(disabled nil) (disabled nil)
(style nil)
(hidden nil)
(class nil) (class nil)
(html-id nil)) (html-id nil))
(create-child obj (format nil "<optgroup label='~A'~A~A/>" (create-child obj (format nil "<optgroup label='~A'~@[~A~]~@[~A~]~@[~A~]/>"
content content
(if class (when class
(format nil " class='~A'" (format nil " class='~A'"
(escape-string class)) (escape-string class)))
"") (when (or hidden style)
(if disabled (format nil " style='~@[~a~]~@[~a~]'"
" disabled" (when hidden "visibility:hidden;")
"")) style))
(when disabled " disabled"))
:clog-type 'clog-optgroup :html-id html-id :auto-place t)) :clog-type 'clog-optgroup :html-id html-id :auto-place t))