index.js 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158
  1. function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  2. var React$1 = require('react');
  3. var React$1__default = _interopDefault(React$1);
  4. var core = require('@material-ui/core');
  5. var styles = require('@material-ui/core/styles');
  6. require('@material-ui/icons/Save');
  7. require('@material-ui/icons/Cancel');
  8. var Table = _interopDefault(require('@material-ui/core/Table'));
  9. var TableBody = _interopDefault(require('@material-ui/core/TableBody'));
  10. var TableCell = _interopDefault(require('@material-ui/core/TableCell'));
  11. var TableContainer = _interopDefault(require('@material-ui/core/TableContainer'));
  12. var TableHead = _interopDefault(require('@material-ui/core/TableHead'));
  13. var TablePagination = _interopDefault(require('@material-ui/core/TablePagination'));
  14. var TableRow = _interopDefault(require('@material-ui/core/TableRow'));
  15. var TableSortLabel = _interopDefault(require('@material-ui/core/TableSortLabel'));
  16. function List(_ref) {
  17. var groupName = _ref.groupName,
  18. _ref$members = _ref.members,
  19. members = _ref$members === void 0 ? [] : _ref$members;
  20. return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("h1", null, "1.0.3"), /*#__PURE__*/React$1__default.createElement("h5", null, "Group: ", /*#__PURE__*/React$1__default.createElement("em", null, groupName)), /*#__PURE__*/React$1__default.createElement("ul", null, /*#__PURE__*/React$1__default.createElement("p", null, "Members"), members.map(function (member) {
  21. return /*#__PURE__*/React$1__default.createElement("li", {
  22. key: member
  23. }, member);
  24. })));
  25. }
  26. function _extends() {
  27. _extends = Object.assign || function (target) {
  28. for (var i = 1; i < arguments.length; i++) {
  29. var source = arguments[i];
  30. for (var key in source) {
  31. if (Object.prototype.hasOwnProperty.call(source, key)) {
  32. target[key] = source[key];
  33. }
  34. }
  35. }
  36. return target;
  37. };
  38. return _extends.apply(this, arguments);
  39. }
  40. function createCommonjsModule(fn, module) {
  41. return module = { exports: {} }, fn(module, module.exports), module.exports;
  42. }
  43. /** @license React v16.13.1
  44. * react-is.production.min.js
  45. *
  46. * Copyright (c) Facebook, Inc. and its affiliates.
  47. *
  48. * This source code is licensed under the MIT license found in the
  49. * LICENSE file in the root directory of this source tree.
  50. */
  51. var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
  52. Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
  53. function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
  54. var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
  55. var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
  56. var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
  57. var reactIs_production_min = {
  58. AsyncMode: AsyncMode,
  59. ConcurrentMode: ConcurrentMode,
  60. ContextConsumer: ContextConsumer,
  61. ContextProvider: ContextProvider,
  62. Element: Element,
  63. ForwardRef: ForwardRef,
  64. Fragment: Fragment,
  65. Lazy: Lazy,
  66. Memo: Memo,
  67. Portal: Portal,
  68. Profiler: Profiler,
  69. StrictMode: StrictMode,
  70. Suspense: Suspense,
  71. isAsyncMode: isAsyncMode,
  72. isConcurrentMode: isConcurrentMode,
  73. isContextConsumer: isContextConsumer,
  74. isContextProvider: isContextProvider,
  75. isElement: isElement,
  76. isForwardRef: isForwardRef,
  77. isFragment: isFragment,
  78. isLazy: isLazy,
  79. isMemo: isMemo,
  80. isPortal: isPortal,
  81. isProfiler: isProfiler,
  82. isStrictMode: isStrictMode,
  83. isSuspense: isSuspense,
  84. isValidElementType: isValidElementType,
  85. typeOf: typeOf
  86. };
  87. var reactIs_development = createCommonjsModule(function (module, exports) {
  88. if (process.env.NODE_ENV !== "production") {
  89. (function() {
  90. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  91. // nor polyfill, then a plain number is used for performance.
  92. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  93. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  94. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  95. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  96. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  97. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  98. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  99. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  100. // (unstable) APIs that have been removed. Can we remove the symbols?
  101. var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
  102. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  103. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  104. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  105. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  106. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  107. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  108. var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  109. var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
  110. var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
  111. var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
  112. function isValidElementType(type) {
  113. return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
  114. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
  115. }
  116. function typeOf(object) {
  117. if (typeof object === 'object' && object !== null) {
  118. var $$typeof = object.$$typeof;
  119. switch ($$typeof) {
  120. case REACT_ELEMENT_TYPE:
  121. var type = object.type;
  122. switch (type) {
  123. case REACT_ASYNC_MODE_TYPE:
  124. case REACT_CONCURRENT_MODE_TYPE:
  125. case REACT_FRAGMENT_TYPE:
  126. case REACT_PROFILER_TYPE:
  127. case REACT_STRICT_MODE_TYPE:
  128. case REACT_SUSPENSE_TYPE:
  129. return type;
  130. default:
  131. var $$typeofType = type && type.$$typeof;
  132. switch ($$typeofType) {
  133. case REACT_CONTEXT_TYPE:
  134. case REACT_FORWARD_REF_TYPE:
  135. case REACT_LAZY_TYPE:
  136. case REACT_MEMO_TYPE:
  137. case REACT_PROVIDER_TYPE:
  138. return $$typeofType;
  139. default:
  140. return $$typeof;
  141. }
  142. }
  143. case REACT_PORTAL_TYPE:
  144. return $$typeof;
  145. }
  146. }
  147. return undefined;
  148. } // AsyncMode is deprecated along with isAsyncMode
  149. var AsyncMode = REACT_ASYNC_MODE_TYPE;
  150. var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
  151. var ContextConsumer = REACT_CONTEXT_TYPE;
  152. var ContextProvider = REACT_PROVIDER_TYPE;
  153. var Element = REACT_ELEMENT_TYPE;
  154. var ForwardRef = REACT_FORWARD_REF_TYPE;
  155. var Fragment = REACT_FRAGMENT_TYPE;
  156. var Lazy = REACT_LAZY_TYPE;
  157. var Memo = REACT_MEMO_TYPE;
  158. var Portal = REACT_PORTAL_TYPE;
  159. var Profiler = REACT_PROFILER_TYPE;
  160. var StrictMode = REACT_STRICT_MODE_TYPE;
  161. var Suspense = REACT_SUSPENSE_TYPE;
  162. var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
  163. function isAsyncMode(object) {
  164. {
  165. if (!hasWarnedAboutDeprecatedIsAsyncMode) {
  166. hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
  167. console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
  168. }
  169. }
  170. return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
  171. }
  172. function isConcurrentMode(object) {
  173. return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
  174. }
  175. function isContextConsumer(object) {
  176. return typeOf(object) === REACT_CONTEXT_TYPE;
  177. }
  178. function isContextProvider(object) {
  179. return typeOf(object) === REACT_PROVIDER_TYPE;
  180. }
  181. function isElement(object) {
  182. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  183. }
  184. function isForwardRef(object) {
  185. return typeOf(object) === REACT_FORWARD_REF_TYPE;
  186. }
  187. function isFragment(object) {
  188. return typeOf(object) === REACT_FRAGMENT_TYPE;
  189. }
  190. function isLazy(object) {
  191. return typeOf(object) === REACT_LAZY_TYPE;
  192. }
  193. function isMemo(object) {
  194. return typeOf(object) === REACT_MEMO_TYPE;
  195. }
  196. function isPortal(object) {
  197. return typeOf(object) === REACT_PORTAL_TYPE;
  198. }
  199. function isProfiler(object) {
  200. return typeOf(object) === REACT_PROFILER_TYPE;
  201. }
  202. function isStrictMode(object) {
  203. return typeOf(object) === REACT_STRICT_MODE_TYPE;
  204. }
  205. function isSuspense(object) {
  206. return typeOf(object) === REACT_SUSPENSE_TYPE;
  207. }
  208. exports.AsyncMode = AsyncMode;
  209. exports.ConcurrentMode = ConcurrentMode;
  210. exports.ContextConsumer = ContextConsumer;
  211. exports.ContextProvider = ContextProvider;
  212. exports.Element = Element;
  213. exports.ForwardRef = ForwardRef;
  214. exports.Fragment = Fragment;
  215. exports.Lazy = Lazy;
  216. exports.Memo = Memo;
  217. exports.Portal = Portal;
  218. exports.Profiler = Profiler;
  219. exports.StrictMode = StrictMode;
  220. exports.Suspense = Suspense;
  221. exports.isAsyncMode = isAsyncMode;
  222. exports.isConcurrentMode = isConcurrentMode;
  223. exports.isContextConsumer = isContextConsumer;
  224. exports.isContextProvider = isContextProvider;
  225. exports.isElement = isElement;
  226. exports.isForwardRef = isForwardRef;
  227. exports.isFragment = isFragment;
  228. exports.isLazy = isLazy;
  229. exports.isMemo = isMemo;
  230. exports.isPortal = isPortal;
  231. exports.isProfiler = isProfiler;
  232. exports.isStrictMode = isStrictMode;
  233. exports.isSuspense = isSuspense;
  234. exports.isValidElementType = isValidElementType;
  235. exports.typeOf = typeOf;
  236. })();
  237. }
  238. });
  239. var reactIs = createCommonjsModule(function (module) {
  240. if (process.env.NODE_ENV === 'production') {
  241. module.exports = reactIs_production_min;
  242. } else {
  243. module.exports = reactIs_development;
  244. }
  245. });
  246. /*
  247. object-assign
  248. (c) Sindre Sorhus
  249. @license MIT
  250. */
  251. /* eslint-disable no-unused-vars */
  252. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  253. var hasOwnProperty = Object.prototype.hasOwnProperty;
  254. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  255. function toObject(val) {
  256. if (val === null || val === undefined) {
  257. throw new TypeError('Object.assign cannot be called with null or undefined');
  258. }
  259. return Object(val);
  260. }
  261. function shouldUseNative() {
  262. try {
  263. if (!Object.assign) {
  264. return false;
  265. }
  266. // Detect buggy property enumeration order in older V8 versions.
  267. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  268. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  269. test1[5] = 'de';
  270. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  271. return false;
  272. }
  273. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  274. var test2 = {};
  275. for (var i = 0; i < 10; i++) {
  276. test2['_' + String.fromCharCode(i)] = i;
  277. }
  278. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  279. return test2[n];
  280. });
  281. if (order2.join('') !== '0123456789') {
  282. return false;
  283. }
  284. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  285. var test3 = {};
  286. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  287. test3[letter] = letter;
  288. });
  289. if (Object.keys(Object.assign({}, test3)).join('') !==
  290. 'abcdefghijklmnopqrst') {
  291. return false;
  292. }
  293. return true;
  294. } catch (err) {
  295. // We don't expect any of the above to throw, but better to be safe.
  296. return false;
  297. }
  298. }
  299. var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
  300. var from;
  301. var to = toObject(target);
  302. var symbols;
  303. for (var s = 1; s < arguments.length; s++) {
  304. from = Object(arguments[s]);
  305. for (var key in from) {
  306. if (hasOwnProperty.call(from, key)) {
  307. to[key] = from[key];
  308. }
  309. }
  310. if (getOwnPropertySymbols) {
  311. symbols = getOwnPropertySymbols(from);
  312. for (var i = 0; i < symbols.length; i++) {
  313. if (propIsEnumerable.call(from, symbols[i])) {
  314. to[symbols[i]] = from[symbols[i]];
  315. }
  316. }
  317. }
  318. }
  319. return to;
  320. };
  321. /**
  322. * Copyright (c) 2013-present, Facebook, Inc.
  323. *
  324. * This source code is licensed under the MIT license found in the
  325. * LICENSE file in the root directory of this source tree.
  326. */
  327. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  328. var ReactPropTypesSecret_1 = ReactPropTypesSecret;
  329. var printWarning = function() {};
  330. if (process.env.NODE_ENV !== 'production') {
  331. var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
  332. var loggedTypeFailures = {};
  333. var has = Function.call.bind(Object.prototype.hasOwnProperty);
  334. printWarning = function(text) {
  335. var message = 'Warning: ' + text;
  336. if (typeof console !== 'undefined') {
  337. console.error(message);
  338. }
  339. try {
  340. // --- Welcome to debugging React ---
  341. // This error was thrown as a convenience so that you can use this stack
  342. // to find the callsite that caused this warning to fire.
  343. throw new Error(message);
  344. } catch (x) {}
  345. };
  346. }
  347. /**
  348. * Assert that the values match with the type specs.
  349. * Error messages are memorized and will only be shown once.
  350. *
  351. * @param {object} typeSpecs Map of name to a ReactPropType
  352. * @param {object} values Runtime values that need to be type-checked
  353. * @param {string} location e.g. "prop", "context", "child context"
  354. * @param {string} componentName Name of the component for error messages.
  355. * @param {?Function} getStack Returns the component stack.
  356. * @private
  357. */
  358. function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
  359. if (process.env.NODE_ENV !== 'production') {
  360. for (var typeSpecName in typeSpecs) {
  361. if (has(typeSpecs, typeSpecName)) {
  362. var error;
  363. // Prop type validation may throw. In case they do, we don't want to
  364. // fail the render phase where it didn't fail before. So we log it.
  365. // After these have been cleaned up, we'll let them throw.
  366. try {
  367. // This is intentionally an invariant that gets caught. It's the same
  368. // behavior as without this statement except with a better message.
  369. if (typeof typeSpecs[typeSpecName] !== 'function') {
  370. var err = Error(
  371. (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
  372. 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
  373. );
  374. err.name = 'Invariant Violation';
  375. throw err;
  376. }
  377. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
  378. } catch (ex) {
  379. error = ex;
  380. }
  381. if (error && !(error instanceof Error)) {
  382. printWarning(
  383. (componentName || 'React class') + ': type specification of ' +
  384. location + ' `' + typeSpecName + '` is invalid; the type checker ' +
  385. 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
  386. 'You may have forgotten to pass an argument to the type checker ' +
  387. 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
  388. 'shape all require an argument).'
  389. );
  390. }
  391. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  392. // Only monitor this failure once because there tends to be a lot of the
  393. // same error.
  394. loggedTypeFailures[error.message] = true;
  395. var stack = getStack ? getStack() : '';
  396. printWarning(
  397. 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
  398. );
  399. }
  400. }
  401. }
  402. }
  403. }
  404. /**
  405. * Resets warning cache when testing.
  406. *
  407. * @private
  408. */
  409. checkPropTypes.resetWarningCache = function() {
  410. if (process.env.NODE_ENV !== 'production') {
  411. loggedTypeFailures = {};
  412. }
  413. };
  414. var checkPropTypes_1 = checkPropTypes;
  415. var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
  416. var printWarning$1 = function() {};
  417. if (process.env.NODE_ENV !== 'production') {
  418. printWarning$1 = function(text) {
  419. var message = 'Warning: ' + text;
  420. if (typeof console !== 'undefined') {
  421. console.error(message);
  422. }
  423. try {
  424. // --- Welcome to debugging React ---
  425. // This error was thrown as a convenience so that you can use this stack
  426. // to find the callsite that caused this warning to fire.
  427. throw new Error(message);
  428. } catch (x) {}
  429. };
  430. }
  431. function emptyFunctionThatReturnsNull() {
  432. return null;
  433. }
  434. var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
  435. /* global Symbol */
  436. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  437. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  438. /**
  439. * Returns the iterator method function contained on the iterable object.
  440. *
  441. * Be sure to invoke the function with the iterable as context:
  442. *
  443. * var iteratorFn = getIteratorFn(myIterable);
  444. * if (iteratorFn) {
  445. * var iterator = iteratorFn.call(myIterable);
  446. * ...
  447. * }
  448. *
  449. * @param {?object} maybeIterable
  450. * @return {?function}
  451. */
  452. function getIteratorFn(maybeIterable) {
  453. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  454. if (typeof iteratorFn === 'function') {
  455. return iteratorFn;
  456. }
  457. }
  458. /**
  459. * Collection of methods that allow declaration and validation of props that are
  460. * supplied to React components. Example usage:
  461. *
  462. * var Props = require('ReactPropTypes');
  463. * var MyArticle = React.createClass({
  464. * propTypes: {
  465. * // An optional string prop named "description".
  466. * description: Props.string,
  467. *
  468. * // A required enum prop named "category".
  469. * category: Props.oneOf(['News','Photos']).isRequired,
  470. *
  471. * // A prop named "dialog" that requires an instance of Dialog.
  472. * dialog: Props.instanceOf(Dialog).isRequired
  473. * },
  474. * render: function() { ... }
  475. * });
  476. *
  477. * A more formal specification of how these methods are used:
  478. *
  479. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  480. * decl := ReactPropTypes.{type}(.isRequired)?
  481. *
  482. * Each and every declaration produces a function with the same signature. This
  483. * allows the creation of custom validation functions. For example:
  484. *
  485. * var MyLink = React.createClass({
  486. * propTypes: {
  487. * // An optional string or URI prop named "href".
  488. * href: function(props, propName, componentName) {
  489. * var propValue = props[propName];
  490. * if (propValue != null && typeof propValue !== 'string' &&
  491. * !(propValue instanceof URI)) {
  492. * return new Error(
  493. * 'Expected a string or an URI for ' + propName + ' in ' +
  494. * componentName
  495. * );
  496. * }
  497. * }
  498. * },
  499. * render: function() {...}
  500. * });
  501. *
  502. * @internal
  503. */
  504. var ANONYMOUS = '<<anonymous>>';
  505. // Important!
  506. // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  507. var ReactPropTypes = {
  508. array: createPrimitiveTypeChecker('array'),
  509. bool: createPrimitiveTypeChecker('boolean'),
  510. func: createPrimitiveTypeChecker('function'),
  511. number: createPrimitiveTypeChecker('number'),
  512. object: createPrimitiveTypeChecker('object'),
  513. string: createPrimitiveTypeChecker('string'),
  514. symbol: createPrimitiveTypeChecker('symbol'),
  515. any: createAnyTypeChecker(),
  516. arrayOf: createArrayOfTypeChecker,
  517. element: createElementTypeChecker(),
  518. elementType: createElementTypeTypeChecker(),
  519. instanceOf: createInstanceTypeChecker,
  520. node: createNodeChecker(),
  521. objectOf: createObjectOfTypeChecker,
  522. oneOf: createEnumTypeChecker,
  523. oneOfType: createUnionTypeChecker,
  524. shape: createShapeTypeChecker,
  525. exact: createStrictShapeTypeChecker,
  526. };
  527. /**
  528. * inlined Object.is polyfill to avoid requiring consumers ship their own
  529. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  530. */
  531. /*eslint-disable no-self-compare*/
  532. function is(x, y) {
  533. // SameValue algorithm
  534. if (x === y) {
  535. // Steps 1-5, 7-10
  536. // Steps 6.b-6.e: +0 != -0
  537. return x !== 0 || 1 / x === 1 / y;
  538. } else {
  539. // Step 6.a: NaN == NaN
  540. return x !== x && y !== y;
  541. }
  542. }
  543. /*eslint-enable no-self-compare*/
  544. /**
  545. * We use an Error-like object for backward compatibility as people may call
  546. * PropTypes directly and inspect their output. However, we don't use real
  547. * Errors anymore. We don't inspect their stack anyway, and creating them
  548. * is prohibitively expensive if they are created too often, such as what
  549. * happens in oneOfType() for any type before the one that matched.
  550. */
  551. function PropTypeError(message) {
  552. this.message = message;
  553. this.stack = '';
  554. }
  555. // Make `instanceof Error` still work for returned errors.
  556. PropTypeError.prototype = Error.prototype;
  557. function createChainableTypeChecker(validate) {
  558. if (process.env.NODE_ENV !== 'production') {
  559. var manualPropTypeCallCache = {};
  560. var manualPropTypeWarningCount = 0;
  561. }
  562. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  563. componentName = componentName || ANONYMOUS;
  564. propFullName = propFullName || propName;
  565. if (secret !== ReactPropTypesSecret_1) {
  566. if (throwOnDirectAccess) {
  567. // New behavior only for users of `prop-types` package
  568. var err = new Error(
  569. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  570. 'Use `PropTypes.checkPropTypes()` to call them. ' +
  571. 'Read more at http://fb.me/use-check-prop-types'
  572. );
  573. err.name = 'Invariant Violation';
  574. throw err;
  575. } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
  576. // Old behavior for people using React.PropTypes
  577. var cacheKey = componentName + ':' + propName;
  578. if (
  579. !manualPropTypeCallCache[cacheKey] &&
  580. // Avoid spamming the console because they are often not actionable except for lib authors
  581. manualPropTypeWarningCount < 3
  582. ) {
  583. printWarning$1(
  584. 'You are manually calling a React.PropTypes validation ' +
  585. 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
  586. 'and will throw in the standalone `prop-types` package. ' +
  587. 'You may be seeing this warning due to a third-party PropTypes ' +
  588. 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
  589. );
  590. manualPropTypeCallCache[cacheKey] = true;
  591. manualPropTypeWarningCount++;
  592. }
  593. }
  594. }
  595. if (props[propName] == null) {
  596. if (isRequired) {
  597. if (props[propName] === null) {
  598. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  599. }
  600. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  601. }
  602. return null;
  603. } else {
  604. return validate(props, propName, componentName, location, propFullName);
  605. }
  606. }
  607. var chainedCheckType = checkType.bind(null, false);
  608. chainedCheckType.isRequired = checkType.bind(null, true);
  609. return chainedCheckType;
  610. }
  611. function createPrimitiveTypeChecker(expectedType) {
  612. function validate(props, propName, componentName, location, propFullName, secret) {
  613. var propValue = props[propName];
  614. var propType = getPropType(propValue);
  615. if (propType !== expectedType) {
  616. // `propValue` being instance of, say, date/regexp, pass the 'object'
  617. // check, but we can offer a more precise error message here rather than
  618. // 'of type `object`'.
  619. var preciseType = getPreciseType(propValue);
  620. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  621. }
  622. return null;
  623. }
  624. return createChainableTypeChecker(validate);
  625. }
  626. function createAnyTypeChecker() {
  627. return createChainableTypeChecker(emptyFunctionThatReturnsNull);
  628. }
  629. function createArrayOfTypeChecker(typeChecker) {
  630. function validate(props, propName, componentName, location, propFullName) {
  631. if (typeof typeChecker !== 'function') {
  632. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  633. }
  634. var propValue = props[propName];
  635. if (!Array.isArray(propValue)) {
  636. var propType = getPropType(propValue);
  637. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  638. }
  639. for (var i = 0; i < propValue.length; i++) {
  640. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
  641. if (error instanceof Error) {
  642. return error;
  643. }
  644. }
  645. return null;
  646. }
  647. return createChainableTypeChecker(validate);
  648. }
  649. function createElementTypeChecker() {
  650. function validate(props, propName, componentName, location, propFullName) {
  651. var propValue = props[propName];
  652. if (!isValidElement(propValue)) {
  653. var propType = getPropType(propValue);
  654. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  655. }
  656. return null;
  657. }
  658. return createChainableTypeChecker(validate);
  659. }
  660. function createElementTypeTypeChecker() {
  661. function validate(props, propName, componentName, location, propFullName) {
  662. var propValue = props[propName];
  663. if (!reactIs.isValidElementType(propValue)) {
  664. var propType = getPropType(propValue);
  665. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
  666. }
  667. return null;
  668. }
  669. return createChainableTypeChecker(validate);
  670. }
  671. function createInstanceTypeChecker(expectedClass) {
  672. function validate(props, propName, componentName, location, propFullName) {
  673. if (!(props[propName] instanceof expectedClass)) {
  674. var expectedClassName = expectedClass.name || ANONYMOUS;
  675. var actualClassName = getClassName(props[propName]);
  676. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  677. }
  678. return null;
  679. }
  680. return createChainableTypeChecker(validate);
  681. }
  682. function createEnumTypeChecker(expectedValues) {
  683. if (!Array.isArray(expectedValues)) {
  684. if (process.env.NODE_ENV !== 'production') {
  685. if (arguments.length > 1) {
  686. printWarning$1(
  687. 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
  688. 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
  689. );
  690. } else {
  691. printWarning$1('Invalid argument supplied to oneOf, expected an array.');
  692. }
  693. }
  694. return emptyFunctionThatReturnsNull;
  695. }
  696. function validate(props, propName, componentName, location, propFullName) {
  697. var propValue = props[propName];
  698. for (var i = 0; i < expectedValues.length; i++) {
  699. if (is(propValue, expectedValues[i])) {
  700. return null;
  701. }
  702. }
  703. var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
  704. var type = getPreciseType(value);
  705. if (type === 'symbol') {
  706. return String(value);
  707. }
  708. return value;
  709. });
  710. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  711. }
  712. return createChainableTypeChecker(validate);
  713. }
  714. function createObjectOfTypeChecker(typeChecker) {
  715. function validate(props, propName, componentName, location, propFullName) {
  716. if (typeof typeChecker !== 'function') {
  717. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  718. }
  719. var propValue = props[propName];
  720. var propType = getPropType(propValue);
  721. if (propType !== 'object') {
  722. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  723. }
  724. for (var key in propValue) {
  725. if (has$1(propValue, key)) {
  726. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
  727. if (error instanceof Error) {
  728. return error;
  729. }
  730. }
  731. }
  732. return null;
  733. }
  734. return createChainableTypeChecker(validate);
  735. }
  736. function createUnionTypeChecker(arrayOfTypeCheckers) {
  737. if (!Array.isArray(arrayOfTypeCheckers)) {
  738. process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  739. return emptyFunctionThatReturnsNull;
  740. }
  741. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  742. var checker = arrayOfTypeCheckers[i];
  743. if (typeof checker !== 'function') {
  744. printWarning$1(
  745. 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
  746. 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
  747. );
  748. return emptyFunctionThatReturnsNull;
  749. }
  750. }
  751. function validate(props, propName, componentName, location, propFullName) {
  752. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  753. var checker = arrayOfTypeCheckers[i];
  754. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
  755. return null;
  756. }
  757. }
  758. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  759. }
  760. return createChainableTypeChecker(validate);
  761. }
  762. function createNodeChecker() {
  763. function validate(props, propName, componentName, location, propFullName) {
  764. if (!isNode(props[propName])) {
  765. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  766. }
  767. return null;
  768. }
  769. return createChainableTypeChecker(validate);
  770. }
  771. function createShapeTypeChecker(shapeTypes) {
  772. function validate(props, propName, componentName, location, propFullName) {
  773. var propValue = props[propName];
  774. var propType = getPropType(propValue);
  775. if (propType !== 'object') {
  776. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  777. }
  778. for (var key in shapeTypes) {
  779. var checker = shapeTypes[key];
  780. if (!checker) {
  781. continue;
  782. }
  783. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
  784. if (error) {
  785. return error;
  786. }
  787. }
  788. return null;
  789. }
  790. return createChainableTypeChecker(validate);
  791. }
  792. function createStrictShapeTypeChecker(shapeTypes) {
  793. function validate(props, propName, componentName, location, propFullName) {
  794. var propValue = props[propName];
  795. var propType = getPropType(propValue);
  796. if (propType !== 'object') {
  797. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  798. }
  799. // We need to check all keys in case some are required but missing from
  800. // props.
  801. var allKeys = objectAssign({}, props[propName], shapeTypes);
  802. for (var key in allKeys) {
  803. var checker = shapeTypes[key];
  804. if (!checker) {
  805. return new PropTypeError(
  806. 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
  807. '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
  808. '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
  809. );
  810. }
  811. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
  812. if (error) {
  813. return error;
  814. }
  815. }
  816. return null;
  817. }
  818. return createChainableTypeChecker(validate);
  819. }
  820. function isNode(propValue) {
  821. switch (typeof propValue) {
  822. case 'number':
  823. case 'string':
  824. case 'undefined':
  825. return true;
  826. case 'boolean':
  827. return !propValue;
  828. case 'object':
  829. if (Array.isArray(propValue)) {
  830. return propValue.every(isNode);
  831. }
  832. if (propValue === null || isValidElement(propValue)) {
  833. return true;
  834. }
  835. var iteratorFn = getIteratorFn(propValue);
  836. if (iteratorFn) {
  837. var iterator = iteratorFn.call(propValue);
  838. var step;
  839. if (iteratorFn !== propValue.entries) {
  840. while (!(step = iterator.next()).done) {
  841. if (!isNode(step.value)) {
  842. return false;
  843. }
  844. }
  845. } else {
  846. // Iterator will provide entry [k,v] tuples rather than values.
  847. while (!(step = iterator.next()).done) {
  848. var entry = step.value;
  849. if (entry) {
  850. if (!isNode(entry[1])) {
  851. return false;
  852. }
  853. }
  854. }
  855. }
  856. } else {
  857. return false;
  858. }
  859. return true;
  860. default:
  861. return false;
  862. }
  863. }
  864. function isSymbol(propType, propValue) {
  865. // Native Symbol.
  866. if (propType === 'symbol') {
  867. return true;
  868. }
  869. // falsy value can't be a Symbol
  870. if (!propValue) {
  871. return false;
  872. }
  873. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  874. if (propValue['@@toStringTag'] === 'Symbol') {
  875. return true;
  876. }
  877. // Fallback for non-spec compliant Symbols which are polyfilled.
  878. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  879. return true;
  880. }
  881. return false;
  882. }
  883. // Equivalent of `typeof` but with special handling for array and regexp.
  884. function getPropType(propValue) {
  885. var propType = typeof propValue;
  886. if (Array.isArray(propValue)) {
  887. return 'array';
  888. }
  889. if (propValue instanceof RegExp) {
  890. // Old webkits (at least until Android 4.0) return 'function' rather than
  891. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  892. // passes PropTypes.object.
  893. return 'object';
  894. }
  895. if (isSymbol(propType, propValue)) {
  896. return 'symbol';
  897. }
  898. return propType;
  899. }
  900. // This handles more types than `getPropType`. Only used for error messages.
  901. // See `createPrimitiveTypeChecker`.
  902. function getPreciseType(propValue) {
  903. if (typeof propValue === 'undefined' || propValue === null) {
  904. return '' + propValue;
  905. }
  906. var propType = getPropType(propValue);
  907. if (propType === 'object') {
  908. if (propValue instanceof Date) {
  909. return 'date';
  910. } else if (propValue instanceof RegExp) {
  911. return 'regexp';
  912. }
  913. }
  914. return propType;
  915. }
  916. // Returns a string that is postfixed to a warning about an invalid type.
  917. // For example, "undefined" or "of type array"
  918. function getPostfixForTypeWarning(value) {
  919. var type = getPreciseType(value);
  920. switch (type) {
  921. case 'array':
  922. case 'object':
  923. return 'an ' + type;
  924. case 'boolean':
  925. case 'date':
  926. case 'regexp':
  927. return 'a ' + type;
  928. default:
  929. return type;
  930. }
  931. }
  932. // Returns class name of the object, if any.
  933. function getClassName(propValue) {
  934. if (!propValue.constructor || !propValue.constructor.name) {
  935. return ANONYMOUS;
  936. }
  937. return propValue.constructor.name;
  938. }
  939. ReactPropTypes.checkPropTypes = checkPropTypes_1;
  940. ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
  941. ReactPropTypes.PropTypes = ReactPropTypes;
  942. return ReactPropTypes;
  943. };
  944. function emptyFunction() {}
  945. function emptyFunctionWithReset() {}
  946. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  947. var factoryWithThrowingShims = function() {
  948. function shim(props, propName, componentName, location, propFullName, secret) {
  949. if (secret === ReactPropTypesSecret_1) {
  950. // It is still safe when called from React.
  951. return;
  952. }
  953. var err = new Error(
  954. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  955. 'Use PropTypes.checkPropTypes() to call them. ' +
  956. 'Read more at http://fb.me/use-check-prop-types'
  957. );
  958. err.name = 'Invariant Violation';
  959. throw err;
  960. } shim.isRequired = shim;
  961. function getShim() {
  962. return shim;
  963. } // Important!
  964. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  965. var ReactPropTypes = {
  966. array: shim,
  967. bool: shim,
  968. func: shim,
  969. number: shim,
  970. object: shim,
  971. string: shim,
  972. symbol: shim,
  973. any: shim,
  974. arrayOf: getShim,
  975. element: shim,
  976. elementType: shim,
  977. instanceOf: getShim,
  978. node: shim,
  979. objectOf: getShim,
  980. oneOf: getShim,
  981. oneOfType: getShim,
  982. shape: getShim,
  983. exact: getShim,
  984. checkPropTypes: emptyFunctionWithReset,
  985. resetWarningCache: emptyFunction
  986. };
  987. ReactPropTypes.PropTypes = ReactPropTypes;
  988. return ReactPropTypes;
  989. };
  990. var propTypes = createCommonjsModule(function (module) {
  991. /**
  992. * Copyright (c) 2013-present, Facebook, Inc.
  993. *
  994. * This source code is licensed under the MIT license found in the
  995. * LICENSE file in the root directory of this source tree.
  996. */
  997. if (process.env.NODE_ENV !== 'production') {
  998. var ReactIs = reactIs;
  999. // By explicitly using `prop-types` you are opting into new development behavior.
  1000. // http://fb.me/prop-types-in-prod
  1001. var throwOnDirectAccess = true;
  1002. module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
  1003. } else {
  1004. // By explicitly using `prop-types` you are opting into new production behavior.
  1005. // http://fb.me/prop-types-in-prod
  1006. module.exports = factoryWithThrowingShims();
  1007. }
  1008. });
  1009. var BootstrapInput = styles.withStyles(function (theme) {
  1010. return {
  1011. root: {
  1012. 'label + &': {
  1013. marginTop: theme.spacing(3)
  1014. }
  1015. },
  1016. input: {
  1017. borderRadius: 4,
  1018. position: 'relative',
  1019. backgroundColor: 'transparent',
  1020. border: '1px solid #ced4da',
  1021. fontSize: 16,
  1022. padding: '10px 26px 10px 12px',
  1023. transition: theme.transitions.create(['border-color', 'box-shadow']),
  1024. fontFamily: ['-apple-system', 'BlinkMacSystemFont', '"Segoe UI"', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif', '"Apple Color Emoji"', '"Segoe UI Emoji"', '"Segoe UI Symbol"'].join(','),
  1025. '&:focus': {
  1026. borderRadius: 4,
  1027. borderColor: '#80bdff',
  1028. boxShadow: '0 0 0 0.2rem rgba(0,123,255,.25)'
  1029. }
  1030. }
  1031. };
  1032. })(core.InputBase);
  1033. var useStyles = styles.makeStyles(function (theme) {
  1034. return {
  1035. root: {
  1036. width: '100%'
  1037. },
  1038. paper: {
  1039. width: '100%',
  1040. marginBottom: theme.spacing(2)
  1041. },
  1042. table: {
  1043. minWidth: 750
  1044. },
  1045. visuallyHidden: {
  1046. border: 0,
  1047. clip: 'rect(0 0 0 0)',
  1048. height: 1,
  1049. margin: -1,
  1050. overflow: 'hidden',
  1051. padding: 0,
  1052. position: 'absolute',
  1053. top: 20,
  1054. width: 1
  1055. },
  1056. underline: {
  1057. "&&&:before": {
  1058. borderBottom: "none"
  1059. },
  1060. "&&:after": {
  1061. borderBottom: "none"
  1062. }
  1063. }
  1064. };
  1065. });
  1066. function FieldList(props) {
  1067. var classes = useStyles();
  1068. var _props$fields = props.fields,
  1069. fields = _props$fields === void 0 ? [] : _props$fields,
  1070. _props$updateData = props.updateData,
  1071. updateData = _props$updateData === void 0 ? {} : _props$updateData,
  1072. onDataCallback = props.onDataCallback;
  1073. var _React$useState = React$1__default.useState(updateData != undefined ? updateData : {}),
  1074. data = _React$useState[0],
  1075. setDataField = _React$useState[1];
  1076. var _React$useState2 = React$1__default.useState(null),
  1077. imgPreview = _React$useState2[0],
  1078. setImgPreviewPath = _React$useState2[1];
  1079. var handleTextString = function handleTextString(e, fieldName) {
  1080. var _extends2;
  1081. setDataField(_extends({}, data, (_extends2 = {}, _extends2[fieldName] = e.target.value, _extends2)));
  1082. };
  1083. var handleTextNumber = function handleTextNumber(e, fieldName) {
  1084. var _extends3;
  1085. setDataField(_extends({}, data, (_extends3 = {}, _extends3[fieldName] = e.target.value, _extends3)));
  1086. };
  1087. var handleTextMultiline = function handleTextMultiline(e, fieldName) {
  1088. var _extends4;
  1089. setDataField(_extends({}, data, (_extends4 = {}, _extends4[fieldName] = e.target.value, _extends4)));
  1090. };
  1091. var handleDate = function handleDate(e, fieldName) {
  1092. var _extends5;
  1093. setDataField(_extends({}, data, (_extends5 = {}, _extends5[fieldName] = e.target.value, _extends5)));
  1094. };
  1095. var handleDropDownChange = function handleDropDownChange(e, fieldName) {
  1096. var _extends6;
  1097. var selectedIndex = e.target.options.selectedIndex;
  1098. var selectedValue = e.target.options[selectedIndex].getAttribute('name');
  1099. var fn = fieldName.split('_');
  1100. var fieldId = fn[0] + '_' + 'id';
  1101. setDataField(_extends({}, data, (_extends6 = {}, _extends6[fieldName] = selectedValue, _extends6[fieldId] = e.target.value, _extends6)));
  1102. };
  1103. var handleImgUpload = function handleImgUpload(e, fieldName) {
  1104. var _extends7;
  1105. e.preventDefault();
  1106. var reader = new FileReader();
  1107. var file = e.target.files[0];
  1108. reader.onloadend = function () {
  1109. setImgPreviewPath(reader.result);
  1110. };
  1111. reader.readAsDataURL(file);
  1112. setDataField(_extends({}, data, (_extends7 = {}, _extends7[fieldName] = e.target.files[0].name, _extends7)));
  1113. };
  1114. var handleDataConfirm = function handleDataConfirm() {
  1115. onDataCallback(data);
  1116. };
  1117. return /*#__PURE__*/React$1__default.createElement("div", {
  1118. className: classes.root
  1119. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1120. container: true
  1121. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1122. item: true,
  1123. xs: 11
  1124. }, fields.map(function (f, i) {
  1125. if (f.type == 'text_string') {
  1126. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1127. key: f.fieldName,
  1128. container: true,
  1129. style: {
  1130. display: 'flex',
  1131. alignItems: 'center',
  1132. marginBottom: '10px'
  1133. }
  1134. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1135. item: true,
  1136. xs: 12,
  1137. sm: 5
  1138. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1139. style: {
  1140. width: '150px'
  1141. }
  1142. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1143. style: {
  1144. paddingRight: '30px',
  1145. color: 'grey'
  1146. }
  1147. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1148. item: true,
  1149. xs: 12,
  1150. sm: 7
  1151. }, /*#__PURE__*/React$1__default.createElement(core.TextField, {
  1152. id: f.fieldName,
  1153. variant: "outlined",
  1154. autoComplete: "off",
  1155. size: "small",
  1156. style: {
  1157. width: '100%'
  1158. },
  1159. value: data != undefined ? data[f.fieldName] : null,
  1160. onChange: function onChange(e) {
  1161. return handleTextString(e, f.fieldName);
  1162. }
  1163. })));
  1164. } else if (f.type == 'text_number') {
  1165. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1166. key: f.fieldName,
  1167. container: true,
  1168. style: {
  1169. display: 'flex',
  1170. alignItems: 'center',
  1171. marginBottom: '10px'
  1172. }
  1173. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1174. item: true,
  1175. xs: 12,
  1176. sm: 5
  1177. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1178. style: {
  1179. width: '150px'
  1180. }
  1181. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1182. style: {
  1183. paddingRight: '30px',
  1184. color: 'grey'
  1185. }
  1186. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1187. item: true,
  1188. xs: 12,
  1189. sm: 7
  1190. }, /*#__PURE__*/React$1__default.createElement(core.TextField, {
  1191. id: f.fieldName,
  1192. variant: "outlined",
  1193. autoComplete: "off",
  1194. size: "small",
  1195. style: {
  1196. width: '100%'
  1197. },
  1198. type: "number",
  1199. value: data != undefined ? data[f.fieldName] : '',
  1200. onChange: function onChange(e) {
  1201. return handleTextNumber(e, f.fieldName);
  1202. }
  1203. })));
  1204. } else if (f.type == 'text_multiline') {
  1205. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1206. key: f.fieldName,
  1207. container: true,
  1208. style: {
  1209. display: 'flex',
  1210. alignItems: 'center',
  1211. marginBottom: '10px'
  1212. }
  1213. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1214. item: true,
  1215. xs: 12,
  1216. sm: 5
  1217. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1218. style: {
  1219. width: '150px'
  1220. }
  1221. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1222. style: {
  1223. paddingRight: '30px',
  1224. color: 'grey'
  1225. }
  1226. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1227. item: true,
  1228. xs: 12,
  1229. sm: 7
  1230. }, /*#__PURE__*/React$1__default.createElement(core.TextField, {
  1231. id: f.fieldName,
  1232. multiline: true,
  1233. autoComplete: "off",
  1234. rows: 3,
  1235. size: "small",
  1236. style: {
  1237. width: '100%'
  1238. },
  1239. value: data != undefined ? data[f.fieldName] : '',
  1240. variant: "outlined",
  1241. onChange: function onChange(e) {
  1242. return handleTextMultiline(e, f.fieldName);
  1243. }
  1244. })));
  1245. } else if (f.type == 'date') {
  1246. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1247. key: f.fieldName,
  1248. container: true,
  1249. style: {
  1250. display: 'flex',
  1251. alignItems: 'center',
  1252. marginBottom: '10px'
  1253. }
  1254. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1255. item: true,
  1256. xs: 12,
  1257. sm: 5
  1258. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1259. style: {
  1260. width: '150px'
  1261. }
  1262. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1263. style: {
  1264. paddingRight: '30px',
  1265. color: 'grey'
  1266. }
  1267. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1268. item: true,
  1269. xs: 12,
  1270. sm: 7
  1271. }, /*#__PURE__*/React$1__default.createElement(core.TextField, {
  1272. id: f.fieldName,
  1273. variant: "outlined",
  1274. autoComplete: "off",
  1275. size: "small",
  1276. value: data != undefined ? data[f.fieldName] : '',
  1277. type: "date",
  1278. style: {
  1279. width: '100%'
  1280. },
  1281. onChange: function onChange(e) {
  1282. return handleDate(e, f.fieldName);
  1283. }
  1284. })));
  1285. } else if (f.type == 'photo') {
  1286. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1287. key: f.fieldName,
  1288. container: true,
  1289. style: {
  1290. display: 'flex',
  1291. alignItems: 'center',
  1292. marginBottom: '10px'
  1293. }
  1294. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1295. item: true,
  1296. xs: 12,
  1297. sm: 5
  1298. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1299. style: {
  1300. width: '150px'
  1301. }
  1302. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1303. style: {
  1304. paddingRight: '30px',
  1305. color: 'grey'
  1306. }
  1307. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1308. item: true,
  1309. xs: 12,
  1310. sm: 7
  1311. }, /*#__PURE__*/React$1__default.createElement("img", {
  1312. src: imgPreview == null ? data['photo_url'] : imgPreview,
  1313. style: {
  1314. width: '120px',
  1315. height: '120px',
  1316. border: '1px solid grey'
  1317. }
  1318. }), /*#__PURE__*/React$1__default.createElement("input", {
  1319. type: "file",
  1320. id: "img-upload",
  1321. onChange: function onChange(e) {
  1322. return handleImgUpload(e, f.fieldName);
  1323. }
  1324. })));
  1325. } else if (f.type == 'dropdown') {
  1326. if (f.fieldName == 'priority') {
  1327. var _React$createElement;
  1328. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1329. key: f.fieldName,
  1330. container: true,
  1331. style: {
  1332. display: 'flex',
  1333. alignItems: 'center',
  1334. marginBottom: '10px'
  1335. }
  1336. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1337. item: true,
  1338. xs: 12,
  1339. sm: 5
  1340. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1341. style: {
  1342. width: '150px'
  1343. }
  1344. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1345. style: {
  1346. paddingRight: '30px',
  1347. color: 'grey'
  1348. }
  1349. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1350. item: true,
  1351. xs: 12,
  1352. sm: 7
  1353. }, /*#__PURE__*/React$1__default.createElement(core.NativeSelect, (_React$createElement = {
  1354. id: "demo-customized-select-native",
  1355. value: data != undefined ? data[f.fieldName] : '',
  1356. onChange: function onChange(e) {
  1357. return handleDropDownChange(e, f.fieldName);
  1358. }
  1359. }, _React$createElement["id"] = f.fieldName, _React$createElement.input = /*#__PURE__*/React$1__default.createElement(BootstrapInput, null), _React$createElement.style = {
  1360. width: '100%'
  1361. }, _React$createElement), /*#__PURE__*/React$1__default.createElement("option", {
  1362. "aria-label": "None",
  1363. value: ""
  1364. }, "Select"), f.options.map(function (d, i) {
  1365. return /*#__PURE__*/React$1__default.createElement("option", {
  1366. name: d.name,
  1367. value: d.id
  1368. }, d.name);
  1369. }))));
  1370. } else {
  1371. var _React$createElement2;
  1372. var fn = f.fieldName.split('_');
  1373. var fieldId = fn[0] + '_' + 'id';
  1374. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1375. key: f.fieldName,
  1376. container: true,
  1377. style: {
  1378. display: 'flex',
  1379. alignItems: 'center',
  1380. marginBottom: '10px'
  1381. }
  1382. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1383. item: true,
  1384. xs: 12,
  1385. sm: 5
  1386. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1387. style: {
  1388. width: '150px'
  1389. }
  1390. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1391. style: {
  1392. paddingRight: '30px',
  1393. color: 'grey'
  1394. }
  1395. }, f.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1396. item: true,
  1397. xs: 12,
  1398. sm: 7
  1399. }, /*#__PURE__*/React$1__default.createElement(core.NativeSelect, (_React$createElement2 = {
  1400. id: "demo-customized-select-native",
  1401. value: data != undefined ? data[fieldId] : '',
  1402. onChange: function onChange(e) {
  1403. return handleDropDownChange(e, f.fieldName);
  1404. }
  1405. }, _React$createElement2["id"] = f.fieldName, _React$createElement2.input = /*#__PURE__*/React$1__default.createElement(BootstrapInput, null), _React$createElement2.style = {
  1406. width: '100%'
  1407. }, _React$createElement2), /*#__PURE__*/React$1__default.createElement("option", {
  1408. "aria-label": "None",
  1409. value: ""
  1410. }, "Select"), f.options.map(function (d, i) {
  1411. return /*#__PURE__*/React$1__default.createElement("option", {
  1412. name: d.name,
  1413. value: d.id
  1414. }, d.name);
  1415. }))));
  1416. }
  1417. } else if (f.type == 'checkbox') {
  1418. return /*#__PURE__*/React$1__default.createElement(core.Grid, null);
  1419. } else if (f.type == 'radio') {
  1420. return /*#__PURE__*/React$1__default.createElement(core.Grid, null);
  1421. }
  1422. })), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1423. item: true,
  1424. xs: 11
  1425. }, /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1426. style: {
  1427. "float": 'right'
  1428. },
  1429. onClick: handleDataConfirm
  1430. }, " Confirm")))));
  1431. }
  1432. FieldList.propTypes = {
  1433. history: propTypes.object,
  1434. fields: propTypes.array.isRequired,
  1435. updateData: propTypes.object,
  1436. onDataCallback: propTypes.func
  1437. };
  1438. function descendingComparator(a, b, orderBy) {
  1439. if (b[orderBy] < a[orderBy]) {
  1440. return -1;
  1441. }
  1442. if (b[orderBy] > a[orderBy]) {
  1443. return 1;
  1444. }
  1445. return 0;
  1446. }
  1447. function getComparator(order, orderBy) {
  1448. return order === 'desc' ? function (a, b) {
  1449. return descendingComparator(a, b, orderBy);
  1450. } : function (a, b) {
  1451. return -descendingComparator(a, b, orderBy);
  1452. };
  1453. }
  1454. function stableSort(array, comparator) {
  1455. var stabilizedThis = array.map(function (el, index) {
  1456. return [el, index];
  1457. });
  1458. stabilizedThis.sort(function (a, b) {
  1459. var order = comparator(a[0], b[0]);
  1460. if (order !== 0) return order;
  1461. return a[1] - b[1];
  1462. });
  1463. return stabilizedThis.map(function (el) {
  1464. return el[0];
  1465. });
  1466. }
  1467. function EnhancedTableHead(props) {
  1468. var classes = props.classes,
  1469. order = props.order,
  1470. orderBy = props.orderBy,
  1471. onRequestSort = props.onRequestSort,
  1472. onRefreshData = props.onRefreshData,
  1473. headCells = props.headCells;
  1474. var createSortHandler = function createSortHandler(property) {
  1475. return function (event) {
  1476. onRequestSort(event, property);
  1477. onRefreshData();
  1478. };
  1479. };
  1480. return /*#__PURE__*/React$1__default.createElement(TableHead, null, /*#__PURE__*/React$1__default.createElement(TableRow, null, headCells.map(function (headCell) {
  1481. return /*#__PURE__*/React$1__default.createElement(TableCell, {
  1482. key: headCell.id,
  1483. align: headCell.numeric ? 'right' : 'left',
  1484. padding: headCell.disablePadding ? 'none' : 'default',
  1485. sortDirection: orderBy === headCell.id ? order : false
  1486. }, headCell.id != 'id' ? /*#__PURE__*/React$1__default.createElement(TableSortLabel, {
  1487. active: orderBy === headCell.id,
  1488. direction: orderBy === headCell.id ? order : 'asc',
  1489. onClick: createSortHandler(headCell.id)
  1490. }, headCell.label, orderBy === headCell.id ? /*#__PURE__*/React$1__default.createElement("span", {
  1491. className: classes.visuallyHidden
  1492. }, order === 'desc' ? 'sorted descending' : 'sorted ascending') : null) : /*#__PURE__*/React$1__default.createElement(TableSortLabel, {
  1493. hideSortIcon: true
  1494. }, headCell.label));
  1495. })));
  1496. }
  1497. EnhancedTableHead.propTypes = {
  1498. classes: propTypes.object.isRequired,
  1499. numSelected: propTypes.number.isRequired,
  1500. onRequestSort: propTypes.func.isRequired,
  1501. onRefreshData: propTypes.func.isRequired,
  1502. onSelectAllClick: propTypes.func.isRequired,
  1503. order: propTypes.oneOf(['asc', 'desc']).isRequired,
  1504. orderBy: propTypes.string.isRequired,
  1505. rowCount: propTypes.number.isRequired
  1506. };
  1507. var useStyles$1 = styles.makeStyles(function (theme) {
  1508. return {
  1509. root: {
  1510. width: '100%'
  1511. },
  1512. paper: {
  1513. width: '100%',
  1514. marginBottom: theme.spacing(2)
  1515. },
  1516. table: {
  1517. minWidth: 750
  1518. },
  1519. visuallyHidden: {
  1520. border: 0,
  1521. clip: 'rect(0 0 0 0)',
  1522. height: 1,
  1523. margin: -1,
  1524. overflow: 'hidden',
  1525. padding: 0,
  1526. position: 'absolute',
  1527. top: 20,
  1528. width: 1
  1529. },
  1530. underline: {
  1531. "&&&:before": {
  1532. borderBottom: "none"
  1533. },
  1534. "&&:after": {
  1535. borderBottom: "none"
  1536. }
  1537. }
  1538. };
  1539. });
  1540. function TableTemplate(props) {
  1541. var _React$createElement;
  1542. var classes = useStyles$1();
  1543. var _props$data = props.data,
  1544. data = _props$data === void 0 ? [] : _props$data,
  1545. _props$headers = props.headers,
  1546. headers = _props$headers === void 0 ? [] : _props$headers,
  1547. onUpdateData = props.onUpdateData,
  1548. onReloadData = props.onReloadData,
  1549. onChangePage = props.onChangePage,
  1550. onChangeRowsPerPage = props.onChangeRowsPerPage,
  1551. _props$rowsPerPage = props.rowsPerPage,
  1552. rowsPerPage = _props$rowsPerPage === void 0 ? 10 : _props$rowsPerPage,
  1553. _props$page = props.page,
  1554. page = _props$page === void 0 ? 0 : _props$page,
  1555. _props$order = props.order,
  1556. order = _props$order === void 0 ? 'asc' : _props$order,
  1557. orderBy = props.orderBy;
  1558. var _React$useState = React$1__default.useState([]),
  1559. selected = _React$useState[0],
  1560. setSelected = _React$useState[1];
  1561. var _React$useState2 = React$1__default.useState(false),
  1562. dense = _React$useState2[0];
  1563. var _React$useState3 = React$1__default.useState(rowsPerPage != undefined ? rowsPerPage : 10),
  1564. rowDataPerPage = _React$useState3[0],
  1565. setRowsPerPage = _React$useState3[1];
  1566. var _React$useState4 = React$1__default.useState(page != undefined ? page : 0),
  1567. paginatePage = _React$useState4[0];
  1568. var _React$useState5 = React$1__default.useState(order != undefined ? order : 'asc'),
  1569. setOrder = _React$useState5[1];
  1570. var _React$useState6 = React$1__default.useState(orderBy != undefined ? orderBy : 'name'),
  1571. setOrderBy = _React$useState6[1];
  1572. var offset = paginatePage * rowDataPerPage;
  1573. var handleRequestSort = function handleRequestSort(event, property) {
  1574. var isAsc = orderBy === property && order === 'asc';
  1575. setOrder(isAsc ? 'desc' : 'asc');
  1576. setOrderBy(property);
  1577. };
  1578. var handleSelectAllClick = function handleSelectAllClick(event) {
  1579. if (event.target.checked) {
  1580. var newSelecteds = data.map(function (n) {
  1581. return n.name;
  1582. });
  1583. setSelected(newSelecteds);
  1584. return;
  1585. }
  1586. setSelected([]);
  1587. };
  1588. var handleClick = function handleClick(event, rowdata) {
  1589. onUpdateData(true, rowdata);
  1590. };
  1591. var handleChangePage = function handleChangePage(event, newPage) {
  1592. onChangePage(newPage);
  1593. };
  1594. var handleReloadData = function handleReloadData() {
  1595. onReloadData();
  1596. };
  1597. var handleChangeRowsPerPage = function handleChangeRowsPerPage(event) {
  1598. setRowsPerPage(parseInt(event.target.value, 10));
  1599. onChangeRowsPerPage(parseInt(event.target.value));
  1600. onReloadData();
  1601. };
  1602. var isSelected = function isSelected(name) {
  1603. return selected.indexOf(name) !== -1;
  1604. };
  1605. var emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);
  1606. return /*#__PURE__*/React$1__default.createElement("div", {
  1607. className: classes.root
  1608. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1609. container: true
  1610. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1611. item: true,
  1612. style: {
  1613. marginRight: '10%'
  1614. }
  1615. }, /*#__PURE__*/React$1__default.createElement(TableContainer, null, /*#__PURE__*/React$1__default.createElement(Table, {
  1616. className: classes.table,
  1617. "aria-labelledby": "tableTitle",
  1618. size: dense ? 'small' : 'medium',
  1619. "aria-label": "enhanced table"
  1620. }, /*#__PURE__*/React$1__default.createElement(EnhancedTableHead, {
  1621. classes: classes,
  1622. numSelected: selected.length,
  1623. headCells: headers,
  1624. order: order,
  1625. orderBy: orderBy,
  1626. onSelectAllClick: handleSelectAllClick,
  1627. onRequestSort: handleRequestSort,
  1628. onRefreshData: handleReloadData,
  1629. rowCount: data.length
  1630. }), /*#__PURE__*/React$1__default.createElement(TableBody, null, data.length != 0 ? stableSort(data, getComparator(order, orderBy)).slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map(function (row, index) {
  1631. var isItemSelected = isSelected(row.name);
  1632. return /*#__PURE__*/React$1__default.createElement(TableRow, {
  1633. hover: true,
  1634. onClick: function onClick(event) {
  1635. return handleClick(event, row);
  1636. },
  1637. role: "checkbox",
  1638. "aria-checked": isItemSelected,
  1639. tabIndex: -1,
  1640. key: index,
  1641. selected: isItemSelected
  1642. }, headers.map(function (h, i) {
  1643. if (h.id == 'id') {
  1644. return /*#__PURE__*/React$1__default.createElement(TableCell, {
  1645. key: h.id,
  1646. align: "right"
  1647. }, ++offset);
  1648. } else {
  1649. return /*#__PURE__*/React$1__default.createElement(TableCell, {
  1650. key: h.id,
  1651. align: "right"
  1652. }, row[h.id]);
  1653. }
  1654. }));
  1655. }) : /*#__PURE__*/React$1__default.createElement("div", null), emptyRows > 0 && /*#__PURE__*/React$1__default.createElement(TableRow, {
  1656. style: {
  1657. height: (dense ? 33 : 53) * emptyRows
  1658. }
  1659. }, /*#__PURE__*/React$1__default.createElement(TableCell, {
  1660. colSpan: 6
  1661. }))))), /*#__PURE__*/React$1__default.createElement(TablePagination, (_React$createElement = {
  1662. rowsPerPageOptions: [5, 10, 20, 30],
  1663. labelDisplayedRows: function labelDisplayedRows(_ref) {
  1664. },
  1665. component: "div",
  1666. count: data.length,
  1667. rowsPerPage: rowsPerPage
  1668. }, _React$createElement["rowsPerPage"] = rowsPerPage, _React$createElement.page = page, _React$createElement.onChangePage = handleChangePage, _React$createElement.onChangeRowsPerPage = handleChangeRowsPerPage, _React$createElement)))));
  1669. }
  1670. TableTemplate.propTypes = {
  1671. history: propTypes.object,
  1672. headers: propTypes.array.isRequired,
  1673. data: propTypes.array.isRequired,
  1674. onUpdateData: propTypes.func,
  1675. onReloadData: propTypes.func,
  1676. onChangePage: propTypes.func,
  1677. onChangeRowsPerPage: propTypes.func,
  1678. query: propTypes.object,
  1679. page: propTypes.any,
  1680. rowsPerPage: propTypes.any,
  1681. order: propTypes.any,
  1682. orderBy: propTypes.any
  1683. };
  1684. var useStyles$2 = styles.makeStyles(function (theme) {
  1685. var _button, _ref;
  1686. return _ref = {
  1687. root: {
  1688. width: '100%'
  1689. },
  1690. paper: {
  1691. width: '100%',
  1692. marginBottom: theme.spacing(2)
  1693. },
  1694. table: {
  1695. minWidth: 750
  1696. },
  1697. visuallyHidden: {
  1698. border: 0,
  1699. clip: 'rect(0 0 0 0)',
  1700. height: 1,
  1701. margin: -1,
  1702. overflow: 'hidden',
  1703. padding: 0,
  1704. position: 'absolute',
  1705. top: 20,
  1706. width: 1
  1707. },
  1708. underline: {
  1709. "&&&:before": {
  1710. borderBottom: "none"
  1711. },
  1712. "&&:after": {
  1713. borderBottom: "none"
  1714. }
  1715. },
  1716. button: (_button = {
  1717. color: 'white'
  1718. }, _button["color"] = theme.palette.primary.main, _button.width = 150, _button.height = 55, _button),
  1719. closeButton: {
  1720. position: 'absolute',
  1721. right: theme.spacing(1),
  1722. top: theme.spacing(1),
  1723. color: theme.palette.grey[500]
  1724. },
  1725. headText: {
  1726. fontSize: 14,
  1727. "float": "left",
  1728. color: theme.palette.primary.main,
  1729. fontWeight: "bold"
  1730. }
  1731. }, _ref["paper"] = {
  1732. padding: theme.spacing(2),
  1733. textAlign: 'center',
  1734. color: theme.palette.text.secondary
  1735. }, _ref;
  1736. });
  1737. function getDataString(data, fieldName) {
  1738. return data[fieldName];
  1739. }
  1740. function InfoPage(props) {
  1741. var classes = useStyles$2();
  1742. var infoData = props.infoData,
  1743. displayFields = props.displayFields,
  1744. _props$isNew = props.isNew,
  1745. isNew = _props$isNew === void 0 ? false : _props$isNew,
  1746. isEditable = props.isEditable,
  1747. currentTabName = props.currentTabName,
  1748. actions = props.actions;
  1749. var _React$useState = React$1__default.useState(isEditable != undefined ? isEditable : true),
  1750. editable = _React$useState[0],
  1751. setEditable = _React$useState[1];
  1752. var _React$useState2 = React$1__default.useState({}),
  1753. data = _React$useState2[0],
  1754. setData = _React$useState2[1];
  1755. var handleEdit = function handleEdit() {
  1756. setEditable(false);
  1757. };
  1758. var handleUpdateData = function handleUpdateData(data) {
  1759. console.log('handle update date:', data);
  1760. setData(data);
  1761. };
  1762. return /*#__PURE__*/React$1__default.createElement("div", {
  1763. className: classes.root
  1764. }, isNew ? /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1765. container: true,
  1766. style: {
  1767. marginTop: '30px'
  1768. }
  1769. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1770. item: true,
  1771. xs: 12,
  1772. sm: 7
  1773. }, /*#__PURE__*/React$1__default.createElement(FieldList, {
  1774. updateData: infoData,
  1775. fields: displayFields,
  1776. isNew: isNew,
  1777. onDataCallback: function onDataCallback(d) {
  1778. return handleUpdateData(d);
  1779. }
  1780. }))) : /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1781. container: true,
  1782. style: {
  1783. marginTop: '30px'
  1784. }
  1785. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1786. item: true,
  1787. xs: 12,
  1788. sm: 7
  1789. }, !editable ? /*#__PURE__*/React$1__default.createElement(FieldList, {
  1790. fields: displayFields,
  1791. isNew: isNew,
  1792. updateData: infoData,
  1793. onDataCallback: function onDataCallback(d) {
  1794. return handleUpdateData(d);
  1795. }
  1796. }) : displayFields.map(function (d, i) {
  1797. return /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1798. container: true
  1799. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1800. item: true,
  1801. xs: 12,
  1802. style: {
  1803. display: 'flex',
  1804. alignItems: 'center',
  1805. marginBottom: '10px'
  1806. }
  1807. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1808. item: true,
  1809. xs: 12,
  1810. sm: 5
  1811. }, /*#__PURE__*/React$1__default.createElement(core.Box, {
  1812. style: {
  1813. width: '250px'
  1814. }
  1815. }, /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1816. style: {
  1817. paddingRight: '30px',
  1818. color: 'grey'
  1819. }
  1820. }, d.label))), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1821. item: true,
  1822. xs: 12,
  1823. sm: 7
  1824. }, d.type == 'photo' ? /*#__PURE__*/React$1__default.createElement("img", {
  1825. src: infoData['photo_url'],
  1826. style: {
  1827. width: '120px',
  1828. height: '120px',
  1829. border: '1px solid grey'
  1830. }
  1831. }) : /*#__PURE__*/React$1__default.createElement(core.Typography, {
  1832. style: {
  1833. paddingRight: '30px'
  1834. }
  1835. }, infoData != undefined ? getDataString(infoData, d.fieldName) : ''))));
  1836. })), /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1837. item: true,
  1838. xs: 12,
  1839. sm: 7
  1840. }, /*#__PURE__*/React$1__default.createElement(core.Grid, {
  1841. container: true,
  1842. direction: "row",
  1843. alignItems: "flex-end"
  1844. }, actions.map(function (a, i) {
  1845. if (currentTabName == 'account') {
  1846. if (infoData.status == 'invited') {
  1847. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1848. style: {
  1849. color: 'white',
  1850. backgroundColor: 'grey',
  1851. "float": 'right',
  1852. marginLeft: '10px'
  1853. },
  1854. onClick: function onClick() {
  1855. return a.callback(data);
  1856. }
  1857. }, a.label));
  1858. }
  1859. if (infoData.status == 'joined') {
  1860. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1861. style: {
  1862. color: 'white',
  1863. backgroundColor: 'grey',
  1864. "float": 'right',
  1865. marginLeft: '10px'
  1866. },
  1867. onClick: function onClick() {
  1868. return a.callback(data);
  1869. }
  1870. }, a.label));
  1871. }
  1872. if (infoData.status == 'disabled') {
  1873. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1874. style: {
  1875. color: 'white',
  1876. backgroundColor: 'grey',
  1877. "float": 'right',
  1878. marginLeft: '10px'
  1879. },
  1880. onClick: function onClick() {
  1881. return a.callback(data);
  1882. }
  1883. }, a.label));
  1884. }
  1885. if (infoData.status == 'requested') {
  1886. if (editable) {
  1887. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1888. style: {
  1889. marginLeft: '10px'
  1890. },
  1891. onClick: handleEdit
  1892. }, a.icon, a.label));
  1893. } else {
  1894. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1895. style: {
  1896. color: 'white',
  1897. backgroundColor: 'grey',
  1898. "float": 'right',
  1899. marginLeft: '10px'
  1900. },
  1901. onClick: function onClick() {
  1902. return a.callback(data);
  1903. }
  1904. }, a.label));
  1905. }
  1906. }
  1907. } else {
  1908. if (editable) {
  1909. if (a.action_type == 'edit') {
  1910. console.log('type: ', a.action_type, 'editable: ', editable);
  1911. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1912. style: {
  1913. marginLeft: '10px'
  1914. },
  1915. onClick: handleEdit
  1916. }, a.icon, a.label));
  1917. }
  1918. if (a.action_type == 'delete') {
  1919. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1920. style: {
  1921. "float": 'right',
  1922. marginLeft: '10px'
  1923. },
  1924. onClick: function onClick() {
  1925. return a.callback(data);
  1926. }
  1927. }, a.icon, a.label));
  1928. }
  1929. } else {
  1930. if (a.action_type == 'save') {
  1931. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1932. style: {
  1933. marginLeft: '10px'
  1934. },
  1935. onClick: function onClick() {
  1936. return a.callback(data);
  1937. }
  1938. }, a.icon, a.label));
  1939. }
  1940. if (a.action_type == 'cancel') {
  1941. return /*#__PURE__*/React$1__default.createElement(core.Box, null, /*#__PURE__*/React$1__default.createElement(core.Button, {
  1942. style: {
  1943. "float": 'right',
  1944. marginLeft: '10px'
  1945. },
  1946. onClick: function onClick() {
  1947. return a.callback(data);
  1948. }
  1949. }, a.icon, a.label));
  1950. }
  1951. }
  1952. }
  1953. })))));
  1954. }
  1955. InfoPage.propTypes = {
  1956. history: propTypes.object,
  1957. infoData: propTypes.object,
  1958. displayFields: propTypes.array,
  1959. isNew: propTypes.bool,
  1960. isEditable: propTypes.bool,
  1961. actions: propTypes.any
  1962. };
  1963. function CheckboxList() {
  1964. return /*#__PURE__*/React.createElement("div", null, "checkbox list");
  1965. }
  1966. function RadioList() {
  1967. return /*#__PURE__*/React.createElement("div", null, "radio list");
  1968. }
  1969. exports.CheckboxList = CheckboxList;
  1970. exports.FieldList = FieldList;
  1971. exports.InfoPage = InfoPage;
  1972. exports.List = List;
  1973. exports.RadioList = RadioList;
  1974. exports.TableTemplate = TableTemplate;
  1975. //# sourceMappingURL=index.js.map