index.js 87 KB

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