index.modern.js 79 KB

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