@entifix/next-shell 0.6.0 → 0.7.0
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
|
-
{"version":3,"file":"use-crud-render-link.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/use-crud-render-link.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAoB1D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"use-crud-render-link.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/use-crud-render-link.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAoB1D;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAiC/D"}
|
|
@@ -24,7 +24,11 @@ import { CATALOG_NEW_SLUG } from './slug.js';
|
|
|
24
24
|
href: href,
|
|
25
25
|
className: className,
|
|
26
26
|
onClick: (event)=>{
|
|
27
|
-
|
|
27
|
+
// A page of the listing on screen is that listing's own address, so
|
|
28
|
+
// there is nothing for a tab host to open: the link is followed.
|
|
29
|
+
if (host === undefined || !isPlainClick(event) || intent.kind === 'page') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
28
32
|
event.preventDefault();
|
|
29
33
|
if (intent.kind === 'open') {
|
|
30
34
|
host.toEntity(entityKey, String(intent.id));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/crud/use-crud-render-link.tsx"],"sourcesContent":["'use client';\n\nimport type { RenderLink } from '@entifix/react-controls';\nimport Link from 'next/link';\nimport { type MouseEvent, useCallback } from 'react';\n\nimport { useEntityNavHost } from '../workspace/entity-nav.js';\nimport { CATALOG_NEW_SLUG } from './slug.js';\n\n/**\n * A click the page may take over: the primary button with no modifier. Anything\n * else — middle-click, ⌘/Ctrl-click, Shift-click — is the visitor asking for the\n * link itself, in a new tab or window, and must be left to the browser.\n */\nconst isPlainClick = (event: MouseEvent<HTMLAnchorElement>): boolean =>\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey;\n\n/**\n * How a generated page renders its Open, New and Back links (#20).\n *\n * A plain anchor was a full document load: the bundle rebuilt, every cache\n * emptied, and inside a workspace tab the click left the workspace for the route\n * page. So every link is `next/link` — a client-side navigation on a route host —\n * and, when a tab host is mounted, a plain click opens the matching tab instead:\n * the record, its create form (`<key>:new`), or the list. The `href` stays real\n * either way, so a modified click still opens the route in a new browser tab.\n */\nexport function useCrudRenderLink(entityKey: string): RenderLink {\n const host = useEntityNavHost();\n\n return useCallback<RenderLink>(\n ({ href, className, children, intent }) => (\n <Link\n href={href}\n className={className}\n onClick={event => {\n if (host === undefined
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/crud/use-crud-render-link.tsx"],"sourcesContent":["'use client';\n\nimport type { RenderLink } from '@entifix/react-controls';\nimport Link from 'next/link';\nimport { type MouseEvent, useCallback } from 'react';\n\nimport { useEntityNavHost } from '../workspace/entity-nav.js';\nimport { CATALOG_NEW_SLUG } from './slug.js';\n\n/**\n * A click the page may take over: the primary button with no modifier. Anything\n * else — middle-click, ⌘/Ctrl-click, Shift-click — is the visitor asking for the\n * link itself, in a new tab or window, and must be left to the browser.\n */\nconst isPlainClick = (event: MouseEvent<HTMLAnchorElement>): boolean =>\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey;\n\n/**\n * How a generated page renders its Open, New and Back links (#20).\n *\n * A plain anchor was a full document load: the bundle rebuilt, every cache\n * emptied, and inside a workspace tab the click left the workspace for the route\n * page. So every link is `next/link` — a client-side navigation on a route host —\n * and, when a tab host is mounted, a plain click opens the matching tab instead:\n * the record, its create form (`<key>:new`), or the list. The `href` stays real\n * either way, so a modified click still opens the route in a new browser tab.\n */\nexport function useCrudRenderLink(entityKey: string): RenderLink {\n const host = useEntityNavHost();\n\n return useCallback<RenderLink>(\n ({ href, className, children, intent }) => (\n <Link\n href={href}\n className={className}\n onClick={event => {\n // A page of the listing on screen is that listing's own address, so\n // there is nothing for a tab host to open: the link is followed.\n if (\n host === undefined ||\n !isPlainClick(event) ||\n intent.kind === 'page'\n ) {\n return;\n }\n event.preventDefault();\n if (intent.kind === 'open') {\n host.toEntity(entityKey, String(intent.id));\n } else if (intent.kind === 'new') {\n host.toEntity(entityKey, CATALOG_NEW_SLUG);\n } else {\n host.toList(entityKey);\n }\n }}\n >\n {children}\n </Link>\n ),\n [host, entityKey],\n );\n}\n"],"names":["Link","useCallback","useEntityNavHost","CATALOG_NEW_SLUG","isPlainClick","event","defaultPrevented","button","metaKey","ctrlKey","shiftKey","altKey","useCrudRenderLink","entityKey","host","href","className","children","intent","onClick","undefined","kind","preventDefault","toEntity","String","id","toList"],"mappings":"AAAA;;AAGA,OAAOA,UAAU,YAAY;AAC7B,SAA0BC,WAAW,QAAQ,QAAQ;AAErD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,gBAAgB,QAAQ,YAAY;AAE7C;;;;CAIC,GACD,MAAMC,eAAe,CAACC,QACpB,CAACA,MAAMC,gBAAgB,IACvBD,MAAME,MAAM,KAAK,KACjB,CAACF,MAAMG,OAAO,IACd,CAACH,MAAMI,OAAO,IACd,CAACJ,MAAMK,QAAQ,IACf,CAACL,MAAMM,MAAM;AAEf;;;;;;;;;CASC,GACD,OAAO,SAASC,kBAAkBC,SAAiB;IACjD,MAAMC,OAAOZ;IAEb,OAAOD,YACL,CAAC,EAAEc,IAAI,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAE,iBACpC,KAAClB;YACCe,MAAMA;YACNC,WAAWA;YACXG,SAASd,CAAAA;gBACP,oEAAoE;gBACpE,iEAAiE;gBACjE,IACES,SAASM,aACT,CAAChB,aAAaC,UACda,OAAOG,IAAI,KAAK,QAChB;oBACA;gBACF;gBACAhB,MAAMiB,cAAc;gBACpB,IAAIJ,OAAOG,IAAI,KAAK,QAAQ;oBAC1BP,KAAKS,QAAQ,CAACV,WAAWW,OAAON,OAAOO,EAAE;gBAC3C,OAAO,IAAIP,OAAOG,IAAI,KAAK,OAAO;oBAChCP,KAAKS,QAAQ,CAACV,WAAWV;gBAC3B,OAAO;oBACLW,KAAKY,MAAM,CAACb;gBACd;YACF;sBAECI;YAGL;QAACH;QAAMD;KAAU;AAErB"}
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"version": "0.
|
|
24
|
+
"version": "0.7.0",
|
|
25
25
|
"description": "Next.js application shell: back-office chrome, workspace tabs, CRUD screens derived from entity metadata, and session and proxy routes.",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"react": "19.3.1",
|
|
58
58
|
"react-dom": "19.3.1",
|
|
59
59
|
"zustand": "^5.0.15",
|
|
60
|
-
"@entifix/testing-unit": "0.
|
|
60
|
+
"@entifix/testing-unit": "0.7.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"idb": "^8.0.4",
|
|
64
|
-
"@entifix/authz": "0.
|
|
65
|
-
"@entifix/
|
|
66
|
-
"@entifix/
|
|
67
|
-
"@entifix/
|
|
68
|
-
"@entifix/react-integration": "0.
|
|
69
|
-
"@entifix/
|
|
70
|
-
"@entifix/
|
|
64
|
+
"@entifix/authz": "0.7.0",
|
|
65
|
+
"@entifix/core": "0.7.0",
|
|
66
|
+
"@entifix/react-controls": "0.7.0",
|
|
67
|
+
"@entifix/business": "0.7.0",
|
|
68
|
+
"@entifix/react-integration": "0.7.0",
|
|
69
|
+
"@entifix/i18n": "0.7.0",
|
|
70
|
+
"@entifix/transactions": "0.7.0"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dist",
|