;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.presentation) ;;;;;; ;;; primitive/filter (def (component e) primitive/filter (primitive/presentation t/filter) () (:documentation "A PRIMITIVE/FILTER filters the set of existing values of a primitive TYPE based on a filter criteria provided by the user.")) (def render-xhtml :before primitive/filter (ensure-client-state-sink -self-)) (def function make-update-use-in-filter-js (component) `js-inline(hdp.field.update-use-in-filter ,(use-in-filter-id-of component) #t)) ;;;;;; ;;; boolean/filter (def (component e) boolean/filter (boolean/presentation primitive/filter) ()) (def subtype-mapper *filter-type-mapping* boolean boolean/filter) (def render-xhtml boolean/filter (bind ((use-in-filter? (use-in-filter? -self-)) (use-in-filter-id (use-in-filter-id-of -self-)) (has-component-value? (slot-boundp -self- 'component-value)) (component-value (when has-component-value? (component-value-of -self-)))) (if (eq (component-value-type-of -self-) 'boolean) (render-checkbox-field component-value :name (client-state-sink-of -self-) :on-change `js-piece(hdp.field.update-use-in-filter ,use-in-filter-id #t))