@hrbolek/uoisfrontend-template 0.6.1 → 0.6.3

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.
Files changed (70) hide show
  1. package/dist/cjs/index.js +447 -0
  2. package/dist/es/index.js +11062 -0
  3. package/dist/umd/index.js +447 -0
  4. package/package.json +5 -1
  5. package/src/Base/Components/Link.jsx +13 -8
  6. package/src/Base/Mutations/General.jsx +3 -1
  7. package/src/Base/Mutations/Update.jsx +5 -0
  8. package/src/EventGQLModel/Components/A4Plan/A4Plan.jsx +363 -0
  9. package/src/EventGQLModel/Components/A4Plan/index.js +1 -0
  10. package/src/EventGQLModel/Components/CardCapsule.jsx +43 -0
  11. package/src/EventGQLModel/Components/Children.jsx +31 -0
  12. package/src/EventGQLModel/Components/ConfirmEdit.jsx +61 -0
  13. package/src/EventGQLModel/Components/Filter.jsx +14 -0
  14. package/src/EventGQLModel/Components/LargeCard.jsx +54 -0
  15. package/src/EventGQLModel/Components/Link.jsx +55 -0
  16. package/src/EventGQLModel/Components/LiveEdit.jsx +111 -0
  17. package/src/EventGQLModel/Components/MediumCard.jsx +39 -0
  18. package/src/EventGQLModel/Components/MediumContent.jsx +96 -0
  19. package/src/EventGQLModel/Components/MediumEditableContent.jsx +35 -0
  20. package/src/EventGQLModel/Components/Plan/PlanRow.jsx +470 -0
  21. package/src/EventGQLModel/Components/Plan/_utils.js +971 -0
  22. package/src/EventGQLModel/Components/Plan/calendarReducer.js +535 -0
  23. package/src/EventGQLModel/Components/Plan/index.js +3 -0
  24. package/src/EventGQLModel/Components/Table.jsx +7 -0
  25. package/src/EventGQLModel/Components/index.js +15 -0
  26. package/src/EventGQLModel/Mutations/Create.jsx +202 -0
  27. package/src/EventGQLModel/Mutations/Delete.jsx +173 -0
  28. package/src/EventGQLModel/Mutations/InteractiveMutations.jsx +30 -0
  29. package/src/EventGQLModel/Mutations/Update.jsx +147 -0
  30. package/src/EventGQLModel/Mutations/helpers.jsx +7 -0
  31. package/src/EventGQLModel/Pages/PageBase.jsx +56 -0
  32. package/src/EventGQLModel/Pages/PageCreateItem.jsx +28 -0
  33. package/src/EventGQLModel/Pages/PageDeleteItem.jsx +16 -0
  34. package/src/EventGQLModel/Pages/PageNavbar.jsx +160 -0
  35. package/src/EventGQLModel/Pages/PagePlan.jsx +42 -0
  36. package/src/EventGQLModel/Pages/PageReadItem.jsx +11 -0
  37. package/src/EventGQLModel/Pages/PageReadItemEx.jsx +42 -0
  38. package/src/EventGQLModel/Pages/PageSubevents.jsx +43 -0
  39. package/src/EventGQLModel/Pages/PageUpdateItem.jsx +14 -0
  40. package/src/EventGQLModel/Pages/PageVector.jsx +80 -0
  41. package/src/EventGQLModel/Pages/RouterSegment.jsx +82 -0
  42. package/src/EventGQLModel/Pages/index.js +2 -0
  43. package/src/EventGQLModel/Queries/DeleteAsyncAction.jsx +32 -0
  44. package/src/EventGQLModel/Queries/Fragments.jsx +123 -0
  45. package/src/EventGQLModel/Queries/InsertAsyncAction.jsx +40 -0
  46. package/src/EventGQLModel/Queries/ReadAsyncAction.jsx +44 -0
  47. package/src/EventGQLModel/Queries/ReadPageAsyncAction.jsx +13 -0
  48. package/src/EventGQLModel/Queries/ReadSubEventsAsyncAction.jsx +44 -0
  49. package/src/EventGQLModel/Queries/SearchAsyncAction.jsx +16 -0
  50. package/src/EventGQLModel/Queries/UpdateAsyncAction.jsx +40 -0
  51. package/src/EventGQLModel/Queries/index.js +6 -0
  52. package/src/EventGQLModel/Scalars/ScalarAttribute.jsx +54 -0
  53. package/src/EventGQLModel/Scalars/TemplateScalarAttribute.jsx +88 -0
  54. package/src/EventGQLModel/Scalars/index.js +1 -0
  55. package/src/EventGQLModel/Vectors/TemplateVectorsAttribute.jsx +326 -0
  56. package/src/EventGQLModel/Vectors/VectorAttribute.jsx +56 -0
  57. package/src/EventGQLModel/Vectors/index.js +1 -0
  58. package/src/EventGQLModel/WhatToDo.md +44 -0
  59. package/src/EventGQLModel/index.js +71 -0
  60. package/src/GroupGQLModel/Mutations/Create.jsx +8 -2
  61. package/src/GroupGQLModel/Mutations/Delete.jsx +8 -2
  62. package/src/GroupGQLModel/Mutations/Update.jsx +8 -8
  63. package/src/GroupGQLModel/Queries/Fragments.jsx +17 -1
  64. package/src/GroupGQLModel/Scalars/RBACObject.jsx +17 -5
  65. package/src/GroupGQLModel/Vectors/GroupMemberships.jsx +1 -1
  66. package/src/UserGQLModel/Components/MediumContent.jsx +9 -3
  67. package/src/UserGQLModel/Queries/Fragments.jsx +6 -0
  68. package/src/_Template/WhatToDo.md +1 -1
  69. package/index.html +0 -104
  70. package/vite.config.js +0 -47
