@ghentcdh/crouton-vue 0.0.1-alpha.1

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 (59) hide show
  1. package/dist/AdminView-oAUAL8cC.js +47 -0
  2. package/dist/ResourceView-CfBofOPI.js +127 -0
  3. package/dist/admin/AdminView.vue.d.ts +3 -0
  4. package/dist/admin/AdminView.vue.d.ts.map +1 -0
  5. package/dist/composables/form-def.d.ts +7 -0
  6. package/dist/composables/form-def.d.ts.map +1 -0
  7. package/dist/composables/form-def.schema.d.ts +624 -0
  8. package/dist/composables/form-def.schema.d.ts.map +1 -0
  9. package/dist/composables/form-def.types.d.ts +68 -0
  10. package/dist/composables/form-def.types.d.ts.map +1 -0
  11. package/dist/composables/sidebar.d.ts +24 -0
  12. package/dist/composables/sidebar.d.ts.map +1 -0
  13. package/dist/composables/useApi.d.ts +4 -0
  14. package/dist/composables/useApi.d.ts.map +1 -0
  15. package/dist/index.d.ts +12 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +122 -0
  18. package/dist/package.json +43 -0
  19. package/dist/relation/RelationButton.vue.d.ts +38 -0
  20. package/dist/relation/RelationButton.vue.d.ts.map +1 -0
  21. package/dist/relation/RelationCell.vue.d.ts +27 -0
  22. package/dist/relation/RelationCell.vue.d.ts.map +1 -0
  23. package/dist/relation/RelationControlRenderer.vue.d.ts +8 -0
  24. package/dist/relation/RelationControlRenderer.vue.d.ts.map +1 -0
  25. package/dist/relation/RelationInline.vue.d.ts +10 -0
  26. package/dist/relation/RelationInline.vue.d.ts.map +1 -0
  27. package/dist/relation/RelationModal.vue.d.ts +109 -0
  28. package/dist/relation/RelationModal.vue.d.ts.map +1 -0
  29. package/dist/relation/RelationReadonlyRenderer.vue.d.ts +8 -0
  30. package/dist/relation/RelationReadonlyRenderer.vue.d.ts.map +1 -0
  31. package/dist/resource/ResourceTable.vue.d.ts +29 -0
  32. package/dist/resource/ResourceTable.vue.d.ts.map +1 -0
  33. package/dist/resource/ResourceView.vue.d.ts +3 -0
  34. package/dist/resource/ResourceView.vue.d.ts.map +1 -0
  35. package/dist/resource/index.d.ts +6 -0
  36. package/dist/resource/index.d.ts.map +1 -0
  37. package/dist/resource/renderers.d.ts +43 -0
  38. package/dist/resource/renderers.d.ts.map +1 -0
  39. package/dist/resource/resource-modal.d.ts +45 -0
  40. package/dist/resource/resource-modal.d.ts.map +1 -0
  41. package/dist/resource/resource.api.d.ts +13 -0
  42. package/dist/resource/resource.api.d.ts.map +1 -0
  43. package/dist/resource/resource.d.ts +50 -0
  44. package/dist/resource/resource.d.ts.map +1 -0
  45. package/dist/resource/resource.types.d.ts +22 -0
  46. package/dist/resource/resource.types.d.ts.map +1 -0
  47. package/dist/resource/uri.utils.d.ts +11 -0
  48. package/dist/resource/uri.utils.d.ts.map +1 -0
  49. package/dist/router.d.ts +12 -0
  50. package/dist/router.d.ts.map +1 -0
  51. package/dist/styles.css +3 -0
  52. package/dist/useCrouton-PpomcThZ.js +237 -0
  53. package/dist/useResources-eUWEFuta.js +812 -0
  54. package/dist/utils/custom-component.d.ts +8 -0
  55. package/dist/utils/custom-component.d.ts.map +1 -0
  56. package/dist/utils/request.d.ts +18 -0
  57. package/dist/utils/request.d.ts.map +1 -0
  58. package/package.json +43 -0
  59. package/styles.css +36 -0
