| 1 | ( function () { |
| 2 | |
| 3 | /** |
| 4 | * Provides access to HTMLForm OOUI classes. |
| 5 | * |
| 6 | * @namespace mw.htmlform |
| 7 | */ |
| 8 | mw.htmlform = {}; |
| 9 | |
| 10 | /** |
| 11 | * @classdesc Allows custom data specific to HTMLFormField to be set for OOUI forms. This picks up the |
| 12 | * extra config from a matching PHP widget (defined in HTMLFormElement.php) when constructed using |
| 13 | * OO.ui.infuse(). |
| 14 | * |
| 15 | * Currently only supports passing 'cond-state' data. |
| 16 | * |
| 17 | * @class |
| 18 | * @constructor |
| 19 | * @description Create an instance of `mw.htmlform.Element`. |
| 20 | * @param {Object} [config] Configuration options |
| 21 | * @param {Object<string,string[]>} [config.condState] typically corresponds to a data-cond-state attribute |
| 22 | * that is found on HTMLForm elements and used during |
| 23 | * {@link event:'htmlform.enhance' htmlform.enhance}. For more information on the format see |
| 24 | * the private function conditionParse in resources/src/mediawiki.htmlform/cond-state.js. |
| 25 | */ |
| 26 | mw.htmlform.Element = function ( config ) { |
| 27 | // Configuration initialization |
| 28 | config = config || {}; |
| 29 | |
| 30 | // Properties |
| 31 | this.condState = config.condState; |
| 32 | }; |
| 33 | |
| 34 | /** |
| 35 | * @class |
| 36 | * @extends OO.ui.FieldLayout |
| 37 | * @mixes mw.htmlform.Element |
| 38 | * @classdesc FieldLayout class. |
| 39 | * @memberof mw.htmlform |
| 40 | * |
| 41 | * @constructor |
| 42 | * @description Create a FieldLayout class. |
| 43 | * @param {Object} config |
| 44 | */ |
| 45 | mw.htmlform.FieldLayout = function ( config ) { |
| 46 | // Parent constructor |
| 47 | mw.htmlform.FieldLayout.super.call( this, config ); |
| 48 | // Mixin constructors |
| 49 | mw.htmlform.Element.call( this, config ); |
| 50 | }; |
| 51 | OO.inheritClass( mw.htmlform.FieldLayout, OO.ui.FieldLayout ); |
| 52 | OO.mixinClass( mw.htmlform.FieldLayout, mw.htmlform.Element ); |
| 53 | |
| 54 | /** |
| 55 | * @class |
| 56 | * @extends OO.ui.ActionFieldLayout |
| 57 | * @mixes mw.htmlform.Element |
| 58 | * @classdesc FieldLayout class. |
| 59 | * @memberof mw.htmlform |
| 60 | * |
| 61 | * @constructor |
| 62 | * @description Create an ActionFieldLayout class. |
| 63 | * @param {Object} config |
| 64 | */ |
| 65 | mw.htmlform.ActionFieldLayout = function ( config ) { |
| 66 | // Parent constructor |
| 67 | mw.htmlform.ActionFieldLayout.super.call( this, config ); |
| 68 | // Mixin constructors |
| 69 | mw.htmlform.Element.call( this, config ); |
| 70 | }; |
| 71 | OO.inheritClass( mw.htmlform.ActionFieldLayout, OO.ui.ActionFieldLayout ); |
| 72 | OO.mixinClass( mw.htmlform.ActionFieldLayout, mw.htmlform.Element ); |
| 73 | |
| 74 | }() ); |