Permalink
Browse files

inputEx 3.1.0

  • Loading branch information...
1 parent 245575d commit 1b7bd4fea4b412215e3571cd9c6dbf016c41fa1b @neyric committed Aug 20, 2012
Showing with 3,133 additions and 3,566 deletions.
  1. +11 −1 lib/inputex/src/inputex-autocomplete/inputex-autocomplete.js
  2. +37 −10 lib/inputex/src/inputex-base/inputex-base.js
  3. +7 −1 lib/inputex/src/inputex-button/inputex-button.js
  4. +9 −4 lib/inputex/src/inputex-checkbox/inputex-checkbox.js
  5. +8 −1 lib/inputex/src/inputex-choice/inputex-choice.js
  6. +1 −1 lib/inputex/src/inputex-color/assets/skins/sam/inputex-color.css
  7. +24 −4 lib/inputex/src/inputex-color/inputex-color.js
  8. +0 −46 lib/inputex/src/inputex-colorpicker/assets/skins/sam/inputex-colorpicker.css
  9. +0 −187 lib/inputex/src/inputex-colorpicker/inputex-colorpicker.js
  10. +17 −4 lib/inputex/src/inputex-combine/inputex-combine.js
  11. BIN lib/inputex/src/inputex-datatable/assets/skins/sam/cross.png
  12. BIN lib/inputex/src/inputex-datatable/assets/skins/sam/edit.png
  13. +17 −0 lib/inputex/src/inputex-datatable/assets/skins/sam/inputex-datatable.css
  14. BIN lib/inputex/src/inputex-datatable/assets/skins/sam/palette.png
  15. +371 −425 lib/inputex/src/inputex-datatable/inputex-datatable.js
  16. +9 −1 lib/inputex/src/inputex-date/inputex-date.js
  17. +23 −7 lib/inputex/src/inputex-datepicker/inputex-datepicker.js
  18. +13 −1 lib/inputex/src/inputex-dateselectmonth/inputex-dateselectmonth.js
  19. +17 −1 lib/inputex/src/inputex-datesplit/inputex-datesplit.js
  20. +3 −1 lib/inputex/src/inputex-datetime/inputex-datetime.js
  21. +36 −9 lib/inputex/src/inputex-ddlist/inputex-ddlist.js
  22. +7 −2 lib/inputex/src/inputex-dsselect/inputex-dsselect.js
  23. +0 −438 lib/inputex/src/inputex-dtinplaceedit/inputex-dtinplaceedit.js
  24. +12 −1 lib/inputex/src/inputex-email/inputex-email.js
  25. +56 −29 lib/inputex/src/inputex-field/inputex-field.js
  26. +3 −1 lib/inputex/src/inputex-file/inputex-file.js
  27. +18 −5 lib/inputex/src/inputex-form/inputex-form.js
  28. +96 −69 lib/inputex/src/inputex-group/inputex-group.js
  29. +3 −0 lib/inputex/src/inputex-hidden/inputex-hidden.js
  30. +236 −0 lib/inputex/src/inputex-imagecropper/inputex-imagecropper.js
  31. +30 −7 lib/inputex/src/inputex-inplaceedit/inputex-inplaceedit.js
  32. +4 −1 lib/inputex/src/inputex-integer/inputex-integer.js
  33. +2 −1 lib/inputex/src/inputex-ipv4/inputex-ipv4.js
  34. +9 −15 lib/inputex/src/inputex-jsonschema/inputex-jsonschema.js
  35. +18 −10 lib/inputex/src/inputex-jsontreeinspector/inputex-jsontreeinspector.js
  36. +3 −2 lib/inputex/src/inputex-keyopvalue/inputex-keyopvalue.js
  37. +7 −3 lib/inputex/src/inputex-keyvalue/inputex-keyvalue.js
  38. +3 −1 lib/inputex/src/inputex-lens/inputex-lens.js
  39. +259 −0 lib/inputex/src/inputex-linkedcombo/inputex-linkedcombo.js
  40. +19 −2 lib/inputex/src/inputex-list/inputex-list.js
  41. +0 −188 lib/inputex/src/inputex-listcustom/inputex-listcustom.js
  42. +183 −473 lib/inputex/src/inputex-map/inputex-map.js
  43. +24 −7 lib/inputex/src/inputex-menu/inputex-menu.js
  44. +65 −49 lib/inputex/src/inputex-multiautocomplete/inputex-multiautocomplete.js
  45. +0 −127 lib/inputex/src/inputex-multiautocompletecustom/inputex-multiautocompletecustom.js
  46. +162 −135 lib/inputex/src/inputex-multiselect/inputex-multiselect.js
  47. +0 −126 lib/inputex/src/inputex-multiselectcustom/inputex-multiselectcustom.js
  48. +4 −1 lib/inputex/src/inputex-number/inputex-number.js
  49. +17 −15 lib/inputex/src/inputex-object/inputex-object.js
  50. +37 −15 lib/inputex/src/inputex-panel/inputex-panel.js
  51. +19 −5 lib/inputex/src/inputex-password/inputex-password.js
  52. +31 −1 lib/inputex/src/inputex-radio/inputex-radio.js
  53. +2 −2 lib/inputex/src/inputex-ratingstars/inputex-ratingstars.js
  54. +1 −1 lib/inputex/src/inputex-ratingstarsform/inputex-ratingstarsform.js
  55. +216 −202 lib/inputex/src/inputex-rpc/inputex-rpc.js
  56. +112 −108 lib/inputex/src/inputex-rte/inputex-rte.js
  57. +26 −2 lib/inputex/src/inputex-select/inputex-select.js
  58. +0 −242 lib/inputex/src/inputex-selecttwice/inputex-selecttwice.js
  59. +17 −3 lib/inputex/src/inputex-serialize/inputex-serialize.js
  60. +9 −5 lib/inputex/src/inputex-slider/inputex-slider.js
  61. +5 −2 lib/inputex/src/inputex-smdtester/inputex-smdtester.js
  62. +26 −5 lib/inputex/src/inputex-string/inputex-string.js
  63. +2 −1 lib/inputex/src/inputex-stringavailability/assets/skins/sam/inputex-stringavailability.css
  64. +249 −185 lib/inputex/src/inputex-stringavailability/inputex-stringavailability.js
  65. +7 −2 lib/inputex/src/inputex-textarea/inputex-textarea.js
  66. +14 −6 lib/inputex/src/inputex-textautotag/inputex-textautotag.js
  67. +3 −1 lib/inputex/src/inputex-time/inputex-time.js
  68. +4 −1 lib/inputex/src/inputex-timeinterval/inputex-timeinterval.js
  69. +8 −2 lib/inputex/src/inputex-timerange/inputex-timerange.js
  70. +153 −125 lib/inputex/src/inputex-tinymce/inputex-tinymce.js
  71. +127 −106 lib/inputex/src/inputex-tree/inputex-tree.js
  72. +9 −1 lib/inputex/src/inputex-type/inputex-type.js
  73. +4 −1 lib/inputex/src/inputex-uneditable/inputex-uneditable.js
  74. +7 −5 lib/inputex/src/inputex-uppercase/inputex-uppercase.js
  75. +31 −7 lib/inputex/src/inputex-url/inputex-url.js
  76. +2 −1 lib/inputex/src/inputex-vector/inputex-vector.js
  77. +6 −3 lib/inputex/src/inputex-visus/inputex-visus.js
  78. +24 −0 lib/inputex/src/inputex/assets/skins/sam/inputex.css
  79. +81 −66 lib/inputex/src/inputex/inputex.js
  80. +1 −1 lib/inputex/src/inputex/lang/inputex_ca.js
  81. +1 −1 lib/inputex/src/inputex/lang/inputex_de.js
  82. +1 −1 lib/inputex/src/inputex/lang/inputex_en.js
  83. +1 −1 lib/inputex/src/inputex/lang/inputex_es.js
  84. +1 −1 lib/inputex/src/inputex/lang/inputex_fr.js
  85. +1 −1 lib/inputex/src/inputex/lang/inputex_it.js
  86. +1 −1 lib/inputex/src/inputex/lang/inputex_nl.js
  87. +27 −38 lib/inputex/src/loader.js
  88. +24 −3 lib/inputex/version.txt
