Skip to content
Snippets Groups Projects
Commit 74de7532 authored by glennvorhes's avatar glennvorhes
Browse files

add jquery helper

parent 2f7d73ba
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ var __assign = (this && this.__assign) || function () { ...@@ -29,6 +29,7 @@ var __assign = (this && this.__assign) || function () {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var reactAndRedux_1 = require("./reactAndRedux"); var reactAndRedux_1 = require("./reactAndRedux");
var $ = require("jquery"); var $ = require("jquery");
window['$'] = window['jQuery'] = $; // notice the definition of global variables here
require("jqueryui"); require("jqueryui");
var makeGuid_1 = require("../util/makeGuid"); var makeGuid_1 = require("../util/makeGuid");
var dateFormat_1 = require("./helpers/dateFormat"); var dateFormat_1 = require("./helpers/dateFormat");
......
{"version":3,"file":"DatePick.js","sourceRoot":"","sources":["../../src/reactComponents/DatePick.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,iDAAsC;AACtC,0BAA6B;AAC7B,oBAAkB;AAClB,6CAAwC;AAGxC,mDAAgE;AAUhE;;GAEG;AACH;IAA8B,4BAAgC;IAG1D,kBAAY,KAAgB,EAAE,OAAe;QAA7C,YACI,kBAAM,KAAK,EAAE,OAAO,CAAC,SAExB;QADG,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,EAAE,IAAI,kBAAQ,EAAE,CAAC;;IAC5C,CAAC;IAED,oCAAiB,GAAjB;QAAA,iBAUC;QATG,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,GAAG,CAAC,UAAU,CACV;YACI,QAAQ,EAAE;gBACN,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAY,CAAC,GAAG,CAAC,GAAG,EAAY,CAAC,CAAC,CAAC;YACzD,CAAC;SACJ,CACJ,CAAC;IACN,CAAC;IAED,yBAAM,GAAN;QACI,IAAI,MAAM,GAAG;YACT,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,IAAI,EAAE,MAAM;YACZ,kDAAkD;YAClD,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC;YACf,MAAM,CAAC,OAAO,CAAC,GAAG,yBAAY,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAClD;aAAM;YACH,MAAM,CAAC,cAAc,CAAC,GAAG,yBAAY,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;SAC/E;QAGD,OAAO,8CAAM,SAAS,EAAC,WAAW;YAC9B,+CAAO,OAAO,EAAE,IAAI,CAAC,IAAI,IAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAS;YAMrD,wDAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAC,IAAM,MAAM,EAAG,CACtF,CAAA;IACX,CAAC;IACL,eAAC;AAAD,CAAC,AA7CD,CAA8B,qBAAK,CAAC,SAAS,GA6C5C;AA7CY,4BAAQ;AA+CrB,kBAAe,QAAQ,CAAC","sourcesContent":["/**\r\n * Created by glenn on 6/14/2017.\r\n */\r\n\r\n\r\nimport {React} from './reactAndRedux';\r\nimport $ = require('jquery');\r\nimport 'jqueryui';\r\nimport makeGuid from '../util/makeGuid';\r\n\r\n\r\nimport {dateToString, stringToDate} from './helpers/dateFormat';\r\n\r\nexport interface iDatePick{\r\n label: string;\r\n id?: string;\r\n initialDate?: Date;\r\n change: (val: Date) => any;\r\n val?: Date\r\n}\r\n\r\n/**\r\n * params label, id, initialDate, change callback with value as string\r\n */\r\nexport class DatePick extends React.Component<iDatePick, null> {\r\n private elId: string;\r\n\r\n constructor(props: iDatePick, context: Object){\r\n super(props, context);\r\n this.elId = this.props.id || makeGuid();\r\n }\r\n\r\n componentDidMount() {\r\n let $el = $('#' + this.elId);\r\n\r\n $el.datepicker(\r\n {\r\n onSelect: () => {\r\n this.props.change(stringToDate($el.val() as string));\r\n }\r\n }\r\n );\r\n }\r\n\r\n render() {\r\n let params = {\r\n id: this.elId,\r\n type: 'text',\r\n // style: {margin: \"0 10px 0 5px\", width: '73px'},\r\n readOnly: true\r\n };\r\n\r\n if (this.props.val){\r\n params['value'] = dateToString(this.props.val);\r\n } else {\r\n params['defaultValue'] = dateToString(this.props.initialDate || new Date());\r\n }\r\n\r\n\r\n return <span className=\"date-pick\">\r\n <label htmlFor={this.elId}>{this.props.label}</label>\r\n {/*<input id={this.elId} type=\"text\"*/}\r\n {/*style={{margin: \"0 10px 0 5px\", width: '73px', textAlign: 'center'}}*/}\r\n {/*defaultValue={dateToString(this.props.initialDate || new Date())}*/}\r\n {/*readOnly={true}*/}\r\n {/*/>*/}\r\n <input style={{textAlign: 'center', margin: \"0 10px 0 5px\", width: '73px'}} {...params}/>\r\n </span>\r\n }\r\n}\r\n\r\nexport default DatePick;"]} {"version":3,"file":"DatePick.js","sourceRoot":"","sources":["../../src/reactComponents/DatePick.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,iDAAsC;AACtC,0BAA6B;AAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,iDAAiD;AACrF,oBAAkB;AAClB,6CAAwC;AAGxC,mDAAgE;AAUhE;;GAEG;AACH;IAA8B,4BAAgC;IAG1D,kBAAY,KAAgB,EAAE,OAAe;QAA7C,YACI,kBAAM,KAAK,EAAE,OAAO,CAAC,SAExB;QADG,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,EAAE,IAAI,kBAAQ,EAAE,CAAC;;IAC5C,CAAC;IAED,oCAAiB,GAAjB;QAAA,iBAUC;QATG,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,GAAG,CAAC,UAAU,CACV;YACI,QAAQ,EAAE;gBACN,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAY,CAAC,GAAG,CAAC,GAAG,EAAY,CAAC,CAAC,CAAC;YACzD,CAAC;SACJ,CACJ,CAAC;IACN,CAAC;IAED,yBAAM,GAAN;QACI,IAAI,MAAM,GAAG;YACT,EAAE,EAAE,IAAI,CAAC,IAAI;YACb,IAAI,EAAE,MAAM;YACZ,kDAAkD;YAClD,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC;YACf,MAAM,CAAC,OAAO,CAAC,GAAG,yBAAY,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAClD;aAAM;YACH,MAAM,CAAC,cAAc,CAAC,GAAG,yBAAY,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;SAC/E;QAGD,OAAO,8CAAM,SAAS,EAAC,WAAW;YAC9B,+CAAO,OAAO,EAAE,IAAI,CAAC,IAAI,IAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAS;YAMrD,wDAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAC,IAAM,MAAM,EAAG,CACtF,CAAA;IACX,CAAC;IACL,eAAC;AAAD,CAAC,AA7CD,CAA8B,qBAAK,CAAC,SAAS,GA6C5C;AA7CY,4BAAQ;AA+CrB,kBAAe,QAAQ,CAAC","sourcesContent":["/**\r\n * Created by glenn on 6/14/2017.\r\n */\r\n\r\n\r\nimport {React} from './reactAndRedux';\r\nimport $ = require(\"jquery\");\r\nwindow['$'] = window['jQuery'] = $; // notice the definition of global variables here\r\nimport 'jqueryui';\r\nimport makeGuid from '../util/makeGuid';\r\n\r\n\r\nimport {dateToString, stringToDate} from './helpers/dateFormat';\r\n\r\nexport interface iDatePick{\r\n label: string;\r\n id?: string;\r\n initialDate?: Date;\r\n change: (val: Date) => any;\r\n val?: Date\r\n}\r\n\r\n/**\r\n * params label, id, initialDate, change callback with value as string\r\n */\r\nexport class DatePick extends React.Component<iDatePick, null> {\r\n private elId: string;\r\n\r\n constructor(props: iDatePick, context: Object){\r\n super(props, context);\r\n this.elId = this.props.id || makeGuid();\r\n }\r\n\r\n componentDidMount() {\r\n let $el = $('#' + this.elId);\r\n\r\n $el.datepicker(\r\n {\r\n onSelect: () => {\r\n this.props.change(stringToDate($el.val() as string));\r\n }\r\n }\r\n );\r\n }\r\n\r\n render() {\r\n let params = {\r\n id: this.elId,\r\n type: 'text',\r\n // style: {margin: \"0 10px 0 5px\", width: '73px'},\r\n readOnly: true\r\n };\r\n\r\n if (this.props.val){\r\n params['value'] = dateToString(this.props.val);\r\n } else {\r\n params['defaultValue'] = dateToString(this.props.initialDate || new Date());\r\n }\r\n\r\n\r\n return <span className=\"date-pick\">\r\n <label htmlFor={this.elId}>{this.props.label}</label>\r\n {/*<input id={this.elId} type=\"text\"*/}\r\n {/*style={{margin: \"0 10px 0 5px\", width: '73px', textAlign: 'center'}}*/}\r\n {/*defaultValue={dateToString(this.props.initialDate || new Date())}*/}\r\n {/*readOnly={true}*/}\r\n {/*/>*/}\r\n <input style={{textAlign: 'center', margin: \"0 10px 0 5px\", width: '73px'}} {...params}/>\r\n </span>\r\n }\r\n}\r\n\r\nexport default DatePick;"]}
\ No newline at end of file \ No newline at end of file
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
import {React} from './reactAndRedux'; import {React} from './reactAndRedux';
import $ = require('jquery'); import $ = require("jquery");
window['$'] = window['jQuery'] = $; // notice the definition of global variables here
import 'jqueryui'; import 'jqueryui';
import makeGuid from '../util/makeGuid'; import makeGuid from '../util/makeGuid';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment