@chelone/vue 0.4.0 → 0.6.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.
Files changed (58) hide show
  1. package/README.md +1 -0
  2. package/dist/admin/admin-shell.vue.js +1 -1
  3. package/dist/components/admin/auth/auth-callback.vue.js +1 -1
  4. package/dist/components/admin/auth/login-form.vue.js +1 -1
  5. package/dist/components/admin/auth/login-with-email.vue.js +1 -1
  6. package/dist/components/admin/feedback/loading-indicator.vue.js +1 -1
  7. package/dist/components/admin/feedback/spinner.vue.js +1 -1
  8. package/dist/components/admin/fields/api-key-field.vue.d.ts +1 -1
  9. package/dist/components/admin/fields/api-key-field.vue.js +2 -12
  10. package/dist/components/admin/fields/select-field.vue.d.ts +17 -6
  11. package/dist/components/admin/fields/select-field.vue.js +1 -1
  12. package/dist/components/admin/inputs/checkbox-group-input.vue.d.ts +14 -7
  13. package/dist/components/admin/inputs/checkbox-group-input.vue.js +2 -2
  14. package/dist/components/admin/inputs/datagrid-input.vue.d.ts +20 -5
  15. package/dist/components/admin/inputs/datagrid-input.vue.js +7 -3
  16. package/dist/components/admin/inputs/radio-button-group-input.vue.d.ts +14 -7
  17. package/dist/components/admin/inputs/radio-button-group-input.vue.js +2 -2
  18. package/dist/components/admin/list/count-spinner.vue.js +1 -1
  19. package/dist/components/admin/supabase/forgot-password-form.vue.js +1 -1
  20. package/dist/components/admin/supabase/set-password-form.vue.js +1 -1
  21. package/dist/components/index.d.ts +0 -2
  22. package/dist/components/kanban/kanban-board.vue.js +260 -0
  23. package/dist/components/kanban/kanban-draggable-card.vue.d.ts +18 -0
  24. package/dist/components/kanban/kanban-draggable-card.vue.js +32 -0
  25. package/dist/components/kanban/kanban-draggable-card2.vue.js +4 -0
  26. package/dist/components/kanban/kanban-drop-area.vue.d.ts +15 -0
  27. package/dist/components/kanban/kanban-drop-area.vue.js +29 -0
  28. package/dist/components/kanban/kanban-drop-area2.vue.js +4 -0
  29. package/dist/components/maps-osm/osm-feature-operator.vue.js +1 -1
  30. package/dist/components/ui/chart/chart-container.vue.d.ts +18 -0
  31. package/dist/components/ui/chart/chart-container.vue.js +40 -0
  32. package/dist/components/ui/chart/chart-container2.vue.js +4 -0
  33. package/dist/components/ui/chart/chart-legend-content.vue.d.ts +9 -0
  34. package/dist/components/ui/chart/chart-legend-content.vue.js +56 -0
  35. package/dist/components/ui/chart/chart-legend-content2.vue.js +4 -0
  36. package/dist/components/ui/chart/chart-style.vue.d.ts +7 -0
  37. package/dist/components/ui/chart/chart-style.vue.js +43 -0
  38. package/dist/components/ui/chart/chart-style2.vue.js +4 -0
  39. package/dist/components/ui/chart/chart-tooltip-content.vue.d.ts +7 -0
  40. package/dist/components/ui/chart/chart-tooltip-content.vue.js +122 -0
  41. package/dist/components/ui/chart/chart-tooltip-content2.vue.js +4 -0
  42. package/dist/components/ui/chart/index.d.ts +11 -0
  43. package/dist/components/ui/chart/utils.d.ts +81 -0
  44. package/dist/components/ui/chart/utils.js +52 -0
  45. package/dist/components/ui/index.d.ts +1 -0
  46. package/dist/components/ui/spinner.vue.js +1 -29
  47. package/dist/components/ui/spinner2.vue.js +29 -1
  48. package/dist/create-resource-components.d.ts +142 -18
  49. package/dist/data/create-chelone-hooks.d.ts +2 -1
  50. package/dist/data/queries.d.ts +6 -3
  51. package/dist/data/queries.js +8 -4
  52. package/dist/index.js +398 -387
  53. package/dist/kanban.d.ts +1 -0
  54. package/dist/kanban.js +4 -0
  55. package/package.json +18 -4
  56. package/dist/components/admin/list/kanban-board.vue.js +0 -275
  57. /package/dist/components/{admin/list → kanban}/kanban-board.vue.d.ts +0 -0
  58. /package/dist/components/{admin/list → kanban}/kanban-board2.vue.js +0 -0