View
12 lib/inputex/src/inputex-autocomplete/inputex-autocomplete.js
@@ -26,6 +26,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
/**
* Adds autocomplete options
+ * @method setOptions
* @param {Object} options Options object as passed to the constructor
*/
setOptions: function(options) {
@@ -45,6 +46,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
* <li>listen to autocompleter textboxBlurEvent instead of this.el "blur" event</li>
* <li>listener to autocompleter textboxBlurEvent added in buildAutocomplete method</li>
* </ul>
+ * @method initEvents
*/
initEvents: function() {
inputEx.AutoComplete.superclass.initEvents.call(this);
@@ -55,6 +57,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
/**
* Render the hidden list element
+ * @method renderComponent
*/
renderComponent: function() {
@@ -98,6 +101,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
/**
* Build the YUI autocompleter
+ * @method buildAutocomplete
*/
buildAutocomplete: function() {
// Call this function only when this.el AND this.listEl are available
@@ -115,6 +119,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
/**
* itemSelect handler
+ * @method itemSelectHandler
* @param {} sType
* @param {} aArgs
*/
@@ -123,6 +128,9 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
this.setValue( this.options.returnValue ? this.options.returnValue(aData) : aData.label );
},
+ /**
+ * @method onBlur
+ */
onBlur: function(e){
if(this.el.value == '' && this.options.typeInvite) {
Y.one(this.divEl).addClass("inputEx-typeInvite")
@@ -133,6 +141,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
/**
* Set the value
+ * @method setValue
* @param {Any} value Value to set
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updated event or not (default is true, pass false to NOT send the event)
*/
@@ -153,6 +162,7 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
/**
* Return the hidden value (stored in a hidden input)
+ * @method getValue
*/
getValue: function() {
return this.hiddenEl.value;
@@ -164,6 +174,6 @@ Y.extend(inputEx.AutoComplete, inputEx.StringField, {
// Register this class as "autocomplete" type
inputEx.registerType("autocomplete", inputEx.AutoComplete);
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ['inputex-string','autocomplete']
})
View
47 lib/inputex/src/inputex-base/inputex-base.js
@@ -10,47 +10,74 @@
* The inputExBase class provides the hideOn attribute which can
* be used to hide the widget when certain events occur.
*
- * @class inputExBase
+ * @class inputEx.Base
* @param {Object} config User configuration object
*/
function inputExBase(config) {
Y.after(this._renderUIInputEx, this, 'renderUI');
+ Y.after(this._bindUIInputEx, this, 'bindUI');
+
if (this.get("rendered")) {
this._renderUIInputEx();
}
}
-/**
-* Static property used to define the default attribute
-* configuration introduced by inputExBase.
-*
-* @property inputExBase.ATTRS
-* @static
-* @type Object
-*/
inputExBase.ATTRS = {
+
+ /**
+ * inputEx json configuration
+ *
+ * @attribute inputEx
+ * @type Object
+ */
inputEx: {
},
+
+
+ /**
+ * Instantiated inputEx field (any type)
+ *
+ * @attribute field
+ * @type inputEx.Field
+ */
field: {
}
};
inputExBase.prototype = {
+ /**
+ * @method _renderUIInputEx
+ * @private
+ */
_renderUIInputEx: function() {
var config = {};
Y.mix(config, this.get('inputEx') );
config.parentEl = this.get('contentBox');
this.set('field', Y.inputEx(config));
+ },
+
+ /**
+ * @method _bindUIInputEx
+ * @private
+ */
+ _bindUIInputEx: function() {
+ // Closing all fields when the widget is hidden
+ this.on('visibleChange', function(e) {
+ if(e.newVal === false) {
+ this.get('field').close();
+ }
+ }, this);
}
+
};
Y.inputEx.Base = inputExBase;
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ['inputex', 'base']
});
View
8 lib/inputex/src/inputex-button/inputex-button.js
@@ -36,6 +36,7 @@ Y.mix(inputEx.widget.Button.prototype,{
/**
* set the default options
+ * @method setOptions
*/
setOptions: function(options) {
@@ -63,6 +64,7 @@ Y.mix(inputEx.widget.Button.prototype,{
/**
* render the button into the parent Element
+ * @method render
* @param {DOMElement} parentEl The DOM element where the button should be rendered
* @return {DOMElement} The created button
*/
@@ -99,6 +101,7 @@ Y.mix(inputEx.widget.Button.prototype,{
/**
* attach the listeners on "click" event and create the custom events
+ * @method initEvents
*/
initEvents: function() {
@@ -154,6 +157,7 @@ Y.mix(inputEx.widget.Button.prototype,{
/**
* Disable the button
+ * @method disable
*/
disable: function() {
@@ -168,6 +172,7 @@ Y.mix(inputEx.widget.Button.prototype,{
/**
* Enable the button
+ * @method enable
*/
enable: function() {
@@ -183,6 +188,7 @@ Y.mix(inputEx.widget.Button.prototype,{
/**
* Purge all event listeners and remove the component from the dom
+ * @method destroy
*/
destroy: function() {
@@ -203,6 +209,6 @@ Y.mix(inputEx.widget.Button.prototype,{
});
Y.augment(inputEx.widget.Button, Y.EventTarget, null, null, {});
-},'3.0.0a',{
+},'3.1.0',{
requires:["inputex"]
});
View
13 lib/inputex/src/inputex-checkbox/inputex-checkbox.js
@@ -24,6 +24,7 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Adds the CheckBox specific options
+ * @method setOptions
* @param {Object} options Options object as passed to the constructor
*/
setOptions: function(options) {
@@ -43,6 +44,7 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Render the checkbox and the hidden field
+ * @method renderComponent
*/
renderComponent: function() {
@@ -62,16 +64,14 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Clear the previous events and listen for the "change" event
+ * @method initEvents
*/
initEvents: function() {
// Awful Hack to work in IE6 and below (the checkbox doesn't fire the change event)
// It seems IE 8 removed this behavior from IE7 so it only works with IE 7 ??
- /*if( YAHOO.env.ua.ie && parseInt(YAHOO.env.ua.ie,10) != 7 ) {
- Event.addListener(this.el, "click", function() { this.fireUpdatedEvt(); }, this, true);
- }*/
if( Y.UA.ie ) {
- Y.one(this.el).on("click", function(e) { Y.later(10,this,function(){this.onChange(e);}); }, this);
+ Y.one(this.el).on("click", function(e) { Y.later(10,this,function(){this.onChange(e);}); }, this);
} else {
Y.one(this.el).on("change", this.onChange, this, true);
}
@@ -82,6 +82,7 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Function called when the checkbox is toggled
+ * @method onChange
* @param {Event} e The original 'change' event
*/
onChange: function(e) {
@@ -92,6 +93,7 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Get the state value
+ * @method getValue
* @return {Any} one of [checkedValue,uncheckedValue]
*/
getValue: function() {
@@ -100,6 +102,7 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Set the value of the checkedbox
+ * @method setValue
* @param {Any} value The value schould be one of [checkedValue,uncheckedValue]
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the 'updated' event or not (default is true, pass false to NOT send the event)
*/
@@ -142,13 +145,15 @@ Y.extend(inputEx.CheckBox, inputEx.Field, {
/**
* Disable the field
+ * @method disable
*/
disable: function() {
this.el.disabled = true;
},
/**
* Enable the field
+ * @method enable
*/
enable: function() {
this.el.disabled = false;
View
9 lib/inputex/src/inputex-choice/inputex-choice.js
@@ -17,6 +17,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Add a choice
+ * @method addChoice
* @param {Object} config An object describing the choice to add (e.g. { value: 'second' [, label: 'Second' [, position: 1 || after: 'First' || before: 'Third']] })
*/
addChoice: function (config) {
@@ -75,6 +76,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Remove a choice
+ * @method removeChoice
* @param {Object} config An object targeting the choice to remove (e.g. { position : 1 } || { value: 'second' } || { label: 'Second' })
*/
removeChoice: function (config) {
@@ -109,6 +111,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Hide a choice
+ * @method hideChoice
* @param {Object} config An object targeting the choice to hide (e.g. { position : 1 } || { value: 'second' } || { label: 'Second' })
*/
hideChoice: function (config, sendUpdatedEvt) {
@@ -142,6 +145,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Show a choice
+ * @method showChoice
* @param {Object} config An object targeting the choice to show (e.g. { position : 1 } || { value: 'second' } || { label: 'Second' })
*/
showChoice: function (config) {
@@ -167,6 +171,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Disable a choice
+ * @method disableChoice
* @param {Object} config An object targeting the choice to disable (e.g. { position : 1 } || { value: 'second' } || { label: 'Second' })
*/
disableChoice: function (config, unselect) {
@@ -195,6 +200,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Enable a choice
+ * @method enableChoice
* @param {Object} config An object targeting the choice to enable (e.g. { position : 1 } || { value: 'second' } || { label: 'Second' })
*/
enableChoice: function (config) {
@@ -215,6 +221,7 @@ YUI.add("inputex-choice", function(Y){
/**
* Get the position of a choice in choicesList (NOT in the DOM)
+ * @method getChoicePosition
* @param {Object} config An object targeting the choice (e.g. { position : 1 } || { value: 'second' } || { label: 'Second' })
*/
getChoicePosition: function (config) {
@@ -249,6 +256,6 @@ YUI.add("inputex-choice", function(Y){
};
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ["inputex"]
});
View
2 lib/inputex/src/inputex-color/assets/skins/sam/inputex-color.css
@@ -11,7 +11,7 @@
div.inputEx-ColorField button {
background-image: url(palette.png);
- background-position: 3px 0;
+ /*background-position: 3px 0;*/
background-repeat: no-repeat;
margin-left: 2px;
}
View
28 lib/inputex/src/inputex-color/inputex-color.js
@@ -27,6 +27,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Adds the 'inputEx-ColorField' default className
+ * @method setOptions
* @param {Object} options Options object as passed to the constructor
*/
setOptions: function(options) {
@@ -44,7 +45,9 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
if (options.cellPerLine) { this.options.cellPerLine = options.cellPerLine;}
},
-
+ /**
+ * @method renderOverlay
+ */
renderOverlay: function() {
// Create overlay
@@ -72,6 +75,10 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
}, this);
},
+ /**
+ * @method _toggleOverlay
+ * @private
+ */
_toggleOverlay: function(e) {
// PreventDefault to prevent submit in a form
e.preventDefault();
@@ -84,6 +91,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Render the color button and the colorpicker popup
+ * @method renderComponent
*/
renderComponent: function() {
@@ -117,8 +125,9 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
this.fieldContainer.appendChild(this.wrapEl);
},
-
-
+ /**
+ * @method renderPalette
+ */
renderPalette: function() {
if(!this.oOverlay) {
@@ -157,6 +166,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Set the colors to set in the picker
+ * @method setDefaultColors
* @param {int} index Index of the palette to use
* @return {Array} List of colors to choose from
*/
@@ -166,6 +176,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* This creates a color grid
+ * @method renderColorGrid
*/
renderColorGrid: function() {
@@ -201,6 +212,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Handle a color selection
+ * @method onColorClick
* @param {Event} e The original click event
*/
onColorClick: function(e,square,container) {
@@ -220,6 +232,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Set the value
+ * @method setValue
* @param {String} value Color to set
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the 'updated' event or not (default is true, pass false to NOT send the event)
*/
@@ -235,6 +248,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Return the color value
+ * @method getValue
* @return {String} Color value
*/
getValue: function() {
@@ -243,6 +257,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Call overlay when field is removed
+ * @method close
*/
close: function() {
if (this.oOverlay) {
@@ -252,6 +267,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Purge all event listeners and remove the component from the dom
+ * @method destroy
*/
destroy: function() {
@@ -267,6 +283,9 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
},
+ /**
+ * @method markSelectedColor
+ */
markSelectedColor: function(value) {
var i;
@@ -300,6 +319,7 @@ Y.extend(inputEx.ColorField, inputEx.Field, {
/**
* Default palettes
+ * @property palettes
*/
inputEx.ColorField.palettes = [
["#FFEA99","#FFFF66","#FFCC99","#FFCAB2","#FF99AD","#FFD6FF","#FF6666","#E8EEF7","#ADC2FF","#ADADFF","#CCFFFF","#D6EAAD","#B5EDBC","#CCFF99"],
@@ -349,6 +369,6 @@ inputEx.ColorField.ensureHexa = function (color) {
// Register this class as "color" type
inputEx.registerType("color", inputEx.ColorField, []);
-},'3.0.0a',{
+},'3.1.0',{
requires: ['inputex-field','node-event-delegate','event-outside','overlay']
});
View
46 lib/inputex/src/inputex-colorpicker/assets/skins/sam/inputex-colorpicker.css
@@ -1,46 +0,0 @@
-
-/**
- * ColorPicker Field (YUI ColorPicker)
- */
-
-.inputEx-ColorPicker-Button { vertical-align: baseline; }
-.inputEx-ColorPicker-Button button {
- outline: none; /* Safari */
- line-height: 1.5;
-}
-
-/* Style the Button instance's label as a square whose background color
- represents the current value of the ColorPicker instance. */
-.inputEx-ColorPicker-Label {
- display: block;
- display: inline-block;
- *display: block; /* For IE */
- *margin: .25em 0; /* For IE */
- width: 1em;
- height: 1em;
- overflow: hidden;
- text-indent: 1em;
- background-color: #fff;
- white-space: nowrap;
- border: solid 1px #000;
-}
-
-
-/* Hide default colors for the ColorPicker instance. */
-.inputEx-ColorPicker-Container-nocontrols .yui-picker-controls,
-.inputEx-ColorPicker-Container-nocontrols .yui-picker-swatch,
-.inputEx-ColorPicker-Container-nocontrols .yui-picker-websafe-swatch {
- display: none;
-}
-
-
-/* Size the body element of the Menu instance to match the dimensions of the ColorPicker instance. */
-.inputEx-ColorPicker-Container {
- width: 370px;
- height: 190px;
-}
-
-.inputEx-ColorPicker-Container-nocontrols {
- width: 220px;
- height: 190px;
-}
View
187 lib/inputex/src/inputex-colorpicker/inputex-colorpicker.js
@@ -1,187 +0,0 @@
-/**
- * @module inputex-colorpickerfield
- */
-YUI.add("inputex-colorpicker",function(Y){
-
- var inputEx = Y.inputEx,
- lang = Y.Lang;
-
- var YAHOO = Y.YUI2, Event = YAHOO.util.Event, Dom = YAHOO.util.Dom;
-
-/**
- * Create a Color picker input field
- * @class inputEx.ColorPickerField
- * @extends inputEx.Field
- * @constructor
- * @param {Object} options Added options for ColorPickerField :
- * <ul>
- * <li>showcontrols: show the input values RGB,HSV,RGB hex</li>
- * </ul>
- */
-inputEx.ColorPickerField = function(options) {
- inputEx.ColorPickerField.superclass.constructor.call(this,options);
-};
-Y.extend(inputEx.ColorPickerField, inputEx.Field, {
-
- /**
- * Adds the 'inputEx-ColorPickerField' default className
- * @param {Object} options Options object as passed to the constructor
- */
- setOptions: function(options) {
- inputEx.ColorPickerField.superclass.setOptions.call(this, options);
-
- // Overwrite options
- this.options.className = options.className ? options.className : 'inputEx-Field inputEx-ColorPickerField';
-
- // Color Picker options object
- this.options.colorPickerOptions = lang.isUndefined(options.colorPickerOptions) ? {} : options.colorPickerOptions;
-
- // showcontrols
- this.options.colorPickerOptions.showcontrols = lang.isUndefined(this.options.colorPickerOptions.showcontrols) ? true : this.options.colorPickerOptions.showcontrols;
-
- // default images (color selection images)
- this.options.colorPickerOptions.images = lang.isUndefined(this.options.colorPickerOptions.images) ? { PICKER_THUMB: "../lib/yui/colorpicker/assets/picker_thumb.png", HUE_THUMB: "../lib/yui/colorpicker/assets/hue_thumb.png" } : this.options.colorPickerOptions.images;
-
- },
-
- /**
- * Render the color button and the colorpicker popup
- */
- renderComponent: function() {
-
- // A hidden input field to store the color code
- this.el = inputEx.cn('input', {
- type: 'hidden',
- name: this.options.name || '',
- value: this.options.value || '#FFFFFF'
- });
-
- // This element wraps the input node in a float: none div
- this.wrapEl = inputEx.cn('div', {className: 'inputEx-ColorPickerField-wrapper'});
- this.wrapEl.appendChild(this.el);
-
- // Create a Menu instance to house the ColorPicker instance
- this.menuElId = Dom.generateId();
- var oColorPickerMenu = new YAHOO.widget.Menu(this.menuElId);
- this.oColorPickerMenu = oColorPickerMenu;
-
- // Create a Button instance of type "menu"
- this.labelElId = Dom.generateId();
- var oButton = new YAHOO.widget.Button({
- type: "menu",
- className: "inputEx-ColorPicker-Button",
- label: "<em id=\""+this.labelElId+"\" class='inputEx-ColorPicker-Label'>Current color is #FFFFFF.</em>",
- menu: oColorPickerMenu,
- container: this.wrapEl
- });
-
- var that = this;
- oButton.on("appendTo", function () {
- oColorPickerMenu.setBody(" ");
- oColorPickerMenu.body.id = Dom.generateId();
- Dom.addClass(oColorPickerMenu.body, that.options.colorPickerOptions.showcontrols ? "inputEx-ColorPicker-Container" : "inputEx-ColorPicker-Container-nocontrols");
- oColorPickerMenu.render(this.get('container'));
- });
-
- /*
- Add a listener for the "click" event. This listener will be
- used to defer the creation the ColorPicker instance until the
- first time the Button's Menu instance is requested to be displayed
- by the user.
- */
- oButton.on("click", this.onButtonClickOnce, this, true);
-
- this.oButton = oButton;
-
- this.fieldContainer.appendChild(this.wrapEl);
- },
-
- onButtonClickOnce: function(event) {
-
- // Remove this event listener so that this code runs only once
- this.oButton.unsubscribe("click", this.onButtonClickOnce, this);
-
- this.oColorPicker = new YAHOO.widget.ColorPicker(this.oColorPickerMenu.body.id, this.options.colorPickerOptions);
-
- if(this.options.value) {
- this.oColorPicker.set("hex", this.options.value.substr(1));
- }
-
- /*
- Add a listener for the ColorPicker instance's "rgbChange" event
- to update the background color and text of the Button's
- label to reflect the change in the value of the ColorPicker.
- */
- this.oColorPicker.on("rgbChange", this.onRgbChange, this, true);
- },
-
- onRgbChange: function(p_oEvent) {
- var sColor = "#" + this.oColorPicker.get("hex");
- this.oButton.set("value", sColor);
- var el = Dom.get(this.labelElId);
- Dom.setStyle(el, "backgroundColor", sColor);
- el.innerHTML = "Current color is " + sColor;
- this.el.value = sColor;
-
- // timer to filter very close events ("updated" event is sent only 50ms after the onRgbChange event)
- if(this.rgbChangeTimeout) {
- clearTimeout(this.rgbChangeTimeout);
- }
- var that = this;
- this.rgbChangeTimeout = setTimeout(function() {
- that.onRgbChangeTimeout();
- }, 50);
- },
-
- onRgbChangeTimeout: function() {
- this.fireUpdatedEvt();
- },
-
- /**
- * Set the value
- * @param {String} value Color to set
- * @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the 'updated' event or not (default is true, pass false to NOT send the event)
- */
- setValue: function(value, sendUpdatedEvt) {
- this.el.value = value;
-
- if(this.oButton) {
- this.oButton.set("value", value);
- var el = Dom.get(this.labelElId);
- if(el) {
- Dom.setStyle(el, "backgroundColor", value);
- el.innerHTML = "Current color is " + value;
- }
- else {
- Event.onAvailable(this.labelElId, function() {
- Dom.setStyle(this, "backgroundColor", value);
- this.innerHTML = "Current color is " + value;
- });
- }
- }
-
- if(this.oColorPicker) {
- this.oColorPicker.set("hex", value.substr(1));
- }
-
- // Call Field.setValue to set class and fire updated event
- inputEx.ColorPickerField.superclass.setValue.call(this,value, sendUpdatedEvt);
- },
-
- /**
- * Return the color value
- * @return {String} Color value
- */
- getValue: function() {
- return this.el.value;
- }
-
-});
-
-
-// Register this class as "color" type
-inputEx.registerType("colorpicker", inputEx.ColorPickerField, []);
-
-},'3.0.0a',{
- requires: ['inputex-field','yui2-colorpicker','yui2-container','yui2-menu','yui2-button']
-});
View
21 lib/inputex/src/inputex-combine/inputex-combine.js
@@ -23,6 +23,7 @@ inputEx.CombineField = function(options) {
Y.extend( inputEx.CombineField, inputEx.Group, {
/**
* Set the default values of the options
+ * @method setOptions
* @param {Object} options Options object as passed to the constructor
*/
setOptions: function(options) {
@@ -35,7 +36,9 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
this.options.separators = options.separators;
},
-
+ /**
+ * @method render
+ */
render: function() {
// Create the div wrapper for this group
@@ -64,6 +67,7 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
/**
* Render the subfields
+ * @method renderFields
*/
renderFields: function(parentEl) {
@@ -98,6 +102,7 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
/**
* Override to force required option on each subfield
+ * @method renderField
* @param {Object} fieldOptions The field properties as required by inputEx()
*/
renderField: function(fieldOptions) {
@@ -110,7 +115,9 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
return inputEx.CombineField.superclass.renderField.call(this, fieldOptions);
},
-
+ /**
+ * @method setFieldName
+ */
setFieldName: function(name) {
if(name) {
for(var i = 0 ; i < this.inputs.length ; i++) {
@@ -128,6 +135,7 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
/**
* Add a separator to the divEl
+ * @method appendSeparator
*/
appendSeparator: function(i) {
if(this.options.separators && this.options.separators[i]) {
@@ -136,6 +144,9 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
}
},
+ /**
+ * @method initEvents
+ */
initEvents: function() {
var me = this,
blurTimeout;
@@ -170,6 +181,7 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
/**
* Set the value
+ * @method setValue
* @param {Array} values [value1, value2, ...]
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the 'updated' event or not (default is true, pass false to NOT send the event)
*/
@@ -191,7 +203,8 @@ Y.extend( inputEx.CombineField, inputEx.Group, {
},
/**
- * Specific getValue
+ * Specific getValue
+ * @method getValue
* @return {Array} An array of values [value1, value2, ...]
*/
getValue: function() {
@@ -211,7 +224,7 @@ inputEx.registerType("combine", inputEx.CombineField, [
]);
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ['inputex-group']
});
View
BIN lib/inputex/src/inputex-datatable/assets/skins/sam/cross.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN lib/inputex/src/inputex-datatable/assets/skins/sam/edit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
17 lib/inputex/src/inputex-datatable/assets/skins/sam/inputex-datatable.css
@@ -0,0 +1,17 @@
+/**
+ * inputExDataTable
+ */
+
+td.inputEx-DataTable-modify {
+ background-image: url(edit.png);
+ background-position:center;
+ background-repeat: no-repeat;
+ margin: 2px;
+}
+
+td.inputEx-DataTable-delete {
+ background-image: url(cross.png);
+ background-position:center;
+ background-repeat: no-repeat;
+ margin: 2px;
+}
View
BIN lib/inputex/src/inputex-datatable/assets/skins/sam/palette.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
796 lib/inputex/src/inputex-datatable/inputex-datatable.js
@@ -1,437 +1,383 @@
+YUI.add("inputex-datatable", function (Y) {
/**
+ * The inputex-datatable module provides the inputEx.Plugin.InputExDataTable class which is a plugin.
* @module inputex-datatable
*/
-YUI.add("inputex-datatable", function(Y) {
- var MSGS = Y.inputEx.messages;
+ var inputEx = Y.inputEx,
+ MSGS = Y.inputEx.messages;
- function DatatableInputex() {
- DatatableInputex.superclass.constructor.apply(this, arguments);
- }
+ // namespace definition
+ Y.namespace('inputEx.Plugin');
- /////////////////////////////////////////////////////////////////////////////
- //
- // STATIC PROPERTIES
- //
- /////////////////////////////////////////////////////////////////////////////
- Y.mix(DatatableInputex, {
- /**
- * The namespace for the plugin. This will be the property on the host which
- * references the plugin instance.
- *
- * @property NS
- * @type String
- * @static
- * @final
- * @value "inputex"
- */
- NS: "inputex",
-
- /**
- * Class name.
- *
- * @property NAME
- * @type String
- * @static
- * @final
- * @value "datatableInputex"
- */
- NAME: "datatableInputex",
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // ATTRIBUTES
- //
- /////////////////////////////////////////////////////////////////////////////
- ATTRS: {
-
- // The Y.inputEx.Panel instance to add/modify
- panel: {
- valueFn: '_initPanel',
- lazyAdd: true
- },
-
- inputEx: {
- value: null
- },
-
- mode: {
- value: null,
- },
-
- modifyColumnLabel: {
- value: MSGS.modifyText
- },
-
- deleteColumnLabel: {
- value: MSGS.deleteText
- },
+ /**
+ * Provide add/modify/delete functionalities on a dataTable as a plugin
+ * @class inputEx.Plugin.InputExDataTable
+ * @extends Plugin.Base
+ * @constructor
+ * @param {Object} configuration object
+ */
+ inputEx.Plugin.InputExDataTable = function (config) {
+ inputEx.Plugin.InputExDataTable.superclass.constructor.call(this, config);
+ };
- deleteColumn: {
- value: null
- },
+ inputEx.Plugin.InputExDataTable.NS = "InputExDataTable";
- confirmDelete: {
- value: true
- },
-
- // a pointer to the record being modified
- modifyRecord: {
+ Y.extend(inputEx.Plugin.InputExDataTable, Y.Plugin.Base, {
+
+ /**
+ * @method initializer
+ */
+ initializer: function () {
+
+ var host = this.get("host");
+
+ // enrich data (Model instance) with modify and delete attributs
+ this.enrichData();
+ // enrich DataTable with modify and delete columns
+ this.enrichColumns();
+ // add a button called "add" in order to add record in the DataTable
+ this.addAddButton();
- },
-
- deleteTemplate: {
- // TODO
- }
- },
-
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // STATIC METHODS
- //
- /////////////////////////////////////////////////////////////////////////////
-
- /**
- * Convert an inputEx fields definition to a DataTable columns definition
- */
- fieldsToColumndefs: function(fields) {
- var columndefs = [];
- for (var i = 0; i < fields.length; i++) {
- columndefs.push(this.fieldToColumndef(fields[i]));
- }
- return columndefs;
- },
-
- /**
- * Convert a single inputEx field definition to a DataTable column definition
- */
- fieldToColumndef: function(field) {
-
- var key,
- label,
- colmunDef;
-
- key = field.name;
- label = field.label;
-
- columnDef = {
- key: key,
- label: label,
- sortable: true,
- resizeable: true
- };
-
- // Field formatter
- if (field.type == "date") {
- columnDef.formatter = YAHOO.widget.DataTable.formatDate;
- }
- else if (field.type == "integer" || field.type == "number") {
- columnDef.formatter = YAHOO.widget.DataTable.formatNumber;
- /*columnDef.sortOptions = {
- defaultDir: "asc",
- sortFunction: // TODO: sort numbers !!!
- }*/
- }
- // TODO: other formatters
- return columnDef;
- }
-
- });
-
-
-
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // PROTOTYPE
- //
- /////////////////////////////////////////////////////////////////////////////
- Y.extend(DatatableInputex, Y.Plugin.Base, {
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // METHODS
- //
- /////////////////////////////////////////////////////////////////////////////
- /**
- * Initializer.
+ if(!this.get("disableModifyFunc")){
+ // handle row modification
+ host.delegate("click",this.modifyRecord,"td.inputEx-DataTable-modify", this);
+ }
+ if(!this.get("disableDeleteFunc")){
+ // handle row removal
+ host.delegate("click",this.deleteRecord, "td.inputEx-DataTable-delete", this);
+ }
+ },
+ /**
+ * add Attributes on the data model depending on the plugin configuration
+ *
+ * @method enrichData
+ * @param {EventFacade} e
+ */
+ enrichData: function (e) {
+
+ var that = this,
+ data = this.get("host").get("data");
+
+ data.each(function (model) {
+ if(!this.get("disableModifyFunc")){
+ that.addModifyAttr(model);
+ }
+ if(!this.get("disableDeleteFunc")){
+ that.addDeleteAttr(model);
+ }
+ });
+ },
+ /**
+ * add Columns on the DataTable depending on the plugin configuration
+ *
+ * @method enrichColumns
+ */
+ enrichColumns: function () {
+ if(!this.get("disableModifyFunc")){
+ this.addModifyColumn();
+ }
+ if(!this.get("disableDeleteFunc")){
+ this.addDeleteColumn();
+ }
+ },
+ /**
+ * Provide the add button in order to add record on the DataTable
+ *
+ * @method addAddButton
+ */
+ addAddButton : function(){
+ if(!this.get("disableAddFunc")){
+ var button = Y.Node.create("<button id='addButton'>"+MSGS.addButtonText+"</button"),
+ panel = this.get("panel");
+ this.get("host").get("contentBox").append(button);
+ button.on("click",function (e) {
+ panel.set("headerContent","Add Item");
+ panel.get("field").clear();
+ panel.show();
+ },this);
+ }
+ },
+ /**
+ *
+ * @method modifyRecord
+ */
+ modifyRecord : function(e){
+ e.stopPropagation();
+ var record = this.get("host").getRecord(e.currentTarget),
+ panel = this.get("panel");
+ panel.set("headerContent","Modify Item");
+ panel.get('field').setValue(record.getAttrs());
+ panel.show();
+ },
+ /**
+ *
+ * @method deleteRecord
+ */
+ deleteRecord : function(e){
+ e.stopPropagation();
+ var record = this.get("host").getRecord(e.currentTarget);
+ if (!this.get("confirmDelete") || confirm(MSGS.confirmDeletion)) {
+ this.get("host").get("data").remove(record);
+ }
+ },
+ /**
+ *
+ * @method deleteExtraColumns
+ */
+ deleteExtraColumns : function(){
+ if(!this.get("disableModifyFunc")){
+ this.removeModifyColumn();
+ }
+ if(!this.get("disableDeleteFunc")){
+ this.removeDeleteColumn();
+ }
+ },
+ /**
+ *
+ * @method _initPanel
+ * @private
+ */
+ _initPanel: function () {
+
+ var that = this;
+
+ var panel = new Y.inputEx.Panel({
+ centered: true,
+ width: 500,
+ modal: true,
+ zIndex: 5,
+ visible: false,
+ inputEx: that.get("inputEx"),
+
+ buttons: [{
+ value: "Cancel",
+ action: function (e) {
+ e.preventDefault();
+ panel.hide();
+ }
+ },{
+ value: "Save",
+ action: function (e) {
+ e.preventDefault();
+
+ var field = that.get("panel").get("field"),
+ fieldValues = field.getValue(),
+ host = that.get("host"),
+ model;
+
+ if (field.validate()) {
+
+ if (fieldValues.id) {
+ // modification
+ host.get("data").getById(fieldValues.id).setAttrs(fieldValues);
+ } else {
+ // creation
+ fieldValues.id = that.generateId(that.get("idSize"));
+ model = new Y.Model();
+ model.setAttrs(fieldValues);
+ that.addModifyAttr(model);
+ that.addDeleteAttr(model);
+ host.get("data").add(model);
+ }
+ panel.hide();
+ }
+ }
+ }]
+ });
+
+ // first the panel needs to be "render" then "show"
+ panel.render();
+ return panel;
+
+ },
+ /**
+ *
+ * @method destructor
+ */
+ destructor : function(){
+
+ var that = this,
+ data = this.get("host").get("data");
+
+ data.each(function (model) {
+
+ if(!this.get("disableModifyFunc")){
+ that.delModifyAttr(model);
+ }
+ if(!this.get("disableDeleteFunc")){
+ that.delDeleteAttr(model);
+ }
+
+ });
+ this.deleteExtraColumns();
+ if(!this.get("disableAddFunc")){
+ Y.one("#addButton").remove();
+ }
+
+ this.get("panel").destroy();
+ },
+ /**
+ * Add the modify attribute on the data model
+ *
+ * @method addModifyAttr
+ */
+ addModifyAttr : function(model){model.addAttr("modify");},
+ /**
+ * Add the delete attribute on the data model
+ *
+ * @method addDeleteAttr
+ */
+ addDeleteAttr : function(model){model.addAttr("delete");},
+ /**
+ * Remove the modify attribute from the data model
+ *
+ * @method delModifyAttr
+ */
+ delModifyAttr : function(model){model.removeAttr("modify");},
+ /**
+ * Remove the modify attribute from the data model
+ *
+ * @method delDeleteAttr
+ */
+ delDeleteAttr : function(model){model.removeAttr("delete");},
+ /**
+ * Add the modify column on the DataTable
+ *
+ * @method addModifyColumn
+ */
+ addModifyColumn : function(){
+ this.get("host").addColumn({
+ key: this.get("modifyColumnLabel"),
+ className: "inputEx-DataTable-modify"
+ });
+ },
+ /**
+ * Add the delete column on the DataTable
+ *
+ * @method addDeleteColumn
+ */
+ addDeleteColumn : function(){
+ this.get("host").addColumn({
+ key: this.get("deleteColumnLabel"),
+ className: "inputEx-DataTable-delete"
+ });
+ },
+ /**
+ * Remove the modify column from the DataTable
+ *
+ * @method removeModifyColumn
+ */
+ removeModifyColumn : function(){this.get("host").removeColumn("modify");},
+ /**
+ * Remove the delete column from the DataTable
+ *
+ * @method removeDeleteColumn
+ */
+ removeDeleteColumn : function(){this.get("host").removeColumn("delete");},
+ generateId : function(size){
+ var prefixId = this.get("prefixId"),
+ s = size ? size : 5;
+ prefixId = prefixId ? prefixId : "";
+ return prefixId + Math.floor(Math.random()*Math.pow(10,s));
+ }
+ }, {
+/**
+ * Static property used to define the default attribute configuration of
+ * the Plugin.
*
- * @method initializer
- * @param config {Object} Config object.
- * @private
+ * @property ATTRS
+ * @type {Object}
+ * @static
*/
- initializer: function(config) {
- var dt = this.get("host");
-
- this.doAfter("renderUI", this._afterRenderUI);
-
-
- this.doAfter("_addTheadTrNode", this._afterAddTheadTrNode);
- this.doAfter("_createTbodyTrNode", this._afterCreateTbodyTrNode);
-
- this.publish("addRow");
-
- this.publish("modifyRow");
-
- this.publish("deleteRow");
-
- // Attach trigger handlers
- dt.delegate("click", Y.bind(this._onRemoveLabelClick, this), "td.delete_column");
- dt.delegate("click", Y.bind(this._onModifyLabelClick, this), "td.modify_column");
-
- },
-
- _afterRenderUI: function() {
- this._renderAddButton();
- },
-
- _renderAddButton: function() {
- var button = Y.Node.create("<button>"+MSGS.addButtonText+"</button");
-
- button.on('click', Y.bind(this._onAddButtonClick, this));
-
- button.appendTo(this.get('host').get("contentBox"));
- },
-
- _onAddButtonClick: function(e) {
-
- this.set('mode','add');
-
- this.get('panel').get('field').clear();
- this.showPanel();
- },
-
- _initPanel: function() {
-
- var that = this;
-
- var panel = new Y.inputEx.Panel({
- centered: true,
- width: 500,
- modal: true,
- zIndex: 5,
- visible: false,
- inputEx: this.get('inputEx'),
- headerContent: "AddItem",
-
- buttons: [
- {
- value: "Save",
- action: function(e) {
- e.preventDefault();
- panel.hide();
-
- var evt = (that.get('mode') == 'modify') ? 'modifyRow' : 'addRow';
-
- that.fire(evt, {
- data: panel.get('field').getValue()
- });
- },
- section: Y.WidgetStdMod.FOOTER
- },
- {
- value: "Cancel",
- action: function(e) {
- e.preventDefault();
- panel.hide();
- },
- section: Y.WidgetStdMod.FOOTER
- }
- ]
- });
- panel.render();
-
- //this.set('panel', panel);
- return panel;
- },
-
- showPanel: function() {
- /*if (!this.get('panel')) {
- this._renderPanel();
- }*/
- this.get('panel').show();
- },
-
-
- /**
- * Add a "delete" column to the datatable
- */
- _afterAddTheadTrNode: function(o, isFirst, isLast) {
- if (isFirst) {
-
- var dt = this.get("host");
-
-
- // Modify column
-
- var modifyColumn = new Y.Column({
- label: this.get('modifyColumnLabel'),
- key: "modify_column"
- // formatter ?
- });
-
- dt._addTheadThNode({
- value: modifyColumn.get("label"),
- column: modifyColumn,
- tr: o.tr
- });
-
- this.set('modifyColumn', modifyColumn);
-
- // Delete column
-
- var deleteColumn = new Y.Column({
- label: this.get('deleteColumnLabel'),
- key: "delete_column"
- // formatter ?
- });
-
- dt._addTheadThNode({
- value: deleteColumn.get("label"),
- column: deleteColumn,
- tr: o.tr
- });
-
- this.set('deleteColumn', deleteColumn);
- }
- },
-
-
- /**
- * Add the remove column to the table
- * Create the TD node to delete
- */
- _afterCreateTbodyTrNode: function(a) {
- var dt = this.get("host");
-
- this._createModifyColumn(a);
- this._createDeleteColumn(a);
- },
-
- _createDeleteColumn: function(a) {
- // Delete column
-
- var o = {};
- o.headers = a.column.headers;
- o.value = "delete"; // TODO: use template
- o.classnames = a.classnames + " delete_column";
-
- var t = Y.Lang.sub(Y.DataTable.Base.prototype.tdTemplate, o);
-
- o.td = Y.Node.create(t);
-
- // save a reference to the record
- o.td.record = a.record;
-
- o.td.tr = a.tr;
-
- a.tr.appendChild(o.td);
- },
-
- _createModifyColumn: function(a) {
-
- var dt = this.get("host");
- // Modify column
-
- var o = {};
- o.headers = a.column.headers;
- o.value = "modify"; // TODO: use template
- o.classnames = a.classnames + " modify_column";
-
- var t = Y.Lang.sub(Y.DataTable.Base.prototype.tdTemplate, o);
-
- o.td = Y.Node.create(t);
-
- // save a reference to the record
- o.td.record = a.record;
-
- o.td.tr = a.tr;
-
- a.tr.appendChild(o.td);
- },
-
-
- _onModifyLabelClick: function(e) {
-
- var td = e.currentTarget,
- tr = td.tr,
- record = td.record,
- dt = this.get('host'),
- rs = dt.get('recordset');
-
- this.set('mode','modify');
- this.set('modifyRecord', record);
-
- var data = record.get("data");
- this.get('panel').get('field').setValue(data);
-
- this.showPanel();
- },
-
- /**
- * Send the remove event
- */
- _onRemoveLabelClick: function(e) {
-
- if (!this.get('confirmDelete') || confirm(MSGS.confirmDeletion)) {
- this.fire("deleteRow", e);
- }
-
- },
-
- /**
- * Remove the Record from the record set
- */
- confirmDelete: function(e) {
-
- var td = e.currentTarget,
- tr = td.tr,
- record = td.record,
- dt = this.get('host'),
- rs = dt.get('recordset');
-
- // Remove the record from the recordset
- rs.remove(rs.indexOf(record));
-
- // Remove the row from the table
- tr.remove();
- },
-
-
- addRow: function(data) {
-
- var dt = this.get('host'),
- rs = dt.get('recordset');
-
- rs.add(data);
-
- // Only add tr ?
- dt._uiSetRecordset( rs );
- },
-
- modifyRow: function(data, details) {
-
- var dt = this.get('host'),
- rs = dt.get('recordset');
-
- var record = this.get('modifyRecord');
-
- record.set('data', data);
-
- // TODO: update tr only ?
- dt._uiSetRecordset( rs );
- }
-
-
- });
-
- Y.namespace("Plugin").DatatableInputex = DatatableInputex;
-
-
-
-},
-'3.0.0a', {
- requires: ['inputex-group', 'inputex-panel', 'datatable']
-});
+ATTRS: {
+ /**
+ * This is an inputEx field definition. This is used when a user try to create/modify a record
+ *
+ * @attribute inputEx
+ */
+ inputEx: {},
+ /**
+ * This string is inserted before the generated id
+ *
+ * @attribute prefixId
+ * @type String
+ * @example prefixId : "po-" --> id = po-1342561
+ */
+ prefixId: {
+ value: ""
+ },
+ /**
+ * This represents the number of digits used in the id generation
+ *
+ * @attribute idSize
+ * @type Number
+ */
+ idSize: {
+ value: 5
+ },
+ /**
+ * If true the add functionality is disabled
+ *
+ * @attribute disableAddFunc
+ * @type boolean
+ */
+ disableAddFunc: {
+ value: false
+ },
+
+ /**
+ * If true the modify functionality is disabled
+ * @attribute disableModifyFunc
+ * @type boolean
+ */
+ disableModifyFunc: {
+ value: false
+ },
+ /**
+ * If true the delete functionality is disabled
+ *
+ * @attribute disableDeleteFunc
+ * @type boolean
+ */
+ disableDeleteFunc: {
+ value: false
+ },
+ /**
+ * Label of the modify column
+ *
+ * @attribute modifyColumnLabel
+ */
+ modifyColumnLabel: {
+ value: MSGS.modifyText
+ },
+ /**
+ * Label of the delete column
+ *
+ * @attribute deleteColumnLabel
+ */
+ deleteColumnLabel: {
+ value: MSGS.deleteText
+ },
+ /**
+ * If true a confirmation will be asked to the user when a delete attempt appear
+ *
+ * @attribute confirmDelete
+ * @type boolean
+ */
+ confirmDelete: {
+ value: true
+ },
+ /**
+ * This panel will be displayed on record creation/modication
+ * @attribute panel
+ * @type Y.inputEx.Panel
+ */
+ panel: {
+ valueFn: '_initPanel',
+ lazyAdd: true
+ }
+}});
+
+}, "", {requires: ['inputex-group', 'inputex-panel','datatable']});
View
10 lib/inputex/src/inputex-date/inputex-date.js
@@ -24,6 +24,7 @@ inputEx.DateField = function(options) {
Y.extend(inputEx.DateField, inputEx.StringField, {
/**
* Adds the 'inputEx-DateField' default className
+ * @method setOptions
* @param {Object} options Options object as passed to the constructor
*/
setOptions: function(options) {
@@ -40,6 +41,7 @@ Y.extend(inputEx.DateField, inputEx.StringField, {
/**
* Specific Date validation depending of the 'format' option
+ * @method validate
*/
validate: function() {
var value = this.el.value;
@@ -62,6 +64,7 @@ Y.extend(inputEx.DateField, inputEx.StringField, {
/**
* Format the date according to options.dateFormat
+ * @method setValue
* @param {Date} val Date to set
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)
*/
@@ -90,6 +93,7 @@ Y.extend(inputEx.DateField, inputEx.StringField, {
/**
* Return the date
+ * @method getValue
* @param {Boolean} forceDate Skip the valueFormat option if set to truthy
* @return {String || Date} Formatted date using the valueFormat or a javascript Date instance
*/
@@ -114,6 +118,8 @@ Y.extend(inputEx.DateField, inputEx.StringField, {
/**
* Those methods are limited but largely enough for our usage
+ * @method parseWithFormat
+ * @static
*/
inputEx.DateField.parseWithFormat = function(sDate,format) {
var separator = format.match(/[^Ymd ]/g)[0];
@@ -127,6 +133,8 @@ inputEx.DateField.parseWithFormat = function(sDate,format) {
/**
* Those methods are limited but largely enough for our usage
+ * @method formatDate
+ * @static
*/
inputEx.DateField.formatDate = function(d,format) {
var str = format.replace('Y',d.getFullYear());
@@ -142,6 +150,6 @@ inputEx.registerType("date", inputEx.DateField, [
{type: 'select', label: 'Date format', name: 'dateFormat', choices: [{ value: "m/d/Y" }, { value:"d/m/Y" }] }
]);
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ['inputex-string']
});
View
30 lib/inputex/src/inputex-datepicker/inputex-datepicker.js
@@ -23,6 +23,7 @@ inputEx.DatePickerField = function(options) {
Y.extend(inputEx.DatePickerField, inputEx.DateField, {
/**
* Set the default date picker CSS classes
+ * @method setOptions
* @param {Object} options Options object as passed to the constructor
*/
setOptions: function(options) {
@@ -38,8 +39,9 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
this.options.zIndex = options.zIndex || 4;
},
-
-
+ /**
+ * @method renderOverlay
+ */
renderOverlay: function() {
// Create overlay
@@ -66,13 +68,20 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
}
else { // hide
this.calendar.hide();
- this.outsideHandler.detach();
+
+ if(this.outsideHandler){
+ this.outsideHandler.detach();
+ }
+
}
}, this);
},
-
+ /**
+ * @method _toggleOverlay
+ * @private
+ */
_toggleOverlay: function(e) {
// DON'T stop the event since it will be used to close other overlays...
@@ -89,6 +98,7 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
/**
* Render the input field and the minical container
+ * @method renderComponent
*/
renderComponent: function() {
@@ -111,6 +121,7 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
/**
* Called ONCE to render the calendar lazily
+ * @method renderCalendar
*/
renderCalendar: function() {
// if already rendered, ignore call
@@ -145,6 +156,7 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
/**
* Select the right date and display the right page on calendar, when the field has a value
+ * @method beforeShowOverlay
*/
beforeShowOverlay: function(e) {
@@ -156,23 +168,26 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
// check date to exclude empty values ('')
if (valid && !!date) {
this.calendar.set('date', date);
- this.calendar._clearSelection(true);
- this.calendar._renderSelectedDate(date);
+ this.calendar.deselectDates();
+ this.calendar.selectDates(date);
}
}
},
/**
* Call overlay when field is removed
+ * @method close
*/
close: function() {
+ console.log("DATEPICKER CLOSE", this.oOverlay);
if (this.oOverlay) {
this.oOverlay.hide();
}
},
/**
* Disable the field
+ * @method disable
*/
disable: function() {
inputEx.DatePickerField.superclass.disable.call(this);
@@ -181,6 +196,7 @@ Y.extend(inputEx.DatePickerField, inputEx.DateField, {
/**
* Enable the field
+ * @method enable
*/
enable: function() {
inputEx.DatePickerField.superclass.enable.call(this);
@@ -194,7 +210,7 @@ inputEx.messages.defaultCalendarOpts = { navigator: true };
// Register this class as "datepicker" type
inputEx.registerType("datepicker", inputEx.DatePickerField);
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ['inputex-date', 'event-outside', 'node-event-delegate','overlay','calendar']
});
View
14 lib/inputex/src/inputex-dateselectmonth/inputex-dateselectmonth.js
@@ -55,6 +55,9 @@ YUI.add("inputex-dateselectmonth", function(Y) {
Y.extend(inputEx.DateSelectMonthField, inputEx.CombineField, {
+ /**
+ * @method setValue
+ */
setValue: function (value, sendUpdatedEvt) {
var values, i;
@@ -74,6 +77,9 @@ YUI.add("inputex-dateselectmonth", function(Y) {
inputEx.DateSelectMonthField.superclass.setValue.call(this, values, sendUpdatedEvt);
},
+ /**
+ * @method getValue
+ */
getValue: function () {
var values;
@@ -92,6 +98,9 @@ YUI.add("inputex-dateselectmonth", function(Y) {
return new Date(parseInt(values[this.yearIndex], 10), values[this.monthIndex], parseInt(values[this.dayIndex], 10));
},
+ /**
+ * @method validate
+ */
validate: function () {
var val = this.getValue();
@@ -112,6 +121,9 @@ YUI.add("inputex-dateselectmonth", function(Y) {
return (val instanceof Date && lang.isNumber(val.getTime()));
},
+ /**
+ * @method isEmpty
+ */
isEmpty: function () {
var values = inputEx.DateSelectMonthField.superclass.getValue.call(this);
return (values[this.monthIndex] === -1 && values[this.yearIndex] === "" && values[this.dayIndex] === "");
@@ -122,7 +134,7 @@ YUI.add("inputex-dateselectmonth", function(Y) {
// Register this class as "dateselectmonth" type
inputEx.registerType("dateselectmonth", inputEx.DateSelectMonthField);
-}, '3.0.0a',{
+}, '3.1.0',{
requires: ['inputex-combine']
});
View
18 lib/inputex/src/inputex-datesplit/inputex-datesplit.js
@@ -44,6 +44,7 @@ Y.extend(inputEx.DateSplitField, inputEx.CombineField, {
/**
* Set the value. Format the date according to options.dateFormat
+ * @method setValue
* @param {Date} val Date to set
* @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the 'updated' event or not (default is true, pass false to NOT send the event)
*/
@@ -65,6 +66,9 @@ Y.extend(inputEx.DateSplitField, inputEx.CombineField, {
inputEx.DateSplitField.superclass.setValue.call(this, values, sendUpdatedEvt);
},
+ /**
+ * @method ensureTwoChars
+ */
ensureTwoChars: function (val) {
val = val + ""; // convert into string if not
@@ -77,6 +81,9 @@ Y.extend(inputEx.DateSplitField, inputEx.CombineField, {
return val;
},
+ /**
+ * @method getValue
+ */
getValue: function() {
if (this.isEmpty()) return "";
@@ -85,6 +92,9 @@ Y.extend(inputEx.DateSplitField, inputEx.CombineField, {
return new Date(values[this.yearIndex], values[this.monthIndex]-1, values[this.dayIndex] );
},
+ /**
+ * @method validate
+ */
validate: function() {
var subFieldsValidation = inputEx.DateSplitField.superclass.validate.call(this);
if (!subFieldsValidation) return false;