simplr-forms-dom
Version:
DOM components for simplr-forms.
223 lines (205 loc) • 7.92 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("simplr-forms-core"), require("react"), require("./abstractions"));
else if(typeof define === 'function' && define.amd)
define(["simplr-forms-core", "react", "./abstractions"], factory);
else {
var a = typeof exports === 'object' ? factory(require("simplr-forms-core"), require("react"), require("./abstractions")) : factory(root["simplr-forms-core"], root["react"], root["./abstractions"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_7__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 6);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ }),
/* 2 */,
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(1);
var simplr_forms_core_1 = __webpack_require__(0);
var Form = (function (_super) {
__extends(Form, _super);
function Form() {
return _super !== null && _super.apply(this, arguments) || this;
}
Form.prototype.render = function () {
return React.createElement("form", null, this.props.children);
};
return Form;
}(simplr_forms_core_1.Abstractions.BaseForm));
exports.Form = Form;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = __webpack_require__(1);
var base_dom_field_1 = __webpack_require__(7);
var Text = (function (_super) {
__extends(Text, _super);
function Text() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.OnChangeHandler = function (event) {
_this.OnValueChange(_this.GetValueFromEvent(event));
var newValue = _this.FormStore.GetField(_this.FieldId).Value;
if (_this.props.onChange != null) {
_this.props.onChange(event, newValue, _this.FieldId, _this.FormId);
}
// TODO: FormProps.OnFieldChange
};
return _this;
}
Text.prototype.GetValueFromEvent = function (event) {
return event.currentTarget.value;
};
Object.defineProperty(Text.prototype, "RawInitialValue", {
get: function () {
if (this.props != null && this.props.value != null) {
return this.props.value;
}
return this.DefaultValue;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Text.prototype, "DefaultValue", {
get: function () {
if (this.props != null && this.props.defaultValue != null) {
return this.props.defaultValue;
}
return "";
},
enumerable: true,
configurable: true
});
Object.defineProperty(Text.prototype, "IsDisabled", {
get: function () {
var disabled;
// TODO: FormProps.Disabled and FieldsGroupProps.Disabled
if (this.props.disabled != null) {
disabled = this.props.disabled;
}
return disabled;
},
enumerable: true,
configurable: true
});
Text.prototype.renderField = function () {
return React.createElement("input", { type: "text", name: this.FieldId, value: this.Value, onChange: this.OnChangeHandler, disabled: this.IsDisabled });
};
return Text;
}(base_dom_field_1.BaseDomField));
exports.Text = Text;
/***/ }),
/* 5 */,
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
;
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(3));
__export(__webpack_require__(4));
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_7__;
/***/ })
/******/ ]);
});