@galadrim/galadmin 0.1.122 → 0.1.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -66
- package/dist/api.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/api.ts +2 -2
- package/src/front/node_modules/.cache/.eslintcache +1 -1
- package/src/front/node_modules/.cache/babel-loader/02b7fe943dc75565e03526b83b520ecbd57198be62b5d2cae86e96b27a203380.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/1186506617786e458e6510b54bee969b5eaec76126d17968106d22628055c890.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/4ddd228e52e76205bc0431b199807e875066e0c19bda2c5b40e78587dca66ad5.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/591f203be44bf03cc118b57f1000134541adccbf41131ed0a1b9be97d66df8c7.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/5dac42db47953d787356ffd59c148c1a6bbfc7b1a397cfc1ce2b5308e1362ad2.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/787bbdf4ae11ba9cad0edb6f858c602a154e963f051b33cce5f9653119dc3897.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/a045dd76231fd6dbed4288223144984bb1c72767e62580236e82b39ce7a51886.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/abe7b74c039f3f697b0f6e275683fed58dde158a5d91b4c294f12b3cd9fd8e8c.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/e78f27001990ee97ec0be1f2d149399baa05affd457a9a407a3a4635f370df0e.json +0 -1
- package/src/front/node_modules/.cache/babel-loader/e878e020c856c207d3b0fc01fad85a426f24b6113f08a0df413667a0102a2cf6.json +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"ast":null,"code":"import _regeneratorRuntime from\"/home/runner/work/galadmin/galadmin/src/front/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _objectSpread from\"/home/runner/work/galadmin/galadmin/src/front/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _asyncToGenerator from\"/home/runner/work/galadmin/galadmin/src/front/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _slicedToArray from\"/home/runner/work/galadmin/galadmin/src/front/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{useContext,useRef,useState,useEffect}from\"react\";import{useParams,useHistory}from\"react-router-dom\";import axios from\"axios\";import Input from\"../components/Input\";import LabelTooltip from\"../components/LabelTooltip\";import{ConfigContext}from'../contexts/ConfigContext';import checkRequiredColumns from\"../utils/checkRequiredColumns\";import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";import{Fragment as _Fragment}from\"react/jsx-runtime\";export default(function(){var config=useContext(ConfigContext);var _useParams=useParams(),viewIndex=_useParams.viewIndex,recordId=_useParams.recordId;var history=useHistory();var view=config.views[viewIndex];var _useState=useState(null),_useState2=_slicedToArray(_useState,2),record=_useState2[0],setRecord=_useState2[1];var filteredColumns=view.columns.filter(function(column){return column.dataType&&column.canEdit!==false&&!column.hidden;});var dataToUpdate=useRef({});var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isUpdating=_useState4[0],setIsUpdating=_useState4[1];useEffect(function(){axios.get(\"/record\",{params:{viewIndex:viewIndex,recordId:recordId}}).then(function(response){dataToUpdate.current={};setRecord(response.data);});},[viewIndex,recordId]);var updateRecord=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(checkRequiredColumns(filteredColumns,_objectSpread(_objectSpread({},record),dataToUpdate.current))){_context.next=2;break;}return _context.abrupt(\"return\");case 2:setIsUpdating(true);_context.prev=3;_context.next=6;return axios.post(\"/updateRecord\",{viewIndex:viewIndex,primaryValue:recordId,data:dataToUpdate.current,previousData:record});case 6:setIsUpdating(false);history.push(\"/record/\".concat(viewIndex,\"/\").concat(recordId));_context.next=14;break;case 10:_context.prev=10;_context.t0=_context[\"catch\"](3);if(_context.t0.response.responseText){window.swal({title:\"Erreur\",text:_context.t0.response.responseText,dangerMode:true});}setIsUpdating(false);case 14:case\"end\":return _context.stop();}},_callee,null,[[3,10]]);}));return function updateRecord(){return _ref.apply(this,arguments);};}();return/*#__PURE__*/_jsxs(\"div\",{class:\"view\",children:[/*#__PURE__*/_jsx(\"div\",{class:\"viewHeader\",children:/*#__PURE__*/_jsx(\"div\",{class:\"viewTitle\",children:view.label})}),/*#__PURE__*/_jsx(\"div\",{class:\"paddedView\",children:record?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{class:\"form\",children:filteredColumns.map(function(column,index){return/*#__PURE__*/_jsxs(\"div\",{class:\"formElement\",children:[/*#__PURE__*/_jsxs(\"div\",{class:\"formLabel\",children:[column.label,\" \",column.required?\"*\":\"\",column.labelTooltip?/*#__PURE__*/_jsx(LabelTooltip,{text:column.labelTooltip}):null]}),/*#__PURE__*/_jsx(\"div\",{class:\"formInput\",children:/*#__PURE__*/_jsx(Input,{column:column,initialData:record,onChange:function onChange(newValues){dataToUpdate.current=_objectSpread(_objectSpread({},dataToUpdate.current),newValues);}})})]},index);})}),/*#__PURE__*/_jsx(\"div\",{class:\"button greenButton \".concat(isUpdating?\"loading\":\"\"),onClick:updateRecord,children:isUpdating?\"Sauvegarde en cours...\":\"Sauvegarder\"}),/*#__PURE__*/_jsx(\"div\",{class:\"button\",onClick:function onClick(){return history.goBack();},children:\"Annuler\"})]}):null})]});});","map":{"version":3,"names":["useContext","useRef","useState","useEffect","useParams","useHistory","axios","Input","LabelTooltip","ConfigContext","checkRequiredColumns","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","config","_useParams","viewIndex","recordId","history","view","views","_useState","_useState2","_slicedToArray","record","setRecord","filteredColumns","columns","filter","column","dataType","canEdit","hidden","dataToUpdate","_useState3","_useState4","isUpdating","setIsUpdating","get","params","then","response","current","data","updateRecord","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_callee$","_context","prev","next","_objectSpread","abrupt","post","primaryValue","previousData","push","concat","t0","responseText","window","swal","title","text","dangerMode","stop","apply","arguments","class","children","label","map","index","required","labelTooltip","initialData","onChange","newValues","onClick","goBack"],"sources":["/home/runner/work/galadmin/galadmin/src/front/src/pages/EditRecord.js"],"sourcesContent":["import { useContext, useRef, useState, useEffect } from \"react\";\nimport {\n useParams,\n useHistory\n} from \"react-router-dom\";\nimport axios from \"axios\";\nimport Input from \"../components/Input\"\nimport LabelTooltip from \"../components/LabelTooltip\"\nimport { ConfigContext } from '../contexts/ConfigContext'\nimport checkRequiredColumns from \"../utils/checkRequiredColumns\";\n\nexport default () => {\n const config = useContext(ConfigContext)\n const { viewIndex, recordId } = useParams();\n const history = useHistory();\n const view = config.views[viewIndex];\n const [record, setRecord] = useState(null);\n const filteredColumns = view.columns.filter(\n column => column.dataType &&\n column.canEdit !== false &&\n !column.hidden\n )\n\n const dataToUpdate = useRef({})\n const [isUpdating, setIsUpdating] = useState(false)\n\n useEffect(() => {\n axios.get(\"/record\", {\n params: {\n viewIndex,\n recordId\n }\n }).then((response) => {\n dataToUpdate.current = {};\n setRecord(response.data);\n });\n }, [viewIndex, recordId]);\n\n const updateRecord = async () => {\n if (!checkRequiredColumns(filteredColumns, {...record, ...dataToUpdate.current})) return;\n setIsUpdating(true)\n try {\n await axios.post(\"/updateRecord\", {\n viewIndex,\n primaryValue: recordId,\n data: dataToUpdate.current,\n previousData: record\n })\n setIsUpdating(false)\n history.push(`/record/${viewIndex}/${recordId}`)\n } catch (error) {\n if (error.response.responseText) {\n window.swal({\n title: \"Erreur\",\n text: error.response.responseText,\n dangerMode: true\n })\n }\n setIsUpdating(false)\n }\n }\n\n return (\n <div class=\"view\">\n <div class=\"viewHeader\">\n <div class=\"viewTitle\">{view.label}</div>\n </div>\n <div class=\"paddedView\">\n {record ? (\n <>\n <div class=\"form\">\n {filteredColumns.map((column, index) => {\n return (\n <div class='formElement' key={index}>\n <div class='formLabel'>\n {column.label} {column.required ? \"*\" : \"\"}\n {column.labelTooltip ? <LabelTooltip text={column.labelTooltip} /> : null}\n </div>\n <div class='formInput'>\n <Input\n column={column}\n initialData={record}\n onChange={(newValues) => { dataToUpdate.current = { ...dataToUpdate.current, ...newValues } }}\n />\n </div>\n </div>\n )\n })}\n </div>\n <div class={`button greenButton ${isUpdating ? \"loading\" : \"\"}`} onClick={updateRecord}>{isUpdating ? \"Sauvegarde en cours...\" : \"Sauvegarder\"}</div>\n <div class=\"button\" onClick={() => history.goBack()}>Annuler</div>\n </>\n ) : null}\n </div>\n </div>\n )\n}"],"mappings":"2hBAAA,OAASA,UAAU,CAAEC,MAAM,CAAEC,QAAQ,CAAEC,SAAS,KAAQ,OAAO,CAC/D,OACIC,SAAS,CACTC,UAAU,KACP,kBAAkB,CACzB,MAAO,CAAAC,KAAK,KAAM,OAAO,CACzB,MAAO,CAAAC,KAAK,KAAM,qBAAqB,CACvC,MAAO,CAAAC,YAAY,KAAM,4BAA4B,CACrD,OAASC,aAAa,KAAQ,2BAA2B,CACzD,MAAO,CAAAC,oBAAoB,KAAM,+BAA+B,CAAC,OAAAC,GAAA,IAAAC,IAAA,gCAAAC,IAAA,IAAAC,KAAA,gCAAAC,QAAA,IAAAC,SAAA,yBAEjE,eAAe,UAAM,CACjB,GAAM,CAAAC,MAAM,CAAGjB,UAAU,CAACS,aAAa,CAAC,CACxC,IAAAS,UAAA,CAAgCd,SAAS,CAAC,CAAC,CAAnCe,SAAS,CAAAD,UAAA,CAATC,SAAS,CAAEC,QAAQ,CAAAF,UAAA,CAARE,QAAQ,CAC3B,GAAM,CAAAC,OAAO,CAAGhB,UAAU,CAAC,CAAC,CAC5B,GAAM,CAAAiB,IAAI,CAAGL,MAAM,CAACM,KAAK,CAACJ,SAAS,CAAC,CACpC,IAAAK,SAAA,CAA4BtB,QAAQ,CAAC,IAAI,CAAC,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