@@ -0,0 +1,47 @@
1
+ import { n as e, o as t, r as n } from "./useCrouton-PpomcThZ.js";
2
+ import { Drawer as r } from "@ghentcdh/ui";
3
+ import { Fragment as i, createBlock as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, openBlock as d, renderList as f, resolveComponent as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
4
+ import { RouterLink as _ } from "vue-router";
5
+ //#region src/admin/AdminView.vue?vue&type=script&setup=true&lang.ts
6
+ var v = { class: "gap-2 flex flex-col h-full" }, y = { class: "menu w-full gap-2 flex-1 flex-grow h-full" }, b = { key: 0 }, x = { open: "" }, S = { class: "font-semibold" }, C = { key: 1 }, w = { class: "bg-base-200 p-4 text-gray-500 text-sm" }, T = /* @__PURE__ */ u({
7
+ __name: "AdminView",
8
+ setup(u) {
9
+ let T = e();
10
+ return (e, u) => {
11
+ let E = p("router-view");
12
+ return d(), a(h(r), {
13
+ class: "_h-full",
14
+ "width-left": 250,
15
+ "drawer-color": "bg-base-200"
16
+ }, {
17
+ "left-drawer": g(() => [s("div", v, [
18
+ s("h2", null, m(h(T).title) + " Admin", 1),
19
+ s("ul", y, [(d(!0), o(i, null, f(h(T).sidebar, (e) => (d(), o(i, { key: e.id }, [h(n)(e) ? (d(), o("li", b, [s("details", x, [s("summary", S, m(e.label), 1), s("ul", null, [(d(!0), o(i, null, f(e.children, (e) => (d(), o("li", { key: e.id }, [l(h(_), {
20
+ to: {
21
+ name: h(t),
22
+ params: { formId: e.id }
23
+ },
24
+ "active-class": "bg-white font-bold"
25
+ }, {
26
+ default: g(() => [c(m(e.label), 1)]),
27
+ _: 2
28
+ }, 1032, ["to"])]))), 128))])])])) : (d(), o("li", C, [l(h(_), {
29
+ to: {
30
+ name: h(t),
31
+ params: { formId: e.id }
32
+ },
33
+ "active-class": "bg-white font-bold"
34
+ }, {
35
+ default: g(() => [c(m(e.label), 1)]),
36
+ _: 2
37
+ }, 1032, ["to"])]))], 64))), 128))]),
38
+ s("div", w, " version: " + m(h(T).version), 1)
39
+ ])]),
40
+ default: g(() => [l(E)]),
41
+ _: 1
42
+ });
43
+ };
44
+ }
45
+ });
46
+ //#endregion
47
+ export { T as default };
@@ -0,0 +1,127 @@
1
+ import { t as e, u as t } from "./useResources-eUWEFuta.js";
2
+ import { n } from "./useCrouton-PpomcThZ.js";
3
+ import { Btn as r, IconEnum as i } from "@ghentcdh/ui";
4
+ import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, mergeProps as p, openBlock as m, resolveDynamicComponent as h, shallowRef as g, toDisplayString as _, toRaw as v, unref as y, watch as b, withCtx as x } from "vue";
5
+ import { TableComponent as S, TableToolbar as C } from "@ghentcdh/crouton-forms-vue";
6
+ import { useRoute as w, useRouter as T } from "vue-router";
7
+ //#region src/resource/ResourceTable.vue?vue&type=script&setup=true&lang.ts
8
+ var E = { key: 0 }, D = {
9
+ key: 1,
10
+ class: "max-w-screen-xl m-auto p-4"
11
+ }, O = { class: "text-xl font-bold mr-4" }, k = /* @__PURE__ */ f({
12
+ __name: "ResourceTable",
13
+ props: {
14
+ formId: { type: String },
15
+ initialRequestParams: {
16
+ type: Object,
17
+ default: {}
18
+ }
19
+ },
20
+ emits: [
21
+ "handleEvent",
22
+ "onRequest",
23
+ "initialLoad"
24
+ ],
25
+ setup(f, { emit: w }) {
26
+ let T = n(), k = f, A = o(() => `${k.formId}_${Date.now()}`), j = t(() => T.getFormDef(k.formId)), M = w, N = (e, t) => {
27
+ M("handleEvent", {
28
+ event: e,
29
+ data: t
30
+ });
31
+ }, P = (e) => M("onRequest", { requestData: e }), F = g(e(j.value, {
32
+ initialRequestParams: { ...v(k.initialRequestParams) },
33
+ onRequest: P,
34
+ handleEvent: N
35
+ }));
36
+ b(() => j.value, (t) => {
37
+ F.value = t ? e(j.value, {
38
+ initialRequestParams: { ...v(k.initialRequestParams) },
39
+ onRequest: P,
40
+ handleEvent: N
41
+ }) : null;
42
+ }), b(() => F.value, () => {
43
+ F.value && M("initialLoad", F.value);
44
+ }, { once: !0 });
45
+ let I = o(() => F.value?.form);
46
+ return (e, t) => (m(), l(a, null, [I.value ? (m(), l("div", E, [(m(), s(h(I.value.component), p(I.value.config, { onCloseModal: F.value.closeForm }), {
47
+ "content-after": x(() => [I.value.customComponent ? (m(), s(h(I.value.customComponent), p({
48
+ key: 0,
49
+ resource: F.value
50
+ }, I.value.config), null, 16, ["resource"])) : c("", !0)]),
51
+ _: 1
52
+ }, 16, ["onCloseModal"]))])) : c("", !0), y(j) && F.value && !I.value?.hideTable ? (m(), l("div", D, [d(y(C), {
53
+ "filter-schema": F.value.filterSchema,
54
+ filters: F.value.filter,
55
+ search: F.value.search,
56
+ actions: F.value.tableActions,
57
+ onUpdateSearch: F.value.onUpdateSearch,
58
+ onUpdateFilters: F.value.onUpdateFilters,
59
+ onAction: F.value.backendAction
60
+ }, {
61
+ left: x(() => [u("span", O, _(y(j).title), 1)]),
62
+ right: x(() => [y(j).operations.create ? (m(), s(y(r), {
63
+ key: 0,
64
+ icon: y(i).Plus,
65
+ onClick: F.value.create
66
+ }, {
67
+ default: x(() => [...t[0] ||= [u("span", { class: "whitespace-nowrap" }, "Add record", -1)]]),
68
+ _: 1
69
+ }, 8, ["icon", "onClick"])) : c("", !0)]),
70
+ _: 1
71
+ }, 8, [
72
+ "filter-schema",
73
+ "filters",
74
+ "search",
75
+ "actions",
76
+ "onUpdateSearch",
77
+ "onUpdateFilters",
78
+ "onAction"
79
+ ]), d(y(S), p({ id: `form_table_${A.value}` }, F.value), null, 16, ["id"])])) : c("", !0)], 64));
80
+ }
81
+ }), A = /* @__PURE__ */ f({
82
+ __name: "ResourceView",
83
+ setup(e) {
84
+ let r = w(), i = T(), a = o(() => r.params.formId), c = n();
85
+ o(() => `${a.value}_${Date.now()}`), t(() => c.getFormDef(a.value));
86
+ let l = ({ event: e, data: t }) => {
87
+ let n = {
88
+ id: t?.id,
89
+ event: e
90
+ };
91
+ e === "close" && (n = {
92
+ id: void 0,
93
+ event: void 0
94
+ }), i.push({ query: {
95
+ ...r.query,
96
+ ...n
97
+ } });
98
+ }, u = (e) => {
99
+ i.push({ query: {
100
+ ...r.query,
101
+ ...e
102
+ } });
103
+ }, d = (e) => {
104
+ let t = r.query.id, n = r.query.event;
105
+ if (n && (n === "create" && e.create(), t)) switch (n) {
106
+ case "view":
107
+ e.view(t);
108
+ break;
109
+ case "update":
110
+ e.edit(t);
111
+ break;
112
+ case "delete":
113
+ e.delete(t);
114
+ break;
115
+ }
116
+ };
117
+ return (e, t) => (m(), s(k, {
118
+ "form-id": a.value,
119
+ "initial-request-params": y(r).query,
120
+ onHandleEvent: l,
121
+ onOnRequest: u,
122
+ onInitialLoad: d
123
+ }, null, 8, ["form-id", "initial-request-params"]));
124
+ }
125
+ });
126
+ //#endregion
127
+ export { A as default };
@@ -0,0 +1,3 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLElement>;
2
+ export default _default;
3
+ //# sourceMappingURL=AdminView.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdminView.vue.d.ts","sourceRoot":"","sources":["../../src/admin/AdminView.vue"],"names":[],"mappings":"AA6CA;;AAqMA,wBAMG"}
@@ -0,0 +1,7 @@
1
+ import { FormDef } from './form-def.types';
2
+ export declare class FormDefCache {
3
+ private cache;
4
+ getFormDef(formId: string): Promise<FormDef>;
5
+ getFormDefByUri(uri: string): Promise<FormDef>;
6
+ }
7
+ //# sourceMappingURL=form-def.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-def.d.ts","sourceRoot":"","sources":["../../src/composables/form-def.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAC;AA4C5D,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAuC;IAE9C,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5C,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA+BrD"}