Skip to content
Snippets Groups Projects
DatePick.js.map 3.51 KiB
Newer Older
Glenn Vorhes's avatar
Glenn Vorhes committed
{"version":3,"file":"DatePick.js","sourceRoot":"","sources":["../../src/reactComponents/DatePick.tsx"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,+BAAgC;AAEhC,4BAA6B;AAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,iDAAiD;AACrF,oBAAkB;AAClB,+CAAwC;AAGxC,qDAAgE;AAUhE;;GAEG;AACH,MAAa,QAAS,SAAQ,KAAK,CAAC,SAA0B;IAG1D,YAAY,KAAgB,EAAE,OAAe;QACzC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,kBAAQ,EAAE,CAAC;IAC5C,CAAC;IAED,iBAAiB;QACb,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7B,GAAG,CAAC,UAAU,CACV;YACI,QAAQ,EAAE,GAAG,EAAE;gBACX,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAY,CAAC,GAAG,CAAC,GAAG,EAAY,CAAC,CAAC,CAAC;YACzD,CAAC;SACJ,CACJ,CAAC;IACN,CAAC;IAED,MAAM;QACF,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,8BAAM,SAAS,EAAC,WAAW;YAC9B,+BAAO,OAAO,EAAE,IAAI,CAAC,IAAI,IAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAS;YAMrD,6CAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAC,IAAM,MAAM,EAAG,CACtF,CAAA;IACX,CAAC;CACJ;AA7CD,4BA6CC;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["/**\r\n * Created by glenn on 6/14/2017.\r\n */\r\n\r\n\r\nimport React = require(\"react\");\r\n\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;"]}