From 2b19ed33faa479b32f16b7b926d2a28d24fbd5df Mon Sep 17 00:00:00 2001 From: baseplate-admin <61817579+baseplate-admin@users.noreply.github.com> Date: Sat, 12 Oct 2024 18:12:53 +0600 Subject: [PATCH] Up --- README.md | 6 +++--- .../js/django_admin_hstore_widget/p-c54ab965.entry.js | 2 -- .../__init__.py | 0 .../forms.py | 0 .../locale/ru/LC_MESSAGES/django.po | 0 .../js/django_hstore_widget}/django-hstore-widget.esm.js | 2 +- .../static/admin/js/django_hstore_widget}/index.esm.js | 0 .../admin/js/django_hstore_widget/p-d858b589.entry.js | 2 ++ .../static/admin/js/django_hstore_widget}/p-e1255160.js | 0 .../static/admin/js/django_hstore_widget}/p-f350f2d0.js | 0 .../templates/django_hstore_widget.html | 2 +- .../widgets.py | 0 pyproject.toml | 8 +++++--- scripts/copy.py | 4 ++-- 14 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-c54ab965.entry.js rename {django_admin_hstore_widget => django_hstore_widget}/__init__.py (100%) rename {django_admin_hstore_widget => django_hstore_widget}/forms.py (100%) rename {django_admin_hstore_widget => django_hstore_widget}/locale/ru/LC_MESSAGES/django.po (100%) rename {django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget => django_hstore_widget/static/admin/js/django_hstore_widget}/django-hstore-widget.esm.js (74%) rename {django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget => django_hstore_widget/static/admin/js/django_hstore_widget}/index.esm.js (100%) create mode 100644 django_hstore_widget/static/admin/js/django_hstore_widget/p-d858b589.entry.js rename {django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget => django_hstore_widget/static/admin/js/django_hstore_widget}/p-e1255160.js (100%) rename {django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget => django_hstore_widget/static/admin/js/django_hstore_widget}/p-f350f2d0.js (100%) rename django_admin_hstore_widget/templates/django_admin_hstore_widget.html => django_hstore_widget/templates/django_hstore_widget.html (50%) rename {django_admin_hstore_widget => django_hstore_widget}/widgets.py (100%) diff --git a/README.md b/README.md index 0ee69fd..7af4f3c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# django-admin-hstore-widget +# django-hstore-widget-2 FormField that properly render HStoreField Data in django Admin based on [`djangoauts package`](https://github.com/djangonauts/django-hstore) and updated fork of [`django-admin-hstore-widget`](https://github.com/PokaInc/django-admin-hstore-widget) @@ -10,7 +10,7 @@ FormField that properly render HStoreField Data in django Admin based on [`djang Using pip: ```bash -pip install django-admin-hstore-widget-2 +pip install django-hstore-widget ``` ## Installation @@ -21,7 +21,7 @@ pip install django-admin-hstore-widget-2 INSTALLED_APPS = [ ..., - 'django_admin_hstore_widget', + 'django_hstore_widget', ... ] diff --git a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-c54ab965.entry.js b/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-c54ab965.entry.js deleted file mode 100644 index 1b8fb72..0000000 --- a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-c54ab965.entry.js +++ /dev/null @@ -1,2 +0,0 @@ -import{r as e,h as t,F as s,H as i}from"./p-f350f2d0.js";const a="django-hstore-widget .wrapper{display:flex;gap:10px}django-hstore-widget .left{min-width:150px}django-hstore-widget .right{min-width:300px}django-hstore-widget .centered{display:flex;align-items:center;justify-content:center}django-hstore-widget .end-items{display:flex;justify-content:space-between;align-items:center}django-hstore-widget .hidden{display:none;visibility:hidden}";const n=a;const d=class{constructor(t){e(this,t);this.json=undefined;this.field_name=undefined;this.delete_svg_src="/static/admin/img/icon-deletelink.svg";this.add_svg_src="/static/admin/img/icon-addlink.svg";this.edit_svg_src="/static/admin/img/icon-changelink.svg";this._json=new Array;this._json_string="";this.output_render_type="rows"}connectedCallback(){let e=JSON.parse(this.json);let t=Object.keys(e).map(((t,s)=>({key:t,value:e[t],index:s})));this._json=t;this.updateJSONString()}handleDelete(e){const t=this._json.filter((t=>t.index!==e));this._json=structuredClone(t)}handleRowAdd(){let e=this._json;const t=e.at(-1);const s={index:t.index+1,key:"",value:""};e.push(s);this._json=structuredClone(e)}handleToggleClick(){switch(this.output_render_type){case"rows":this.output_render_type="textarea";break;case"textarea":this.output_render_type="rows";break;default:console.error("Something is wrong with `output_render_type`");break}}getJSONWithoutIndex(){return this._json.reduce(((e,t)=>{e[t.key]=t.value;return e}),{})}updateJSONString(){this._json_string=JSON.stringify(this.getJSONWithoutIndex(),null,Object.keys(this._json).length===1?0:4)}handleTextAreaInput(e){this.json=e;this.connectedCallback()}render(){return t(i,{key:"3d850b79768aa496fbf68de0d0e3eb4c6bc70de7"},t("textarea",{key:"73b225802ea89a6d700f10d00338e49124406ee8",class:`${this.output_render_type==="textarea"?"":"hidden"} vLargeTextField`,cols:40,name:`${this.field_name}`,rows:10,onInput:e=>{const t=e.currentTarget;const s=t.value;this.handleTextAreaInput(s)}},this._json_string),this.output_render_type==="rows"&&this._json&&t(s,{key:"2a48eb6bda28c3efba703aad71974d05f33e1289"},this._json.map(((e,s)=>t("div",{class:"form-row field-data"},t("div",{class:"wrapper"},t("input",{value:e.key,onInput:t=>{const s=t.currentTarget;const i=s.value;e.key=i;this.updateJSONString()},placeholder:"key",class:"left"}),t("strong",null,":"),t("input",{value:e.value,onInput:()=>{const t=event.currentTarget;const s=t.value;e.value=s;this.updateJSONString()},placeholder:"value",class:"right"}),t("div",{class:"centered",onClick:()=>{this.handleDelete(s)}},t("img",{src:this.delete_svg_src,alt:"❌"}))))))),t("div",{key:"084894e2bb9d3ee340bfa419d7786e1700970a70",class:"form-row end-items"},this.output_render_type==="rows"?t(s,null,t("div",{onClick:()=>{this.handleRowAdd()}},t("img",{src:this.add_svg_src,alt:"➕"}),"Add row")):t(s,null,t("div",null)),t("div",{key:"6541734d839034f35d66c9efdee3b02c82ff37c6",class:"centered",onClick:()=>{this.handleToggleClick()}},this.output_render_type==="textarea"&&t(s,{key:"9fef0494e43894cfe8622656a6d3a5c7dedc4672"},t("img",{key:"8395c0acc06315130f330c49a1813bbad8fbe20b",src:this.delete_svg_src,alt:"❌"}),"Close TextArea"),this.output_render_type==="rows"&&t(s,{key:"cebd2f5a0aead9e19f7cbf79f3d3a80b98a63144"},t("img",{key:"f9ec40354a64623329dc9de57b8b020676758989",src:this.edit_svg_src,alt:"✏️"}),"Open TextArea"))))}};d.style=n;export{d as django_hstore_widget}; -//# sourceMappingURL=p-c54ab965.entry.js.map \ No newline at end of file diff --git a/django_admin_hstore_widget/__init__.py b/django_hstore_widget/__init__.py similarity index 100% rename from django_admin_hstore_widget/__init__.py rename to django_hstore_widget/__init__.py diff --git a/django_admin_hstore_widget/forms.py b/django_hstore_widget/forms.py similarity index 100% rename from django_admin_hstore_widget/forms.py rename to django_hstore_widget/forms.py diff --git a/django_admin_hstore_widget/locale/ru/LC_MESSAGES/django.po b/django_hstore_widget/locale/ru/LC_MESSAGES/django.po similarity index 100% rename from django_admin_hstore_widget/locale/ru/LC_MESSAGES/django.po rename to django_hstore_widget/locale/ru/LC_MESSAGES/django.po diff --git a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/django-hstore-widget.esm.js b/django_hstore_widget/static/admin/js/django_hstore_widget/django-hstore-widget.esm.js similarity index 74% rename from django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/django-hstore-widget.esm.js rename to django_hstore_widget/static/admin/js/django_hstore_widget/django-hstore-widget.esm.js index 1382e77..48d6446 100644 --- a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/django-hstore-widget.esm.js +++ b/django_hstore_widget/static/admin/js/django_hstore_widget/django-hstore-widget.esm.js @@ -1,2 +1,2 @@ -import{p as e,b as r}from"./p-f350f2d0.js";export{s as setNonce}from"./p-f350f2d0.js";import{g as t}from"./p-e1255160.js";var o=()=>{const s=import.meta.url;const r={};if(s!==""){r.resourcesUrl=new URL(".",s).href}return e(r)};o().then((async s=>{await t();return r([["p-c54ab965",[[0,"django-hstore-widget",{json:[1],field_name:[1],delete_svg_src:[1],add_svg_src:[1],edit_svg_src:[1],_json:[32],_json_string:[32],output_render_type:[32]}]]]],s)})); +import{p as e,b as r}from"./p-f350f2d0.js";export{s as setNonce}from"./p-f350f2d0.js";import{g as t}from"./p-e1255160.js";var o=()=>{const s=import.meta.url;const r={};if(s!==""){r.resourcesUrl=new URL(".",s).href}return e(r)};o().then((async s=>{await t();return r([["p-d858b589",[[0,"django-hstore-widget",{json:[1],field_name:[1],delete_svg_src:[1],add_svg_src:[1],edit_svg_src:[1],output_render_type:[32],_json:[32],_json_string:[32]}]]]],s)})); //# sourceMappingURL=django-hstore-widget.esm.js.map \ No newline at end of file diff --git a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/index.esm.js b/django_hstore_widget/static/admin/js/django_hstore_widget/index.esm.js similarity index 100% rename from django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/index.esm.js rename to django_hstore_widget/static/admin/js/django_hstore_widget/index.esm.js diff --git a/django_hstore_widget/static/admin/js/django_hstore_widget/p-d858b589.entry.js b/django_hstore_widget/static/admin/js/django_hstore_widget/p-d858b589.entry.js new file mode 100644 index 0000000..918d6d8 --- /dev/null +++ b/django_hstore_widget/static/admin/js/django_hstore_widget/p-d858b589.entry.js @@ -0,0 +1,2 @@ +import{r as e,h as t,F as s,H as i}from"./p-f350f2d0.js";const a="django-hstore-widget .wrapper{display:flex;gap:10px}django-hstore-widget .left{min-width:150px}django-hstore-widget .right{min-width:300px}django-hstore-widget .centered{display:flex;align-items:center;justify-content:center}django-hstore-widget .end-items{display:flex;justify-content:space-between;align-items:center}django-hstore-widget .hidden{display:none;visibility:hidden}django-hstore-widget .gap-1{gap:0.25rem;}";const d=a;const n=class{constructor(t){e(this,t);this.json=undefined;this.field_name=undefined;this.delete_svg_src="/static/admin/img/icon-deletelink.svg";this.add_svg_src="/static/admin/img/icon-addlink.svg";this.edit_svg_src="/static/admin/img/icon-changelink.svg";this.output_render_type="rows";this._json=new Array;this._json_string=""}connectedCallback(){let e=JSON.parse(this.json);let t=Object.keys(e).map(((t,s)=>({key:t,value:e[t],index:s})));this._json=t;this.updateJSONString()}handleDelete(e){const t=this._json.filter((t=>t.index!==e));this._json=structuredClone(t)}handleRowAdd(){let e=this._json;const t=e.at(-1);const s={index:t.index+1,key:"",value:""};e.push(s);this._json=structuredClone(e)}handleToggleClick(){switch(this.output_render_type){case"rows":this.output_render_type="textarea";break;case"textarea":this.output_render_type="rows";break;default:console.error("Something is wrong with `output_render_type`");break}}getJSONWithoutIndex(){return this._json.reduce(((e,t)=>{e[t.key]=t.value;return e}),{})}updateJSONString(){this._json_string=JSON.stringify(this.getJSONWithoutIndex(),null,Object.keys(this._json).length===1?0:4)}handleTextAreaInput(e){this.json=e;this.connectedCallback()}render(){return t(i,{key:"77b16da3b3a2263e68c44d7f8eecd08b76f14c14"},t("textarea",{key:"7ae9b7fbed6963475af888e58db07540dab3debc",class:`${this.output_render_type==="textarea"?"":"hidden"} vLargeTextField`,cols:40,name:`${this.field_name}`,rows:10,onInput:e=>{const t=e.currentTarget;const s=t.value;this.handleTextAreaInput(s)}},this._json_string),this.output_render_type==="rows"&&this._json&&t(s,{key:"d09edc9df2c628f3b5b0a2ebda5ac0af84073b69"},this._json.map(((e,s)=>t("div",{class:"form-row field-data"},t("div",{class:"wrapper"},t("input",{value:e.key,onInput:t=>{const s=t.currentTarget;const i=s.value;e.key=i;this.updateJSONString()},placeholder:"key",class:"left"}),t("strong",null,":"),t("input",{value:e.value,onInput:()=>{const t=event.currentTarget;const s=t.value;e.value=s;this.updateJSONString()},placeholder:"value",class:"right"}),t("div",{class:"centered",onClick:()=>{this.handleDelete(s)}},t("img",{src:this.delete_svg_src,alt:"❌"}))))))),t("div",{key:"d0d6aa78a655a4774fb74d8c1c63d19216252af6",class:"form-row end-items"},this.output_render_type==="rows"?t(s,null,t("div",{class:"centered gap-1",onClick:()=>{this.handleRowAdd()}},t("img",{src:this.add_svg_src,alt:"➕"}),"Add row")):t(s,null,t("div",null)),t("div",{key:"f2f39d2d17e65de1560ded22f818a8881664ce13",class:"centered gap-1",onClick:()=>{this.handleToggleClick()}},this.output_render_type==="textarea"&&t(s,{key:"ee7550127ffdbaa70121168e500f7dfdfe6926b4"},t("img",{key:"94d3d944fa366ed1b8884805bf2d91773b105d22",src:this.delete_svg_src,alt:"❌"}),"Close TextArea"),this.output_render_type==="rows"&&t(s,{key:"440cbcf942064d69042cc7c2c26bc35fecba3a49"},t("img",{key:"ed9a735556ce0c8074bafa4c0aa9293ef23720ee",src:this.edit_svg_src,alt:"✏️"}),"Open TextArea"))))}};n.style=d;export{n as django_hstore_widget}; +//# sourceMappingURL=p-d858b589.entry.js.map \ No newline at end of file diff --git a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-e1255160.js b/django_hstore_widget/static/admin/js/django_hstore_widget/p-e1255160.js similarity index 100% rename from django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-e1255160.js rename to django_hstore_widget/static/admin/js/django_hstore_widget/p-e1255160.js diff --git a/django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-f350f2d0.js b/django_hstore_widget/static/admin/js/django_hstore_widget/p-f350f2d0.js similarity index 100% rename from django_admin_hstore_widget/static/admin/js/django_admin_hstore_widget/p-f350f2d0.js rename to django_hstore_widget/static/admin/js/django_hstore_widget/p-f350f2d0.js diff --git a/django_admin_hstore_widget/templates/django_admin_hstore_widget.html b/django_hstore_widget/templates/django_hstore_widget.html similarity index 50% rename from django_admin_hstore_widget/templates/django_admin_hstore_widget.html rename to django_hstore_widget/templates/django_hstore_widget.html index 9ee6676..e7ea91f 100644 --- a/django_admin_hstore_widget/templates/django_admin_hstore_widget.html +++ b/django_hstore_widget/templates/django_hstore_widget.html @@ -1,6 +1,6 @@ {% load static %} - + diff --git a/django_admin_hstore_widget/widgets.py b/django_hstore_widget/widgets.py similarity index 100% rename from django_admin_hstore_widget/widgets.py rename to django_hstore_widget/widgets.py diff --git a/pyproject.toml b/pyproject.toml index 2cad1f6..ecf86e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] -name = "django-hstore-widget-2" +name = "django-hstore-widget" version = "0.0.1" -description = "Continual of django-admin-hstore-widget" +description = "Human friendly HStoreWidget. Continual of django-admin-hstore-widget." authors = ["baseplate-admin <61817579+baseplate-admin@users.noreply.github.com>"] readme = "README.md" license = "MIT" @@ -18,6 +18,8 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -28,7 +30,7 @@ classifiers = [ ] [tool.poetry.dependencies] -python = ">3.8" +python = ">3.6" django = "*" diff --git a/scripts/copy.py b/scripts/copy.py index 4bad8f9..d992460 100644 --- a/scripts/copy.py +++ b/scripts/copy.py @@ -6,11 +6,11 @@ DIST_DIR = Path(BASE_DIR.parent, "dist", "django-hstore-widget") TARGET_DIR = Path( BASE_DIR.parent, - "django_admin_hstore_widget", + "django_hstore_widget", "static", "admin", "js", - "django_admin_hstore_widget", + "django_hstore_widget", ) shutil.rmtree(TARGET_DIR)