@@ -0,0 +1 @@
1
+ export { default as KanbanBoard, type KanbanBoardProps, } from "./components/kanban/kanban-board.vue.js";
package/dist/kanban.js ADDED
@@ -0,0 +1,4 @@
1
+ import { default as default2 } from "./components/kanban/kanban-board.vue.js";
2
+ export {
3
+ default2 as KanbanBoard
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chelone/vue",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,6 +25,10 @@
25
25
  "types": "./dist/monaco.d.ts",
26
26
  "default": "./dist/monaco.js"
27
27
  },
28
+ "./kanban": {
29
+ "types": "./dist/kanban.d.ts",
30
+ "default": "./dist/kanban.js"
31
+ },
28
32
  "./supabase": {
29
33
  "types": "./dist/supabase.d.ts",
30
34
  "default": "./dist/supabase.js"
@@ -57,9 +61,11 @@
57
61
  "dependencies": {
58
62
  "cronstrue": "^3.24.0",
59
63
  "libphonenumber-js": "^1.13.8",
60
- "@chelone/core": "0.4.0"
64
+ "@chelone/core": "0.6.0"
61
65
  },
62
66
  "peerDependencies": {
67
+ "@dnd-kit/dom": "^0.5.3",
68
+ "@dnd-kit/vue": "^0.5.3",
63
69
  "@guolao/vue-monaco-editor": "^1.6.0",
64
70
  "@milkdown/crepe": "^7.23.0",
65
71
  "@milkdown/kit": "^7.23.0",
@@ -76,12 +82,18 @@
76
82
  "terra-draw-maplibre-gl-adapter": "^1.5.0",
77
83
  "vue": "^3.4.0",
78
84
  "vue-router": "^4.0.0",
79
- "@chelone/supabase": "0.4.0"
85
+ "@chelone/supabase": "0.6.0"
80
86
  },
81
87
  "peerDependenciesMeta": {
82
88
  "@chelone/supabase": {
83
89
  "optional": true
84
90
  },
91
+ "@dnd-kit/dom": {
92
+ "optional": true
93
+ },
94
+ "@dnd-kit/vue": {
95
+ "optional": true
96
+ },
85
97
  "@guolao/vue-monaco-editor": {
86
98
  "optional": true
87
99
  },
@@ -124,6 +136,8 @@
124
136
  },
125
137
  "devDependencies": {
126
138
  "@arethetypeswrong/cli": "^0.18.0",
139
+ "@dnd-kit/dom": "^0.5.3",
140
+ "@dnd-kit/vue": "^0.5.3",
127
141
  "@guolao/vue-monaco-editor": "^1.6.0",
128
142
  "@milkdown/crepe": "^7.23.0",
129
143
  "@milkdown/kit": "^7.23.0",
@@ -150,7 +164,7 @@
150
164
  "vue-router": "^4.0.0",
151
165
  "vue-tsc": "^2.0.0",
152
166
  "zod": "^3.24.0",
153
- "@chelone/supabase": "0.4.0"
167
+ "@chelone/supabase": "0.6.0"
154
168
  },
155
169
  "scripts": {
156
170
  "build": "vite build && vue-tsc -p tsconfig.build.json && node ../../scripts/strip-dts-css-imports.mjs dist && node ../../scripts/dts-extensions.mjs dist",
@@ -1,275 +0,0 @@
1
- import { defineComponent, computed, getCurrentInstance, shallowRef, ref, openBlock, createElementBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, toDisplayString, createCommentVNode, renderSlot, withModifiers, createVNode, withCtx, createBlock, createTextVNode } from "vue";
2
- import { buildKanbanBuckets, planKanbanMove, getAtPath } from "@chelone/core";
3
- import { useResourceDefinition } from "../../../admin/resource-registry.js";
4
- import { useCheloneNotifications } from "../../../context.js";
5
- import { useUpdate } from "../../../data/mutations.js";
6
- import { useTranslate } from "../../../i18n/use-translate.js";
7
- import { useGetRecordRepresentation } from "../../../label/use-get-record-representation.js";
8
- import { cn } from "../../../lib/utils.js";
9
- import { useListContext } from "../../../list/list-context.js";
10
- import { useResourceContext } from "../../../resource-context.js";
11
- import _sfc_main$3 from "../../ui/button.vue.js";
12
- import { useMenuAccess } from "../layout/use-menu-access.js";
13
- import { ArrowRightLeftIcon } from "./list-icons.js";
14
- import { useNavigate, useCreatePath } from "../../../router/nav-composables.js";
15
- import _sfc_main$1 from "../../ui/dropdown-menu/dropdown-menu.vue.js";
16
- import _sfc_main$2 from "../../ui/dropdown-menu/dropdown-menu-trigger.vue.js";
17
- import _sfc_main$4 from "../../ui/dropdown-menu/dropdown-menu-content.vue.js";
18
- import _sfc_main$5 from "../../ui/dropdown-menu/dropdown-menu-item.vue.js";
19
- const _hoisted_1 = ["aria-label", "data-column-id"];
20
- const _hoisted_2 = { class: "flex items-center justify-between px-1 text-sm font-medium" };
21
- const _hoisted_3 = {
22
- "data-slot": "kanban-column-count",
23
- class: "text-muted-foreground"
24
- };
25
- const _hoisted_4 = ["data-over", "onDragover", "onDragleave", "onDrop"];
26
- const _hoisted_5 = {
27
- key: 0,
28
- "data-slot": "kanban-empty",
29
- class: "px-1 py-2 text-sm text-muted-foreground"
30
- };
31
- const _hoisted_6 = ["data-record-id", "data-dragging", "draggable", "onClick", "onKeydown", "onDragstart"];
32
- const _hoisted_7 = { class: "flex min-w-0 flex-1 flex-col gap-1" };
33
- const _hoisted_8 = {
34
- "data-slot": "kanban-card-title",
35
- class: "font-medium"
36
- };
37
- const _hoisted_9 = {
38
- key: 0,
39
- "data-slot": "kanban-card-description",
40
- class: "text-muted-foreground"
41
- };
42
- const _sfc_main = /* @__PURE__ */ defineComponent({
43
- __name: "kanban-board",
44
- props: {
45
- groupSource: {},
46
- columns: {},
47
- titleSource: { default: void 0 },
48
- descriptionSource: { default: void 0 },
49
- linkType: { type: [String, Boolean], default: void 0 },
50
- class: {}
51
- },
52
- emits: ["select-card"],
53
- setup(__props, { emit: __emit }) {
54
- const props = __props;
55
- const emit = __emit;
56
- const list = useListContext();
57
- const resource = useResourceContext();
58
- const translate = useTranslate();
59
- const getRepresentation = useGetRecordRepresentation(resource);
60
- const navigate = useNavigate();
61
- const createPath = useCreatePath();
62
- const definition = useResourceDefinition(() => ({ resource }));
63
- const notifications = useCheloneNotifications();
64
- const { canAccess, isPending: isAccessPending } = useMenuAccess(
65
- computed(() => ({
66
- action: "edit",
67
- resource: resource ?? ""
68
- }))
69
- );
70
- const update = useUpdate(resource ?? "", { mutationMode: "optimistic" });
71
- const draggable = computed(
72
- () => !!resource && canAccess.value && !isAccessPending.value
73
- );
74
- const instance = getCurrentInstance();
75
- const hasListener = () => {
76
- const listeners = instance?.vnode.props;
77
- return !!(listeners?.onSelectCard || listeners?.onSelectCardOnce);
78
- };
79
- const buckets = computed(
80
- () => buildKanbanBuckets(list.data ?? [], props.groupSource, props.columns)
81
- );
82
- const grabbed = shallowRef(null);
83
- const draggingId = ref();
84
- const overColumn = ref();
85
- function clearDrag() {
86
- grabbed.value = null;
87
- draggingId.value = void 0;
88
- overColumn.value = void 0;
89
- }
90
- function move(record, targetColumnId) {
91
- const plan = planKanbanMove(
92
- record,
93
- props.groupSource,
94
- props.columns,
95
- targetColumnId
96
- );
97
- if (!plan) return;
98
- update.mutateAsync(plan).catch(() => {
99
- notifications?.notify("chelone.notification.http_error", {
100
- type: "error"
101
- });
102
- });
103
- }
104
- const type = computed(
105
- () => props.linkType ?? (definition.value.hasEdit ? "edit" : definition.value.hasShow ? "show" : false)
106
- );
107
- const linkTo = (record) => resource && type.value ? createPath({ resource, id: record.id, type: type.value }) : void 0;
108
- const selectable = computed(
109
- () => hasListener() || !!resource && type.value !== false
110
- );
111
- function select(record) {
112
- if (!selectable.value) return;
113
- if (hasListener()) return emit("select-card", record);
114
- const to = linkTo(record);
115
- if (to) navigate(to);
116
- }
117
- function onCardKeydown(event, record) {
118
- if (event.target !== event.currentTarget) return;
119
- if (event.key !== "Enter" && event.key !== " ") return;
120
- event.preventDefault();
121
- select(record);
122
- }
123
- function onDragStart(event, record) {
124
- if (!draggable.value || !event.dataTransfer) return;
125
- event.dataTransfer.effectAllowed = "move";
126
- event.dataTransfer.setData("text/plain", String(record.id));
127
- grabbed.value = record;
128
- draggingId.value = String(record.id);
129
- }
130
- function onDragOver(event, columnId) {
131
- if (!grabbed.value) return;
132
- event.preventDefault();
133
- if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
134
- overColumn.value = columnId;
135
- }
136
- function onDragLeave(event, columnId) {
137
- const into = event.relatedTarget;
138
- const area = event.currentTarget;
139
- if (into instanceof Node && area?.contains(into)) return;
140
- if (overColumn.value === columnId) overColumn.value = void 0;
141
- }
142
- function onDrop(event, columnId) {
143
- const record = grabbed.value;
144
- if (!record || !draggable.value) return;
145
- event.preventDefault();
146
- clearDrag();
147
- move(record, columnId);
148
- }
149
- const isEmpty = (value) => value == null || value === "";
150
- const textOf = (record, source) => source ? getAtPath(record, source) : void 0;
151
- const titleOf = (record) => {
152
- const value = textOf(record, props.titleSource);
153
- return value == null ? getRepresentation(record) : String(value);
154
- };
155
- const othersOf = (columnId) => props.columns.filter((other) => other.id !== columnId);
156
- const moveLabel = (record) => translate("chelone.kanban_board.move", {
157
- title: titleOf(record),
158
- _: "Move {title}"
159
- });
160
- const emptyLabel = computed(
161
- () => translate("chelone.kanban_board.empty", { _: "No items" })
162
- );
163
- return (_ctx, _cache) => {
164
- return openBlock(), createElementBlock("div", {
165
- "data-slot": "kanban-board",
166
- class: normalizeClass(unref(cn)("flex items-start gap-4 overflow-x-auto pb-2", props.class))
167
- }, [
168
- (openBlock(true), createElementBlock(Fragment, null, renderList(buckets.value, ({ column, records }) => {
169
- return openBlock(), createElementBlock("div", {
170
- key: column.id,
171
- role: "group",
172
- "aria-label": column.label,
173
- "data-slot": "kanban-column",
174
- "data-column-id": column.id,
175
- class: normalizeClass(
176
- unref(cn)(
177
- "flex w-72 shrink-0 flex-col gap-2 rounded-lg bg-muted/50 p-2",
178
- column.className
179
- )
180
- )
181
- }, [
182
- createElementVNode("div", _hoisted_2, [
183
- createElementVNode("span", null, toDisplayString(column.label), 1),
184
- createElementVNode("span", _hoisted_3, toDisplayString(records.length), 1)
185
- ]),
186
- createElementVNode("div", {
187
- "data-slot": "kanban-column-cards",
188
- "data-over": overColumn.value === column.id ? "" : void 0,
189
- class: "flex min-h-16 flex-col gap-2 rounded-md data-[over]:bg-accent",
190
- onDragover: ($event) => onDragOver($event, column.id),
191
- onDragleave: ($event) => onDragLeave($event, column.id),
192
- onDrop: ($event) => onDrop($event, column.id)
193
- }, [
194
- records.length === 0 ? (openBlock(), createElementBlock("p", _hoisted_5, toDisplayString(emptyLabel.value), 1)) : createCommentVNode("", true),
195
- (openBlock(true), createElementBlock(Fragment, null, renderList(records, (record) => {
196
- return openBlock(), createElementBlock("div", {
197
- key: record.id,
198
- role: "button",
199
- tabindex: "0",
200
- "data-slot": "kanban-card",
201
- "data-record-id": String(record.id),
202
- "data-dragging": draggingId.value === String(record.id) ? "" : void 0,
203
- draggable: draggable.value,
204
- class: "flex cursor-pointer items-start gap-2 rounded-md border bg-card p-3 text-sm shadow-xs data-[dragging]:opacity-50",
205
- onClick: ($event) => select(record),
206
- onKeydown: ($event) => onCardKeydown($event, record),
207
- onDragstart: ($event) => onDragStart($event, record),
208
- onDragend: clearDrag
209
- }, [
210
- createElementVNode("div", _hoisted_7, [
211
- _ctx.$slots.card ? renderSlot(_ctx.$slots, "card", {
212
- key: 0,
213
- record
214
- }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
215
- createElementVNode("span", _hoisted_8, toDisplayString(titleOf(record)), 1),
216
- !isEmpty(textOf(record, props.descriptionSource)) ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(String(textOf(record, props.descriptionSource))), 1)) : createCommentVNode("", true)
217
- ], 64))
218
- ]),
219
- draggable.value ? (openBlock(), createElementBlock("div", {
220
- key: 0,
221
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
222
- }, ["stop"]))
223
- }, [
224
- createVNode(unref(_sfc_main$1), null, {
225
- default: withCtx(() => [
226
- createVNode(unref(_sfc_main$2), null, {
227
- default: withCtx(() => [
228
- createVNode(_sfc_main$3, {
229
- type: "button",
230
- variant: "ghost",
231
- size: "icon",
232
- "data-slot": "kanban-card-move",
233
- class: "size-6",
234
- "aria-label": moveLabel(record)
235
- }, {
236
- default: withCtx(() => [
237
- createVNode(unref(ArrowRightLeftIcon))
238
- ]),
239
- _: 1
240
- }, 8, ["aria-label"])
241
- ]),
242
- _: 2
243
- }, 1024),
244
- createVNode(unref(_sfc_main$4), { align: "end" }, {
245
- default: withCtx(() => [
246
- (openBlock(true), createElementBlock(Fragment, null, renderList(othersOf(column.id), (other) => {
247
- return openBlock(), createBlock(unref(_sfc_main$5), {
248
- key: other.id,
249
- onSelect: ($event) => move(record, other.id)
250
- }, {
251
- default: withCtx(() => [
252
- createTextVNode(toDisplayString(other.label), 1)
253
- ]),
254
- _: 2
255
- }, 1032, ["onSelect"]);
256
- }), 128))
257
- ]),
258
- _: 2
259
- }, 1024)
260
- ]),
261
- _: 2
262
- }, 1024)
263
- ])) : createCommentVNode("", true)
264
- ], 40, _hoisted_6);
265
- }), 128))
266
- ], 40, _hoisted_4)
267
- ], 10, _hoisted_1);
268
- }), 128))
269
- ], 2);
270
- };
271
- }
272
- });
273
- export {
274
- _sfc_main as default
275
- };