adminizer 4.3.0-build.114 → 4.3.0-build.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{j as r,bH as p,bI as m,bJ as o,bK as a,bL as x,bM as b}from"./app.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";const _=({pagination:s,pageChange:t,currentPage:n})=>{const l=n!==1&&s.last_page>1,i=n!==s.last_page&&s.last_page>1;return r.jsx(p,{children:r.jsxs(m,{className:"flex-wrap",children:[r.jsx(o,{className:`${l?"":"opacity-40 pointer-events-none"}`,children:r.jsx(a,{className:"px-6 cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:e=>{e.preventDefault(),t(1)},children:"First"})}),r.jsx(o,{children:r.jsx(x,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${s.prev_page_url?"":"opacity-50 pointer-events-none"}`,onClick:e=>{e.preventDefault(),s.prev_page_url&&t(n-1)}})}),s.links.map((e,c)=>e.label==="Previous"||e.label==="Next"?null:r.jsx(o,{children:r.jsx(a,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${e.active?"!bg-primary dark:!bg-muted-foreground !text-primary-foreground dark:!text-ring":""}`,onClick:u=>{u.preventDefault();const d=parseInt(e.label);t(d)},isActive:e.active,children:e.label})},c)),r.jsx(o,{children:r.jsx(b,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${s.next_page_url?"":"opacity-50 pointer-events-none"}`,onClick:e=>{e.preventDefault(),s.next_page_url&&t(n+1)}})}),r.jsx(o,{className:`${i?"":"opacity-40 pointer-events-none"}`,children:r.jsx(a,{className:"px-6 cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:e=>{e.preventDefault(),t(s.last_page)},children:"Last"})})]})})};export{_ as default};
1
+ import{j as r,bI as p,bJ as m,bK as o,bL as a,bM as x,bN as b}from"./app.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./monaco-ICtx6xoc.js";import"./handsontable-PVakPtJV.js";const N=({pagination:s,pageChange:t,currentPage:n})=>{const l=n!==1&&s.last_page>1,i=n!==s.last_page&&s.last_page>1;return r.jsx(p,{children:r.jsxs(m,{className:"flex-wrap",children:[r.jsx(o,{className:`${l?"":"opacity-40 pointer-events-none"}`,children:r.jsx(a,{className:"px-6 cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:e=>{e.preventDefault(),t(1)},children:"First"})}),r.jsx(o,{children:r.jsx(x,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${s.prev_page_url?"":"opacity-50 pointer-events-none"}`,onClick:e=>{e.preventDefault(),s.prev_page_url&&t(n-1)}})}),s.links.map((e,c)=>e.label==="Previous"||e.label==="Next"?null:r.jsx(o,{children:r.jsx(a,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${e.active?"!bg-primary dark:!bg-muted-foreground !text-primary-foreground dark:!text-ring":""}`,onClick:u=>{u.preventDefault();const d=parseInt(e.label);t(d)},isActive:e.active,children:e.label})},c)),r.jsx(o,{children:r.jsx(b,{className:`cursor-pointer bg-secondary hover:bg-muted-foreground/15 ${s.next_page_url?"":"opacity-50 pointer-events-none"}`,onClick:e=>{e.preventDefault(),s.next_page_url&&t(n+1)}})}),r.jsx(o,{className:`${i?"":"opacity-40 pointer-events-none"}`,children:r.jsx(a,{className:"px-6 cursor-pointer bg-secondary hover:bg-muted-foreground/15",onClick:e=>{e.preventDefault(),t(s.last_page)},children:"Last"})})]})})};export{N as default};
@@ -37,6 +37,7 @@ export class VueCatalog {
37
37
  "Select Ids": "",
38
38
  "OR": "",
39
39
  "Open in a new window": "",
40
+ "Visible": "",
40
41
  "Clean": "",
41
42
  "Performing an action...": "",
42
43
  "Action completed": "",
@@ -347,6 +347,7 @@ export interface TuiEditorFieldConfig extends BaseFieldConfig {
347
347
  export interface MediaManagerOptionsField {
348
348
  id: 'default' | string;
349
349
  group: string;
350
+ accept: string[];
350
351
  config?: Record<string, any>;
351
352
  }
352
353
  interface RangeType {
@@ -5,6 +5,7 @@ export interface NavItem extends Item {
5
5
  urlPath?: string;
6
6
  modelId?: string | number;
7
7
  targetBlank?: boolean;
8
+ visible?: boolean;
8
9
  }
9
10
  declare class StorageService {
10
11
  protected storageMap: Map<string | number, NavItem>;
@@ -203,7 +203,8 @@ class NavigationItem extends AbstractItem {
203
203
  storageData = await this.dataPreparation({
204
204
  record: record,
205
205
  parentId: data.parentId,
206
- targetBlank: data.targetBlank
206
+ targetBlank: data.targetBlank,
207
+ visible: data.visible
207
208
  }, catalogId);
208
209
  }
209
210
  else {
@@ -219,6 +220,8 @@ class NavigationItem extends AbstractItem {
219
220
  id: uuid(),
220
221
  modelId: data.record.id,
221
222
  targetBlank: data.targetBlank ?? data.record.targetBlank,
223
+ visible: data.visible ?? data.record.visible,
224
+ isNavigation: true,
222
225
  name: data.record.name ?? data.record.title ?? data.record.id,
223
226
  parentId: parentId,
224
227
  sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
@@ -237,6 +240,7 @@ class NavigationItem extends AbstractItem {
237
240
  item.urlPath = urlPath;
238
241
  if (item.id === data.record.treeId) {
239
242
  item.targetBlank = data.record.targetBlank;
243
+ item.visible = data.record.visible;
240
244
  }
241
245
  response.push(await storage.setElement(item.id, item));
242
246
  }
@@ -278,6 +282,7 @@ class NavigationItem extends AbstractItem {
278
282
  createTitle: `${req.i18n.__('create new')} ${req.i18n.__(this.name + 's')}`,
279
283
  OR: req.i18n.__('OR'),
280
284
  openInNewWindow: req.i18n.__('Open in a new window'),
285
+ visible: req.i18n.__('Visible')
281
286
  }
282
287
  }
283
288
  };
@@ -325,8 +330,8 @@ class NavigationGroup extends AbstractGroup {
325
330
  name: data.name,
326
331
  targetBlank: data.targetBlank,
327
332
  visible: data.visible,
328
- parentId: parentId,
329
333
  isNavigation: true,
334
+ parentId: parentId,
330
335
  sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
331
336
  icon: this.icon,
332
337
  type: this.type
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.3.0-build.114",
4
+ "version": "4.3.0-build.116",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",
package/ui/lib/utils.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import { type ClassValue } from "clsx";
2
2
  export declare function cn(...inputs: ClassValue[]): string;
3
+ export declare function simpleSanitizeHtml(html: string): string;
package/ui/lib/utils.js CHANGED
@@ -3,3 +3,19 @@ import { twMerge } from "tailwind-merge";
3
3
  export function cn(...inputs) {
4
4
  return twMerge(clsx(inputs));
5
5
  }
6
+ export function simpleSanitizeHtml(html) {
7
+ return html
8
+ // Удаляем script теги
9
+ .replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '')
10
+ // Удаляем iframe, embed, object
11
+ .replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, '')
12
+ .replace(/<embed\b[^<]*(?:(?!<\/embed>)<[^<]*)*<\/embed>/gi, '')
13
+ .replace(/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi, '')
14
+ // Удаляем опасные атрибуты событий
15
+ .replace(/ on\w+="[^"]*"/g, '')
16
+ .replace(/ on\w+='[^']*'/g, '')
17
+ .replace(/ on\w+=[^ >]+/g, '')
18
+ // Удаляем javascript: ссылки
19
+ .replace(/href="javascript:[^"]*"/gi, 'href="#"')
20
+ .replace(/href='javascript:[^']*'/gi, 'href="#"');
21
+ }
@@ -1 +0,0 @@
1
- import{X as U,bx as C,j as s,B as E,W as A,aE as P,by as R,L as I,bz as $,g as V,b as O,m as D,K as J,M as K,N as X,aF as q,O as G,h as H}from"./app.js";import{r as u}from"./monaco-ICtx6xoc.js";import{Icon as _}from"./icon-DpkedrXG.js";import{F as z}from"./field-renderer-DBKkDhBG.js";import T from"./input-error-CmXZF6xy.js";import"./jsoneditor-D95dIAP2.js";import"./vendor-wzZzN_Jv.js";import"./handsontable-PVakPtJV.js";import"./dynamic-controls-BOYmRX_z.js";var S=new Map,F=new WeakMap,B=0,Q=void 0;function W(e){return e?(F.has(e)||(B+=1,F.set(e,B.toString())),F.get(e)):"0"}function Y(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?W(e.root):e[t]}`).toString()}function Z(e){const t=Y(e);let a=S.get(t);if(!a){const i=new Map;let d;const c=new IntersectionObserver(o=>{o.forEach(n=>{var l;const f=n.isIntersecting&&d.some(p=>n.intersectionRatio>=p);e.trackVisibility&&typeof n.isVisible>"u"&&(n.isVisible=f),(l=i.get(n.target))==null||l.forEach(p=>{p(f,n)})})},e);d=c.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),a={id:t,observer:c,elements:i},S.set(t,a)}return a}function ee(e,t,a={},i=Q){if(typeof window.IntersectionObserver>"u"&&i!==void 0){const l=e.getBoundingClientRect();return t(i,{isIntersecting:i,target:e,intersectionRatio:typeof a.threshold=="number"?a.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:d,observer:c,elements:o}=Z(a),n=o.get(e)||[];return o.has(e)||o.set(e,n),n.push(t),c.observe(e),function(){n.splice(n.indexOf(t),1),n.length===0&&(o.delete(e),c.unobserve(e)),o.size===0&&(c.disconnect(),S.delete(d))}}function se({threshold:e,delay:t,trackVisibility:a,rootMargin:i,root:d,triggerOnce:c,skip:o,initialInView:n,fallbackInView:l,onChange:f}={}){var p;const[v,k]=u.useState(null),m=u.useRef(f),[b,x]=u.useState({inView:!!n,entry:void 0});m.current=f,u.useEffect(()=>{if(o||!v)return;let g;return g=ee(v,(N,r)=>{x({inView:N,entry:r}),m.current&&m.current(N,r),r.isIntersecting&&c&&g&&(g(),g=void 0)},{root:d,rootMargin:i,threshold:e,trackVisibility:a,delay:t},l),()=>{g&&g()}},[Array.isArray(e)?e.toString():e,v,d,i,c,o,a,l,t]);const w=(p=b.entry)==null?void 0:p.target,y=u.useRef(void 0);!v&&w&&!c&&!o&&y.current!==w&&(y.current=w,x({inView:!!n,entry:void 0}));const h=[k,b.inView,b.entry];return h.ref=h[0],h.inView=h[1],h.entry=h[2],h}const L=u.memo(({field:e})=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx(O,{htmlFor:`${e.type}-${e.name}`,children:e.label}),e.tooltip&&s.jsx(J,{children:s.jsxs(K,{children:[s.jsx(X,{onClick:t=>t.preventDefault(),children:s.jsx(_,{iconNode:q,className:"text-primary w-5 h-5 cursor-pointer"})}),s.jsx(G,{align:"center",side:"top",className:"z-[1002]",children:s.jsx("p",{children:e.tooltip})})]})})]})),re=u.memo(({field:e,value:t,onChange:a,processing:i,notFound:d,search:c})=>{const[o,n]=se({triggerOnce:!0,rootMargin:"100px 0px"});return s.jsx("div",{ref:o,className:"grid gap-4 w-full",children:n?s.jsx(z,{field:e,value:t,onChange:a,notFound:d,search:c,processing:i}):s.jsx(D,{className:"w-full h-[250px] rounded-sm"})})}),pe=({page:e,catalog:t,callback:a,openNewWindow:i,openNewWindowLabel:d,isNavigation:c})=>{const{fields:o,btnBack:n,view:l,notFound:f}=e.props,{data:p,setData:v,post:k,processing:m,transform:b}=U({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),[x,w]=u.useState(!1),[y,h]=u.useState(i??!1);u.useEffect(()=>(h(i??!1),C(),v({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),()=>C()),[o,t,i]);const g=u.useCallback((r,j)=>{v(r,j)},[]),N=async r=>{if(r.preventDefault(),t){w(!0);const j=await H.post(e.props.postLink,p);j.status===200&&a&&(c?a(j.data.record,y):a(j.data.record))}else{const j=localStorage.getItem("backUrl");b(M=>({...M,redirectUrl:j??""})),k(e.props.postLink,{onSuccess:()=>{localStorage.setItem("backUrl","")}})}};return s.jsxs("div",{className:"p-4 w-full",children:[!t&&s.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[s.jsx(E,{className:"w-fit",asChild:!0,children:s.jsxs(A,{href:n.link,preserveScroll:!0,children:[s.jsx(_,{iconNode:P}),n.title]})}),s.jsxs(E,{variant:"green",type:"submit",className:"w-fit lg:hidden",form:"addUserForm",disabled:x||m||e.props.view||R(),children:[x||m&&s.jsx(I,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]}),s.jsx("form",{id:"addUserForm",onSubmit:N,className:l?"cursor-not-allowed":"",children:s.jsxs("div",{className:`grid lg:grid-cols-[1fr_150px] gap-4 max-w-[1144px] pb-8 ${t?"lg:grid-cols-[1fr_200px]":"lg:grid-cols-[1fr_150px]"}`,children:[s.jsx("div",{className:"flex flex-col gap-10",children:o.map(r=>s.jsx("div",{className:`grid gap-4 w-full ${l?"pointer-events-none":""}`,children:r.type==="markdown"||r.type==="table"||r.type==="jsonEditor"||r.type==="codeEditor"||r.type==="geoJson"?s.jsxs(s.Fragment,{children:[s.jsx(L,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(re,{field:r,value:p[r.name],onChange:g,processing:x||m||l,notFound:f,search:e.props.search})]}):s.jsxs(s.Fragment,{children:[s.jsx(L,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(z,{field:r,value:p[r.name],onChange:g,processing:x||m||l,notFound:f,search:e.props.search})]})},r.name))}),s.jsxs("div",{className:`p-4 rounded-md h-fit sticky shadow ${t?"top-0 grid gap-4":"top-[84px] hidden lg:block"}`,children:[c&&s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx(V,{id:"targetBlank",checked:y,onCheckedChange:r=>h(!!r),className:"cursor-pointer size-5"}),s.jsx(O,{htmlFor:"targetBlank",children:d})]}),s.jsxs(E,{variant:"green",type:"submit",className:"w-fit",disabled:x||m||e.props.view||R(),children:[(x||m)&&s.jsx(I,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]})]})})]})};export{L as LabelRenderer,re as LazyField,pe as default};