From 5d3c4e5b84797b58fb8feca20419ab7faf039ee0 Mon Sep 17 00:00:00 2001 From: Ali Date: Sun, 16 Jun 2024 16:35:31 +0200 Subject: [PATCH 01/19] main --- server/schema-server.js | 9 +- server/schemas/new/questions.json | 122 +- .../schemas/newSchema/defaultQuestions.json | 96 ++ .../schemas/{new => newSchema}/details.json | 0 server/schemas/newSchema/questions.json | 1219 +++++++++++++++++ src/SchemaUtil.ts | 78 +- src/components/modules/ModuleFactory.ts | 1 + .../modules/base-class/ToolboxModule.ts | 1 + .../question/IQuestionModuleDataModel.ts | 5 +- .../modules/question/QuestionModule.ts | 45 +- .../modules/section/SectionModule.ts | 2 +- .../property-box/assets/layout.html | 1 + src/components/property-box/assets/style.css | 5 +- src/components/workspace/assets/style.css | 2 +- wwwroot/component/new/index.html | 73 +- wwwroot/component/new/schema/index.html | 74 +- 16 files changed, 1617 insertions(+), 116 deletions(-) create mode 100644 server/schemas/newSchema/defaultQuestions.json rename server/schemas/{new => newSchema}/details.json (100%) create mode 100644 server/schemas/newSchema/questions.json diff --git a/server/schema-server.js b/server/schema-server.js index a7e88dd..03f615a 100644 --- a/server/schema-server.js +++ b/server/schema-server.js @@ -53,9 +53,14 @@ router.get("/schemas/:id", function (req, res) { }); }); router.get("/details", async function (req, res) { - return res.json(JSON.parse(await fs.promises.readFile(path.join(__dirname, `/schemas/new/details.json`)))) + return res.json(JSON.parse(await fs.promises.readFile(path.join(__dirname, `/schemas/newSchema/details.json`)))) +}); +router.get("/new-schema", async function (req, res) { + return res.json(JSON.parse(await fs.promises.readFile(path.join(__dirname, `/schemas/newSchema/questions.json`)))) +}); +router.get("/add-to-log", async function (req, res) { + return res.json(JSON.parse(await fs.promises.readFile(path.join(__dirname, `/schemas/new/addToLog.json`)))) }); - router.get("/fix-data/:prpId/:part", function (req, res) { const fixDataStr = fs.readFileSync( path.join(__dirname, "/schemas/data.json"), diff --git a/server/schemas/new/questions.json b/server/schemas/new/questions.json index 740c661..c6e070e 100644 --- a/server/schemas/new/questions.json +++ b/server/schemas/new/questions.json @@ -26,9 +26,8 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text", + "cssClass": "css_13050_1" } ] }, @@ -58,9 +57,12 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text", + "validations": { + "required": true, + "minLength": 3, + "maxLength": 50 + } } ] }, @@ -93,7 +95,7 @@ "title": "Is Multi", "parts": [ { - "part": 1, + "part": 3, "viewType": "select", "fixValues": [ { @@ -147,6 +149,35 @@ ] } ] + }, { + "prpId": 7, + "vocab": "AddToLog", + "title": "AddToLog", + "multi": false, + "parts": [ + { + "part": 1, + "viewType": "radio", + "fixValues": [ + { + "id": 0, + "value": "off" + }, + { + "id": 4, + "value": "on", + "schema": { + "schemaId": 10, + "paramUrl": "add-to-log", + "lid": 1, + "schemaVersion": 1.1 + } + } + ], + "caption": "", + "link": "" + } + ] } ] }, @@ -163,9 +194,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -313,9 +342,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -371,9 +398,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -524,9 +549,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -596,9 +619,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -627,9 +648,7 @@ }, { "part": 2, - "link": "/server/popup", - "viewType": "html", - "multi": true, + "viewType": "text", "caption": "Title" } ] @@ -689,9 +708,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -720,9 +737,7 @@ }, { "part": 2, - "link": "/server/popup", - "viewType": "html", - "multi": true, + "viewType": "text", "caption": "Title" } ] @@ -807,9 +822,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -838,9 +851,7 @@ }, { "part": 2, - "link": "/server/popup", - "viewType": "html", - "multi": true, + "viewType": "text", "caption": "Title" } ] @@ -900,9 +911,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -972,9 +981,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -1093,9 +1100,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", - "viewType": "html", - "multi": false + "viewType": "text" } ] }, @@ -1210,6 +1215,31 @@ "title": "Validations" } ] + }, + { + "paramUrl": "add-to-log", + + "schemaVersion": 1.1, + "lid": 1, + "schemaId": "add-to-log", + "baseVocab": "http://schema.site/FA/vo", + "questions": [ + { + "prpId": 1, + "vocab": "LogName", + "title": "LogName", + "multi": false, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "required": true + } + } + ] + } + ] } ] } diff --git a/server/schemas/newSchema/defaultQuestions.json b/server/schemas/newSchema/defaultQuestions.json new file mode 100644 index 0000000..b677929 --- /dev/null +++ b/server/schemas/newSchema/defaultQuestions.json @@ -0,0 +1,96 @@ +{ + "setting": { + "keepalive": true + }, + "sources": [ + { + "options": { + "tableName": "answer.data", + "keyFieldName": "", + "statusFieldName": "", + "mergeType": 0 + }, + "data": [ + { + "lid": 1, + "questions": [ + { + "TypeID": 150, + "Ord": 700, + "multi": false, + "class": "css_150", + "Url": "FA/vo/عنوان", + "title": "عنوان", + "parts": [ + { + "part": 1, + "viewType": "text", + "cssClass": "css_150_1", + "validations": { + "required": true, + "minLength": "2", + "maxLength": "100" + } + } + ] + }, + { + "TypeID": 164, + "Ord": 720, + "multi": false, + "class": "css_164", + "Url": "FA/vo/برند", + "title": "برند", + "parts": [ + { + "part": 1, + "viewType": "text", + "cssClass": "css_164_1", + "validations": { + "minLength": "2", + "maxLength": "4000" + } + } + ] + }, + { + "TypeID": 163, + "Ord": 740, + "multi": false, + "class": "css_163", + "Url": "FA/vo/مدل", + "title": "مدل", + "parts": [ + { + "part": 1, + "viewType": "text", + "cssClass": "css_163_1", + "validations": { + "minLength": "2", + "maxLength": "4000" + } + } + ] + }, + { + "TypeID": 144, + "Ord": 1220, + "multi": true, + "class": "css_144", + "Url": "FA/vo/توضیحات", + "title": "توضیحات", + "parts": [ + { + "part": 1, + "viewType": "textarea", + "cssClass": "css_144_1", + "validations": {} + } + ] + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/server/schemas/new/details.json b/server/schemas/newSchema/details.json similarity index 100% rename from server/schemas/new/details.json rename to server/schemas/newSchema/details.json diff --git a/server/schemas/newSchema/questions.json b/server/schemas/newSchema/questions.json new file mode 100644 index 0000000..73867ae --- /dev/null +++ b/server/schemas/newSchema/questions.json @@ -0,0 +1,1219 @@ +{ + "setting": { + "keepalive": true + }, + "sources": [ + { + "options": { + "tableName": "schema.newdata", + "keyFieldName": null, + "statusFieldName": null, + "mergeType": 0 + }, + "data": [ + { + "schemas": [ + { + "schemaId": "section", + "paramUrl": "section", + "schemaType": "section", + "title": "Section", + "image": "/assets/images/sections.png", + "questions": [ + { + "prpId": 1, + "title": "Title", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Description", + "parts": [ + { + "part": 1, + "viewType": "textarea", + "cssClass": "css_13050_1" + } + ] + } + ] + }, + { + "schemaId": "question", + "paramUrl": "question", + "schemaType": "question", + "title": "Question", + "image": "/assets/images/question.png", + "questions": [ + { + "prpId": 1, + "title": "Title", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Parts", + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "1" + }, + { + "id": 2, + "value": "2" + }, + { + "id": 3, + "value": "3" + } + ] + } + ] + }, + { + "prpId": 3, + "title": "Is Multi", + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "No" + }, + { + "id": 2, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 4, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 5, + "title": "Help", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 6, + "title": "Use In List", + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "No" + }, + { + "id": 2, + "value": "Yes" + } + ] + } + ] + } + ] + }, + { + "schemaId": "text", + "paramUrl": "text", + "schemaType": "part", + "title": "Short Text", + "image": "/assets/images/input.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 3002, + "title": "minLength", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3003, + "title": "maxLength", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3004, + "title": "min", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3005, + "title": "max", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3006, + "title": "dataType", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "text" + }, + { + "id": "int", + "value": "int" + }, + { + "id": "float", + "value": "float" + } + ] + } + ] + }, + { + "prpId": 3007, + "title": "regex", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "color", + "paramUrl": "color", + "schemaType": "part", + "title": "Color", + "image": "/assets/images/color.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "datepicker", + "paramUrl": "datepicker", + "schemaType": "part", + "title": "Datepicker", + "image": "/assets/images/date.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "textarea", + "paramUrl": "textarea", + "schemaType": "part", + "title": "Long Text", + "image": "/assets/images/text-box.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 3002, + "title": "minLength", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3003, + "title": "maxLength", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3007, + "title": "regex", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "AutoComplete", + "paramUrl": "AutoComplete", + "schemaType": "part", + "title": "Autocomplete", + "image": "/assets/images/autoComplete.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 5, + "title": "Url", + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "required": true, + "regex1": "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)" + } + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "Select", + "paramUrl": "Select", + "schemaType": "part", + "title": "Select", + "image": "/assets/images/dropdown.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 4, + "title": "Items", + "multi": "true", + "parts": [ + { + "part": 1, + "viewType": "Text", + "caption": "Value", + "validations": { + "dataType": "int" + } + }, + { + "part": 2, + "link": "/server/popup", + "viewType": "html", + "multi": true, + "caption": "Title" + } + ] + }, + { + "prpId": 5, + "title": "Url", + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "regex1": "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)" + } + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "Checklist", + "paramUrl": "Checklist", + "schemaType": "part", + "title": "Checklist", + "image": "/assets/images/checklist.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 4, + "title": "Items", + "multi": "true", + "parts": [ + { + "part": 1, + "viewType": "Text", + "caption": "Value", + "validations": { + "dataType": "int" + } + }, + { + "part": 2, + "link": "/server/popup", + "viewType": "html", + "multi": true, + "caption": "Title" + } + ] + }, + { + "prpId": 5, + "title": "Url", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 3002, + "title": "minLength", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3003, + "title": "maxLength", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "Radio", + "paramUrl": "Radio", + "schemaType": "part", + "title": "Radio", + "image": "/assets/images/radio.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 4, + "title": "Items", + "multi": "true", + "parts": [ + { + "part": 1, + "viewType": "Text", + "caption": "Value", + "validations": { + "dataType": "int" + } + }, + { + "part": 2, + "link": "/server/popup", + "viewType": "html", + "multi": true, + "caption": "Title" + } + ] + }, + { + "prpId": 5, + "title": "Url", + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "regex1": "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)" + } + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "Lookup", + "paramUrl": "Lookup", + "schemaType": "part", + "title": "Lookup", + "image": "/assets/images/lookup.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 5, + "title": "Url", + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "required": true, + "regex1": "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)" + } + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "Upload", + "paramUrl": "Upload", + "schemaType": "part", + "title": "Upload", + "image": "/assets/images/upload.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3, + "title": "multiple", + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "No" + }, + { + "id": 2, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 3008, + "title": "mimes", + "multi": "true", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "Text", + "caption": "mime" + }, + { + "part": 2, + "viewType": "text", + "caption": "minSize", + "validations": { + "dataType": "int" + } + }, + { + "part": 3, + "viewType": "text", + "caption": "maxSize", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3009, + "title": "size", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + }, + { + "schemaId": "Blob", + "paramUrl": "Blob", + "schemaType": "part", + "title": "Upload Multi Part", + "image": "/assets/images/upload.png", + "questions": [ + { + "prpId": 1, + "title": "Caption", + "parts": [ + { + "part": 1, + "link": "/server/popup", + "viewType": "html", + "multi": false + } + ] + }, + { + "prpId": 2, + "title": "Css Class", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3, + "title": "multiple", + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "No" + }, + { + "id": 2, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 4, + "title": "upload token", + "parts": [ + { + "part": 1, + "viewType": "text" + } + ] + }, + { + "prpId": 3001, + "title": "required", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "No" + }, + { + "id": 1, + "value": "Yes" + } + ] + } + ] + }, + { + "prpId": 3008, + "title": "mimes", + "multi": "true", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "Text", + "caption": "mime" + }, + { + "part": 2, + "viewType": "text", + "caption": "minSize", + "validations": { + "dataType": "int" + } + }, + { + "part": 3, + "viewType": "text", + "caption": "maxSize", + "validations": { + "dataType": "int" + } + } + ] + }, + { + "prpId": 3009, + "title": "size", + "sectionId": 1, + "parts": [ + { + "part": 1, + "viewType": "text", + "validations": { + "dataType": "int" + } + } + ] + } + ], + "sections": [ + { + "id": 1, + "title": "Validations" + } + ] + } + ] + } + ] + } + ] +} diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index 854ab15..cd4ed4d 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -110,6 +110,62 @@ export default class SchemaUtil { answerSchema.properties.push(retVal); } } + public static addSimpleValuePropertyToSubSchema( + answerSchema: IAnswerSchema, + value: any, + prpId: number, + innerPrpId: number, + innerValue: string + ): void { + if (value != null && value != undefined) { + const partValue: IPartValue = { + id: 0, + value: value, + answer: { + usedForId: 1, + lastUpdate: Date.now().toString(), + schemaVersion: "1.1", + schemaId: "add-to-log", + paramUrl: "add-to-log", + lid: 1, + properties: [ + { + prpId: innerPrpId, + answers: [ + { + id: 0, + parts: [ + { + part: 1, + values: [ + { + id: 0, + value: innerValue, + }, + ], + }, + ], + }, + ], + }, + ], + }, + }; + const partCollection: IPartCollection = { + part: 1, + values: [partValue], + }; + const answerPart: IAnswerPart = { + id: 0, + parts: [partCollection], + }; + const retVal: IAnswerProperty = { + prpId: prpId, + answers: [answerPart], + }; + answerSchema.properties.push(retVal); + } + } public static getPropertyValue( result: IUserActionResult, @@ -136,6 +192,26 @@ export default class SchemaUtil { } return retVal; } + public static getSubSchema( + result: IUserActionResult, + propId: number, + part: number = 0 + ): any { + let retVal: IUserActionResult = null; + const property = result.properties.find((x) => x.propId == propId); + if (property) { + if (property.edited) { + retVal = property.edited[0].parts[part].values[0].answer; + } + if (property.added) { + retVal = property.added[0].parts[part].values[0].answer; + } + if (property.deleted) { + retVal = property.deleted[0].parts[0].values[0].answer; + } + } + return retVal; + } public static getMimeValidationPropertyValue( result: IUserActionResult, @@ -245,7 +321,7 @@ export default class SchemaUtil { public static getMultipleProperty(result: IUserActionResult) { return SchemaUtil.getPropertyValue(result, SchemaUtil.MULTIPLE_ID); } - + public static addUploadTokenProperty( answerSchema: IAnswerSchema, uploadToken: string diff --git a/src/components/modules/ModuleFactory.ts b/src/components/modules/ModuleFactory.ts index a64b14b..4a0387f 100644 --- a/src/components/modules/ModuleFactory.ts +++ b/src/components/modules/ModuleFactory.ts @@ -46,6 +46,7 @@ export default class ModuleFactory implements IModuleFactory { break; } case "question": { + module = new QuestionModule(owner, container, isABuiltIn, model); break; } diff --git a/src/components/modules/base-class/ToolboxModule.ts b/src/components/modules/base-class/ToolboxModule.ts index 9560b57..b78d50e 100644 --- a/src/components/modules/base-class/ToolboxModule.ts +++ b/src/components/modules/base-class/ToolboxModule.ts @@ -63,6 +63,7 @@ export default abstract class ToolboxModule { this.container .querySelector("[data-btn-setting]") .addEventListener("click", (e) => { + console.log("888888888888",this.getAnswerSchema()) e.preventDefault(); this.rootComponent .getOwner() diff --git a/src/components/modules/question/IQuestionModuleDataModel.ts b/src/components/modules/question/IQuestionModuleDataModel.ts index 1951c76..5ef6dc5 100644 --- a/src/components/modules/question/IQuestionModuleDataModel.ts +++ b/src/components/modules/question/IQuestionModuleDataModel.ts @@ -1,12 +1,13 @@ import { HTMLValueType } from "basiscore"; - export default interface IQuestionModuleDataModel { - titleData : HTMLValueType, + titleData: HTMLValueType; title: string | HTMLValueType; part: number; multi: boolean; cssClass: string; help: string; useInList?: boolean; + addToLog?: boolean; + logValue? :string; } diff --git a/src/components/modules/question/QuestionModule.ts b/src/components/modules/question/QuestionModule.ts index db5e5f9..1f94c6e 100644 --- a/src/components/modules/question/QuestionModule.ts +++ b/src/components/modules/question/QuestionModule.ts @@ -22,6 +22,7 @@ export default class QuestionModule extends ContainerModule { private static readonly CSS_CLASS_ID = 4; private static readonly HELP_URL_ID = 5; private static readonly USE_IN_LIST_ID = 6; + private static readonly ADD_LOG_ID = 7; private readonly _data: Partial; private readonly _schema: IQuestion; @@ -36,6 +37,19 @@ export default class QuestionModule extends ContainerModule { getTitleData() { return this._data.titleData; } + set addToLog(value: boolean) { + this._data.addToLog = value; + } + get addToLog() { + return this._data.addToLog; + } + set logName(value: string) { + this._data.logValue = value; + } + get logName(): string { + return this._data.logValue; + } + get title(): string | HTMLValueType { return this._data.title; } @@ -95,6 +109,8 @@ export default class QuestionModule extends ContainerModule { if (this._schema) { this._data = { title: this._schema.title, + addToLog: this._schema?.addToLog, + logValue: this._schema?.logValue, cssClass: this._schema.cssClass, help: this._schema.help, multi: this._schema.multi, @@ -104,7 +120,7 @@ export default class QuestionModule extends ContainerModule { } else { this._data = { multi: false, - title: { value: "test value", id: 0 }, + title: "test title", part: 1, }; } @@ -148,10 +164,18 @@ export default class QuestionModule extends ContainerModule { this._data.useInList ? "2" : "1", QuestionModule.USE_IN_LIST_ID ); + console.log("RRRRRRRR",this.logName) + SchemaUtil.addSimpleValuePropertyToSubSchema( + ans, + this._data.addToLog, + QuestionModule.ADD_LOG_ID,1,this.logName + ); + console.log("mf doom",ans) return ans; } public update(result: IUserActionResult): void { + console.log("result", result); const title = SchemaUtil.getPropertyValue(result, QuestionModule.TITLE_ID); if (title != null) { this.title = title; @@ -187,6 +211,19 @@ export default class QuestionModule extends ContainerModule { result, QuestionModule.USE_IN_LIST_ID ); + const addToLog = SchemaUtil.getPropertyValue( + result, + QuestionModule.ADD_LOG_ID + ); + this.addToLog = addToLog; + if (this.addToLog) { + + const subSchema = SchemaUtil.getSubSchema(result, QuestionModule.ADD_LOG_ID); + this.logName = SchemaUtil.getPropertyValue( + subSchema, + 1 + );console.log("monster",this.addToLog,this.logName) + } if (useInList != null) { this._data.useInList = useInList == "2"; } @@ -196,7 +233,8 @@ export default class QuestionModule extends ContainerModule { const sectionId = this.owner .closest("[data-drop-acceptable-container-schema-type]") .getAttribute("data-bc-section-id"); - + console.log("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFff", this._data); + console.log("sina",this.logName) const question: IQuestion = { ...(this._schema && { prpId: this._schema.prpId }), ...(this._schema && { typeId: this._schema.typeId }), @@ -211,12 +249,15 @@ export default class QuestionModule extends ContainerModule { ...(this._data.titleData && { titleData: this.getTitleData(), }), + ...(this._schema && { wordId: this._schema.wordId }), ...(this._data.multi && { multi: this._data.multi }), ...(sectionId && { sectionId: parseInt(sectionId) }), ...(this._data.cssClass && { cssClass: this._data.cssClass }), ...(this._data.help && { help: this._data.help }), ...(this._data.useInList && { useInList: this._data.useInList }), + ...(this._data.addToLog && { addToLog: this._data.addToLog }), + ...(this.logName && {logValue : this.logName}), parts: null, }; diff --git a/src/components/modules/section/SectionModule.ts b/src/components/modules/section/SectionModule.ts index b28ba3f..3e15bb9 100644 --- a/src/components/modules/section/SectionModule.ts +++ b/src/components/modules/section/SectionModule.ts @@ -63,7 +63,7 @@ export default class SectionModule extends ContainerModule { if (!this._data) { this._data = { id: this.usedForId, - title: { id: 0, value: "test title" }, + title : "test title" , description: "", }; } diff --git a/src/components/property-box/assets/layout.html b/src/components/property-box/assets/layout.html index 05adbd0..ab8b38e 100644 --- a/src/components/property-box/assets/layout.html +++ b/src/components/property-box/assets/layout.html @@ -18,3 +18,4 @@ + diff --git a/src/components/property-box/assets/style.css b/src/components/property-box/assets/style.css index 130f35d..ca0aa19 100644 --- a/src/components/property-box/assets/style.css +++ b/src/components/property-box/assets/style.css @@ -183,4 +183,7 @@ [data-bc-properties-container] [data-bc-fm-lookup] input[type="text"] { margin-left: 0; margin-right: 10px; -} \ No newline at end of file +} +[data-bc-sm-sub-schema-container] [data-bc-part-container] { + width : -webkit-fill-available + } \ No newline at end of file diff --git a/src/components/workspace/assets/style.css b/src/components/workspace/assets/style.css index 6597084..28f7e0c 100644 --- a/src/components/workspace/assets/style.css +++ b/src/components/workspace/assets/style.css @@ -233,7 +233,7 @@ [data-bc-part-related-cell] { margin-left: 0px !important; } -[data-bc-title-container] { +[data-details] [data-bc-title-container] { width: 130px !important; height: 30px !important; margin-left: 0px; diff --git a/wwwroot/component/new/index.html b/wwwroot/component/new/index.html index 10e0049..62b79e1 100644 --- a/wwwroot/component/new/index.html +++ b/wwwroot/component/new/index.html @@ -1,38 +1,51 @@ + + + + + Schema Maker Command - Zero Config + + - - - - - Schema Maker Command - Zero Config - - - - - + - - - - - - - - + + + + + + diff --git a/wwwroot/component/new/schema/index.html b/wwwroot/component/new/schema/index.html index 37830f8..88c7fa4 100644 --- a/wwwroot/component/new/schema/index.html +++ b/wwwroot/component/new/schema/index.html @@ -1,38 +1,52 @@ + + + + + Schema Maker Command - Zero Config + + - - - - - Schema Maker Command - Zero Config - - - - - + - - - - - - - - + + + + + + From a999b599cd135769972f9b8ad275af9ec2382162 Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 18 Jun 2024 12:46:01 +0200 Subject: [PATCH 02/19] final --- server/schemas/new/questions.json | 13 +++------ src/SchemaUtil.ts | 15 ++++++----- .../modules/base-class/ToolboxModule.ts | 1 - .../question/IQuestionModuleDataModel.ts | 2 +- .../modules/question/QuestionModule.ts | 27 +++++++++---------- 5 files changed, 26 insertions(+), 32 deletions(-) diff --git a/server/schemas/new/questions.json b/server/schemas/new/questions.json index c6e070e..6b70280 100644 --- a/server/schemas/new/questions.json +++ b/server/schemas/new/questions.json @@ -157,15 +157,11 @@ "parts": [ { "part": 1, - "viewType": "radio", + "viewType": "checklist", "fixValues": [ { - "id": 0, - "value": "off" - }, - { - "id": 4, - "value": "on", + "id": 1, + "value": "", "schema": { "schemaId": 10, "paramUrl": "add-to-log", @@ -1218,14 +1214,13 @@ }, { "paramUrl": "add-to-log", - "schemaVersion": 1.1, "lid": 1, "schemaId": "add-to-log", "baseVocab": "http://schema.site/FA/vo", "questions": [ { - "prpId": 1, + "prpId": 71, "vocab": "LogName", "title": "LogName", "multi": false, diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index cd4ed4d..a8e53c8 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -115,31 +115,34 @@ export default class SchemaUtil { value: any, prpId: number, innerPrpId: number, - innerValue: string + innerValue: string, + usedForId :number ): void { + console.log(innerValue) if (value != null && value != undefined) { const partValue: IPartValue = { - id: 0, + id: 1, value: value, answer: { - usedForId: 1, - lastUpdate: Date.now().toString(), + usedForId: usedForId, + lastUpdate: "", schemaVersion: "1.1", schemaId: "add-to-log", paramUrl: "add-to-log", lid: 1, properties: [ { + //@ts-ignore prpId: innerPrpId, answers: [ { - id: 0, + id : 1, parts: [ { part: 1, values: [ { - id: 0, + id : 1, value: innerValue, }, ], diff --git a/src/components/modules/base-class/ToolboxModule.ts b/src/components/modules/base-class/ToolboxModule.ts index b78d50e..9560b57 100644 --- a/src/components/modules/base-class/ToolboxModule.ts +++ b/src/components/modules/base-class/ToolboxModule.ts @@ -63,7 +63,6 @@ export default abstract class ToolboxModule { this.container .querySelector("[data-btn-setting]") .addEventListener("click", (e) => { - console.log("888888888888",this.getAnswerSchema()) e.preventDefault(); this.rootComponent .getOwner() diff --git a/src/components/modules/question/IQuestionModuleDataModel.ts b/src/components/modules/question/IQuestionModuleDataModel.ts index 5ef6dc5..dc10f8a 100644 --- a/src/components/modules/question/IQuestionModuleDataModel.ts +++ b/src/components/modules/question/IQuestionModuleDataModel.ts @@ -9,5 +9,5 @@ export default interface IQuestionModuleDataModel { help: string; useInList?: boolean; addToLog?: boolean; - logValue? :string; + logName? :string; } diff --git a/src/components/modules/question/QuestionModule.ts b/src/components/modules/question/QuestionModule.ts index 1f94c6e..a2de90f 100644 --- a/src/components/modules/question/QuestionModule.ts +++ b/src/components/modules/question/QuestionModule.ts @@ -44,10 +44,10 @@ export default class QuestionModule extends ContainerModule { return this._data.addToLog; } set logName(value: string) { - this._data.logValue = value; + this._data.logName = value; } get logName(): string { - return this._data.logValue; + return this._data.logName; } get title(): string | HTMLValueType { @@ -109,8 +109,6 @@ export default class QuestionModule extends ContainerModule { if (this._schema) { this._data = { title: this._schema.title, - addToLog: this._schema?.addToLog, - logValue: this._schema?.logValue, cssClass: this._schema.cssClass, help: this._schema.help, multi: this._schema.multi, @@ -122,6 +120,7 @@ export default class QuestionModule extends ContainerModule { multi: false, title: "test title", part: 1, + logName : "test title" }; } this.title = this._data.title as string; @@ -164,13 +163,13 @@ export default class QuestionModule extends ContainerModule { this._data.useInList ? "2" : "1", QuestionModule.USE_IN_LIST_ID ); - console.log("RRRRRRRR",this.logName) + console.log(this.logName) SchemaUtil.addSimpleValuePropertyToSubSchema( ans, - this._data.addToLog, - QuestionModule.ADD_LOG_ID,1,this.logName + this._data.addToLog ? "1" : null, + QuestionModule.ADD_LOG_ID,71,this.logName,this.usedForId ); - console.log("mf doom",ans) + console.log(JSON.stringify(ans)) return ans; } @@ -215,14 +214,13 @@ export default class QuestionModule extends ContainerModule { result, QuestionModule.ADD_LOG_ID ); - this.addToLog = addToLog; + this.addToLog = addToLog ? true : false; if (this.addToLog) { - const subSchema = SchemaUtil.getSubSchema(result, QuestionModule.ADD_LOG_ID); - this.logName = SchemaUtil.getPropertyValue( + this.logName = SchemaUtil.getPropertyValue( subSchema, - 1 - );console.log("monster",this.addToLog,this.logName) + 71 + );console.log("monster",subSchema,this.addToLog,this.logName) } if (useInList != null) { this._data.useInList = useInList == "2"; @@ -233,7 +231,6 @@ export default class QuestionModule extends ContainerModule { const sectionId = this.owner .closest("[data-drop-acceptable-container-schema-type]") .getAttribute("data-bc-section-id"); - console.log("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFff", this._data); console.log("sina",this.logName) const question: IQuestion = { ...(this._schema && { prpId: this._schema.prpId }), @@ -257,7 +254,7 @@ export default class QuestionModule extends ContainerModule { ...(this._data.help && { help: this._data.help }), ...(this._data.useInList && { useInList: this._data.useInList }), ...(this._data.addToLog && { addToLog: this._data.addToLog }), - ...(this.logName && {logValue : this.logName}), + ...(this.logName && {logName : this.logName}), parts: null, }; From 42ada09a544ed0d2a080b3aefecb623ae0ca7383 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 22 Jun 2024 07:43:07 +0200 Subject: [PATCH 03/19] remove logs --- src/SchemaUtil.ts | 1 - src/components/modules/question/QuestionModule.ts | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index a8e53c8..6969aaa 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -118,7 +118,6 @@ export default class SchemaUtil { innerValue: string, usedForId :number ): void { - console.log(innerValue) if (value != null && value != undefined) { const partValue: IPartValue = { id: 1, diff --git a/src/components/modules/question/QuestionModule.ts b/src/components/modules/question/QuestionModule.ts index a2de90f..9984838 100644 --- a/src/components/modules/question/QuestionModule.ts +++ b/src/components/modules/question/QuestionModule.ts @@ -163,18 +163,15 @@ export default class QuestionModule extends ContainerModule { this._data.useInList ? "2" : "1", QuestionModule.USE_IN_LIST_ID ); - console.log(this.logName) SchemaUtil.addSimpleValuePropertyToSubSchema( ans, this._data.addToLog ? "1" : null, QuestionModule.ADD_LOG_ID,71,this.logName,this.usedForId ); - console.log(JSON.stringify(ans)) return ans; } public update(result: IUserActionResult): void { - console.log("result", result); const title = SchemaUtil.getPropertyValue(result, QuestionModule.TITLE_ID); if (title != null) { this.title = title; @@ -220,7 +217,7 @@ export default class QuestionModule extends ContainerModule { this.logName = SchemaUtil.getPropertyValue( subSchema, 71 - );console.log("monster",subSchema,this.addToLog,this.logName) + ) } if (useInList != null) { this._data.useInList = useInList == "2"; @@ -231,7 +228,6 @@ export default class QuestionModule extends ContainerModule { const sectionId = this.owner .closest("[data-drop-acceptable-container-schema-type]") .getAttribute("data-bc-section-id"); - console.log("sina",this.logName) const question: IQuestion = { ...(this._schema && { prpId: this._schema.prpId }), ...(this._schema && { typeId: this._schema.typeId }), From aa3afd01dc1441d370083f76c10da1c1e9602d9a Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 13 Jul 2024 08:40:29 +0200 Subject: [PATCH 04/19] add priority --- server/schemas/new/questions.json | 27 ++++++++++++++++++- server/schemas/newSchema/questions.json | 24 +++++++++++++++++ src/SchemaUtil.ts | 27 ++++++++++++++----- .../modules/list-base/ListBaseModule.ts | 8 ++++-- 4 files changed, 77 insertions(+), 9 deletions(-) diff --git a/server/schemas/new/questions.json b/server/schemas/new/questions.json index 6b70280..a2d2738 100644 --- a/server/schemas/new/questions.json +++ b/server/schemas/new/questions.json @@ -149,7 +149,8 @@ ] } ] - }, { + }, + { "prpId": 7, "vocab": "AddToLog", "title": "AddToLog", @@ -646,6 +647,14 @@ "part": 2, "viewType": "text", "caption": "Title" + }, + { + "part": 3, + "viewType": "text", + "caption": "priority", + "validations": { + "dataType": "float" + } } ] }, @@ -735,6 +744,14 @@ "part": 2, "viewType": "text", "caption": "Title" + }, + { + "part": 3, + "viewType": "text", + "caption": "priority", + "validations": { + "dataType": "float" + } } ] }, @@ -849,6 +866,14 @@ "part": 2, "viewType": "text", "caption": "Title" + }, + { + "part": 3, + "viewType": "text", + "caption": "priority", + "validations": { + "dataType": "float" + } } ] }, diff --git a/server/schemas/newSchema/questions.json b/server/schemas/newSchema/questions.json index 73867ae..6a8d501 100644 --- a/server/schemas/newSchema/questions.json +++ b/server/schemas/newSchema/questions.json @@ -631,6 +631,14 @@ "viewType": "html", "multi": true, "caption": "Title" + }, + { + "part": 3, + "viewType": "text", + "caption": "priority", + "validations": { + "dataType": "float" + } } ] }, @@ -724,6 +732,14 @@ "viewType": "html", "multi": true, "caption": "Title" + }, + { + "part": 3, + "viewType": "text", + "caption": "priority", + "validations": { + "dataType": "float" + } } ] }, @@ -842,6 +858,14 @@ "viewType": "html", "multi": true, "caption": "Title" + }, + { + "part": 3, + "viewType": "text", + "caption": "priority", + "validations": { + "dataType": "float" + } } ] }, diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index 6969aaa..aacfbc4 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -116,7 +116,7 @@ export default class SchemaUtil { prpId: number, innerPrpId: number, innerValue: string, - usedForId :number + usedForId: number ): void { if (value != null && value != undefined) { const partValue: IPartValue = { @@ -135,13 +135,13 @@ export default class SchemaUtil { prpId: innerPrpId, answers: [ { - id : 1, + id: 1, parts: [ { part: 1, values: [ { - id : 1, + id: 1, value: innerValue, }, ], @@ -519,10 +519,17 @@ export default class SchemaUtil { part: 2, values: [valuePartValue], }; - + const priorityPartValue :IPartValue = { + id: 0, + value: index +1 , + }; + const priorityPartCollection: IPartCollection = { + part: 3, + values: [priorityPartValue], + }; const answerPart: IAnswerPart = { id: value.id ?? -1 * (index + 1), - parts: [idPartCollection, valuePartCollection], + parts: [idPartCollection, valuePartCollection,priorityPartCollection], }; answers.push(answerPart); }); @@ -553,6 +560,8 @@ export default class SchemaUtil { edited.id = parseInt(editedPart.values[0].value); } else if (editedPart.part == 2) { edited.value = editedPart.values[0].value; + } else if (editedPart.part == 3) { + edited.priority = editedPart.values[0].value; } }); }); @@ -576,14 +585,20 @@ export default class SchemaUtil { const id = addedItem.parts.find((x) => x.part == 1)?.values[0].value; const value = addedItem.parts.find((x) => x.part == 2)?.values[0] .value; + const priority = addedItem.parts.find((x) => x.part == 3)?.values[0] + .value; const added: IFixValue = { id: id ? parseInt(id) : null, value: value, + priority : priority }; retVal.push(added); }); + } } - return retVal.length > 0 ? retVal : null; + return retVal.length > 0 + ? retVal.sort((a, b) => a.priority - b.priority) + : null; } } diff --git a/src/components/modules/list-base/ListBaseModule.ts b/src/components/modules/list-base/ListBaseModule.ts index 22918ec..4a874f4 100644 --- a/src/components/modules/list-base/ListBaseModule.ts +++ b/src/components/modules/list-base/ListBaseModule.ts @@ -26,7 +26,7 @@ export default abstract class ListBaseModule extends PartBaseModule{ + return { + ...fixedValue,priority : index + 1 + } + }) : null , ListBaseModule.FIX_VALUES_ID ); From 3a7791daefbfb5585beb2f98004d6a353ccc7aa7 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 13 Jul 2024 13:05:54 +0200 Subject: [PATCH 05/19] first steps --- server/schemas/new/questions.json | 118 ++++++++++++++++++ server/schemas/newSchema/questions.json | 118 ++++++++++++++++++ src/SchemaUtil.ts | 1 + .../text-base/ITextBaseModuleDataModel.ts | 5 +- .../text-base/date-picker/DatePickerModule.ts | 25 +++- .../date-picker/DatePickerOptions.ts | 11 ++ .../date-picker/IDateQuestionPart.ts | 13 ++ 7 files changed, 288 insertions(+), 3 deletions(-) create mode 100644 src/components/modules/text-base/date-picker/DatePickerOptions.ts create mode 100644 src/components/modules/text-base/date-picker/IDateQuestionPart.ts diff --git a/server/schemas/new/questions.json b/server/schemas/new/questions.json index a2d2738..38583b8 100644 --- a/server/schemas/new/questions.json +++ b/server/schemas/new/questions.json @@ -409,6 +409,120 @@ } ] }, + { + "prpId": 3, + "title": "dateProvider", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "basisCalendar" + } + ] + } + ] + }, + { + "prpId": 4, + "title": "yearsList", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "false" + }, + { + "id": 1, + "value": "true" + } + ] + } + ] + }, + { + "prpId": 6, + "title": "rangeDates", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "false" + }, + { + "id": 1, + "value": "true" + } + ] + } + ] + }, + { + "prpId": 7, + "title": "switchType", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "false" + }, + { + "id": 1, + "value": "true" + } + ] + } + ] + }, + { + "prpId": 8, + "title": "Type", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "click" + } + ] + } + ] + }, + { + "prpId": 9, + "title": "Mode", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "Desktop" + } + ] + } + ] + }, { "prpId": 3001, "title": "required", @@ -435,6 +549,10 @@ { "id": 1, "title": "Validations" + }, + { + "id" : 2, + "title" : "Options" } ] }, diff --git a/server/schemas/newSchema/questions.json b/server/schemas/newSchema/questions.json index 6a8d501..4103d05 100644 --- a/server/schemas/newSchema/questions.json +++ b/server/schemas/newSchema/questions.json @@ -387,6 +387,120 @@ } ] }, + { + "prpId": 3, + "title": "dateProvider", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "basisCalendar" + } + ] + } + ] + }, + { + "prpId": 4, + "title": "yearsList", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "false" + }, + { + "id": 1, + "value": "true" + } + ] + } + ] + }, + { + "prpId": 6, + "title": "rangeDates", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "false" + }, + { + "id": 1, + "value": "true" + } + ] + } + ] + }, + { + "prpId": 7, + "title": "switchType", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 0, + "value": "false" + }, + { + "id": 1, + "value": "true" + } + ] + } + ] + }, + { + "prpId": 8, + "title": "Type", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "click" + } + ] + } + ] + }, + { + "prpId": 9, + "title": "Mode", + "sectionId": 2, + "parts": [ + { + "part": 1, + "viewType": "select", + "fixValues": [ + { + "id": 1, + "value": "Desktop" + } + ] + } + ] + }, { "prpId": 3001, "title": "required", @@ -413,6 +527,10 @@ { "id": 1, "title": "Validations" + }, + { + "id" : 2, + "title" : "Options" } ] }, diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index aacfbc4..10c265d 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -547,6 +547,7 @@ export default class SchemaUtil { propId: number ): IFixValue[] { const retVal = values ? [...values] : []; + console.log("alireza",result,values,propId) const property = result.properties.find((x) => x.propId == propId); if (property) { if (property.edited) { diff --git a/src/components/modules/text-base/ITextBaseModuleDataModel.ts b/src/components/modules/text-base/ITextBaseModuleDataModel.ts index 7948d00..ca1286e 100644 --- a/src/components/modules/text-base/ITextBaseModuleDataModel.ts +++ b/src/components/modules/text-base/ITextBaseModuleDataModel.ts @@ -1,4 +1,7 @@ import IPartBaseModuleDataModel from "../IPartBaseModuleDataModel"; +import IDatepickerOptions from "./date-picker/DatePickerOptions"; export default interface ITextBaseModuleDataModel - extends IPartBaseModuleDataModel {} + extends IPartBaseModuleDataModel { + options?: Partial +} diff --git a/src/components/modules/text-base/date-picker/DatePickerModule.ts b/src/components/modules/text-base/date-picker/DatePickerModule.ts index 63c16fe..ae95097 100644 --- a/src/components/modules/text-base/date-picker/DatePickerModule.ts +++ b/src/components/modules/text-base/date-picker/DatePickerModule.ts @@ -3,14 +3,35 @@ import IWorkspaceComponent from "../../../workspace/IWorkspaceComponent"; import TextBaseModule from "../TextBaseModule"; import layout from "./assets/layout.html"; import "./assets/style.css"; +import IDateQuestionPart from "./IDateQuestionPart"; export default class DatePickerModule extends TextBaseModule { + + private readonly DATE_PROVIDER_ID = 3 + private readonly YEARS_LIST_ID =4 + private readonly MONTH_LIST_ID =5 + protected readonly RANGE_DATES_ID = 6 + protected readonly SWITCH_TYPE_ID = 7 + protected readonly TYPE_ID = 8 + protected readonly MODE_ID = 9 + constructor( owner: HTMLElement, component: IWorkspaceComponent, isABuiltIn: boolean, - model: IQuestionPart + questionPart: IDateQuestionPart ) { - super(layout, owner, component, "Datepicker", isABuiltIn, model); + super(layout, owner, component, "Datepicker", isABuiltIn, questionPart); + if(questionPart){ + this.data.options = { + Culture : questionPart.Culture, + lid : questionPart.lid, + yearsList : questionPart.yearsList, + monthList : questionPart.monthList, + switchType : questionPart.switchType, + Type : questionPart.Type, + Style : questionPart.Style + } + } } } diff --git a/src/components/modules/text-base/date-picker/DatePickerOptions.ts b/src/components/modules/text-base/date-picker/DatePickerOptions.ts new file mode 100644 index 0000000..3f9f2c3 --- /dev/null +++ b/src/components/modules/text-base/date-picker/DatePickerOptions.ts @@ -0,0 +1,11 @@ +export default interface IDatepickerOptions { + Culture: string; + lid: string; + yearsList: boolean; + monthList: boolean; + rangeDates: boolean; + switchType: string; + Type: string; + Mode: string; + Style: string; +} diff --git a/src/components/modules/text-base/date-picker/IDateQuestionPart.ts b/src/components/modules/text-base/date-picker/IDateQuestionPart.ts new file mode 100644 index 0000000..01eef97 --- /dev/null +++ b/src/components/modules/text-base/date-picker/IDateQuestionPart.ts @@ -0,0 +1,13 @@ +import { IQuestionPart } from "basiscore"; + +export default interface IDateQuestionPart extends IQuestionPart { + Culture?: string; + lid?: string; + yearsList?: boolean; + monthList?: boolean; + rangeDates?: boolean; + switchType?: string; + Type?: string; + Mode?: string; + Style?: string; +} From 87df071af3d03a213a9af4a306d74ae155d0ad98 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 13 Jul 2024 13:13:13 +0200 Subject: [PATCH 06/19] final --- src/SchemaUtil.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index aacfbc4..f0518fc 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -10,6 +10,9 @@ import { IMimes, } from "basiscore"; +interface IFixValueEx extends IFixValue { + priority : number +} export default class SchemaUtil { private static readonly CAPTION_ID = 1; private static readonly CSS_CLASS_ID = 2; @@ -543,9 +546,9 @@ export default class SchemaUtil { public static getFixValueProperty( result: IUserActionResult, - values: IFixValue[], + values: IFixValueEx[], propId: number - ): IFixValue[] { + ): IFixValueEx[] { const retVal = values ? [...values] : []; const property = result.properties.find((x) => x.propId == propId); if (property) { @@ -587,7 +590,7 @@ export default class SchemaUtil { .value; const priority = addedItem.parts.find((x) => x.part == 3)?.values[0] .value; - const added: IFixValue = { + const added: IFixValueEx = { id: id ? parseInt(id) : null, value: value, priority : priority From 9bdb99aac7160008b796cabde30402a55e080f2e Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 13 Jul 2024 13:17:02 +0200 Subject: [PATCH 07/19] final --- server/schemas/new/questions.json | 6 +++--- server/schemas/newSchema/questions.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/schemas/new/questions.json b/server/schemas/new/questions.json index a2d2738..1baa1dc 100644 --- a/server/schemas/new/questions.json +++ b/server/schemas/new/questions.json @@ -638,7 +638,7 @@ { "part": 1, "viewType": "Text", - "caption": "Value", + "caption": "Id", "validations": { "dataType": "int" } @@ -735,7 +735,7 @@ { "part": 1, "viewType": "Text", - "caption": "Value", + "caption": "Id", "validations": { "dataType": "int" } @@ -857,7 +857,7 @@ { "part": 1, "viewType": "Text", - "caption": "Value", + "caption": "Id", "validations": { "dataType": "int" } diff --git a/server/schemas/newSchema/questions.json b/server/schemas/newSchema/questions.json index 6a8d501..51e4ae1 100644 --- a/server/schemas/newSchema/questions.json +++ b/server/schemas/newSchema/questions.json @@ -620,7 +620,7 @@ { "part": 1, "viewType": "Text", - "caption": "Value", + "caption": "Id", "validations": { "dataType": "int" } @@ -721,7 +721,7 @@ { "part": 1, "viewType": "Text", - "caption": "Value", + "caption": "Id", "validations": { "dataType": "int" } @@ -847,7 +847,7 @@ { "part": 1, "viewType": "Text", - "caption": "Value", + "caption": "Id", "validations": { "dataType": "int" } From c43cf15f622f79c3ab6c2ce244eaedaf589b2149 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 13 Jul 2024 14:10:42 +0200 Subject: [PATCH 08/19] FINAL --- src/SchemaUtil.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index f0518fc..dfa4ce9 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -548,7 +548,7 @@ export default class SchemaUtil { result: IUserActionResult, values: IFixValueEx[], propId: number - ): IFixValueEx[] { + ): IFixValue[] { const retVal = values ? [...values] : []; const property = result.properties.find((x) => x.propId == propId); if (property) { From e549253d63286a84625e3812fd243d75df80178b Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 13 Jul 2024 16:00:38 +0200 Subject: [PATCH 09/19] STEP 1 --- server/schemas/new/questions.json | 42 +++++----- server/schemas/newSchema/questions.json | 42 +++++----- .../text-base/date-picker/DatePickerModule.ts | 84 +++++++++++++++---- .../date-picker/DatePickerOptions.ts | 15 ++-- .../date-picker/IDateQuestionPart.ts | 15 ++-- 5 files changed, 122 insertions(+), 76 deletions(-) diff --git a/server/schemas/new/questions.json b/server/schemas/new/questions.json index c20d1cc..d9f600b 100644 --- a/server/schemas/new/questions.json +++ b/server/schemas/new/questions.json @@ -411,16 +411,20 @@ }, { "prpId": 3, - "title": "dateProvider", + "title": "todayButton", "sectionId": 2, "parts": [ { "part": 1, "viewType": "select", "fixValues": [ + { + "id": 0, + "value": "false" + }, { "id": 1, - "value": "basisCalendar" + "value": "true" } ] } @@ -448,8 +452,8 @@ ] }, { - "prpId": 6, - "title": "rangeDates", + "prpId": 5, + "title": "monthList", "sectionId": 2, "parts": [ { @@ -469,8 +473,8 @@ ] }, { - "prpId": 7, - "title": "switchType", + "prpId": 6, + "title": "rangeDates", "sectionId": 2, "parts": [ { @@ -490,36 +494,34 @@ ] }, { - "prpId": 8, - "title": "Type", + "prpId": 7, + "title": "switchType", "sectionId": 2, "parts": [ { "part": 1, "viewType": "select", "fixValues": [ + { + "id": 0, + "value": "false" + }, { "id": 1, - "value": "click" + "value": "true" } ] } ] }, { - "prpId": 9, - "title": "Mode", + "prpId": 8, + "title": "style", "sectionId": 2, "parts": [ { "part": 1, - "viewType": "select", - "fixValues": [ - { - "id": 1, - "value": "Desktop" - } - ] + "viewType": "text" } ] }, @@ -551,8 +553,8 @@ "title": "Validations" }, { - "id" : 2, - "title" : "Options" + "id": 2, + "title": "Options" } ] }, diff --git a/server/schemas/newSchema/questions.json b/server/schemas/newSchema/questions.json index c65217f..ca8ec9f 100644 --- a/server/schemas/newSchema/questions.json +++ b/server/schemas/newSchema/questions.json @@ -389,16 +389,20 @@ }, { "prpId": 3, - "title": "dateProvider", + "title": "todayButton", "sectionId": 2, "parts": [ { "part": 1, "viewType": "select", "fixValues": [ + { + "id": 0, + "value": "false" + }, { "id": 1, - "value": "basisCalendar" + "value": "true" } ] } @@ -426,8 +430,8 @@ ] }, { - "prpId": 6, - "title": "rangeDates", + "prpId": 5, + "title": "monthList", "sectionId": 2, "parts": [ { @@ -447,8 +451,8 @@ ] }, { - "prpId": 7, - "title": "switchType", + "prpId": 6, + "title": "rangeDates", "sectionId": 2, "parts": [ { @@ -468,36 +472,34 @@ ] }, { - "prpId": 8, - "title": "Type", + "prpId": 7, + "title": "switchType", "sectionId": 2, "parts": [ { "part": 1, "viewType": "select", "fixValues": [ + { + "id": 0, + "value": "false" + }, { "id": 1, - "value": "click" + "value": "true" } ] } ] }, { - "prpId": 9, - "title": "Mode", + "prpId": 8, + "title": "style", "sectionId": 2, "parts": [ { "part": 1, - "viewType": "select", - "fixValues": [ - { - "id": 1, - "value": "Desktop" - } - ] + "viewType": "text" } ] }, @@ -529,8 +531,8 @@ "title": "Validations" }, { - "id" : 2, - "title" : "Options" + "id": 2, + "title": "Options" } ] }, diff --git a/src/components/modules/text-base/date-picker/DatePickerModule.ts b/src/components/modules/text-base/date-picker/DatePickerModule.ts index ae95097..eaad38e 100644 --- a/src/components/modules/text-base/date-picker/DatePickerModule.ts +++ b/src/components/modules/text-base/date-picker/DatePickerModule.ts @@ -1,19 +1,24 @@ -import { IQuestionPart } from "basiscore"; +import SchemaUtil from "../../../../SchemaUtil"; import IWorkspaceComponent from "../../../workspace/IWorkspaceComponent"; import TextBaseModule from "../TextBaseModule"; import layout from "./assets/layout.html"; import "./assets/style.css"; import IDateQuestionPart from "./IDateQuestionPart"; +import { + IFixValue, + IQuestionPart, + ViewType, + IAnswerSchema, + IUserActionResult, +} from "basiscore"; export default class DatePickerModule extends TextBaseModule { - - private readonly DATE_PROVIDER_ID = 3 - private readonly YEARS_LIST_ID =4 - private readonly MONTH_LIST_ID =5 - protected readonly RANGE_DATES_ID = 6 - protected readonly SWITCH_TYPE_ID = 7 - protected readonly TYPE_ID = 8 - protected readonly MODE_ID = 9 + private readonly TODAY_BUTTON_ID = 3; + private readonly YEARS_LIST_ID = 4; + private readonly MONTH_LIST_ID = 5; + protected readonly RANGE_DATES_ID = 6; + protected readonly SWITCH_TYPE_ID = 7; + protected readonly STYLE_ID = 8; constructor( owner: HTMLElement, @@ -22,16 +27,59 @@ export default class DatePickerModule extends TextBaseModule { questionPart: IDateQuestionPart ) { super(layout, owner, component, "Datepicker", isABuiltIn, questionPart); - if(questionPart){ + if (questionPart) { this.data.options = { - Culture : questionPart.Culture, - lid : questionPart.lid, - yearsList : questionPart.yearsList, - monthList : questionPart.monthList, - switchType : questionPart.switchType, - Type : questionPart.Type, - Style : questionPart.Style - } + todayButton: questionPart.todayButton, + yearsList: questionPart.yearsList, + monthList: questionPart.monthList, + rangeDates: questionPart.rangeDates, + switchType: questionPart.switchType, + style: questionPart.style, + }; } } + + protected getAnswerSchema(): IAnswerSchema { + var ans = super.getAnswerSchema(); + SchemaUtil.addSimpleValueProperty( + ans, + this.data.options.todayButton == true ? 1 : 0, + this.TODAY_BUTTON_ID + ); + SchemaUtil.addSimpleValueProperty( + ans, + this.data.options.yearsList == true ? 1 : 0, + this.YEARS_LIST_ID + ); + SchemaUtil.addSimpleValueProperty( + ans, + this.data.options.yearsList == true ? 1 : 0, + this.MONTH_LIST_ID + ); + SchemaUtil.addSimpleValueProperty( + ans, + this.data.options.rangeDates == true ? 1 : 0, + this.RANGE_DATES_ID + ); + SchemaUtil.addSimpleValueProperty( + ans, + this.data.options.switchType == true ? 1 : 0, + this.SWITCH_TYPE_ID + ); + SchemaUtil.addSimpleValueProperty( + ans, + this.data.options.style, + this.STYLE_ID + ); + return ans; + } + public update(userAction: IUserActionResult): void { + super.update(userAction); + this.data.options.monthList = SchemaUtil.getPropertyValue(userAction,this.MONTH_LIST_ID) == 1 + this.data.options.yearsList = SchemaUtil.getPropertyValue(userAction,this.YEARS_LIST_ID) == 1 + this.data.options.rangeDates = SchemaUtil.getPropertyValue(userAction,this.RANGE_DATES_ID) == 1 + this.data.options.todayButton = SchemaUtil.getPropertyValue(userAction,this.TODAY_BUTTON_ID) == 1 + this.data.options.switchType = SchemaUtil.getPropertyValue(userAction,this.SWITCH_TYPE_ID) == 1 + this.data.options.style= SchemaUtil.getPropertyValue(userAction,this.SWITCH_TYPE_ID) + } } diff --git a/src/components/modules/text-base/date-picker/DatePickerOptions.ts b/src/components/modules/text-base/date-picker/DatePickerOptions.ts index 3f9f2c3..ade3140 100644 --- a/src/components/modules/text-base/date-picker/DatePickerOptions.ts +++ b/src/components/modules/text-base/date-picker/DatePickerOptions.ts @@ -1,11 +1,8 @@ export default interface IDatepickerOptions { - Culture: string; - lid: string; - yearsList: boolean; - monthList: boolean; - rangeDates: boolean; - switchType: string; - Type: string; - Mode: string; - Style: string; + "todayButton": boolean, + "yearsList" : boolean, + "monthList":boolean, + "rangeDates": boolean, + "switchType" : boolean, + "style": string } diff --git a/src/components/modules/text-base/date-picker/IDateQuestionPart.ts b/src/components/modules/text-base/date-picker/IDateQuestionPart.ts index 01eef97..71a46c5 100644 --- a/src/components/modules/text-base/date-picker/IDateQuestionPart.ts +++ b/src/components/modules/text-base/date-picker/IDateQuestionPart.ts @@ -1,13 +1,10 @@ import { IQuestionPart } from "basiscore"; export default interface IDateQuestionPart extends IQuestionPart { - Culture?: string; - lid?: string; - yearsList?: boolean; - monthList?: boolean; - rangeDates?: boolean; - switchType?: string; - Type?: string; - Mode?: string; - Style?: string; + todayButton: boolean; + yearsList: boolean; + monthList: boolean; + rangeDates: boolean; + switchType: boolean; + style: string; } From fc7aab46fd0b7478f6133dda83fac82de6003fd4 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 20 Jul 2024 09:02:34 +0200 Subject: [PATCH 10/19] add is Schema --- server/schemas/newSchema/details.json | 2 +- server/schemas/newSchema/questions.json | 30 ++++++++++++------------- server/schemas/popUp.html | 9 +++++--- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/server/schemas/newSchema/details.json b/server/schemas/newSchema/details.json index 61117c1..6005705 100644 --- a/server/schemas/newSchema/details.json +++ b/server/schemas/newSchema/details.json @@ -34,7 +34,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=true", "viewType": "html", "multi": false } diff --git a/server/schemas/newSchema/questions.json b/server/schemas/newSchema/questions.json index ca8ec9f..b150ac4 100644 --- a/server/schemas/newSchema/questions.json +++ b/server/schemas/newSchema/questions.json @@ -26,7 +26,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -58,7 +58,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -163,7 +163,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -313,7 +313,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -371,7 +371,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -644,7 +644,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -716,7 +716,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -747,7 +747,7 @@ }, { "part": 2, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": true, "caption": "Title" @@ -817,7 +817,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -848,7 +848,7 @@ }, { "part": 2, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": true, "caption": "Title" @@ -943,7 +943,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -974,7 +974,7 @@ }, { "part": 2, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": true, "caption": "Title" @@ -1044,7 +1044,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -1116,7 +1116,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } @@ -1237,7 +1237,7 @@ "parts": [ { "part": 1, - "link": "/server/popup", + "link": "/server/popup?isSchema=false", "viewType": "html", "multi": false } diff --git a/server/schemas/popUp.html b/server/schemas/popUp.html index 5968624..0c6b233 100644 --- a/server/schemas/popUp.html +++ b/server/schemas/popUp.html @@ -113,9 +113,12 @@ - + diff --git a/wwwroot/component/new/index.html b/wwwroot/component/new/index.html index 62b79e1..6976c58 100644 --- a/wwwroot/component/new/index.html +++ b/wwwroot/component/new/index.html @@ -46,6 +46,6 @@

