From 457e062677277c83146665fe636d15250d74b0a3 Mon Sep 17 00:00:00 2001 From: Kavalar Date: Tue, 21 Mar 2023 23:58:22 +0300 Subject: [PATCH] first --- .gitignore | 4 + cdncli.py | 84 +++++ dist/index.css | 378 +++++++++++++++++++ dist/index.css.map | 1 + dist/index.js | 891 +++++++++++++++++++++++++++++++++++++++++++++ dist/index.js.map | 1 + main.py | 16 + package.json | 46 +++ server.py | 50 +++ 9 files changed, 1471 insertions(+) create mode 100644 .gitignore create mode 100644 cdncli.py create mode 100644 dist/index.css create mode 100644 dist/index.css.map create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 main.py create mode 100644 package.json create mode 100644 server.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d04c6fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +packages +venv +.idea +__pycache__ \ No newline at end of file diff --git a/cdncli.py b/cdncli.py new file mode 100644 index 0000000..03f688d --- /dev/null +++ b/cdncli.py @@ -0,0 +1,84 @@ +import argparse +import json +import requests +import os +import magic + +parser = argparse.ArgumentParser(description='Videos to images') + +parser.add_argument( + '-d', + '--dir', + type=str, + default='dist', + help='Директоия билда' +) + +parser.add_argument( + '-fjs', + '--file_js', + type=str, + default='index.js', + help='Файл javascript билда' +) + +parser.add_argument( + '-fcss', + '--file_css', + type=str, + default='index.css', + help='Файл css билда' +) + +parser.add_argument( + '-f', + '--file', + type=str, + default='script.js', + help='Файл билда' +) + + +if __name__ == '__main__': + args = parser.parse_args() + + if os.path.exists("package.json"): + d = json.load(open("package.json", 'rb')) + + print("package name: {name}".format(name=d['name'])) + print("package version: {version}".format(version=d['version'])) + + # filepath_js = "{dir}/{file}".format(dir=args.dir, file=args.file_js) + # if os.path.exists(filepath_js): + # file_js = {'file': open(filepath_js, 'rb')} + # res_js = requests.post(url='http://127.0.0.1:8000/uploadfile/', + # files=file_js, data={'package': d['name'], 'version': d['version'], 'type': 'js'}) + # if res_js.ok: + # print("Successfully uploaded index.js") + # else: + # print("Wrong") + # + # filepath_css = "{dir}/{file}".format(dir=args.dir, file=args.file_css) + # if os.path.exists(filepath_css): + # file_css = {'file': open(filepath_css, 'rb')} + # res_css = requests.post(url='http://127.0.0.1:8000/uploadfile/', + # files=file_css, data={'package': d['name'], 'version': d['version'], 'type': 'css'}) + # if res_css.ok: + # print("Successfully uploaded index.css") + # else: + # print("Wrong") + + filepath = "{dir}/{file}".format(dir=args.dir, file=args.file) + if os.path.exists(filepath): + mime = magic.Magic(mime=True) + file_mime = mime.from_file(filepath) + file = {'file': open(filepath, 'rb')} + res = requests.post(url='http://127.0.0.1:8000/uploadfile/', + files=file, data={'package': d['name'], 'version': d['version'], 'filename': args.file}) + if res.ok: + print(f"Successfully uploaded {filepath}") + else: + print("Wrong") + + else: + print("package.json not found") diff --git a/dist/index.css b/dist/index.css new file mode 100644 index 0000000..bd54983 --- /dev/null +++ b/dist/index.css @@ -0,0 +1,378 @@ +.nativeSelect { + cursor: pointer; + color: #fff; + -ms-border-radius: 5px; + -o-border-radius: 5px; + background: #2a2f3b; + border: none; + border-radius: 5px; + margin: 0; + display: none; + box-shadow: 2px 3px 5px #00000080; +} + +.nativeSelect__nativeOption { + border: 1px solid #0a0b0e; +} + +.nativeSelectActive { + min-width: 235px; + height: 50px; + border: none; + border-radius: 10px; + display: block; +} + +@media (max-width: 576px) { + .nativeSelect { + min-width: 235px; + height: 50px; + border: none; + border-radius: 10px; + } + + select[multiple="multiple"] { + color: #000; + background-color: #fff; + border-radius: 0; + } +} + +::-webkit-scrollbar { + width: 10px; +} + +::-webkit-scrollbar-track { + background-color: #d1d1d19d; +} + +::-webkit-scrollbar-thumb { + background-color: #4d4d4d; +} + +.svg-icon { + width: 16px; + cursor: pointer; + -o-transition: 1s; + background-color: #bebebc; + border-radius: 5px; + margin-left: 3px; + transition: all 1s; +} + +.svg-icon:hover { + -o-transition: 1s; + background-color: #fff; + transition: all 1s; +} + +.svg-icon path { + color: #000; + stroke: currentColor; + stroke-width: .5px; + transition: all .2s; +} + +.svg-clear { + background-color: #0000; + position: absolute; + right: 36px; +} + +.svg-clear:hover { + background-color: #0000; +} + +.selectWhite { + background: #f8f8f8; +} + +.selectWhite, .listWhite, .inputWhite, .pathBlack, .selectWhite { + color: #000; +} + +.caretWhite { + border-top: 6px solid #000; +} + +.listWhite { + background-color: #fff; +} + +.inputWhite { + color: #000 !important; + border-bottom: 1px solid #000 !important; +} + +.modal { + z-index: 9999; + background-color: #00000073; + justify-content: center; + display: flex; + position: fixed; + inset: 0; +} + +.modal_active { + display: flex; +} + +.listModal { + top: 150px; + position: fixed !important; +} + +.overflowHide { + overflow: hidden; +} + +.classicSelect { + color: #fff; + background: #2a2f3b; +} + +.classicSelect:hover { + background: #394050; +} + +.classicList { + color: #fff; + background: #2a2f3b; + border: 1px solid #0a0b0e; +} + +.pathWhite { + color: #fff !important; +} + +.pathBlack { + color: #000; +} + +.selectDark { + color: #fff; + background: #1d1d1d; +} + +.caretWhite { + border-top: 6px solid #000 !important; +} + +.listDark { + color: #fff; + background: #1d1d1d; +} + +.inputDark { + border-bottom: 1px solid #000 !important; +} + +.cg-dropdown { + min-width: 235px; + -ms-border-radius: 10px; + -o-border-radius: 10px; + border: none; + border-radius: 10px; + margin: 0; + padding: 0; + position: relative; +} + +.cg-select { + min-height: 50px; + text-overflow: ellipsis; + cursor: pointer; + -ms-border-radius: 5px; + -o-border-radius: 5px; + -o-transition: .5s; + border: none; + border-radius: 5px; + flex-grow: 1; + justify-content: space-between; + align-items: center; + padding: 5px; + transition: all .5s; + display: flex; +} + +.cg-select .selected { + max-width: 195px; + margin: 5px; +} + +.cg-select:hover { + -o-transition: .5s; + transition: all .5s; +} + +.caret { + width: 0; + height: 0; + -o-transition: .5s; + border-top: 6px solid #fff; + border-left: 5px solid #0000; + border-right: 5px solid #0000; + margin-right: 10px; + transition: all .5s; +} + +.caret_rotate { + -o-transition: .5s; + transition: all .5s; + transform: rotate(180deg); +} + +.list { + max-height: 230px; + width: 220px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + -o-transition: .5s; + opacity: 0; + z-index: 1; + border-radius: 5px; + margin-top: -.2px; + padding: 7px; + list-style: none; + transition: all .5s; + display: none; + position: absolute; + overflow-y: auto; + box-shadow: 2px 3px 5px #00000080; +} + +.list__item { + -o-transition: .5s; + flex-direction: row; + align-items: center; + padding: 15px; + transition: all .5s; + display: flex; +} + +.list__item:hover { + -o-transition: .5s; + cursor: pointer; + background: #8282822c; + transition: all .5s; +} + +.list .inputSearch { + width: 90%; + background: none; + border: none; + border-bottom: 1px solid #fff; + margin-top: 5px; + margin-bottom: 5px; +} + +.list .inputSearch:focus { + color: #fff; + outline: none; +} + +.multiselect-tag { + flex-flow: wrap; + align-items: center; + margin: 0; + padding: 0; + list-style-type: none; + display: flex; +} + +.multiselect-tag li { + height: 20px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + background: #76767659; + border-radius: 5px; + align-items: center; + margin: 0 5px 5px 0; + padding: 2px 4px; + display: flex; + position: relative; +} + +.multiselect-tag__button { + width: 15px; + height: 16px; + border: none; +} + +.category { + height: 20px; + border-bottom: 1px solid; + align-items: center; + margin: 6px 5px 0 7px; + font-size: 17px; + display: flex; +} + +input[type="checkbox"] { + cursor: pointer; + margin: 0 5px 0 0; +} + +.label { + color: #fff; +} + +.active { + text-align: start; + background: #8282822c; +} + +.open { + -o-transition: .5s; + opacity: 1; + transition: all .5s; + display: block !important; +} + +.open_none { + opacity: 0 !important; +} + +.disabled { + background-color: #8f9195 !important; +} + +.overflow-hidden { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.displayHide { + display: none !important; +} + +@media (max-width: 576px) { + body { + margin: 0; + padding: 0; + } + + .list { + width: 98% !important; + } + + .listModal { + width: 88% !important; + } + + .cg-select { + width: 100% !important; + } + + .example-select_title { + padding: 24px 0 0 15px; + font-size: 16px; + } + + pre { + overflow-x: scroll; + } +} + +/*# sourceMappingURL=index.css.map */ diff --git a/dist/index.css.map b/dist/index.css.map new file mode 100644 index 0000000..5907fdc --- /dev/null +++ b/dist/index.css.map @@ -0,0 +1 @@ +{"mappings":"ACAA;;;;;;;;;;;;;AAeE;;;;AAKF;;;;;;;;AAQA;EACE;;;;;;;EAOA;;;;;;;ACnCF;;;;AAIA;;;;AAIA;;;;ACRA;;;;;;;;;;AAYE;;;;;;AAUF;;;;;;;AAQA;;;;;;AAKE;;;;ACpCF;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAIA;;;;;ACpBA;;;;;;;;;AAWE;;;;AAKF;;;;;AAKA;;;;ACrBA;;;;;AAIE;;;;AAKF;;;;;;AAMA;;;;AAIA;;;;ACnBA;;;;;AAKA;;;;AAIA;;;;;AAKA;;;;APLA;;;;;;;;;;;AAeA;;;;;;;;;;;;;;;;;AAqCE;;;;;AAKA;;;;;AASF;;;;;;;;;;;AAcE;;;;;;AAeF;;;;;;;;;;;;;;;;;;;AA6BE;;;;;;;;;AAsBE;;;;;;;AAYF;;;;;;;;;AAQE;;;;;AAOJ;;;;;;;;;AAqBE;;;;;;;;;;;;;AAsBA;;;;;;AAOF;;;;;;;;;AAeA;;;;;AAKA;;;;AAMA;;;;;AAKA;;;;;;;AAUE;;;;AAKF;;;;AAIA;;;;;;AAMA;;;;AAKA;EACE;;;;;EAKA;;;;EAIA;;;;EAIA;;;;EAKE;;;;;EAMF","sources":["src/main.scss","src/style/nativeSelect.scss","src/style/scrollbar.scss","src/style/svgStyle.scss","src/style/whiteTheme.scss","src/style/displayMode.scss","src/style/classicTheme.scss","src/style/darkTheme.scss"],"sourcesContent":["@import './style/nativeSelect.scss';\n@import './style/scrollbar.scss';\n@import './style/svgStyle.scss';\n@import './style/whiteTheme.scss';\n@import './style/displayMode.scss';\n@import './style/classicTheme.scss';\n@import './style/darkTheme.scss';\n\n// ----Layout----\n.cg-dropdown {\n min-width: 235px;\n margin-left: 0;\n position: relative;\n margin: 0;\n padding: 0;\n border: none;\n\n border-radius: 10px;\n -webkit-border-radius: 10px;\n -moz-border-radius: 10px;\n -ms-border-radius: 10px;\n -o-border-radius: 10px;\n}\n\n.cg-select {\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n\n min-height: 50px;\n padding: 5px;\n\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n text-overflow: ellipsis;\n\n border: none;\n cursor: pointer;\n\n border-radius: 5px;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -ms-border-radius: 5px;\n -o-border-radius: 5px;\n\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n\n .selected {\n max-width: 195px;\n margin: 5px;\n }\n\n &:hover {\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n }\n}\n\n.caret {\n width: 0;\n height: 0;\n margin-right: 10px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 6px solid #fff;\n\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n\n &_rotate {\n transform: rotate(180deg);\n -webkit-transform: rotate(180deg);\n -moz-transform: rotate(180deg);\n -ms-transform: rotate(180deg);\n -o-transform: rotate(180deg);\n\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n }\n}\n\n.list {\n max-height: 230px;\n overflow-y: auto;\n position: absolute;\n\n width: 220px;\n padding: 7px;\n margin-top: -0.2px;\n list-style: none;\n\n border-radius: 5px;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -ms-border-radius: 5px;\n -o-border-radius: 5px;\n\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.5);\n -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.5);\n\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n\n opacity: 0;\n display: none;\n z-index: 1;\n\n &__item {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n\n padding: 15px;\n\n &:hover {\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n transition: 0.5s;\n\n cursor: pointer;\n background: #8282822c;\n }\n }\n\n .inputSearch {\n background: transparent;\n border: none;\n width: 90%;\n border-bottom: 1px solid white;\n margin-top: 5px;\n margin-bottom: 5px;\n\n &:focus {\n outline: none;\n color: white;\n }\n }\n}\n\n.multiselect-tag {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n list-style-type: none;\n margin: 0;\n padding: 0;\n\n li {\n padding: 2px 4px 2px 4px;\n background: #76767659;\n height: 20px;\n margin: 0 5px 5px 0;\n\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n position: relative;\n border-radius: 5px;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -ms-border-radius: 5px;\n -o-border-radius: 5px;\n }\n\n &__button {\n width: 15px;\n height: 16px;\n border: none;\n }\n}\n\n.category {\n height: 20px;\n margin: 6px 5px 0 7px;\n font-size: 17px;\n border-bottom: 1px solid;\n\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\ninput[type='checkbox'] {\n cursor: pointer;\n margin: 0 5px 0 0;\n}\n\n.label {\n color: white;\n}\n\n//-------Behavior--------\n\n.active {\n text-align: start;\n background: #8282822c;\n}\n\n.open {\n transition: 0.5s;\n -webkit-transition: 0.5s;\n -moz-transition: 0.5s;\n -ms-transition: 0.5s;\n -o-transition: 0.5s;\n\n display: block !important;\n opacity: 1;\n\n &_none {\n opacity: 0 !important;\n }\n}\n\n.disabled {\n background-color: #8f9195 !important;\n}\n\n.overflow-hidden {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.displayHide {\n display: none !important;\n}\n\n/*320px - 576px*/\n@media (max-width: 576px) {\n body {\n margin: 0;\n padding: 0;\n }\n\n .list {\n width: 98% !important;\n }\n\n .listModal {\n width: 88% !important;\n }\n\n .cg-select {\n width: 100% !important;\n }\n\n .example-select {\n &_title {\n padding: 24px 0 0px 15px;\n font-size: 16px;\n }\n }\n\n pre {\n overflow-x: scroll;\n }\n}\n",".nativeSelect {\n border: none;\n cursor: pointer;\n display: none;\n color: white;\n background: #2a2f3b;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.5);\n -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.5);\n border-radius: 5px;\n -webkit-border-radius: 5px;\n -moz-border-radius: 5px;\n -ms-border-radius: 5px;\n -o-border-radius: 5px;\n margin: 0;\n\n &__nativeOption {\n border: 1px #0a0b0e solid;\n }\n}\n\n.nativeSelectActive {\n display: block;\n min-width: 235px;\n height: 50px;\n border: none;\n border-radius: 10px;\n}\n\n@media (max-width: 576px) {\n .nativeSelect {\n min-width: 235px;\n height: 50px;\n border: none;\n border-radius: 10px;\n }\n\n select[multiple='multiple'] {\n color: black;\n background-color: white;\n border-radius: 0;\n }\n}\n","// ------SCROLLBAR------\n::-webkit-scrollbar {\n width: 10px;\n}\n\n::-webkit-scrollbar-track {\n background-color: #d1d1d19d;\n}\n\n::-webkit-scrollbar-thumb {\n background-color: #4d4d4d;\n}\n","// --------SVG--------\n.svg-icon {\n width: 16px;\n margin-left: 3px;\n background-color: #bebebc;\n border-radius: 5px;\n cursor: pointer;\n -webkit-transition: 1s;\n transition: 1s;\n -moz-transition: 1s;\n -ms-transition: 1s;\n -o-transition: 1s;\n\n &:hover {\n -webkit-transition: 1s;\n transition: 1s;\n -moz-transition: 1s;\n -ms-transition: 1s;\n -o-transition: 1s;\n background-color: #ffffff;\n }\n}\n\n.svg-icon path {\n color: black;\n stroke: currentcolor;\n transition: 0.2s;\n -webkit-transition: 0.2s;\n stroke-width: 0.5;\n}\n\n.svg-clear {\n position: absolute;\n right: 36px;\n background-color: transparent;\n\n &:hover {\n background-color: transparent;\n }\n}\n",".selectWhite {\n background: rgb(248, 248, 248);\n}\n\n.selectWhite,\n.listWhite,\n.inputWhite,\n.pathBlack,\n.selectWhite {\n color: black;\n}\n\n.caretWhite {\n border-top: 6px solid black;\n}\n\n.listWhite {\n background-color: white;\n}\n\n.inputWhite {\n border-bottom: 1px solid black !important;\n color: black !important;\n}\n",".modal {\n display: flex;\n justify-content: center;\n background-color: rgba(0, 0, 0, 0.45);\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n z-index: 9999;\n\n &_active {\n display: flex;\n }\n}\n\n.listModal {\n position: fixed !important;\n top: 150px;\n}\n\n.overflowHide {\n overflow: hidden;\n}\n",".classicSelect {\n color: #fff;\n background: #2a2f3b;\n\n &:hover {\n background: #394050;\n }\n}\n\n.classicList {\n color: white;\n background: #2a2f3b;\n border: 1px #0a0b0e solid;\n}\n\n.pathWhite {\n color: white !important;\n}\n\n.pathBlack {\n color: black;\n}\n",".selectDark {\n background: rgb(29, 29, 29);\n color: white;\n}\n\n.caretWhite {\n border-top: 6px solid black !important;\n}\n\n.listDark {\n background: rgb(29, 29, 29);\n color: white;\n}\n\n.inputDark {\n border-bottom: 1px solid black !important;\n}\n"],"names":[],"version":3,"file":"index.css.map"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..8f6a351 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,891 @@ +require("./index.css"); + +function $parcel$defineInteropFlag(a) { + Object.defineProperty(a, '__esModule', {value: true, configurable: true}); +} +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + +$parcel$defineInteropFlag(module.exports); + +$parcel$export(module.exports, "default", () => $43d7963e56408b24$export$2e2bcd8739ae039); +function $5aca7c389be45fd0$export$b2e1d36bc0be1b2f(dataItem, index) { + const random = Math.random().toString(36).substring(2, 10); + let item; + if ($5aca7c389be45fd0$export$5c0c8aabba12399d(dataItem)) return dataItem; + else { + item = { + id: random, + title: dataItem, + value: index + }; + return item; + } +} +function $5aca7c389be45fd0$export$11380eda3eb06ca9(data, select) { + const { placeholder: placeholder , selected: selected } = data; + if (placeholder) select.innerText = placeholder; + else if (selected) select.innerText = selected; + else select.innerText = "Select..."; + return select; +} +function $5aca7c389be45fd0$export$5c0c8aabba12399d(item) { + if (item && typeof item !== "object") return false; + return item.hasOwnProperty("id") && item.hasOwnProperty("title") && item.hasOwnProperty("value"); +} +function $5aca7c389be45fd0$export$31b5fa56cc6048cb(element, content, styles) { + const select = document.createElement("div"); + const selected = document.createElement("p"); + const caret = document.createElement("div"); + select.classList.add("cg-select"); + select.classList.add("classicSelect"); + selected.classList.add("selected"); + caret.classList.add("caret"); + select.appendChild(selected); + select.appendChild(caret); + if (content) { + const text = document.createTextNode(content); + selected.appendChild(text); + element.innerHTML = ""; + element?.insertAdjacentElement("afterbegin", select); + } else if (styles) { + $5aca7c389be45fd0$export$edf5b2501a573922(element, styles); + select.setAttribute("style", `${styles}`); + selected.setAttribute("style", `${styles}`); + caret.setAttribute("style", `${styles}`); + } +} +function $5aca7c389be45fd0$export$4474211a0591e3fe(select, element, dataSelectText) { + const { selectedItems: selectedItems , indexes: indexes , theme: theme , multiselectTag: multiselectTag } = dataSelectText; + const options = element.querySelectorAll(".list__item"); + const nativeOption = element.querySelectorAll(".nativeSelect__nativeOption"); + const svgIcon = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path"); + const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path"); + const checkBox = element.querySelectorAll("li input"); + svgIcon.setAttribute("viewBox", "0 0 10 10"); + path1.setAttribute("d", "M2,8 L8,2"); + path2.setAttribute("d", "M2,2 L8,8"); + svgIcon.appendChild(path1); + svgIcon.appendChild(path2); + if (multiselectTag && multiselectTag == true) return; + switch(theme){ + case "dark": + path1.classList.add("pathWhite"); + path2.classList.add("pathWhite"); + break; + case "white": + path1.classList.add("pathBlack"); + path2.classList.add("pathBlack"); + break; + default: + path1.classList.add("pathWhite"); + path2.classList.add("pathWhite"); + break; + } + svgIcon.classList.add("svg-icon"); + svgIcon.classList.add("svg-clear"); + select.appendChild(svgIcon); + svgIcon.addEventListener("click", (e)=>{ + e.preventDefault(); + e.stopPropagation(); + select.innerText = ""; + nativeOption.forEach((option)=>{ + option.removeAttribute("selected"); + }); + if (Array.isArray(selectedItems)) { + selectedItems.splice(0); + indexes.splice(0); + } + checkBox.forEach((item)=>{ + if (item instanceof HTMLInputElement) item.checked = false; + }); + $5aca7c389be45fd0$export$11380eda3eb06ca9(dataSelectText, select); + options.forEach((option)=>{ + option.classList.remove("active"); + }); + }); +} +function $5aca7c389be45fd0$export$668f6560249913a1(element, item) { + element.forEach((option)=>{ + option.removeAttribute("selected"); + if (option.textContent === item) option.setAttribute("selected", "selected"); + }); +} +function $5aca7c389be45fd0$export$a240606f327b3da2(element, item, condition) { + element.forEach((option)=>{ + if (condition == true) { + if (option.textContent === item) option.setAttribute("selected", "selected"); + } else if (condition == false) { + if (option.textContent === item) option.removeAttribute("selected"); + } else return; + }); +} +function $5aca7c389be45fd0$export$edf5b2501a573922(element, styles) { + const cgSelect = element.querySelector(".cg-select"); + const caretSelect = element.querySelector(".caret"); + const placeholderSelect = element.querySelector(".selected"); + const lableItem = element.parentElement.querySelector("h1.label"); + $5aca7c389be45fd0$export$5f8f940a0de3e7d(styles.head, cgSelect); + $5aca7c389be45fd0$export$5f8f940a0de3e7d(styles.caret, caretSelect); + $5aca7c389be45fd0$export$5f8f940a0de3e7d(styles.lable, lableItem); + if (placeholderSelect) $5aca7c389be45fd0$export$5f8f940a0de3e7d(styles.placeholder, placeholderSelect); +} +function $5aca7c389be45fd0$export$5f8f940a0de3e7d(elemOption, selector) { + if (elemOption) Object.entries(elemOption).forEach(([key, value])=>{ + selector.style[key] = value; + }); +} + + +function $3e0e9117e5437319$export$dfb0baf35876628e() { + const nativeSelect = document.createElement("select"); + nativeSelect.setAttribute("name", "dataSelect"); + nativeSelect.classList.add("nativeSelect"); + return nativeSelect; +} +function $3e0e9117e5437319$export$401096e4c8c5bfbe() { + const nativeOption = document.createElement("option"); + nativeOption.classList.add("nativeSelect__nativeOption"); + return nativeOption; +} +function $3e0e9117e5437319$export$94c1ad1d6db6a1d0(data, title, index, id) { + const { element: element , option: option , indexes: indexes , selectedItems: selectedItems } = data; + const { placeholder: placeholder , styles: styles } = option; + const selected = element?.querySelector(".selected"); + const nativeOption = element.querySelectorAll(".nativeSelect__nativeOption"); + const liChip = document.createElement("li"); + const textNode = document.createTextNode(title); + const svgIcon = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path"); + const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path"); + svgIcon.setAttribute("viewBox", "0 0 10 10"); + path1.setAttribute("d", "M3,7 L7,3"); + path2.setAttribute("d", "M3,3 L7,7"); + liChip.setAttribute("id", `tag-${index}-${id}`); + svgIcon.classList.add("svg-icon"); + svgIcon.appendChild(path1); + svgIcon.appendChild(path2); + liChip.appendChild(textNode); + liChip.appendChild(svgIcon); + if (styles) { + const { chips: chips } = styles; + (0, $5aca7c389be45fd0$export$5f8f940a0de3e7d)(chips, liChip); + } + svgIcon.addEventListener("click", (event)=>{ + event.preventDefault(); + event.stopPropagation(); + (0, $5aca7c389be45fd0$export$a240606f327b3da2)(nativeOption, title, false); + const deleteIcon = indexes.indexOf(index); + let checkBox; + indexes.splice(deleteIcon, 1); + selectedItems.splice(deleteIcon, 1); + if (id) checkBox = document.getElementById(`chbox-${id}`); + else checkBox = document.getElementById(`chbox-${index}`); + checkBox.checked = false; + checkBox.parentElement.classList.remove("active"); + if (!selectedItems.length) selected.innerText = placeholder; + liChip.parentElement.removeChild(liChip); + }); + return liChip; +} +function $3e0e9117e5437319$export$3ffa48e55176070e(random, lenguage) { + const inputSearch = document.createElement("input"); + inputSearch.type = "text"; + inputSearch.classList.add("inputSearch"); + inputSearch.setAttribute("id", `searchSelect-${random}`); + if (lenguage) inputSearch.setAttribute("placeholder", `${lenguage}`); + else inputSearch.setAttribute("placeholder", "Search..."); + inputSearch.addEventListener("click", (e)=>{ + e.preventDefault(); + }); + return inputSearch; +} + + + +const $356528c60e5e24f4$export$cf48009033a0126b = { + selectPlaceholder: "Выберите элемент...", + placeholder: "Поиск...", + textInListSearch: "Совпадений нет..." +}; +const $356528c60e5e24f4$export$84584c2a98eb6753 = { + selectPlaceholder: "Select element...", + placeholder: "Search...", + textInListSearch: "No matches..." +}; + + + +function $e3e030f05caf96c0$export$e6eb54368342cb84(element, theme) { + const select = element.querySelector(".cg-select"); + const caret = element.querySelector(".caret"); + const list = element.querySelector("ul.list"); + const search = element.querySelector(".inputSearch"); + const path = element.querySelectorAll(".pathWhite"); + const nativeSelect = element.querySelector(".nativeSelect"); + select.classList.remove("classicSelect"); + list.classList.remove("classicList"); + path.forEach((elem)=>{ + elem.classList.remove("pathBlack"); + elem.classList.remove("pathWhite"); + }); + if (typeof theme === "string") switch(theme){ + case "dark": + select.classList.add("selectDark"); + list.classList.add("listDark"); + nativeSelect?.classList.add("listDark"); + path.forEach((elem)=>{ + elem.classList.add("pathWhite"); + }); + break; + case "white": + select.classList.add("selectWhite"); + caret.classList.add("caretWhite"); + list.classList.add("listWhite"); + nativeSelect?.classList.add("listWhite"); + path.forEach((elem)=>{ + elem.classList.add("pathBlack"); + }); + if (search) search.classList.add("inputWhite"); + break; + default: + select.classList.add("classicSelect"); + list.classList.add("classicList"); + break; + } + else { + select.classList.add(`${theme.styles.head}`); + list.classList.add(`${theme.styles.list}`); + } +} + + +class $adaec01e28cd9884$export$ba2c4ca7a0a16031 { + /** + * Array of indexes of selected elements. + * @type {number[]} + */ indexes = []; + /** + * @param {ICgSelect} setting Object accepting select settings. + * @constructor ICgSelect class constructor. + * @description The constructor takes an object and renders the select. + * @example + * options = { + * selector: 'Unique selector', + selected: 'Selected item', + placeholder: '...', + label: '...' + items: [string|number|object], + theme: string, + searchMode: true/false, + closeOnSelect: true/false, + nativeSelectMode: true/false, + listDisplayMode: true/false, + language: 'ru/en', + styles: { + head: { + background: '...', + }, + list: {...}, + chips: {...}, + carriage: {...}, + placeholder: {...}, + label: {..}, + }, + event: '...', + url: 'http/...', + multiselect: true/false, + multiselectTag: true/false, + * } + */ constructor(setting){ + this.init(setting); + this.render(); + this.closeSelectClick(); + this.initEvent(); + } + //Getters + /** + * @returns {string[] | string} Returns the selected element(s) as an array / element / null. + * @description Getter returning the selected element(s) of the select. + */ get value() { + return this.selectedItems ?? null; + } + /** + * @returns {number | number[]} Returns the indices of the selected element(s) as an array / empty array. + * @description A getter that returns the indexes of the selected element(s) of the select. + */ get indexesOf() { + return this.indexes ?? []; + } + /** + * Private method for initializing an instance of the ICgSelect class. + * @method init + * @member + * @private + * @param {ISgSelect} setting passed select settings. + * @description Private method. General initialization of the select. Obtaining tinctures and converting select elements. + * @example + * { + selector: '.cg-dropdown_one', + placeholder: 'Choose a car', + items: [ + 'BMW', + { + id: '213sade', + title: 'Opel', + value: 1, + }, + 'Mersedes', + 'MAN', + 'max', + ], + multiselect: true, + multiselectTag: true, + } + */ init(setting) { + const { items: items , multiselect: multiselect , multiselectTag: multiselectTag , url: url , selector: selector , listDisplayMode: listDisplayMode , nativeSelectMode: nativeSelectMode , searchMode: searchMode , language: language , styles: styles , label: label , event: event , selected: selected , placeholder: placeholder , theme: theme , } = setting; + this.options = setting; + this.multiselect = multiselect; + this.multiselectTag = multiselectTag; + this.url = url; + this.selector = selector; + this.items = items; + this.searchMode = searchMode; + this.language = language; + this.nativeSelectMode = nativeSelectMode; + this.listDisplayMode = listDisplayMode; + this.styles = styles; + this.label = label; + this.event = event; + this.selected = selected; + this.placeholder = placeholder; + this.theme = theme; + const elem = document.querySelector(this.selector); + this.element = elem; + this.element?.addEventListener("click", (e)=>{ + e.preventDefault(); + this.open(); + }); + this.items = []; + if (this.url && !items) { + this.renderUrl(); + return; + } + if (this.label) { + const labelItem = document.createElement("h1"); + const textLabel = document.createTextNode(this.label); + labelItem.appendChild(textLabel); + labelItem.classList.add("label"); + this.element.insertAdjacentElement("beforebegin", labelItem); + } + items.forEach((dataItem, index)=>{ + let itemInputs = { + ItemValue: dataItem, + category: dataItem.category, + categoryItems: dataItem.categoryItems + }; + if (itemInputs.category && itemInputs.categoryItems) { + this.category = itemInputs.category; + this.items.push(this.category); + itemInputs.categoryItems.forEach((categoryItem, indexCategory)=>{ + this.items.push((0, $5aca7c389be45fd0$export$b2e1d36bc0be1b2f)(categoryItem, indexCategory)); + }); + } else this.items.push((0, $5aca7c389be45fd0$export$b2e1d36bc0be1b2f)(itemInputs.ItemValue, index)); + }); + } + /** + * @private + * @method render + * @param {string} select optional element. Passed to the initSelected. + * @description Render elements in select. + */ render(select) { + const random = Math.random().toString(36).substring(2, 10); + if (select || select && this.styles) { + this.initSelected(select); + (0, $5aca7c389be45fd0$export$edf5b2501a573922)(this.element, this.styles); + } else this.initSelected(); + const ulList = document.createElement("ul"); + const nativeSelect = (0, $3e0e9117e5437319$export$dfb0baf35876628e)(); + let inputSearch; + let textNode; + this.randomId = random; + ulList.classList.add("list"); + ulList.classList.add("classicList"); + if (this.styles) (0, $5aca7c389be45fd0$export$5f8f940a0de3e7d)(this.styles.list, ulList); + if (this.searchMode) { + if (this.language === "ru") inputSearch = (0, $3e0e9117e5437319$export$3ffa48e55176070e)(random, (0, $356528c60e5e24f4$export$cf48009033a0126b).placeholder); + else inputSearch = (0, $3e0e9117e5437319$export$3ffa48e55176070e)(random, (0, $356528c60e5e24f4$export$84584c2a98eb6753).placeholder); + (0, $5aca7c389be45fd0$export$5f8f940a0de3e7d)(this.styles?.search, inputSearch); + ulList.appendChild(inputSearch); + } + this.element?.appendChild(ulList); + this.items.forEach((dataItem)=>{ + this.element?.appendChild(nativeSelect); + const liItem = document.createElement("li"); + const nativeOption = (0, $3e0e9117e5437319$export$401096e4c8c5bfbe)(); + const strongItem = document.createElement("strong"); + liItem.classList.add("list__item"); + strongItem.classList.add("category"); + if (this.multiselect) { + const checkBox = document.createElement("input"); + checkBox.type = "checkbox"; + checkBox.setAttribute("id", `chbox-${dataItem.id}`); + liItem.appendChild(checkBox); + if (this.multiselectTag) checkBox.classList.add("displayHide"); + nativeSelect.setAttribute("multiple", "multiple"); + } + if (dataItem.title) { + nativeOption.text = dataItem.title; + nativeOption.value = dataItem.title; + textNode = document.createTextNode(dataItem.title); + nativeSelect.appendChild(nativeOption); + liItem.appendChild(textNode); + ulList.appendChild(liItem); + } else { + // Для отрисовки категорий + textNode = document.createTextNode(dataItem); + strongItem.appendChild(textNode); + ulList.appendChild(strongItem); + } + }); + this.items.filter((item, index)=>{ + if (typeof item !== "object") this.items.splice(index, 1); + return item; + }); + this.list = this.element.querySelector(".list"); + this.carriage = this.element.querySelector(".caret"); + if (this.theme) (0, $e3e030f05caf96c0$export$e6eb54368342cb84)(this.element, this.theme); + if (this.nativeSelectMode === true) this.selectMode(this.nativeSelectMode); + if (this.listDisplayMode) this.displayMode(this.listDisplayMode); + this.addOptionsBehaviour(); + } + /** + * @private + * @method renderUrl + * @description Rendering elements in the select passed from the URL and setting them up. + */ async renderUrl() { + const response = await fetch(this.url); + const dataUrl = await response.json(); + const nativeSelect = (0, $3e0e9117e5437319$export$dfb0baf35876628e)(); + dataUrl.forEach((dataItem, index)=>{ + const item = { + id: dataItem.id, + title: dataItem.title, + value: index + }; + const ulUrl = this.element.querySelector(".list"); + const nativeOption = (0, $3e0e9117e5437319$export$401096e4c8c5bfbe)(); + const liUrl = document.createElement("li"); + const textUrl = document.createTextNode(item.title); + if (this.multiselect) { + const checkBox = document.createElement("input"); + checkBox.type = "checkbox"; + if (this.multiselectTag) checkBox.classList.add("displayHide"); + checkBox.setAttribute("id", `chbox-${item.id}`); + nativeSelect.setAttribute("multiple", "multiple"); + liUrl.appendChild(checkBox); + } + liUrl.classList.add("list__item"); + nativeOption.value = item.title; + nativeOption.text = item.title; + nativeSelect.appendChild(nativeOption); + liUrl.appendChild(textUrl); + ulUrl.appendChild(liUrl); + this.items.push(item); + }); + this.element.appendChild(nativeSelect); + this.items.filter((item, index)=>{ + if (typeof item !== "object") this.items.splice(index, 1); + return item; + }); + this.addOptionsBehaviour(); + } + /** + * @method initSelected + * @param {string} select optional element. Used in the selectedIndex method. + * @description Renders and styles the select. + * @private + */ initSelected(select) { + if (this.selected) (0, $5aca7c389be45fd0$export$31b5fa56cc6048cb)(this.element, this.selected); + else if (this.placeholder) (0, $5aca7c389be45fd0$export$31b5fa56cc6048cb)(this.element, this.placeholder); + else if (this.language && this.language === "ru") (0, $5aca7c389be45fd0$export$31b5fa56cc6048cb)(this.element, (0, $356528c60e5e24f4$export$cf48009033a0126b).selectPlaceholder); + else (0, $5aca7c389be45fd0$export$31b5fa56cc6048cb)(this.element, (0, $356528c60e5e24f4$export$84584c2a98eb6753).selectPlaceholder); + if (select) (0, $5aca7c389be45fd0$export$31b5fa56cc6048cb)(this.element, select, this.styles); + if (this.styles) (0, $5aca7c389be45fd0$export$edf5b2501a573922)(this.element, this.styles); + } + /** + * @private + * @description Opens and closes the list by the passed event. + * @method initEvent + */ initEvent() { + if (this.event) { + if (this.event === "mouseenter") { + this.element.addEventListener(this.event, ()=>{ + this.open(); + }); + this.element.addEventListener("mouseleave", ()=>{ + this.close(); + }); + } + } + } + /** + * @private + * @param {boolean} oneClick optional parameter passed from the buttonControl function. + * @description Opens a list to select an element. + * @method open + */ open(oneClick) { + if (oneClick === true) { + this.list.classList.add("open"); + this.carriage.classList.add("caret_rotate"); + } else { + this.list.classList.toggle("open"); + this.carriage.classList.toggle("caret_rotate"); + } + } + /** + * @private + * @description Closes the list. + * @method close + */ close() { + this.list?.classList.remove("open"); + this.carriage?.classList.remove("caret_rotate"); + } + /** + * @private + * @description Closes the list on click outside of an element. + * @method closeSelectClick + */ closeSelectClick() { + const dropdown = document.querySelector(`${this.options.selector}`); + document.addEventListener("click", (e)=>{ + const withinBoundaries = e.composedPath().includes(dropdown); + if (!withinBoundaries) { + if (this.buttonAction) return; + else this.close(); + } + }); + } + /** + * @private + * @description A method that implements the selection of elements in different modes. + * @method addOptionsBehaviour + */ addOptionsBehaviour() { + const options = this.element?.querySelectorAll(".list__item"); + const select = this.element?.querySelector(".selected"); + const nativeOption = this.element.querySelectorAll(".nativeSelect__nativeOption"); + let selectedItemsClear = { + placeholder: this.placeholder, + selected: this.selected, + theme: this.theme + }; + const ulMultipul = document.createElement("ul"); + if (this.multiselect) { + this.selectedItems = []; + ulMultipul.classList.add("multiselect-tag"); + select?.classList.add("overflow-hidden"); + } + if (this.searchMode) this.searchModeSelect(this.randomId); + options?.forEach((option, index)=>{ + option.addEventListener("click", (event)=>{ + if (Array.isArray(this.selectedItems)) selectedItemsClear = { + placeholder: this.placeholder, + selected: this.selected, + selectedItems: this.selectedItems, + indexes: this.indexes, + multiselectTag: this.multiselectTag + }; + const item = this.items[index]; + const checkIndex = this.indexes.indexOf(index); + if (this.closeOnSelect == false || this.multiselect) { + event.stopPropagation(); + event.preventDefault(); + } + if (this.multiselect) { + option.classList.toggle("active"); + const checkBox = option.querySelector('input[type="checkbox"]'); + if (checkBox) { + if (!(event.target instanceof HTMLInputElement)) checkBox.checked = !checkBox.checked; + if (checkIndex == -1) { + this.indexes.push(index); + (0, $5aca7c389be45fd0$export$a240606f327b3da2)(nativeOption, item.title, true); + select.textContent = ""; + if (this.multiselectTag) { + if (Array.isArray(this.selectedItems)) { + const dataBreadCrumb = { + option: this.options, + element: this.element, + indexes: this.indexes, + selectedItems: this.selectedItems + }; + this.selectedItems.push(item.title); + select.appendChild(ulMultipul); + ulMultipul.appendChild((0, $3e0e9117e5437319$export$94c1ad1d6db6a1d0)(dataBreadCrumb, item.title, index, item.id)); + } + } else if (Array.isArray(this.selectedItems)) { + this.selectedItems.push(item.title); + select.innerText = this.selectedItems.join(","); + } + } else { + if (this.multiselectTag) { + const tagItem = document.getElementById(`tag-${index}-${item.id}`); + ulMultipul.removeChild(tagItem); + } + if (Array.isArray(this.selectedItems)) { + this.selectedItems.splice(checkIndex, 1); + this.indexes.splice(checkIndex, 1); + (0, $5aca7c389be45fd0$export$a240606f327b3da2)(nativeOption, item.title, false); + } + } + if (!this.selectedItems.length) (0, $5aca7c389be45fd0$export$11380eda3eb06ca9)(selectedItemsClear, select); + else { + if (this.multiselectTag) select.appendChild(ulMultipul); + else if (Array.isArray(this.selectedItems)) select.innerText = this.selectedItems.join(","); + } + } + } else { + select.textContent = item.title; + this.selectedItems = item.title; + (0, $5aca7c389be45fd0$export$668f6560249913a1)(nativeOption, item.title); + options.forEach((option)=>{ + option.classList.remove("active"); + }); + option.classList.add("active"); + } + (0, $5aca7c389be45fd0$export$4474211a0591e3fe)(select, this.element, selectedItemsClear); + }); + }); + } + /** + * @private + * @param {boolean} nativeSelectMode parameter responsible for adding native select. + * @description Changes the display of the select on mobile devices. + * @method selectMode + */ selectMode(nativeSelectMode) { + let win = window.outerWidth; + if (nativeSelectMode === true) { + const select = this.element.querySelector(".cg-select"); + const list = this.element.querySelector(".list"); + const nativeSelect = this.element.querySelector(".nativeSelect"); + if (win < 576) { + select.classList.add("displayHide"); + list.classList.add("displayHide"); + nativeSelect.classList.add("nativeSelectActive"); + } else if (win > 576) { + select.classList.remove("displayHide"); + list.classList.remove("displayHide"); + nativeSelect.classList.remove("nativeSelectActive"); + nativeSelect.classList.add("displayHide"); + } + } else return; + } + /** + * @description The method that implements the search for elements in the select. + * @private + * @param {string} random unique value for input element. + * @method searchMode + */ searchModeSelect(random) { + const input = this.element.querySelector(`#searchSelect-${random}`); + const searchSelect = this.element.querySelectorAll(".list__item"); + const result = document.createElement("p"); + let textNode; + if (this.language && this.language === "ru") textNode = document.createTextNode(`${(0, $356528c60e5e24f4$export$cf48009033a0126b).textInListSearch}`); + else textNode = document.createTextNode(`${(0, $356528c60e5e24f4$export$84584c2a98eb6753).textInListSearch}`); + result.appendChild(textNode); + result.classList.add("displayHide"); + result.classList.add("noRezult"); + input.parentElement.appendChild(result); + input.addEventListener("click", (e)=>{ + e.stopPropagation(); + }); + if (input instanceof HTMLInputElement) input.oninput = function() { + let valueSearch = input.value.trim().toLowerCase(); + let anyMatch = false; + if (valueSearch != "") { + searchSelect.forEach((elem)=>{ + let isMatching = new RegExp(valueSearch, "gi").test(elem.textContent); + anyMatch = anyMatch || isMatching; + if (elem.textContent.toLowerCase().search(valueSearch) == -1) elem.classList.add("displayHide"); + else elem.classList.remove("displayHide"); + }); + result.classList.toggle("displayHide", anyMatch); + } else searchSelect.forEach((elem)=>{ + elem.classList.remove("displayHide"); + result.classList.add("displayHide"); + }); + }; + } + /** + * @private + * @param {boolean} listDisplayMode parameter responsible for displaying the selection in the form of a modal window. + * @description Changes the display of a sheet with a selection as a modal window. + * @method displayMode + */ displayMode(listDisplayMode) { + if (listDisplayMode) { + const modal = document.createElement("div"); + const body = document.querySelector("body"); + const list = this.list; + modal.appendChild(list); + this.element.appendChild(modal); + this.element.addEventListener("click", ()=>{ + modal.classList.toggle("modal"); + list.classList.toggle("listModal"); + body.classList.toggle("overflowHide"); + }); + } else return; + } + // Public methods + /** + * @param {number} numberItem returned element number. + * @returns {HTMLElement} returns a reference to the selected HTML element. + * @method getElement + */ getElement(numberItem) { + if (numberItem > this.items.length) return; + return this.items[numberItem]; + } + /** + * @param {ILanguage} language the object in which the fields for connecting the language are located has two mandatory fields placeholder, textInListSearch, selectPlaceholder. + * @description a method that allows you to change the placeholder in the search and the text that is displayed if there is no result. + * @method addLanguage + */ addLanguage(language) { + const { placeholder: placeholder , textInListSearch: textInListSearch , selectPlaceholder: selectPlaceholder } = language; + const select = this.element.querySelector(".selected"); + const textNodeSelect = document.createTextNode(selectPlaceholder); + select.appendChild(textNodeSelect); + if (this.searchMode) { + const search = this.element.querySelector(".inputSearch"); + const textNoRezult = this.element.querySelector(".noRezult"); + const textNode = document.createTextNode(textInListSearch); + search.setAttribute("placeholder", placeholder); + search.setAttribute("placeholder", placeholder); + textNoRezult.textContent = ""; + textNoRezult.appendChild(textNode); + } + } + /** + * @param {HTMLInputElement} button - HTML button. + * @param {string} method - open/close method. + * @description A method that allows you to open / close the select using buttons. + * @method buttonControl + */ buttonControl(button, method) { + if (this.listDisplayMode) return; + this.buttonAction = button; + button.addEventListener("click", ()=>{ + if (method.toLowerCase() === "open") this.open(true); + else if (method.toLowerCase() === "close") this.close(); + else return; + }); + } + /** + * @param {boolean} value - Passed parameter to add the disabled attribute. + * @description A method that allows you to toggle the state of the disabled select. + * @method disabled + */ disabled(value) { + const select = this.element.querySelector(".cg-select"); + const nativeSelect = this.element.querySelector(".nativeSelect"); + if (value === true) { + this.element.setAttribute("disabled", "true"); + nativeSelect.setAttribute("disabled", "true"); + select.classList.add("disabled"); + } else { + this.element.removeAttribute("disabled"); + nativeSelect.removeAttribute("disabled"); + select.classList.remove("disabled"); + } + } + /** + * @param {string | IItems} item added element. + * @description adds the given element to the end of the list and redraws the list. Cannot be used when passing elements with categories. + * @method addItem + */ addItem(item) { + if (this.category) { + console.log("can`t add item to category"); + return; + } + if (!item) return false; + const index = this.items.length; + this.items.push((0, $5aca7c389be45fd0$export$b2e1d36bc0be1b2f)(item, index)); + this.render(); + } + /** + * @param {number} index the index of the element to be removed. + * @description removes the element by index from the list and redraws it. Cannot be used when passing elements with categories. + * @method deleteItem + */ deleteItem(index) { + if (this.category) { + console.log("can`t add item to category"); + return; + } + const item = this.items[index]; + this.items.splice(index, 1); + this.render(); + } + /** + * @description removes all elements from the list and redraws it. + * @method deleteItemAll + */ deleteItemAll() { + this.items.splice(0, this.items.length); + this.render(); + } + /** + * @param {number} index the index of the selected element. + * @description selects the element that will be initially rendered in the select. + * @method selectIndex + */ selectIndex(index) { + if (this.category) { + console.log("can`t add item to category"); + return; + } + const options = this.element.querySelectorAll(".list__item"); + if (index > options.length) return; + const select = options[index].innerText; + this.render(select); + } + /** + * @description Method for tracking the actions of the select, you can pass a callback + * @param state select state. + * @param callback + * @method on + */ on(state, callback) { + const options = this.element?.querySelectorAll(".list__item"); + let value = ""; + switch(state){ + case "select": + options?.forEach((option)=>{ + option.addEventListener("click", ()=>{ + console.log("option:select", option.textContent); + value = option.textContent; + callback(state, value); + }); + }); + break; + case "close": + this.element.addEventListener("click", ()=>{ + console.log("list:close", this.list.classList.contains("close")); + }); + callback(state); + break; + case "open": + this.element.addEventListener("click", ()=>{ + console.log("list:open", this.list.classList.contains("open")); + }); + callback(state); + break; + case "clear": + this.element.addEventListener("click", ()=>{ + const svgIcon = this.element?.querySelector(".svg-icon"); + svgIcon?.addEventListener("click", ()=>{ + console.log("list:clear", svgIcon.classList.contains("svg-clear")); + }); + }); + callback(state); + break; + } + } +} + + +var $43d7963e56408b24$export$2e2bcd8739ae039 = (0, $adaec01e28cd9884$export$ba2c4ca7a0a16031); + + +//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..a6cce60 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"mappings":";;;;;;;;;;;;AGcO,SAAS,yCAAa,CAAC,QAAa,EAAE,KAAa,EAAU;IAClE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAA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,CAAC;gBACH,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAChB,MAAM;SACT;KACF;CACF;;AD57BD;IAEA,wCAAwB,GAAT,CAAA,GAAA,yCAAQ,CAAA","sources":["index.js","src/cg-select.ts","src/components/create-element/create-element.ts","src/components/utils/utils.ts","src/language/language.ts","src/components/theme/theme.ts"],"sourcesContent":["import { CGSelect } from './src/cg-select';\n\nexport default CGSelect;\n","import {\n createBreadCrumb,\n createInputSearch,\n createNativeSelect,\n createNativeSelectOption,\n} from './components/create-element/create-element';\nimport { ICreateBreadCrumb } from './components/create-element/create-element.interface';\n\nimport {\n clearSelect,\n createSelected,\n customStyles,\n customStylesFormat,\n getFormatItem,\n getSelectText,\n nativeOptionMultiple,\n nativeOptionOrdinary,\n} from './components/utils/utils';\nimport { IDataItem, ISelectedItems } from './components/utils/utils.interface';\n\nimport { ICgSelect, IStyle } from './interfaces/cg-select.interface';\nimport { IItems } from './interfaces/items.interface';\nimport { ru, en } from './language/language';\nimport { ILanguage } from './interfaces/language.interface';\n\nimport './main.scss';\nimport { changeTheme } from './components/theme/theme';\nimport { CustomTheme } from 'components/theme/theme.interface';\n\n/**\n * @class Class Description ICgSelect\n * @description This class implements the functionality of a custom select, with customization capabilities.\n * @author Ovsyanikov Maxim\n */\nexport class CGSelect implements ICgSelect {\n selector?: string;\n selected?: string;\n placeholder?: string;\n items?: IItems[] | string[] | any;\n theme?: string | CustomTheme;\n searchMode?: boolean;\n closeOnSelect?: boolean;\n nativeSelectMode?: boolean;\n listDisplayMode?: boolean;\n language?: string;\n label?: string;\n styles?: IStyle;\n event?: string;\n url?: string;\n multiselect?: boolean;\n multiselectTag?: boolean;\n\n /**\n * Created HTML element.\n * @type {Element | null}\n */\n private element!: Element | null;\n /**\n * Created list(ul), with class list.\n * @type {Element | null | undefined}\n */\n private list!: Element | null;\n /**\n * Select settings passed when creating an instance of the class.\n * @type {ICgSelect}\n */\n private options!: ICgSelect;\n /**\n * Unique Id for elements.\n * @type {string}\n */\n private randomId!: string;\n /**\n * Variable for carriage control.\n * @type {Element | null | undefined}\n */\n private carriage: Element | null | undefined;\n /**\n * Transferred categories.\n * @type {string}\n */\n private category?: string;\n /**\n * Selected or an array of selected items from a list.\n * @type {string[] | string}\n */\n private selectedItems!: string[] | string;\n /**\n * Array of indexes of selected elements.\n * @type {number[]}\n */\n private indexes: number[] = [];\n /**\n * Button, to control the select.\n * @type {Element | null}\n */\n private buttonAction?: Element | null;\n\n /**\n * @param {ICgSelect} setting Object accepting select settings.\n * @constructor ICgSelect class constructor.\n * @description The constructor takes an object and renders the select.\n * @example\n * options = {\n * selector: 'Unique selector',\n selected: 'Selected item',\n placeholder: '...',\n label: '...'\n items: [string|number|object],\n theme: string,\n searchMode: true/false,\n closeOnSelect: true/false,\n nativeSelectMode: true/false,\n listDisplayMode: true/false,\n language: 'ru/en',\n styles: {\n head: {\n background: '...',\n },\n list: {...},\n chips: {...},\n carriage: {...},\n placeholder: {...},\n label: {..},\n },\n event: '...',\n url: 'http/...',\n multiselect: true/false,\n multiselectTag: true/false,\n * } \n */\n constructor(setting: ICgSelect) {\n this.init(setting);\n this.render();\n this.closeSelectClick();\n this.initEvent();\n }\n\n //Getters\n /**\n * @returns {string[] | string} Returns the selected element(s) as an array / element / null.\n * @description Getter returning the selected element(s) of the select.\n */\n get value(): string | string[] {\n return this.selectedItems ?? null;\n }\n\n /**\n * @returns {number | number[]} Returns the indices of the selected element(s) as an array / empty array.\n * @description A getter that returns the indexes of the selected element(s) of the select.\n */\n get indexesOf(): number | number[] {\n return this.indexes ?? [];\n }\n\n /**\n * Private method for initializing an instance of the ICgSelect class.\n * @method init\n * @member\n * @private\n * @param {ISgSelect} setting passed select settings.\n * @description Private method. General initialization of the select. Obtaining tinctures and converting select elements.\n * @example\n * {\n selector: '.cg-dropdown_one',\n placeholder: 'Choose a car',\n items: [\n 'BMW',\n {\n id: '213sade',\n title: 'Opel',\n value: 1,\n },\n 'Mersedes',\n 'MAN',\n 'max',\n ],\n multiselect: true,\n multiselectTag: true,\n }\n */\n private init(setting: ICgSelect): void {\n const {\n items,\n multiselect,\n multiselectTag,\n url,\n selector,\n listDisplayMode,\n nativeSelectMode,\n searchMode,\n language,\n styles,\n label,\n event,\n selected,\n placeholder,\n theme,\n } = setting;\n\n this.options = setting;\n\n this.multiselect = multiselect;\n this.multiselectTag = multiselectTag;\n this.url = url;\n this.selector = selector;\n this.items = items;\n this.searchMode = searchMode;\n this.language = language;\n this.nativeSelectMode = nativeSelectMode;\n this.listDisplayMode = listDisplayMode;\n this.styles = styles;\n this.label = label;\n this.event = event;\n this.selected = selected;\n this.placeholder = placeholder;\n this.theme = theme;\n\n const elem = document.querySelector(this.selector!);\n this.element = elem;\n\n this.element?.addEventListener('click', (e) => {\n e.preventDefault();\n this.open();\n });\n\n this.items = [];\n\n if (this.url && !items) {\n this.renderUrl();\n return;\n }\n\n if (this.label) {\n const labelItem = document.createElement('h1');\n const textLabel = document.createTextNode(this.label);\n\n labelItem.appendChild(textLabel);\n labelItem.classList.add('label');\n\n this.element!.insertAdjacentElement('beforebegin', labelItem);\n }\n\n items.forEach((dataItem: any, index: number) => {\n let itemInputs: IDataItem = {\n ItemValue: dataItem,\n category: dataItem.category,\n categoryItems: dataItem.categoryItems,\n };\n\n if (itemInputs.category && itemInputs.categoryItems) {\n this.category = itemInputs.category!;\n this.items.push(this.category);\n itemInputs.categoryItems.forEach(\n (categoryItem: string | IItems | any, indexCategory: number) => {\n this.items.push(getFormatItem(categoryItem, indexCategory));\n },\n );\n } else {\n this.items.push(getFormatItem(itemInputs.ItemValue, index));\n }\n });\n }\n\n /**\n * @private\n * @method render\n * @param {string} select optional element. Passed to the initSelected.\n * @description Render elements in select.\n */\n private render(select?: string): void {\n const random = Math.random().toString(36).substring(2, 10);\n\n if (select || (select && this.styles)) {\n this.initSelected(select);\n customStyles(this.element!, this.styles!);\n } else {\n this.initSelected();\n }\n\n const ulList = document.createElement('ul');\n const nativeSelect = createNativeSelect();\n\n let inputSearch: HTMLInputElement;\n let textNode: Text;\n\n this.randomId = random;\n\n ulList.classList.add('list');\n ulList!.classList.add('classicList');\n\n if (this.styles) {\n customStylesFormat(this.styles.list!, ulList);\n }\n\n if (this.searchMode) {\n if (this.language === 'ru') {\n inputSearch = createInputSearch(random, ru.placeholder);\n } else {\n inputSearch = createInputSearch(random, en.placeholder);\n }\n\n customStylesFormat(this.styles?.search!, inputSearch);\n ulList.appendChild(inputSearch);\n }\n\n this.element?.appendChild(ulList);\n\n this.items.forEach((dataItem: IItems | any) => {\n this.element?.appendChild(nativeSelect);\n\n const liItem = document.createElement('li');\n const nativeOption = createNativeSelectOption();\n const strongItem = document.createElement('strong');\n\n liItem.classList.add('list__item');\n strongItem.classList.add('category');\n\n if (this.multiselect) {\n const checkBox = document.createElement('input');\n checkBox.type = 'checkbox';\n checkBox.setAttribute('id', `chbox-${dataItem.id}`);\n liItem.appendChild(checkBox);\n\n if (this.multiselectTag) {\n checkBox.classList.add('displayHide');\n }\n\n nativeSelect.setAttribute('multiple', 'multiple');\n }\n\n if (dataItem.title) {\n nativeOption.text = dataItem.title;\n nativeOption.value = dataItem.title;\n textNode = document.createTextNode(dataItem.title);\n\n nativeSelect.appendChild(nativeOption);\n liItem.appendChild(textNode);\n ulList.appendChild(liItem);\n } else {\n // Для отрисовки категорий\n textNode = document.createTextNode(dataItem);\n strongItem.appendChild(textNode);\n ulList.appendChild(strongItem);\n }\n });\n\n this.items.filter((item: IItems | any, index: number) => {\n if (typeof item !== 'object') {\n this.items.splice(index, 1);\n }\n\n return item;\n });\n\n this.list = this.element!.querySelector('.list');\n this.carriage = this.element!.querySelector('.caret');\n\n if (this.theme) {\n changeTheme(this.element!, this.theme!);\n }\n\n if (this.nativeSelectMode === true) {\n this.selectMode(this.nativeSelectMode);\n }\n\n if (this.listDisplayMode) {\n this.displayMode(this.listDisplayMode);\n }\n\n this.addOptionsBehaviour();\n }\n\n /**\n * @private\n * @method renderUrl\n * @description Rendering elements in the select passed from the URL and setting them up.\n */\n private async renderUrl() {\n const response = await fetch(this.url!);\n const dataUrl = await response.json();\n\n const nativeSelect = createNativeSelect();\n\n dataUrl.forEach((dataItem: IItems, index: number) => {\n const item = {\n id: dataItem.id,\n title: dataItem.title,\n value: index,\n };\n\n const ulUrl = this.element!.querySelector('.list');\n\n const nativeOption = createNativeSelectOption();\n const liUrl = document.createElement('li');\n const textUrl = document.createTextNode(item.title);\n\n if (this.multiselect) {\n const checkBox = document.createElement('input');\n checkBox.type = 'checkbox';\n\n if (this.multiselectTag) {\n checkBox.classList.add('displayHide');\n }\n\n checkBox.setAttribute('id', `chbox-${item.id}`);\n nativeSelect.setAttribute('multiple', 'multiple');\n\n liUrl.appendChild(checkBox);\n }\n\n liUrl.classList.add('list__item');\n nativeOption.value = item.title;\n nativeOption.text = item.title;\n\n nativeSelect.appendChild(nativeOption);\n liUrl.appendChild(textUrl);\n ulUrl!.appendChild(liUrl);\n\n this.items.push(item);\n });\n\n this.element!.appendChild(nativeSelect);\n\n this.items.filter((item: IItems | string | any, index: number) => {\n if (typeof item !== 'object') {\n this.items.splice(index, 1);\n }\n return item;\n });\n\n this.addOptionsBehaviour();\n }\n\n /**\n * @method initSelected\n * @param {string} select optional element. Used in the selectedIndex method.\n * @description Renders and styles the select.\n * @private\n */\n private initSelected(select?: string): void {\n if (this.selected) {\n createSelected(this.element!, this.selected);\n } else if (this.placeholder) {\n createSelected(this.element!, this.placeholder);\n } else {\n if (this.language && this.language === 'ru') {\n createSelected(this.element!, ru.selectPlaceholder);\n } else {\n createSelected(this.element!, en.selectPlaceholder);\n }\n }\n\n if (select) {\n createSelected(this.element!, select, this.styles);\n }\n\n if (this.styles) {\n customStyles(this.element!, this.styles);\n }\n }\n\n /**\n * @private\n * @description Opens and closes the list by the passed event.\n * @method initEvent\n */\n private initEvent() {\n if (this.event) {\n if (this.event === 'mouseenter') {\n this.element!.addEventListener(this.event, () => {\n this.open();\n });\n this.element!.addEventListener('mouseleave', () => {\n this.close();\n });\n }\n }\n }\n\n /**\n * @private\n * @param {boolean} oneClick optional parameter passed from the buttonControl function.\n * @description Opens a list to select an element.\n * @method open\n */\n private open(oneClick?: boolean): void {\n if (oneClick === true) {\n this.list!.classList.add('open');\n this.carriage!.classList.add('caret_rotate');\n } else {\n this.list!.classList.toggle('open');\n this.carriage!.classList.toggle('caret_rotate');\n }\n }\n\n /**\n * @private\n * @description Closes the list.\n * @method close\n */\n private close(): void {\n this.list?.classList.remove('open');\n this.carriage?.classList.remove('caret_rotate');\n }\n\n /**\n * @private\n * @description Closes the list on click outside of an element.\n * @method closeSelectClick\n */\n private closeSelectClick(): void {\n const dropdown = document.querySelector(`${this.options.selector}`);\n\n document.addEventListener('click', (e) => {\n const withinBoundaries = e.composedPath().includes(dropdown!);\n if (!withinBoundaries) {\n if (this.buttonAction) {\n return;\n } else {\n this.close();\n }\n }\n });\n }\n\n /**\n * @private\n * @description A method that implements the selection of elements in different modes.\n * @method addOptionsBehaviour\n */\n private addOptionsBehaviour() {\n const options = this.element?.querySelectorAll('.list__item');\n const select: HTMLElement | null | undefined = this.element?.querySelector('.selected');\n const nativeOption = this.element!.querySelectorAll('.nativeSelect__nativeOption');\n\n let selectedItemsClear: ISelectedItems = {\n placeholder: this.placeholder!,\n selected: this.selected!,\n theme: this.theme,\n };\n\n const ulMultipul = document.createElement('ul');\n\n if (this.multiselect) {\n this.selectedItems = [];\n ulMultipul.classList.add('multiselect-tag');\n select?.classList.add('overflow-hidden');\n }\n\n if (this.searchMode) {\n this.searchModeSelect(this.randomId);\n }\n\n options?.forEach((option: Element, index: number) => {\n option.addEventListener('click', (event) => {\n if (Array.isArray(this.selectedItems)) {\n selectedItemsClear = {\n placeholder: this.placeholder!,\n selected: this.selected!,\n selectedItems: this.selectedItems,\n indexes: this.indexes,\n multiselectTag: this.multiselectTag,\n };\n }\n\n const item: IItems = this.items[index];\n\n const checkIndex = this.indexes.indexOf(index);\n\n if (this.closeOnSelect == false || this.multiselect) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n if (this.multiselect) {\n option.classList.toggle('active');\n\n const checkBox: HTMLInputElement | null = option.querySelector('input[type=\"checkbox\"]');\n\n if (checkBox) {\n if (!(event.target instanceof HTMLInputElement)) {\n checkBox.checked = !checkBox.checked;\n }\n\n if (checkIndex == -1) {\n this.indexes.push(index);\n nativeOptionMultiple(nativeOption, item.title, true);\n select!.textContent = '';\n\n if (this.multiselectTag) {\n if (Array.isArray(this.selectedItems)) {\n const dataBreadCrumb: ICreateBreadCrumb = {\n option: this.options,\n element: this.element,\n indexes: this.indexes,\n selectedItems: this.selectedItems,\n };\n\n this.selectedItems.push(item.title);\n select!.appendChild(ulMultipul);\n ulMultipul.appendChild(\n createBreadCrumb(dataBreadCrumb, item.title, index, item.id),\n );\n }\n } else {\n if (Array.isArray(this.selectedItems)) {\n this.selectedItems.push(item.title);\n select!.innerText = this.selectedItems.join(',');\n }\n }\n } else {\n if (this.multiselectTag) {\n const tagItem = document.getElementById(`tag-${index}-${item.id}`);\n ulMultipul.removeChild(tagItem!);\n }\n\n if (Array.isArray(this.selectedItems)) {\n this.selectedItems.splice(checkIndex, 1);\n this.indexes.splice(checkIndex, 1);\n nativeOptionMultiple(nativeOption, item.title, false);\n }\n }\n\n if (!this.selectedItems.length) {\n getSelectText(selectedItemsClear, select);\n } else {\n if (this.multiselectTag) {\n select!.appendChild(ulMultipul);\n } else {\n if (Array.isArray(this.selectedItems)) {\n select!.innerText = this.selectedItems.join(',');\n }\n }\n }\n }\n } else {\n select!.textContent = item.title;\n this.selectedItems = item.title;\n\n nativeOptionOrdinary(nativeOption, item.title);\n\n options.forEach((option) => {\n option.classList.remove('active');\n });\n option.classList.add('active');\n }\n\n clearSelect(select!, this.element!, selectedItemsClear);\n });\n });\n }\n\n /**\n * @private\n * @param {boolean} nativeSelectMode parameter responsible for adding native select.\n * @description Changes the display of the select on mobile devices.\n * @method selectMode\n */\n private selectMode(nativeSelectMode: boolean) {\n let win = window.outerWidth;\n\n if (nativeSelectMode === true) {\n const select = this.element!.querySelector('.cg-select');\n const list = this.element!.querySelector('.list');\n const nativeSelect = this.element!.querySelector('.nativeSelect');\n\n if (win < 576) {\n select!.classList.add('displayHide');\n list!.classList.add('displayHide');\n nativeSelect!.classList.add('nativeSelectActive');\n } else if (win > 576) {\n select!.classList.remove('displayHide');\n list!.classList.remove('displayHide');\n nativeSelect!.classList.remove('nativeSelectActive');\n nativeSelect!.classList.add('displayHide');\n }\n } else {\n return;\n }\n }\n\n /**\n * @description The method that implements the search for elements in the select.\n * @private\n * @param {string} random unique value for input element.\n * @method searchMode\n */\n private searchModeSelect(random: string) {\n const input = this.element!.querySelector(`#searchSelect-${random}`) as HTMLInputElement;\n const searchSelect = this.element!.querySelectorAll('.list__item');\n const result = document.createElement('p');\n\n let textNode: Text;\n if (this.language && this.language === 'ru') {\n textNode = document.createTextNode(`${ru.textInListSearch}`);\n } else {\n textNode = document.createTextNode(`${en.textInListSearch}`);\n }\n\n result.appendChild(textNode);\n result.classList.add('displayHide');\n result.classList.add('noRezult');\n input!.parentElement!.appendChild(result);\n\n input!.addEventListener('click', (e) => {\n e.stopPropagation();\n });\n\n if (input instanceof HTMLInputElement) {\n input!.oninput = function () {\n let valueSearch: string = input.value.trim().toLowerCase();\n let anyMatch = false;\n\n if (valueSearch != '') {\n searchSelect.forEach((elem) => {\n let isMatching = new RegExp(valueSearch, 'gi').test(elem.textContent!);\n anyMatch = anyMatch || isMatching;\n\n if (elem.textContent!.toLowerCase().search(valueSearch) == -1) {\n elem.classList.add('displayHide');\n } else {\n elem.classList.remove('displayHide');\n }\n });\n\n result.classList.toggle('displayHide', anyMatch);\n } else {\n searchSelect.forEach((elem) => {\n elem.classList.remove('displayHide');\n result.classList.add('displayHide');\n });\n }\n };\n }\n }\n\n /**\n * @private\n * @param {boolean} listDisplayMode parameter responsible for displaying the selection in the form of a modal window.\n * @description Changes the display of a sheet with a selection as a modal window.\n * @method displayMode\n */\n private displayMode(listDisplayMode: boolean): void {\n if (listDisplayMode) {\n const modal = document.createElement('div');\n const body = document.querySelector('body');\n const list = this.list!;\n\n modal.appendChild(list);\n this.element!.appendChild(modal);\n\n this.element!.addEventListener('click', () => {\n modal.classList.toggle('modal');\n list.classList.toggle('listModal');\n body!.classList.toggle('overflowHide');\n });\n } else {\n return;\n }\n }\n\n // Public methods\n\n /**\n * @param {number} numberItem returned element number.\n * @returns {HTMLElement} returns a reference to the selected HTML element.\n * @method getElement\n */\n public getElement(numberItem: number): IItems[] | any {\n if (numberItem > this.items.length) {\n return;\n }\n\n return this.items[numberItem];\n }\n\n /**\n * @param {ILanguage} language the object in which the fields for connecting the language are located has two mandatory fields placeholder, textInListSearch, selectPlaceholder.\n * @description a method that allows you to change the placeholder in the search and the text that is displayed if there is no result.\n * @method addLanguage\n */\n public addLanguage(language: ILanguage) {\n const { placeholder, textInListSearch, selectPlaceholder } = language;\n\n const select = this.element!.querySelector('.selected');\n const textNodeSelect = document.createTextNode(selectPlaceholder);\n select!.appendChild(textNodeSelect);\n\n if (this.searchMode) {\n const search = this.element!.querySelector('.inputSearch');\n const textNoRezult = this.element!.querySelector('.noRezult');\n const textNode = document.createTextNode(textInListSearch);\n\n search!.setAttribute('placeholder', placeholder);\n search!.setAttribute('placeholder', placeholder);\n\n textNoRezult!.textContent = '';\n textNoRezult!.appendChild(textNode);\n }\n }\n\n /**\n * @param {HTMLInputElement} button - HTML button.\n * @param {string} method - open/close method.\n * @description A method that allows you to open / close the select using buttons.\n * @method buttonControl\n */\n public buttonControl(button: Element, method: string) {\n if (this.listDisplayMode) {\n return;\n }\n\n this.buttonAction = button!;\n button.addEventListener('click', () => {\n if (method.toLowerCase() === 'open') {\n this.open(true);\n } else if (method.toLowerCase() === 'close') {\n this.close();\n } else {\n return;\n }\n });\n }\n\n /**\n * @param {boolean} value - Passed parameter to add the disabled attribute.\n * @description A method that allows you to toggle the state of the disabled select.\n * @method disabled\n */\n public disabled(value: boolean) {\n const select = this.element!.querySelector('.cg-select');\n const nativeSelect = this.element!.querySelector('.nativeSelect');\n\n if (value === true) {\n this.element!.setAttribute('disabled', 'true');\n nativeSelect!.setAttribute('disabled', 'true');\n select!.classList.add('disabled');\n } else {\n this.element!.removeAttribute('disabled');\n nativeSelect!.removeAttribute('disabled');\n select!.classList.remove('disabled');\n }\n }\n\n /**\n * @param {string | IItems} item added element.\n * @description adds the given element to the end of the list and redraws the list. Cannot be used when passing elements with categories.\n * @method addItem\n */\n public addItem(item: IItems | string | number) {\n if (this.category) {\n console.log('can`t add item to category');\n return;\n }\n\n if (!item) {\n return false;\n }\n\n const index = this.items.length;\n\n this.items.push(getFormatItem(item, index));\n this.render();\n }\n\n /**\n * @param {number} index the index of the element to be removed.\n * @description removes the element by index from the list and redraws it. Cannot be used when passing elements with categories.\n * @method deleteItem\n */\n public deleteItem(index: number) {\n if (this.category) {\n console.log('can`t add item to category');\n return;\n }\n\n const item = this.items[index];\n\n this.items.splice(index, 1);\n this.render();\n }\n\n /**\n * @description removes all elements from the list and redraws it.\n * @method deleteItemAll\n */\n public deleteItemAll() {\n this.items.splice(0, this.items.length);\n this.render();\n }\n\n /**\n * @param {number} index the index of the selected element.\n * @description selects the element that will be initially rendered in the select.\n * @method selectIndex\n */\n public selectIndex(index: number) {\n if (this.category) {\n console.log('can`t add item to category');\n return;\n }\n\n const options = this.element!.querySelectorAll('.list__item') as NodeListOf;\n\n if (index > options!.length) {\n return;\n }\n\n const select: string = options[index].innerText;\n this.render(select);\n }\n\n /**\n * @description Method for tracking the actions of the select, you can pass a callback\n * @param state select state.\n * @param callback\n * @method on\n */\n public on(state: string, callback: (state: any, value?: string) => any) {\n const options = this.element?.querySelectorAll('.list__item');\n let value = '';\n\n switch (state) {\n case 'select':\n options?.forEach((option: Element) => {\n option.addEventListener('click', () => {\n console.log('option:select', option.textContent);\n value = option.textContent!;\n callback(state, value);\n });\n });\n break;\n case 'close':\n this.element!.addEventListener('click', () => {\n console.log('list:close', this.list!.classList.contains('close'));\n });\n callback(state);\n break;\n case 'open':\n this.element!.addEventListener('click', () => {\n console.log('list:open', this.list!.classList.contains('open'));\n });\n callback(state);\n break;\n case 'clear':\n this.element!.addEventListener('click', () => {\n const svgIcon = this.element?.querySelector('.svg-icon');\n svgIcon?.addEventListener('click', () => {\n console.log('list:clear', svgIcon.classList.contains('svg-clear'));\n });\n });\n callback(state);\n break;\n }\n }\n}\n","import { customStylesFormat, nativeOptionMultiple } from '../utils/utils';\nimport { ICreateBreadCrumb } from './create-element.interface';\n\n/**\n * The method that creates the native select.\n * @returns {HTMLSelectElement} Returns the created native select.\n */\nexport function createNativeSelect(): HTMLSelectElement {\n const nativeSelect = document.createElement('select');\n\n nativeSelect.setAttribute('name', 'dataSelect');\n nativeSelect.classList.add('nativeSelect');\n return nativeSelect;\n}\n\n/**\n * The method that creates Options for the native select.\n * @returns {HTMLOptionElement} Returns the generated Options of the native select.\n */\nexport function createNativeSelectOption(): HTMLOptionElement {\n const nativeOption = document.createElement('option');\n\n nativeOption.classList.add('nativeSelect__nativeOption');\n return nativeOption;\n}\n\n/**\n * The method that creates and is responsible for the behavior of the chips.\n * @param {ICreateBreadCrumb} data an object that contains settings and select elements.\n * @param {string} title the name of the selected element to draw chips.\n * @param {number} index index of the selected item to draw chips.\n * @param {string} id unique id of the selected element.\n * @returns {HTMLElement} returns the generated HTMLElement chips item.\n */\nexport function createBreadCrumb(\n data: ICreateBreadCrumb,\n title: string,\n index: number,\n id: string,\n): HTMLLIElement {\n const { element, option, indexes, selectedItems } = data;\n const { placeholder, styles } = option;\n\n const selected: HTMLElement | null | undefined = element?.querySelector('.selected');\n const nativeOption = element!.querySelectorAll('.nativeSelect__nativeOption');\n\n const liChip = document.createElement('li');\n const textNode = document.createTextNode(title);\n const svgIcon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n const path1 = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n const path2 = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n\n svgIcon.setAttribute('viewBox', '0 0 10 10');\n path1.setAttribute('d', 'M3,7 L7,3');\n path2.setAttribute('d', 'M3,3 L7,7');\n liChip.setAttribute('id', `tag-${index}-${id}`);\n\n svgIcon.classList.add('svg-icon');\n\n svgIcon.appendChild(path1);\n svgIcon.appendChild(path2);\n liChip.appendChild(textNode);\n liChip.appendChild(svgIcon);\n\n if (styles) {\n const { chips } = styles;\n customStylesFormat(chips!, liChip);\n }\n\n svgIcon.addEventListener('click', (event) => {\n event.preventDefault();\n event.stopPropagation();\n nativeOptionMultiple(nativeOption, title, false);\n\n const deleteIcon = indexes.indexOf(index);\n let checkBox: any;\n\n indexes.splice(deleteIcon, 1);\n selectedItems.splice(deleteIcon, 1);\n\n if (id) {\n checkBox = document.getElementById(`chbox-${id}`);\n } else {\n checkBox = document.getElementById(`chbox-${index}`);\n }\n\n checkBox.checked = false;\n checkBox.parentElement.classList.remove('active');\n\n if (!selectedItems.length) {\n selected!.innerText = placeholder!;\n }\n\n liChip.parentElement!.removeChild(liChip);\n });\n\n return liChip;\n}\n\n/**\n * The method that creates a search for elements in the select.\n * @param {string} random unique value for input element.\n * @param {string} lenguage text in specific language passed from language.ts file\n * @returns {HTMLInputElement} Returns the rendered input element.\n */\nexport function createInputSearch(random: string, lenguage: string): HTMLInputElement {\n const inputSearch = document.createElement('input');\n\n inputSearch.type = 'text';\n inputSearch.classList.add('inputSearch');\n inputSearch.setAttribute('id', `searchSelect-${random}`);\n\n if (lenguage) {\n inputSearch.setAttribute('placeholder', `${lenguage}`);\n } else {\n inputSearch.setAttribute('placeholder', 'Search...');\n }\n\n inputSearch.addEventListener('click', (e) => {\n e.preventDefault();\n });\n\n return inputSearch;\n}\n","/**\n * Utils module\n * @module Utils\n */\nimport { IStyle } from 'interfaces/cg-select.interface';\nimport { IItems } from 'interfaces/items.interface';\nimport { ISelectedItems } from './utils.interface';\n\n/**\n * Converting each item obtained from the Items field;\n * @param {any} dataItem received element passed when creating the select.\n * @param {number} index index of this element.\n * @returns {IItems} returns the formed object\n */\nexport function getFormatItem(dataItem: any, index: number): IItems {\n const random = Math.random().toString(36).substring(2, 10);\n let item: IItems;\n\n if (checkItemStruct(dataItem)) {\n return dataItem;\n } else {\n item = {\n id: random,\n title: dataItem,\n value: index,\n };\n\n return item;\n }\n}\n\n/**\n * Insert initial select text (before selection)\n * @param {ITextSelect} data the object in which the title of the select is located.\n * @param {HTMLElement | null | undefined} select select element where title will be inserted.\n * @returns {HTMLElement} returns the generated select element.\n */\nexport function getSelectText(\n data: ISelectedItems,\n select: HTMLElement | null | undefined,\n): HTMLElement {\n const { placeholder, selected } = data;\n\n if (placeholder) {\n select!.innerText = placeholder;\n } else if (selected) {\n select!.innerText = selected;\n } else {\n select!.innerText = 'Select...';\n }\n\n return select!;\n}\n\n/**\n * Checking if item contains the specified properties.\n * @param {object} item element to be checked against a certain structure.\n * @returns {boolean} returns true/false if item contains the specified properties.\n */\nexport function checkItemStruct(item: object): boolean {\n if (item && typeof item !== 'object') {\n return false;\n }\n\n return item.hasOwnProperty('id') && item.hasOwnProperty('title') && item.hasOwnProperty('value');\n}\n\n/**\n * Creating an Item Selector Button.\n * @param {HTMLElement} element instantiated class CgSelect.\n * @param {string} content placeholer passed from select settings.\n * @param {object} styles optional parameter. The object in which the settings for customizing parts of the select are located.\n */\nexport function createSelected(element: Element, content?: string, styles?: IStyle) {\n const select = document.createElement('div');\n const selected = document.createElement('p');\n const caret = document.createElement('div');\n\n select.classList.add('cg-select');\n select.classList.add('classicSelect');\n selected.classList.add('selected');\n caret.classList.add('caret');\n\n select.appendChild(selected);\n select.appendChild(caret);\n\n if (content) {\n const text = document.createTextNode(content);\n selected.appendChild(text);\n element.innerHTML = '';\n element?.insertAdjacentElement('afterbegin', select);\n } else if (styles) {\n customStyles(element!, styles);\n select.setAttribute('style', `${styles}`);\n selected.setAttribute('style', `${styles}`);\n caret.setAttribute('style', `${styles}`);\n }\n}\n\n/**\n * Creating a clear select button, with a single selection.\n * @param {HTMLElement} select place in the select that will be reassigned to ''.\n * @param {Element} element class instance CgSelect.\n * @param {ISelectedItems} dataSelectText the text that is rendered in the select.\n */\nexport function clearSelect(select: HTMLElement, element: Element, dataSelectText: ISelectedItems) {\n const { selectedItems, indexes, theme, multiselectTag } = dataSelectText;\n\n const options = element.querySelectorAll('.list__item');\n const nativeOption = element!.querySelectorAll('.nativeSelect__nativeOption');\n const svgIcon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n const path1 = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n const path2 = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n const checkBox = element.querySelectorAll('li input');\n\n svgIcon.setAttribute('viewBox', '0 0 10 10');\n path1.setAttribute('d', 'M2,8 L8,2');\n path2.setAttribute('d', 'M2,2 L8,8');\n svgIcon.appendChild(path1);\n svgIcon.appendChild(path2);\n\n if (multiselectTag && multiselectTag == true) {\n return;\n }\n\n switch (theme) {\n case 'dark':\n path1.classList.add('pathWhite');\n path2.classList.add('pathWhite');\n break;\n case 'white':\n path1.classList.add('pathBlack');\n path2.classList.add('pathBlack');\n break;\n default:\n path1.classList.add('pathWhite');\n path2.classList.add('pathWhite');\n break;\n }\n\n svgIcon.classList.add('svg-icon');\n svgIcon.classList.add('svg-clear');\n\n select!.appendChild(svgIcon);\n\n svgIcon.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n select!.innerText = '';\n\n nativeOption.forEach((option) => {\n option.removeAttribute('selected');\n });\n\n if (Array.isArray(selectedItems)) {\n selectedItems!.splice(0);\n indexes!.splice(0);\n }\n\n checkBox.forEach((item) => {\n if (item instanceof HTMLInputElement) {\n item.checked = false;\n }\n });\n\n getSelectText(dataSelectText, select);\n\n options.forEach((option) => {\n option.classList.remove('active');\n });\n });\n}\n\n/**\n * Behavior of a native (single) select when choosing a custom one.\n * @param {NodeList} element NodeList native select.\n * @param {any} item selected element in custom select.\n */\nexport function nativeOptionOrdinary(element: NodeListOf | undefined, item: string) {\n element!.forEach((option) => {\n option.removeAttribute('selected');\n if (option.textContent === item) {\n option.setAttribute('selected', 'selected');\n }\n });\n}\n\n/**\n * The behavior of the native (Multiple) select when choosing in a custom one.\n * @param {NodeListOf | undefined} element NodeList of native select.\n * @param {string} item selected element in custom select.\n * @param {boolean} condition a special flag that adds / removes attributes from the native select.\n */\nexport function nativeOptionMultiple(\n element: NodeListOf | undefined,\n item: string,\n condition: boolean,\n) {\n element!.forEach((option) => {\n if (condition == true) {\n if (option.textContent === item) {\n option.setAttribute('selected', 'selected');\n }\n } else if (condition == false) {\n if (option.textContent === item) {\n option.removeAttribute('selected');\n }\n } else {\n return;\n }\n });\n}\n\n/**\n * Finding and styling elements derived from the styles instance CgSelect\n * @param {Element} element instantiated class CgSelect.\n * @param {object} styles object in which there are settings for customizing parts of the select.\n */\nexport function customStyles(element: Element, styles: IStyle) {\n const cgSelect = element.querySelector('.cg-select');\n const caretSelect = element.querySelector('.caret');\n const placeholderSelect = element.querySelector('.selected');\n const lableItem = element.parentElement!.querySelector('h1.label');\n\n customStylesFormat(styles.head!, cgSelect!);\n customStylesFormat(styles.caret!, caretSelect!);\n customStylesFormat(styles.lable!, lableItem!);\n\n if (placeholderSelect) {\n customStylesFormat(styles.placeholder!, placeholderSelect);\n }\n}\n\n/**\n * Generic Method for Styling a Select.\n * @param {object} elemOption an object obtained from the styles object from which we get the styles key-value.\n * @param {HTMLElement} selector HTMLElement subject to customization.\n */\nexport function customStylesFormat(elemOption: object, selector: any) {\n if (elemOption) {\n Object.entries(elemOption).forEach(([key, value]) => {\n selector.style[key] = value;\n });\n }\n}\n","import { ILanguage } from 'interfaces/language.interface';\n\nexport const ru: ILanguage = {\n selectPlaceholder: 'Выберите элемент...',\n placeholder: 'Поиск...',\n textInListSearch: 'Совпадений нет...',\n};\n\nexport const en: ILanguage = {\n selectPlaceholder: 'Select element...',\n placeholder: 'Search...',\n textInListSearch: 'No matches...',\n};\n","import { CustomTheme } from './theme.interface';\n\nexport function changeTheme(element: Element, theme: string | CustomTheme) {\n const select = element!.querySelector('.cg-select');\n const caret = element!.querySelector('.caret');\n const list = element!.querySelector('ul.list');\n const search = element!.querySelector('.inputSearch');\n const path = element.querySelectorAll('.pathWhite');\n const nativeSelect = element.querySelector('.nativeSelect');\n\n select!.classList.remove('classicSelect');\n list!.classList.remove('classicList');\n path.forEach((elem) => {\n elem.classList.remove('pathBlack');\n elem.classList.remove('pathWhite');\n });\n\n if (typeof theme === 'string') {\n switch (theme) {\n case 'dark':\n select!.classList.add('selectDark');\n list!.classList.add('listDark');\n nativeSelect?.classList.add('listDark');\n path.forEach((elem) => {\n elem.classList.add('pathWhite');\n });\n break;\n case 'white':\n select!.classList.add('selectWhite');\n caret!.classList.add('caretWhite');\n list!.classList.add('listWhite');\n nativeSelect?.classList.add('listWhite');\n path.forEach((elem) => {\n elem.classList.add('pathBlack');\n });\n\n if (search!) {\n search!.classList.add('inputWhite');\n }\n break;\n\n default:\n select!.classList.add('classicSelect');\n list!.classList.add('classicList');\n break;\n }\n } else {\n select!.classList.add(`${theme.styles.head}`);\n list!.classList.add(`${theme.styles.list}`);\n }\n}\n"],"names":[],"version":3,"file":"index.js.map"} \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..5596b44 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +# This is a sample Python script. + +# Press Shift+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/package.json b/package.json new file mode 100644 index 0000000..ff44b8f --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "cg-select", + "version": "0.2.5", + "source": "index.js", + "main": "dist/index.js", + "description": "Feature rich Select control for React/JS with multiselect, autocomplete and styling", + "author": { + "name": "CraftGroup", + "url": "https://github.com/apuc/" + }, + "homepage": "https://cg-select.itguild.info", + "scripts": { + "watch": "parcel watch", + "build": "parcel build", + "deploy": "gh-pages -d dist", + "predeploy": "npm run build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/apuc/cg-select.git" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/apuc/cg-select/issues" + }, + "devDependencies": { + "@parcel/transformer-sass": "^2.7.0", + "jsdoc": "^4.0.0", + "parcel": "^2.7.0", + "prettier": "^2.7.1" + }, + "dependencies": { + "@parcel/optimizer-css": "^2.8.0", + "@types/prettier": "^2.7.2", + "gh-pages": "^4.0.0", + "typedoc": "^0.23.24", + "typescript": "^4.9.4" + }, + "keywords": [ + "select", + "autocomplete", + "dropdown", + "multiselect", + "tag" + ] +} diff --git a/server.py b/server.py new file mode 100644 index 0000000..9b5e71a --- /dev/null +++ b/server.py @@ -0,0 +1,50 @@ +from typing import Union, Annotated + +from fastapi import FastAPI, File, UploadFile, Form, Response, status + +import os +import magic + +app = FastAPI() + + +@app.get("/") +def read_root(): + return {"Hello": "World"} + + +@app.get("/items/{version}/{name}/{file}") +def read_item(version: str, name: str, file: str = 'index.js'): + mime = magic.Magic(mime=True) + file_path = f"packages/{name}/{version}/{file}" + file_mime = mime.from_file(file_path) + if os.path.exists(file_path): + with open(file_path, 'rb') as f: + return Response(content=f.read(), media_type=file_mime) + + return status.HTTP_404_NOT_FOUND + + +@app.post("/files/") +async def create_file(file: Annotated[bytes | None, File()] = None): + if not file: + return {"message": "No file sent"} + else: + return {"file_size": len(file)} + + +@app.post("/uploadfile/") +async def create_upload_file(file: UploadFile | None, package: Annotated[str, Form()], version: Annotated[str, Form()], filename: Annotated[str, Form()]): + try: + contents = file.file.read() + dir_file = "packages/{package}/{version}".format(package=package, version=version) + if not os.path.exists(dir_file): + os.makedirs(dir_file) + with open(f"{dir_file}/{filename}", 'wb') as f: + f.write(contents) + except Exception: + return {"message": "There was an error uploading the file"} + finally: + file.file.close() + + return {"message": f"Successfully uploaded {file.filename}"} \ No newline at end of file