diff --git a/.eslintrc.js b/.eslintrc.js index 1fb303bf..159239b4 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -93,15 +93,9 @@ module.exports = { // 'multiline-ternary': 'off', 'vue/max-attributes-per-line': [ 'error', { - 'singleline': { - 'max': 6, - 'allowFirstLine': true, - }, - 'multiline': { - 'max': 6, - 'allowFirstLine': false, - }, - }], + 'singleline': 15, + 'multiline': 15 + }], 'import/first': 'off', 'import/named': 'off', 'import/namespace': 'error', @@ -124,6 +118,7 @@ module.exports = { '@typescript-eslint/semi': 'off', '@typescript-eslint/object-curly-spacing': 'off', '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', // allow debugger during development only 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', @@ -153,6 +148,7 @@ module.exports = { 'no-extra-boolean-cast': 'off', 'max-attributes-per-line': 'off', 'vue/no-v-model-argument': 'off', + 'vue/multi-word-component-names': 'off', '@typescript-eslint/ban-types': [ 'error', { diff --git a/package.json b/package.json index b9a42596..87bb7040 100755 --- a/package.json +++ b/package.json @@ -23,36 +23,36 @@ "generate-sw": "workbox generateSW workbox-config.js" }, "dependencies": { - "@quasar/extras": "^1.11.1", + "@quasar/extras": "^1.12.1", "@quasar/quasar-ui-qcalendar": "^4.0.0-beta.6", - "@vue/compat": "^3.2.19", - "@vue/compiler-sfc": "^3.2.19", - "@vue/eslint-config-standard": "^6.1.0", - "@vuelidate/core": "^2.0.0-alpha.27", - "@vuelidate/validators": "^2.0.0-alpha.23", - "acorn": "^8.5.0", - "autoprefixer": "^10.3.7", + "@vue/compat": "^3.2.22", + "@vue/compiler-sfc": "^3.2.22", + "@vue/eslint-config-standard": "^5.1.2", + "@vuelidate/core": "^2.0.0-alpha.32", + "@vuelidate/validators": "^2.0.0-alpha.25", + "acorn": "^8.6.0", + "autoprefixer": "^10.4.0", "axios": "0.21.4", "bcryptjs": "^2.4.3", - "core-js": "^3.18.2", + "core-js": "^3.19.1", "crypto": "^1.0.1", - "date-fns": "^2.25.0", + "date-fns": "^2.26.0", "dotenv": "^10.0.0", - "echarts": "^5.2.1", + "echarts": "^5.2.2", "eslint-plugin-quasar": "^1.0.0", - "graphql": "^15.6.1", - "graphql-tag": "^2.12.5", + "graphql": "^16.0.1", + "graphql-tag": "^2.12.6", "gsap": "^3.8.0", "jquery": "^3.6.0", "js-cookie": "^3.0.1", "localforage": "^1.10.0", "lodash": "^4.17.21", "normalize.css": "^8.0.1", - "npm": "^7.24.2", + "npm": "^8.1.4", "nprogress": "^0.2.0", - "pinia": "^2.0.0-rc.11", + "pinia": "^2.0.4", "prerender-spa-plugin": "^3.4.0", - "quasar": "^2.1.0", + "quasar": "^2.3.3", "quasar-extras": "^2.0.9", "register-service-worker": "^1.7.2", "vee-validate": "^4.4.10", @@ -74,47 +74,47 @@ "vuex-typex": "^3.1.9" }, "devDependencies": { - "@babel/eslint-parser": "^7.15.7", - "@quasar/app": "^3.1.2", + "@babel/eslint-parser": "^7.16.3", + "@quasar/app": "^3.2.3", "@quasar/quasar-app-extension-qcalendar": "^4.0.0-beta.6", "@types/bcryptjs": "^2.4.2", "@types/dotenv": "^8.2.0", "@types/googlemaps": "^3.43.3", - "@types/jest": "^27.0.2", - "@types/js-cookie": "^3.0.0", - "@types/node": "14.14.45", + "@types/jest": "^27.0.3", + "@types/js-cookie": "^3.0.1", + "@types/node": "16.11.10", "@types/nprogress": "^0.2.0", "@types/vue-tel-input": "^2.1.2", "@types/vuelidate": "^0.7.15", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", - "eslint": "^7.32.0", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "@typescript-eslint/parser": "^5.4.0", + "eslint": "^8.3.0", "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.24.2", + "eslint-plugin-import": "^2.25.3", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-vue": "^7.19.1", + "eslint-plugin-promise": "^5.1.1", + "eslint-plugin-vue": "^8.1.1", "file-loader": "^6.2.0", - "html-webpack-plugin": "^5.3.2", + "html-webpack-plugin": "^5.5.0", "http-proxy-middleware": "^2.0.1", - "jest": "^27.2.4", + "jest": "^27.3.1", "json-loader": "^0.5.7", "node-sass": "^6.0.1", - "npm-check-updates": "^11.8.5", + "npm-check-updates": "^12.0.2", "optimize-css-assets-webpack-plugin": "^6.0.1", - "postcss": "^8.3.9", - "postcss-loader": "^6.1.1", - "sass-loader": "^12.1.0", + "postcss": "^8.3.11", + "postcss-loader": "^6.2.0", + "sass-loader": "^12.3.0", "strip-ansi": "=7.0.1", - "ts-jest": "^27.0.5", + "ts-jest": "^27.0.7", "ts-loader": "^9.2.6", "tslint": "^6.1.3", "tslint-config-standard": "^9.0.0", "tslint-loader": "^3.5.4", - "typescript": "^4.4.3", + "typescript": "^4.5.2", "vue-cli-plugin-element-ui": "^1.1.4", "vueify": "^9.4.1", - "workbox-webpack-plugin": "^6.3.0" + "workbox-webpack-plugin": "^6.4.1" }, "browser": { "crypto": false @@ -131,7 +131,7 @@ "last 5 Opera versions" ], "engines": { - "node": ">= 14.15.0", + "node": ">= 14.17.0", "npm": ">= 6.14.8", "yarn": ">= 1.21.1" } diff --git a/src/common/axios.ts b/src/common/axios.ts.off similarity index 100% rename from src/common/axios.ts rename to src/common/axios.ts.off diff --git a/src/common/index.ts b/src/common/index.ts index bcc0db6b..b65b7f28 100755 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -1,5 +1,5 @@ export * from './pattern' -export * from './axios' +// export * from './axios' export * from './debounce' export * from './message' export { default as GlobalConfig } from '../config' diff --git a/src/components/CGallery/CGallery.scss b/src/components/CGallery/CGallery.scss index e2ca7ada..6d1add9c 100755 --- a/src/components/CGallery/CGallery.scss +++ b/src/components/CGallery/CGallery.scss @@ -44,10 +44,12 @@ $grayshadow: #555; min-width: 200px; padding: 1rem 1rem; height: 350px; + margin: auto; } .my-card-gallery-view { width: 100px; height: 100px; padding: 0.5rem 0.5rem; + margin: auto; } diff --git a/src/components/CGallery/CGallery.ts b/src/components/CGallery/CGallery.ts index 34629385..a61ef224 100755 --- a/src/components/CGallery/CGallery.ts +++ b/src/components/CGallery/CGallery.ts @@ -25,7 +25,7 @@ export default defineComponent({ required: true, }, imgGall: { - type: Object as PropType, + type: Object as PropType, required: true, }, }, diff --git a/src/components/CGallery/CGallery.vue b/src/components/CGallery/CGallery.vue index 98d77327..839f7bf3 100755 --- a/src/components/CGallery/CGallery.vue +++ b/src/components/CGallery/CGallery.vue @@ -31,7 +31,6 @@ v-model="order">-->
- mygallery : {{ mygallery }}
{ - return true - }) + console.log('annulla') + if (newRecord.value) { + globalStore.DeleteRec({ table: mytable.value, id: newRecord.value._id }) + .then((ris) => { + // console.log('deleted', ris) + serverData.value.pop(ris) + newRecord.value = null + return true + }) + } } function SaveValue(newVal: any, valinitial: any) { @@ -391,11 +425,6 @@ export default defineComponent({ } if (myfield) { - if (colsel.value) { - // console.log('rowsel[myfield]', rowsel[myfield], 'field', myfield) - // console.log('subf', subf) - } - if (colsel.value) { // Update value in table memory if (subf !== '') { @@ -465,18 +494,13 @@ export default defineComponent({ const mydata: any = { table: mytable.value, - data: function () { - return {} - } + data: {} } - mydata.data = props.defaultnewrec + if (props.defaultnewrec) + mydata.data = props.defaultnewrec() - // const mykey = fieldsTable.getKeyByTable(mytable) - - // mydata.data[mykey] = '' - - // console.log('mydata', mydata) + // console.log('DATA=', mydata.data) newRecord.value = await globalStore.saveTable(mydata) newRecordBool.value = true @@ -484,26 +508,10 @@ export default defineComponent({ } async function createNewRecord() { - console.log('createNewRecord') - loading.value = true - const mydata: any = { - table: mytable.value, - data: {} - } + await createNewRecordDialog() - if (props.defaultnewrec) { - mydata.data = props.defaultnewrec - } - - // const mykey = fieldsTable.getKeyByTable(mytable) - - // mydata.data[mykey] = '' - - console.log('mydata', mydata) - const data = await globalStore.saveTable(mydata) - - serverData.value.push(data) + serverData.value.push(newRecord.value) pagination.value.rowsNumber++ loading.value = false @@ -549,7 +557,7 @@ export default defineComponent({ tablesel.value = mytable.value } - console.log('2) tablesel', tablesel.value) + // console.log('2) tablesel', tablesel.value) changeTable(tablesel.value) @@ -590,25 +598,34 @@ export default defineComponent({ param2: item, } - return $q.dialog({ - message: translate(col.askaction) + '?', - html: true, - ok: { - label: ok, - push: true, - }, - title: 'Action', - cancel: true, - persistent: false, - }).onOk(() => { - // console.log('OK') - exec_func_table(table, col.action, par) - return true - }).onCancel(() => { - // console.log('CANCEL') - exec_func_table(table, funccancel, par) - return false - }) + if (col.action === lists.MenuAction.CAN_EDIT_TABLE) { + console.log('Edit', item) + selItem(item, col) + recModif.value = item + editRecordBool.value = true + } else { + + + return $q.dialog({ + message: translate(col.askaction) + '?', + html: true, + ok: { + label: ok, + push: true, + }, + title: 'Action', + cancel: true, + persistent: false, + }).onOk(() => { + // console.log('OK') + exec_func_table(table, col.action, par) + return true + }).onCancel(() => { + // console.log('CANCEL') + exec_func_table(table, funccancel, par) + return false + }) + } } } @@ -617,7 +634,7 @@ export default defineComponent({ if (action === lists.MenuAction.DELETE_RECTABLE) { if ((serverData.value.length > 0) && item) { serverData.value.splice(serverData.value.indexOf(item), 1) - refresh_table() + refresh_arr() } } else if (action === lists.MenuAction.DUPLICATE_RECTABLE) { // Add record duplicated @@ -638,6 +655,21 @@ export default defineComponent({ } } + function clByCol(col: IColGridTable) { + if (!visuIntestazCol(col)) { + return 'row justify-center vertical-middle' + } else { + return '' + } + } + function visuIntestazCol(col: IColGridTable) { + if (col.fieldtype === costanti.FieldType.html || col.fieldtype === costanti.FieldType.listimages) { + return false + } else { + return true + } + } + function changeCol(newval: any) { // console.log('changecol', mytable.value) if (!!mytable.value) { @@ -666,7 +698,7 @@ export default defineComponent({ } } - console.log('tablesel', tablesel.value, 'mytab', mytab) + // console.log('tablesel', tablesel.value, 'mytab', mytab) if (mytab) { mytitle.value = mytab.label @@ -774,29 +806,55 @@ export default defineComponent({ async function saveNewRecord() { console.log('saveNewRecord') - savenewRec.value = true const mydata = { table: mytable.value, data: {} } - mydata.data = newRecord + mydata.data = newRecord.value const data = await globalStore.saveTable(mydata) .then((ris) => { if (ris) { // console.log('ris', ris) newRecordBool.value = false - refresh() + const indrec = serverData.value.findIndex((rec: IMySkill) => rec._id === ris._id) + console.log('indrec', indrec, serverData.value[indrec]) + if (indrec >= 0) + serverData.value[indrec] = ris + else + serverData.value.push(ris) + + newRecord.value = null + // refresh() + } + }) + } + + async function saverecModif() { + console.log('saverecModif') + const mydata = { + table: mytable.value, + data: {} + } + + mydata.data = recModif.value + + const data = await globalStore.saveTable(mydata) + .then((ris) => { + if (ris) { + // console.log('ris', ris) + editRecordBool.value = false + const indrec = serverData.value.findIndex((rec: IMySkill) => rec._id === ris._id) + console.log('indrec', indrec, serverData.value[indrec]) + if (indrec >= 0) + serverData.value[indrec] = ris } }) } function hidewindow() { - console.log('hidewindow') - if (!savenewRec.value) { - annulla(0) - } + annulla(0) } function getlabelAddRow() { @@ -826,6 +884,8 @@ export default defineComponent({ saveFieldValue, clickFunz, visCol, + visuIntestazCol, + clByCol, changeCol, changeTable, doSearch, @@ -836,6 +896,7 @@ export default defineComponent({ selectionclick, getusernamesel, saveNewRecord, + saverecModif, hidewindow, isfinishLoading, getlabelAddRow, @@ -858,11 +919,15 @@ export default defineComponent({ myfilter, disabilita, newRecordBool, + editRecordBool, + newRecord, + recModif, lists, refresh, spinner_visible, tablesel, myfilterand, + tools, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index d9c25236..36b5bc16 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -8,7 +8,61 @@ @click="createNewRecordDialog">
+
+ + + + + + + + + + + +
+
+
{{ mytitle }}
+ + + + + + +
+ + + - - -