@@ -0,0 +1,56 @@
1
+ import { CardCapsule } from "../Components/CardCapsule"
2
+ import { Table } from "../Components/Table"
3
+ import { Col } from "../../../../_template/src/Base/Components/Col"
4
+ import { Row } from "../../../../_template/src/Base/Components/Row"
5
+
6
+ export const VectorAttributeFactory = (attribute_name) => ({ item }) => {
7
+ const attribute_value = item?.[attribute_name] || []
8
+ return (
9
+ <Row key={attribute_name}>
10
+ <Col className="col-2"><b>{attribute_name}</b></Col>
11
+ <Col className="col-10">
12
+ <CardCapsule item={item}>
13
+ <Table data={attribute_value} />
14
+ </CardCapsule>
15
+ </Col>
16
+ </Row>
17
+ )
18
+ }
19
+
20
+ export const VectorAttribute_ = ({ attribute_name, item }) => {
21
+ const attribute_value = item?.[attribute_name] || []
22
+ return (
23
+ <Row key={attribute_name}>
24
+ <Col className="col-2"><b>{attribute_name}</b></Col>
25
+ <Col className="col-10">
26
+ <CardCapsule item={item}>
27
+ <Table data={attribute_value} />
28
+ </CardCapsule>
29
+ </Col>
30
+ </Row>
31
+ )
32
+ }
33
+
34
+ export const VectorAttribute = ({ attribute_name, item }) => {
35
+ const attribute_value = item?.[attribute_name] || []
36
+ return (
37
+ <CardCapsule item={item} title={attribute_name+'[]'}>
38
+ <Table data={attribute_value} />
39
+ </CardCapsule>
40
+ )
41
+ }
42
+
43
+
44
+ export const MediumCardVectors = ({ item }) => {
45
+ return (
46
+ <CardCapsule item={item}>
47
+ {Object.entries(item).map(([attribute_name, attribute_value]) => {
48
+ if (Array.isArray(attribute_value)) {
49
+ return <VectorAttribute key={attribute_name} attribute_name={attribute_name} item={item} />
50
+ } else {
51
+ return null
52
+ }
53
+ })}
54
+ </CardCapsule>
55
+ )
56
+ }
@@ -0,0 +1 @@
1
+ export * from './TemplateVectorsAttribute'
@@ -0,0 +1,44 @@
1
+
2
+
3
+ ## Base Copy
4
+
5
+ - copy /_template/ directory to your place
6
+
7
+ ## Adapt to new type
8
+
9
+ ### Change URI locations
10
+ - in Link.jsx file (see subdir ./components/) change LinkURI
11
+ - in Link.jsx file change registerLink('YourGQLModel)
12
+
13
+ ### Register pages and components to Application
14
+ - rename RouterSegments in Page/RouterSegments.jsx
15
+ - insert RouterSegments into app router, so make them working
16
+
17
+
18
+ At some point you should restart vite.
19
+
20
+ - use http://localhost:8001/doc and graphiql at http://localhost:8001/gql to get queries and update AsyncActions, fragments, etc. in directory Queries
21
+ - readById
22
+ - readPage
23
+ - mutations (CUD)
24
+
25
+ - try to navigate in your app to URI defined in Link to reach list of items `/template/YOUDEFINED/list/'
26
+ - remove all errors until you get your app showing a table
27
+ - try to navigate from table into individual items
28
+ - check permission at API (source code etc.) to get info about neede roles for particular mutations
29
+ - UserAbsoluteAccessControlExtension or RbacProviderExtension
30
+ - set
31
+
32
+ - Change LargeCard, add there more buttons
33
+
34
+ - Update MediumContent.jsx file to show more or less data related to you entity
35
+ - Update MediumEditableContent.jsx file to allow edit of more or less data
36
+
37
+
38
+ ## Add new Mutations
39
+
40
+ - check gqlendpoint to cover all available mutations with appropriate permissions
41
+
42
+ ### Update filters
43
+
44
+ - Set Filter component, correct it at PageVector, do not forget to use appropriate name for query param in url
@@ -0,0 +1,71 @@
1
+
2
+ export * from './Components'
3
+ export * from './Scalars'
4
+ export * from './Vectors'
5
+ export * from './Queries'
6
+ export * from './Pages'
7
+
8
+ import {
9
+ CardCapsule,
10
+ Children,
11
+ CUDButton,
12
+ LargeCard,
13
+ Link,
14
+ MediumContent,
15
+ MediumCard,
16
+
17
+ MediumEditableContent,
18
+ LiveEdit
19
+
20
+ } from './Components'
21
+
22
+ import {
23
+ EditPage,
24
+ Page,
25
+ PageNavbar,
26
+ TemplateRouterSegments,
27
+ VectorPage
28
+ } from './Pages'
29
+
30
+ // import { UIActions } from './Queries'
31
+
32
+ export const TemplateUI = {
33
+ CardCapsule,
34
+ Children,
35
+ CUDButton,
36
+ LargeCard,
37
+ Link,
38
+ MediumContent,
39
+ MediumCard,
40
+
41
+ MediumEditableContent,
42
+ LiveEdit,
43
+
44
+ Page,
45
+ VectorPage,
46
+ EditPage,
47
+ PageNavbar,
48
+ TemplateRouterSegments
49
+ }
50
+
51
+
52
+
53
+ // export const TemplateUI = {
54
+ // CardCapsule: withUI(_TemplateUI)(_TemplateUI.CardCapsule),
55
+ // Children: withUI(_TemplateUI)(_TemplateUI.Children),
56
+ // CUDButton: withUI(_TemplateUI)(_TemplateUI.CUDButton),
57
+ // LargeCard: withUI(_TemplateUI)(_TemplateUI.LargeCard),
58
+ // Link: withUI(_TemplateUI)(_TemplateUI.Link),
59
+ // MediumContent: withUI(_TemplateUI)(_TemplateUI.MediumContent),
60
+ // MediumCard: withUI(_TemplateUI)(_TemplateUI.MediumCard),
61
+
62
+ // MediumEditableContent: withUI(_TemplateUI)(_TemplateUI.MediumEditableContent),
63
+ // LiveEdit: withUI(_TemplateUI)(_TemplateUI.LiveEdit),
64
+
65
+ // Page: withUI(_TemplateUI)(_TemplateUI.Page),
66
+ // VectorPage: withUI(_TemplateUI)(_TemplateUI.VectorPage),
67
+ // EditPage: withUI(_TemplateUI)(_TemplateUI.EditPage),
68
+ // PageNavbar: withUI(_TemplateUI)(_TemplateUI.PageNavbar),
69
+ // RouterSegment: withUI(_TemplateUI)(_TemplateUI.RouterSegment)
70
+ // }
71
+
@@ -10,9 +10,15 @@ import {
10
10
  const DefaultContent = MediumEditableContent
11
11
  const MutationAsyncAction = InsertAsyncAction
12
12
 
13
+ // const permissions = {
14
+ // oneOfRoles: ["superadmin"],
15
+ // mode: "absolute",
16
+ // }
17
+
18
+ // ALTERNATIVE, CHECK GQLENDPOINT
13
19
  const permissions = {
14
- oneOfRoles: ["superadmin"],
15
- mode: "absolute",
20
+ oneOfRoles: ["administrátor", "personalista"],
21
+ mode: "item",
16
22
  }
17
23
 
18
24
  export const CreateLink = ({
@@ -10,9 +10,15 @@ import {
10
10
  const DefaultContent = MediumContent
11
11
  const MutationAsyncAction = DeleteAsyncAction
12
12
 
13
+ // const permissions = {
14
+ // oneOfRoles: ["superadmin"],
15
+ // mode: "absolute",
16
+ // }
17
+
18
+ // ALTERNATIVE, CHECK GQLENDPOINT
13
19
  const permissions = {
14
- oneOfRoles: ["superadmin"],
15
- mode: "absolute",
20
+ oneOfRoles: ["administrátor", "personalista"],
21
+ mode: "item",
16
22
  }
17
23
 
18
24
  export const DeleteLink = ({
@@ -11,17 +11,17 @@ import { UpdateAsyncAction } from "../Queries";
11
11
  const DefaultContent = MediumEditableContent
12
12
  const mutationAsyncAction = UpdateAsyncAction
13
13
 
14
- const permissions = {
15
- oneOfRoles: ["superadmin"],
16
- mode: "absolute",
17
- }
18
-
19
- // ALTERNATIVE, CHECK GQLENDPOINT
20
14
  // const permissions = {
21
- // oneOfRoles: ["administrátor", "personalista"],
22
- // mode: "item",
15
+ // oneOfRoles: ["superadmin"],
16
+ // mode: "absolute",
23
17
  // }
24
18
 
19
+ // ALTERNATIVE, CHECK GQLENDPOINT
20
+ const permissions = {
21
+ oneOfRoles: ["administrátor", "personalista"],
22
+ mode: "item",
23
+ }
24
+
25
25
 
26
26
  export const UpdateLink = ({
27
27
  uriPattern=UpdateItemURI,
@@ -47,7 +47,20 @@ fragment Medium on GroupGQLModel {
47
47
  const LargeFragmentStr = `
48
48
  fragment Large on GroupGQLModel {
49
49
  ...Medium
50
- subgroups {
50
+ subgroups(where: {
51
+ grouptype: {
52
+ id: {
53
+ _in: [
54
+ "cd49e152-610c-11ed-9f29-001a7dda7110",
55
+ "cd49e153-610c-11ed-bf19-001a7dda7110",
56
+ "cd49e154-610c-11ed-bdbf-001a7dda7110",
57
+ "cd49e155-610c-11ed-bdbf-001a7dda7110",
58
+ "cd49e155-610c-11ed-844e-001a7dda7110",
59
+ "cd49e156-610c-11ed-87ef-001a7dda7110"
60
+ ]
61
+ }
62
+ }
63
+ }) {
51
64
  __typename
52
65
  id
53
66
  name
@@ -56,6 +69,9 @@ fragment Large on GroupGQLModel {
56
69
  id
57
70
  name
58
71
  }
72
+ rbacobject {
73
+ ...RBRoles
74
+ }
59
75
  }
60
76
  rolesOn {
61
77
  ...Role
@@ -13,7 +13,7 @@ import { EntityLookup } from "../../Base/FormControls/EntityLookup"
13
13
  import { Input } from "../../Base/FormControls/Input"
14
14
  import { SearchAsyncAction as SearchUserAsyncAction } from "../../UserGQLModel/Queries/SearchAsyncAction"
15
15
  import { useEffect } from "react"
16
- import { useAsyncThunkAction } from "../../../../dynamic/src/Hooks"
16
+ import { useAsync, useAsyncThunkAction } from "../../../../dynamic/src/Hooks"
17
17
  import { ReadAsyncAction } from "../../GroupGQLModel"
18
18
  import { AsyncStateIndicator } from "../../Base/Helpers/AsyncStateIndicator"
19
19
  import { InsertAsyncAction } from "../../RoleGQLModel/Queries"
@@ -25,9 +25,12 @@ export const RBACObject = ({ item }) => {
25
25
  const filtered = useMemo(() => currentUserRoles.filter(cr => cr?.valid), [currentUserRoles])
26
26
  return (
27
27
  <BaseUI.CardCapsule item={{}} title="Moje role vůči této entitě">
28
- <SimpleCardCapsuleRightCorner>
29
- <Edit item={item}/>
30
- </SimpleCardCapsuleRightCorner>
28
+ {item?.__typename !== "UserGQLModel" && (
29
+ <SimpleCardCapsuleRightCorner>
30
+ <Edit item={item}/>
31
+ </SimpleCardCapsuleRightCorner>
32
+ )}
33
+
31
34
  {filtered.map(role => (
32
35
  <Attribute key={role?.id}>
33
36
  <Link item={role?.roletype} />@
@@ -71,8 +74,15 @@ export const RBACEdit = ({ item, onChange }) => {
71
74
  const { id="" } = item || {}
72
75
  const { entity, loading, error, run } = useAsyncThunkAction(ReadAsyncAction, {id}, {deferred: true})
73
76
  const { data, loading: saving, error: updateError, run: save } = useAsyncThunkAction(InsertAsyncAction, {id}, {deferred: true})
74
-
77
+ // const { entity=item, loading, error, run } = useAsync(ReadAsyncAction, {id}, {deferred: true})
78
+ // const { data, loading: saving, error: updateError, run: save } = useAsync(InsertAsyncAction, {id}, {deferred: true})
79
+ // const [itemCached, setItemCached] = useState(item)
75
80
  const [roles, setRoles] = useState((entity || {})?.roles||[])
81
+
82
+ // useEffect(()=>{
83
+ // setItemCached(() => entity)
84
+ // },[entity])
85
+
76
86
 
77
87
  // useEffect(()=>{
78
88
  // const newRoles = (entity || {})?.roles||[]
@@ -128,9 +138,11 @@ export const RBACEdit = ({ item, onChange }) => {
128
138
  user: null,
129
139
  })
130
140
  )
141
+ // await run()
131
142
  // setRoles(prev => ([...prev, role]))
132
143
  }
133
144
  return (<>
145
+ {/* {JSON.stringify(roles)} */}
134
146
  <AsyncStateIndicator
135
147
  error={error}
136
148
  loading={loading}
@@ -6,7 +6,7 @@ import { Link as BaseLink } from "../../../../_template/src/Base/Components/Link
6
6
  import { useNavigate } from "react-router"
7
7
  import { UpdateLink } from "../Mutations/Update"
8
8
  import { LinkURI } from "../Components"
9
- import { label } from "happy-dom/lib/PropertySymbol"
9
+
10
10
  import { Attribute } from "../../../../_template/src/Base/Components/Attribute"
11
11
  import { SimpleCardCapsuleRightCorner } from "../../../../_template/src/Base/Components"
12
12
  import { CreateGroupInserMembershipButton } from "../Mutations/AddMembership"
@@ -1,8 +1,8 @@
1
1
  import { Attribute } from "../../../../_template/src/Base/Components/Attribute"
2
- import { Col as Col_ } from "../../../../_template/src/Base/Components/Col"
3
- import { Row } from "../../../../_template/src/Base/Components/Row"
2
+ // import { Col as Col_ } from "../../../../_template/src/Base/Components/Col"
3
+ // import { Row } from "../../../../_template/src/Base/Components/Row"
4
4
  import { Roles } from "../Vectors/Roles"
5
- import { UserRoles } from "../Vectors/UserRoles"
5
+ // import { UserRoles } from "../Vectors/UserRoles"
6
6
 
7
7
  /**
8
8
  * A component that displays medium-level content for an template entity.
@@ -35,6 +35,12 @@ export const MediumContent = ({ item, children}) => {
35
35
  <Attribute attribute_name="surname" label="Příjmení" item={item} />
36
36
  <Attribute attribute_name="fullname" label="Celé jméno" item={item} />
37
37
  <Attribute attribute_name="email" label="Email" item={item} />
38
+ <Attribute attribute_name="email" label="Email" item={item}>
39
+ <a href={`mailto:${item?.email}`}>{item?.email}</a>
40
+ </Attribute>
41
+ <Attribute label="Telefon" item={item}>
42
+ <a href={`tel:+420800101202`}>800 101 202</a>
43
+ </Attribute>
38
44
  {children}
39
45
  </div>
40
46
 
@@ -40,10 +40,16 @@ fragment Large on UserGQLModel {
40
40
  id
41
41
  name
42
42
  }
43
+ rbacobject {
44
+ ...RBRoles
45
+ }
43
46
  }
44
47
  valid
45
48
  startdate
46
49
  enddate
50
+ rbacobject {
51
+ ...RBRoles
52
+ }
47
53
  }
48
54
  roles {
49
55
  ...Role
@@ -17,7 +17,7 @@
17
17
 
18
18
  At some point you should restart vite.
19
19
 
20
- - use http://localhost:8001/doc and graphiql at http://localhost:8001/gql to get queries and update AsyncActions, fragments, etc. in directory Queries
20
+ - use http://localhost:8001/doc and graphiql at http://localhost:8001/gql to get queries and update AsyncActions, fragments, etc. in directory Queries, as an alternative uri you could use http://localhost:33001/
21
21
  - readById
22
22
  - readPage
23
23
  - mutations (CUD)
package/index.html DELETED
@@ -1,104 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>GQL Model Viewer</title>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
8
- <script>
9
- // Node-like shim pro knihovny, které čekají process.env
10
- globalThis.process = globalThis.process || { env: {} };
11
- globalThis.process.env = globalThis.process.env || {};
12
- globalThis.process.env.NODE_ENV = globalThis.process.env.NODE_ENV || "development" || "production";
13
- </script>
14
-
15
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
16
-
17
- <!-- <script src="https://unpkg.com/react@19"></script>
18
- <script src="https://unpkg.com/react-dom@19"></script> -->
19
-
20
- <script src="https://unpkg.com/react@18.3.1/umd/react.development.js"></script>
21
- <script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js"></script>
22
-
23
- <script src="https://unpkg.com/@reduxjs/toolkit@1.9.3/dist/redux-toolkit.umd.js"></script>
24
-
25
- <!-- Babel (modern verze) -->
26
- <script src="https://unpkg.com/@babel/standalone@7.25.0/babel.min.js"></script>
27
-
28
- <!-- HTM (React JSX alternativa) -->
29
- <script src="https://unpkg.com/htm@3.1.1/dist/htm.umd.js" crossorigin></script>
30
-
31
- </head>
32
-
33
- <body>
34
-
35
- <div id="log-root_"></div>
36
- <div id="root"></div>
37
- <div id="log-output"></div>
38
-
39
-
40
-
41
- <script type="text/babel" data-type="module" data-presets="react">
42
- const { useState, useMemo } = React;
43
- import { CardCapsule, LeftColumn, MiddleColumn, Row } from "./dist/es"
44
-
45
- function htmlLog(...args) {
46
- const el = document.getElementById('log-output');
47
- if (!el) return;
48
-
49
- const line = document.createElement('div');
50
-
51
- line.textContent = args
52
- .map(arg => typeof arg === 'object'
53
- ? JSON.stringify(arg, null, 2)
54
- : String(arg)
55
- )
56
- .join(' ');
57
-
58
- el.appendChild(line);
59
- }
60
-
61
- const originalLog = console.log;
62
-
63
- console.log = (...args) => {
64
- originalLog(...args);
65
- htmlLog(...args);
66
- };
67
-
68
- const Counter = () => {
69
- const [counter, setCounter] = useState(0)
70
- const Plus = () => {
71
- console.log(counter, '=>', counter + 1)
72
- setCounter(prev=>prev+1)
73
- }
74
- return (
75
- <button className="btn btn-sm btn-outline-primary" onClick={Plus}>
76
- {counter} + 1
77
- </button>
78
- )
79
- }
80
-
81
- const MyApp = () => {
82
- console.log("MyApp")
83
- return (
84
- <CardCapsule title={<> demo <Counter /> </>}>
85
- <Row>
86
- <LeftColumn>
87
- <CardCapsule title="Left">
88
- Hello world <Counter />
89
- </CardCapsule>
90
- </LeftColumn>
91
- <MiddleColumn>
92
- <CardCapsule title="Middle">
93
- Hello world <Counter />
94
- </CardCapsule>
95
- </MiddleColumn>
96
- </Row>
97
- </CardCapsule>
98
- )
99
- }
100
- // console.log("mount", mount)
101
- ReactDOM.createRoot(document.getElementById("root")).render(<MyApp />);
102
- </script>
103
- </body>
104
- </html>
package/vite.config.js DELETED
@@ -1,47 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
- import path from "path";
4
-
5
- export default defineConfig({
6
- plugins: [react()],
7
-
8
- resolve: {
9
- alias: {
10
- // Když někdo v tomhle balíku (nebo jeho deps) udělá
11
- // import '@hrbolek/uoisfrontend-gql-shared'
12
- // → vezme se přímo src/index.js, ne package.json/main/dist
13
- // "@hrbolek/uoisfrontend-template": path.resolve(__dirname, "src"),
14
- "@hrbolek/uoisfrontend-template": path.resolve(__dirname, "src/index.js"),
15
- "@hrbolek/uoisfrontend-dynamic": path.resolve(__dirname, "../../packages/dynamic/src/index.js"),
16
- },
17
- },
18
-
19
- build: {
20
- lib: {
21
- entry: path.resolve(__dirname, "src/index.js"),
22
- name: "UoisfrontendGqlShared",
23
- formats: ["es", "cjs", "umd"],
24
- fileName: (format, name) => `${format}/${name}.js`,
25
- },
26
- rollupOptions: {
27
- external: [
28
- "react",
29
- "react-dom",
30
- "react-redux",
31
- "react-bootstrap",
32
- "react-router-dom",
33
- "@reduxjs/toolkit",
34
- ],
35
- output: {
36
- globals: {
37
- react: "React",
38
- "react-dom": "ReactDOM",
39
- "react-redux": "ReactRedux",
40
- "react-bootstrap": "ReactBootstrap",
41
- "react-router-dom": "ReactRouterDOM",
42
- "@reduxjs/toolkit": "RTK",
43
- },
44
- },
45
- },
46
- },
47
- });