Issue #23853: More widget refactoring.
[xtuple] / lib / enyo-x / source / widgets / picker.js
index 05944d2..0473cd3 100644 (file)
@@ -19,9 +19,9 @@ regexp:true, undef:true, trailing:true, white:true, strict:false */
    */
   enyo.kind(
     /** @lends XV.PickerWidget# */{
-    name: "XV.Picker",
+    name: "XV.PickerWidget",
     kind: "enyo.Control",
-    classes: "xv-input",
+    classes: "xv-pickerwidget",
     events: /** @lends XV.PickerWidget# */{
       /**
         @property {Object} inEvent The payload that's attached to bubbled-up events
@@ -41,16 +41,22 @@ regexp:true, undef:true, trailing:true, white:true, strict:false */
       noneClasses: "",
       showNone: true,
       prerender: true,
-      defaultValue: null
+      defaultValue: null,
+      showLabel: true,
+      label: ""
     },
     handlers: {
       onSelect: "itemSelected"
     },
     components: [
-      {kind: "onyx.PickerDecorator",
-        components: [
-        {kind: "XV.PickerButton", name: "pickerButton", content: "_none".loc(), onkeyup: "keyUp"},
-        {name: "picker", kind: "onyx.Picker"}
+      {controlClasses: 'enyo-inline', components: [
+        {name: "label", classes: "xv-label"},
+        {kind: "onyx.InputDecorator", name: "inputWrapper", components: [
+          {kind: "onyx.PickerDecorator", components: [
+            {kind: "XV.PickerButton", name: "pickerButton", content: "_none".loc(), onkeyup: "keyUp"},
+            {name: "picker", kind: "onyx.Picker"}
+          ]}
+        ]}
       ]}
     ],
     /**
@@ -155,6 +161,9 @@ regexp:true, undef:true, trailing:true, white:true, strict:false */
       if (defaultValue) {
         this.setValue(defaultValue, {silent: true});
       }
+
+      this.labelChanged();
+      this.showLabelChanged();
     },
     destroy: function () {
       if (this._collection && this._collection.off) {
@@ -401,44 +410,6 @@ regexp:true, undef:true, trailing:true, white:true, strict:false */
           }
         }
       }
-    }
-  });
-
-  /**
-    @name XV.PickerWidget
-    @class A picker control that implements a dropdown list of items which can be selected.<br />
-    Unlike the {@link XV.RelationWidget}, the collection is stored local to the widget.<br />
-    The superkind of {@link XV.CharacteristicPicker}.<br />
-    Derived from <a href="http://enyojs.com/api/#enyo.Control">enyo.Control</a>.
-    @extends enyo.Control
-   */
-  enyo.kind(/** @lends XV.PickerWidget# */{
-    name: "XV.PickerWidget",
-    kind: "XV.Picker",
-    published: {
-      label: "",
-      showLabel: true
-    },
-    components: [
-      {kind: "FittableColumns", components: [
-        {name: "label", content: "", classes: "xv-label"},
-        {kind: "onyx.InputDecorator", name: "inputWrapper", classes: "xv-input-decorator",
-          components: [
-          {kind: "onyx.PickerDecorator",
-            components: [
-            {kind: "XV.PickerButton", name: "pickerButton", content: "_none".loc(), onkeyup: "keyUp"},
-            {name: "picker", kind: "onyx.Picker"}
-          ]}
-        ]}
-      ]}
-    ],
-    /**
-     @todo Document the create method.
-     */
-    create: function () {
-      this.inherited(arguments);
-      this.labelChanged();
-      this.showLabelChanged();
     },
     /**
      @todo Document the labelChanged method.