index.js 87 KB

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