Sample autocomplete Data Url: /server/autocomplete?term=${term}

console.log(args.source?.rows[0]); } - + diff --git a/wwwroot/component/new/schema/index.html b/wwwroot/component/new/schema/index.html index 88c7fa4..d651bd8 100644 --- a/wwwroot/component/new/schema/index.html +++ b/wwwroot/component/new/schema/index.html @@ -47,6 +47,6 @@

Sample autocomplete Data Url: /server/autocomplete?term=${term}

console.log(args.source?.rows[0]); } - + From dd0ee2c5a2ffe0558f60c286c873574e3ebda2d2 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 20 Jul 2024 15:59:30 +0200 Subject: [PATCH 17/19] add temp --- server/schema-server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/schema-server.js b/server/schema-server.js index d164b2a..d20678a 100644 --- a/server/schema-server.js +++ b/server/schema-server.js @@ -156,7 +156,9 @@ router.get("/temp-schema-maker", async (req, res) => { router.get("/keywordinfo", async (req, res) => { const id = Number(req.query.id); const result = data.find((element) => element.id == id); - if (result ) { + if (result.status = "tempKeyWord") { + return res.status(200).json([]) + } return res.status(200).json([ { culture: "fa", @@ -167,7 +169,6 @@ router.get("/keywordinfo", async (req, res) => { title: "Value", }, ]); - } }); module.exports = router; From 59d2c97350d70be5d3cf5cd6125372eb35184a9c Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 20 Jul 2024 16:06:34 +0200 Subject: [PATCH 18/19] fix --- server/schema-server.js | 7 ++----- server/schemas/popUp.html | 35 ++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/server/schema-server.js b/server/schema-server.js index d20678a..65ebf8d 100644 --- a/server/schema-server.js +++ b/server/schema-server.js @@ -156,10 +156,7 @@ router.get("/temp-schema-maker", async (req, res) => { router.get("/keywordinfo", async (req, res) => { const id = Number(req.query.id); const result = data.find((element) => element.id == id); - if (result.status = "tempKeyWord") { - return res.status(200).json([]) - } - return res.status(200).json([ + return res.status(200).json({rows : [ { culture: "fa", title: result.value, @@ -168,7 +165,7 @@ router.get("/keywordinfo", async (req, res) => { culture: "en", title: "Value", }, - ]); + ],status: result.status}); }); module.exports = router; diff --git a/server/schemas/popUp.html b/server/schemas/popUp.html index 7bd72ef..a186da2 100644 --- a/server/schemas/popUp.html +++ b/server/schemas/popUp.html @@ -114,27 +114,33 @@