diff --git a/jsdoc/Test.vue b/jsdoc/Test.vue new file mode 100644 index 000000000..6ed36027c --- /dev/null +++ b/jsdoc/Test.vue @@ -0,0 +1,68 @@ + + + diff --git a/jsdoc/components/Builder.vue b/jsdoc/components/Builder.vue new file mode 100644 index 000000000..6ed36027c --- /dev/null +++ b/jsdoc/components/Builder.vue @@ -0,0 +1,68 @@ + + + diff --git a/jsdoc/components/Forms/Error/Field.vue b/jsdoc/components/Forms/Error/Field.vue new file mode 100644 index 000000000..19d83923a --- /dev/null +++ b/jsdoc/components/Forms/Error/Field.vue @@ -0,0 +1,43 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Forms/Field/Checkbox.vue b/jsdoc/components/Forms/Field/Checkbox.vue new file mode 100644 index 000000000..3165dc840 --- /dev/null +++ b/jsdoc/components/Forms/Field/Checkbox.vue @@ -0,0 +1,162 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Forms/Field/Datepicker.vue b/jsdoc/components/Forms/Field/Datepicker.vue new file mode 100644 index 000000000..b547aa5e1 --- /dev/null +++ b/jsdoc/components/Forms/Field/Datepicker.vue @@ -0,0 +1,657 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Forms/Field/Input.vue b/jsdoc/components/Forms/Field/Input.vue new file mode 100644 index 000000000..3d6ab9fca --- /dev/null +++ b/jsdoc/components/Forms/Field/Input.vue @@ -0,0 +1,276 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Forms/Field/Select.vue b/jsdoc/components/Forms/Field/Select.vue new file mode 100644 index 000000000..1d7a5e18e --- /dev/null +++ b/jsdoc/components/Forms/Field/Select.vue @@ -0,0 +1,272 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Forms/Header/Field.vue b/jsdoc/components/Forms/Header/Field.vue new file mode 100644 index 000000000..2808bcfa3 --- /dev/null +++ b/jsdoc/components/Forms/Header/Field.vue @@ -0,0 +1,66 @@ + + + diff --git a/jsdoc/components/Icons/Button/Add.vue b/jsdoc/components/Icons/Button/Add.vue new file mode 100644 index 000000000..544ba949f --- /dev/null +++ b/jsdoc/components/Icons/Button/Add.vue @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Widget/Button.vue b/jsdoc/components/Widget/Button.vue new file mode 100644 index 000000000..4d918c96f --- /dev/null +++ b/jsdoc/components/Widget/Button.vue @@ -0,0 +1,216 @@ + + + diff --git a/jsdoc/components/Widget/Container.vue b/jsdoc/components/Widget/Container.vue new file mode 100644 index 000000000..9136dace6 --- /dev/null +++ b/jsdoc/components/Widget/Container.vue @@ -0,0 +1,41 @@ + + + \ No newline at end of file diff --git a/jsdoc/components/Widget/Flex.vue b/jsdoc/components/Widget/Flex.vue new file mode 100644 index 000000000..a33457245 --- /dev/null +++ b/jsdoc/components/Widget/Flex.vue @@ -0,0 +1,35 @@ + + + diff --git a/jsdoc/components/Widget/Grid.vue b/jsdoc/components/Widget/Grid.vue new file mode 100644 index 000000000..64de3ddc9 --- /dev/null +++ b/jsdoc/components/Widget/Grid.vue @@ -0,0 +1,48 @@ + + + diff --git a/jsdoc/components/Widget/GridLayout.vue b/jsdoc/components/Widget/GridLayout.vue new file mode 100644 index 000000000..1f4f5f659 --- /dev/null +++ b/jsdoc/components/Widget/GridLayout.vue @@ -0,0 +1,70 @@ + + + diff --git a/jsdoc/components/Widget/Popover.vue b/jsdoc/components/Widget/Popover.vue new file mode 100644 index 000000000..96f1922da --- /dev/null +++ b/jsdoc/components/Widget/Popover.vue @@ -0,0 +1,85 @@ + + + \ No newline at end of file diff --git a/jsdoc/output/Add.md b/jsdoc/output/Add.md new file mode 100644 index 000000000..2c86f4133 --- /dev/null +++ b/jsdoc/output/Add.md @@ -0,0 +1,17 @@ +## Icons/Button/Add.vue + +This component is used to create a complete svg icon for a button. +This svg is related to a add action button. + +### Parameters + +* `iconColor` **[string][4]** (optional, default `"white"`) + +### Examples + +```javascript +{ +iconColor: 'white', +} +``` + diff --git a/jsdoc/output/Builder.md b/jsdoc/output/Builder.md new file mode 100644 index 000000000..59913a4a6 --- /dev/null +++ b/jsdoc/output/Builder.md @@ -0,0 +1,34 @@ +## Builder.vue + +This component is a wrapper to create a complete page using containers and widgets. +We have to define each container and each widget inside it. +This is an abstract component that will be used to create any kind of page content (base dashboard elements like menu and news excluded) + +### Parameters + +* `builder` **[array][4]** Array of containers and widgets + +### Examples + +```javascript +[ +{ +"type": "card", // this can be a "card", "modal", "table"... etc +"containerClass": "", // tailwind css grid class (items-start, ...) +"containerColumns" : {"pc": 12, "tablet": 12, "mobile": 12}, +"title" : "My awesome card", // container title +// Each widget need a name (here type) and associated data +// We need to send specific data for each widget type +widgets: [ +{ +type : "Checkbox", +data : {containerClass : "", columns : {"pc": 6, "tablet": 12, "mobile": 12}, id:"test-check", value: "yes", label: "Checkbox", name: "checkbox", required: true, version: "v1.0.0", hideLabel: false, headerClass: "text-red-500" } +}, { +type : "Select", +data : {containerClass : "", columns : {"pc": 6, "tablet": 12, "mobile": 12}, id: 'test-select', value: 'yes', values: ['yes', 'no'], name: 'test-select', disabled: false, required: true, label: 'Test select', tabId: '1',} +} +] +} +] +``` + diff --git a/jsdoc/output/Button.md b/jsdoc/output/Button.md new file mode 100644 index 000000000..9b272b0f0 --- /dev/null +++ b/jsdoc/output/Button.md @@ -0,0 +1,38 @@ +## Widget/Button.vue + +This component is a standard button. +You can link this button to the event store on click with eventAttr. +This will allow you to share a value with other components, for example switching form on a click. +The eventAttr object must contain the store name and the value to send on click at least. +It can also contain the target id element and the expanded value, this will add additionnal accessibility attributs to the button. + +### Parameters + +* `id` **[string][4]** +* `text` **[string][4]** Content of the button +* `type` **[string][4]** Can be of type button || submit (optional, default `"button"`) +* `disabled` **[boolean][5]** (optional, default `false`) +* `hideText` **[boolean][5]** Hide text to only display icon (optional, default `false`) +* `color` **[string][4]** (optional, default `"primary"`) +* `size` **[string][4]** Can be of size sm || normal || lg || xl (optional, default `"normal"`) +* `iconName` **[string][4]** Name in lowercase of icons store on /Icons/Button (optional, default `""`) +* `iconColor` **[string][4]** (optional, default `""`) +* `eventAttr` **[object][6]** Store event on click {"store" : \, "default" : \, "value" : \, "target" : \, "valueExpanded" : "expanded\_value"} (optional, default `{}`) +* `tabId` **([string][4] | [number][7])** (optional, default `""`) + +### Examples + +```javascript +{ +id: "open-modal-btn", +text: "Open modal", +disabled: false, +hideText: true, +color: "green", +size: "normal", +iconName: "modal", +iconColor: "white", +eventAttr: {"store" : "modal", "value" : "open", "target" : "modal_id", "valueExpanded" : "open"},7 +} +``` + diff --git a/jsdoc/output/Checkbox.md b/jsdoc/output/Checkbox.md new file mode 100644 index 000000000..670eefc71 --- /dev/null +++ b/jsdoc/output/Checkbox.md @@ -0,0 +1,36 @@ +## Forms/Field/Checkbox.vue + +This component is used to create a complete checkbox field input with error handling and label. +We can also add popover to display more information. +It is mainly use in forms. + +### Parameters + +* `id` **[string][4]** +* `name` **[string][4]** +* `label` **[string][4]** +* `value` **[string][4]** +* `disabled` **[boolean][5]** (optional, default `false`) +* `required` **[boolean][5]** (optional, default `false`) +* `columns` **[object][6]** (optional, default `{"pc":"12","tab":"12","mob":"12}`) +* `hideLabel` **[boolean][5]** (optional, default `false`) +* `containerClass` **[string][4]** (optional, default `""`) +* `headerClass` **[string][4]** (optional, default `""`) +* `inpClass` **[string][4]** (optional, default `""`) +* `tabId` **([string][4] | [number][7])** (optional, default `""`) + +### Examples + +```javascript +{ +columns : {"pc": 6, "tablet": 12, "mobile": 12}, +id:"test-check", +value: "yes", +label: "Checkbox", +name: "checkbox", +required: true, +hideLabel: false, +headerClass: "text-red-500" +} +``` + diff --git a/jsdoc/output/Container.md b/jsdoc/output/Container.md new file mode 100644 index 000000000..644adf615 --- /dev/null +++ b/jsdoc/output/Container.md @@ -0,0 +1,21 @@ +## Widget/Container.vue + +This component is a basic container that can be used to wrap other components. +In case we are working with grid system, we can add columns to position the container. +We can define additional class too. +This component is mainly use as widget container. + +### Parameters + +* `containerClass` **[string][4]** Additional class (optional, default `""`) +* `columns` **([object][5] | [boolean][6])** Work with grid system { pc: 12, tablet: 12, mobile: 12} (optional, default `false`) + +### Examples + +```javascript +{ +containerClass: "w-full h-full bg-white rounded shadow-md", +columns: { pc: 12, tablet: 12, mobile: 12} +} +``` + diff --git a/jsdoc/output/Datepicker.md b/jsdoc/output/Datepicker.md new file mode 100644 index 000000000..57086b482 --- /dev/null +++ b/jsdoc/output/Datepicker.md @@ -0,0 +1,38 @@ +## Forms/Field/Datepicker.vue + +This component is used to create a complete datepicker field input with error handling and label. +You can define a default date, a min and max date, and a format. +We can also add popover to display more information. +It is mainly use in forms. + +### Parameters + +* `id` **[string][4]** +* `name` **[string][4]** +* `label` **[string][4]** +* `defaultDate` **([string][4] | [number][5] | [date][6])** Default date when instanciate (optional, default `null`) +* `noPickBeforeStamp` **([string][4] | [number][5])** Impossible to pick a date before this date (optional, default `""`) +* `noPickAfterStamp` **([string][4] | [number][5])** Impossible to pick a date after this date (optional, default `""`) +* `hideLabel` **[boolean][7]** (optional, default `false`) +* `columns` **([object][8] | [boolean][7])** (optional, default `{"pc":"12","tab":"12","mob":"12}`) +* `disabled` **[boolean][7]** (optional, default `false`) +* `required` **[boolean][7]** (optional, default `false`) +* `headerClass` **[string][4]** (optional, default `""`) +* `containerClass` **[string][4]** (optional, default `""`) +* `tabId` **([string][4] | [number][5])** (optional, default `""`) + +### Examples + +```javascript +{ +id: 'test-date', +columns : {"pc": 6, "tablet": 12, "mobile": 12}, +disabled: false, +required: true, +defaultDate: 1735682600000, +noPickBeforeStamp: 1735682600000, +noPickAfterStamp: 1735689600000, +inpClass: "text-center", +} +``` + diff --git a/jsdoc/output/Field.md b/jsdoc/output/Field.md new file mode 100644 index 000000000..80cf17811 --- /dev/null +++ b/jsdoc/output/Field.md @@ -0,0 +1,25 @@ +## Forms/Header/Field.vue + +This component is used with field in order to link a label to field type. +We can add popover to display more information. +Always use with field component. + +### Parameters + +* `label` **[string][4]** +* `name` **[string][4]** +* `required` **[boolean][5]** (optional, default `false`) +* `hideLabel` **[boolean][5]** (optional, default `false`) +* `headerClass` **[string][4]** (optional, default `""`) + +### Examples + +```javascript +{ +label: 'Test', +version : "0.1.0", +name: 'test-input', +required: true, +} +``` + diff --git a/jsdoc/output/Flex.md b/jsdoc/output/Flex.md new file mode 100644 index 000000000..5089662fe --- /dev/null +++ b/jsdoc/output/Flex.md @@ -0,0 +1,19 @@ +## Widget/Flex.vue + +This component is a basic container that can be used to wrap other components. +Per default, it aligns the components horizontally using flex. +We can define additional class too. +This component is mainly use as widget container or for groups of widget. + +### Parameters + +* `flexClass` **[string][4]** Additional class (optional, default `"flex-start"`) + +### Examples + +```javascript +{ +flexClass: "flex-start" +} +``` + diff --git a/jsdoc/output/Grid.md b/jsdoc/output/Grid.md new file mode 100644 index 000000000..fe48e7e2b --- /dev/null +++ b/jsdoc/output/Grid.md @@ -0,0 +1,22 @@ +## Widget/Grid.vue + +This component is a basic container that can be used to wrap other components. +This container is based on a grid system and will return a grid container with 12 columns. +In case we are working with grid system, we can add columns to position the container. +We can define additional class too. +This component is mainly use as widget container or as a child of a GridLayout. + +### Parameters + +* `gridClass` **[string][4]** Additional class (optional, default `"items-start"`) +* `columns` **([object][5] | [boolean][6])** Work with grid system { pc: 12, tablet: 12, mobile: 12} (optional, default `false`) + +### Examples + +```javascript +{ +columns: { pc: 12, tablet: 12, mobile: 12}, +gridClass: "items-start" +} +``` + diff --git a/jsdoc/output/GridLayout.md b/jsdoc/output/GridLayout.md new file mode 100644 index 000000000..abfac3f8f --- /dev/null +++ b/jsdoc/output/GridLayout.md @@ -0,0 +1,25 @@ +## Widget/GridLayout.vue + +This component is used for top level page layout. +This will determine the position of layout components based on the grid system. +We can create card, modal, table and others top level layout using this component. +This component is mainly use as Grid parent component. + +### Parameters + +* `type` **[string][4]** Type of layout component, we can have : card, table, modal and others (optional, default `"card"`) +* `title` **[string][4]** Title of the layout component, will be displayed at the top if exists. Type of layout component will determine the style of the title. (optional, default `""`) +* `columns` **[object][5]** Work with grid system { pc: 12, tablet: 12, mobile: 12} (optional, default `{"pc":12,"tablet":12,"mobile":12}`) +* `gridLayoutClass` **[string][4]** Additional class (optional, default `"items-start"`) + +### Examples + +```javascript +{ +type: "card", +title: "Test", +columns: { pc: 12, tablet: 12, mobile: 12}, +gridLayoutClass: "items-start" +} +``` + diff --git a/jsdoc/output/Input.md b/jsdoc/output/Input.md new file mode 100644 index 000000000..045d18cf5 --- /dev/null +++ b/jsdoc/output/Input.md @@ -0,0 +1,42 @@ +## Forms/Field/Input.vue + +This component is used to create a complete input field input with error handling and label. +We can add a clipboard button to copy the input value. +We can also add a password button to show the password. +We can also add popover to display more information. +It is mainly use in forms. + +### Parameters + +* `id` **[string][4]** +* `name` **[string][4]** +* `type` **[string][4]** text, email, password, number, tel, url +* `value` **[string][4]** +* `label` **[string][4]** +* `disabled` **[boolean][5]** (optional, default `false`) +* `required` **[boolean][5]** (optional, default `false`) +* `placeholder` **[string][4]** (optional, default `""`) +* `pattern` **[string][4]** (optional, default `"(?.*)"`) +* `clipboard` **[boolean][5]** allow to copy the input value (optional, default `false`) +* `readonly` **[boolean][5]** allow to read only the input value (optional, default `false`) +* `hideLabel` **[boolean][5]** (optional, default `false`) +* `containerClass` **[string][4]** (optional, default `""`) +* `inpClass` **[string][4]** (optional, default `""`) +* `headerClass` **[string][4]** (optional, default `""`) +* `tabId` **([string][4] | [number][6])** (optional, default `""`) + +### Examples + +```javascript +{ +id: 'test-input', +value: 'yes', +type: "text", +name: 'test-input', +disabled: false, +required: true, +label: 'Test input', +pattern : "(test)", +} +``` + diff --git a/jsdoc/output/Popover.md b/jsdoc/output/Popover.md new file mode 100644 index 000000000..2776ecd6e --- /dev/null +++ b/jsdoc/output/Popover.md @@ -0,0 +1,3 @@ + + + diff --git a/jsdoc/output/Select.md b/jsdoc/output/Select.md new file mode 100644 index 000000000..a2ad6223d --- /dev/null +++ b/jsdoc/output/Select.md @@ -0,0 +1,39 @@ +## Forms/Field/Select.vue + +This component is used to create a complete select field input with error handling and label. +We can be more precise by adding values that need to be selected to be valid. +We can also add popover to display more information. +It is mainly use in forms. + +### Parameters + +* `id` **[string][4]** +* `name` **[string][4]** +* `value` **[string][4]** +* `label` **[string][4]** +* `values` **[array][5]** +* `disabled` **[boolean][6]** (optional, default `false`) +* `required` **[boolean][6]** (optional, default `false`) +* `requiredValues` **[array][5]** values that need to be selected to be valid, works only if required is true (optional, default `[]`) +* `columns` **([object][7] | [boolean][6])** (optional, default `{"pc":"12","tab":"12","mob":"12}`) +* `hideLabel` **[boolean][6]** (optional, default `false`) +* `containerClass` **[string][4]** (optional, default `""`) +* `inpClass` **[string][4]** (optional, default `""`) +* `headerClass` **[string][4]** (optional, default `""`) +* `tabId` **([string][4] | [number][8])** (optional, default `""`) + +### Examples + +```javascript +{ +id: 'test-input', +value: 'yes', +values : ['yes', 'no'], +name: 'test-input', +disabled: false, +required: true, +requiredValues : ['no'], // need required to be checked +label: 'Test select', +} +``` + diff --git a/jsdoc/vue2md.js b/jsdoc/vue2md.js new file mode 100644 index 000000000..04816b05e --- /dev/null +++ b/jsdoc/vue2md.js @@ -0,0 +1,117 @@ +const fs = require("fs"); +const path = require("path"); + +const inputFolder = path.join(__dirname, "components"); +const ouputFolder = path.join(__dirname, "output"); + +function flatten(lists) { + return lists.reduce((a, b) => a.concat(b), []); +} + +function getDirectories(srcpath) { + return fs + .readdirSync(srcpath) + .map((file) => path.join(srcpath, file)) + .filter((path) => fs.statSync(path).isDirectory()); +} + +function getDirectoriesRecursive(srcpath) { + return [ + srcpath, + ...flatten(getDirectories(srcpath).map(getDirectoriesRecursive)), + ]; +} + +// Get the script part of a Vue file and create a JS file +function vue2js() { + const folders = getDirectoriesRecursive(inputFolder); + console.log(folders); + // Read every subfolders from the input folder and get all files + folders.forEach((folder) => { + const files = fs.readdirSync(path.join(folder), { + withFileTypes: true, + }); + files.forEach((file) => { + if (file.isFile() && file.name.endsWith(".vue")) { + const src = path.join(folder, file.name); + const fileName = file.name.replace(".vue", ".js"); + const data = fs.readFileSync(src, "utf8"); + // Get only the content between tag + const script = data.match(/ tags + script[0] = script[0] + .replace("", ""); + // Create a file on the output folder with the same name but with .js extension + const dest = path.join(ouputFolder, fileName); + fs.writeFileSync(dest, script[0], "utf8"); + } + }); + }); +} + +// Run a command to render markdown from JS files +function js2md() { + // Get all files from the output folder + const files = fs.readdirSync(ouputFolder, { withFileTypes: true }); + // Create a markdown file for each JS file + files.forEach((file) => { + // Run a process `documentation build -f md > .md + const command = `documentation build ${path.join( + ouputFolder, + file.name + )} -f md > ${path.join(ouputFolder, file.name.replace(".js", ".md"))}`; + console.log(command + "\n"); + // Run the command + const { execSync } = require("child_process"); + execSync(command, (error, stdout, stderr) => { + if (error) { + console.error(`exec error: ${error}`); + return; + } + console.log(`stdout: ${stdout}`); + console.error(`stderr: ${stderr}`); + }); + }); + // Remove all JS files when all processes are done + files.forEach((file) => { + fs.unlinkSync(path.join(ouputFolder, file.name)); + }); +} + +// Format each md file to remove specific content +function formatMd() { + // Get all files from the output folder + const files = fs.readdirSync(ouputFolder, { withFileTypes: true }); + files.forEach((file, id) => { + let data = fs.readFileSync(path.join(ouputFolder, file.name), "utf8"); + // Remove ### Table of contents + data = data.replace("### Table of Contents", ""); + // In case we have "[1]:", remove everything after + data = data.replace(/\[\d+\]:[\s\S]*?$/g, ""); + // Remove everything after the first ## tag + const index = data.indexOf("## "); + data = data.substring(index); + fs.writeFileSync(path.join(ouputFolder, file.name), data, "utf8"); + }); +} + +// Check that input folder exists +if (!fs.existsSync(inputFolder)) { + console.error("Input folder does not exist"); + process.exit(1); +} + +// Create the output folder if it doesn't exist +if (!fs.existsSync(ouputFolder)) { + fs.mkdirSync(ouputFolder); +} + +// Remove previous content of the output folder +fs.readdirSync(ouputFolder).forEach((file) => { + fs.unlinkSync(path.join(ouputFolder, file)); +}); + +vue2js(); +js2md(); +formatMd();