@stonecrop/desktop 0.33.0 → 0.35.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.
- package/README.md +4 -2
- package/dist/assets/index.css +321 -220
- package/dist/desktop.js +502 -196
- package/dist/desktop.js.map +1 -1
- package/dist/src/components/ActionSet.vue.d.ts +6 -1
- package/dist/src/components/ActionSet.vue.d.ts.map +1 -1
- package/dist/src/components/CommandPalette.vue.d.ts.map +1 -1
- package/dist/src/components/Desktop.vue.d.ts +9 -3
- package/dist/src/components/Desktop.vue.d.ts.map +1 -1
- package/dist/src/components/SheetNav.vue.d.ts.map +1 -1
- package/dist/src/composables/useActionSet.d.ts +23 -0
- package/dist/src/composables/useActionSet.d.ts.map +1 -0
- package/dist/src/icons/index.d.ts +22 -0
- package/dist/src/icons/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/plugins/index.d.ts.map +1 -1
- package/dist/src/sheet-nav-toolbar.d.ts +4 -1
- package/dist/src/sheet-nav-toolbar.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +27 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/desktop.js
CHANGED
|
@@ -1,111 +1,29 @@
|
|
|
1
|
-
import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, nextTick, normalizeClass,
|
|
1
|
+
import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, unref, useId, useTemplateRef, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
2
2
|
import { DRAFT_RECORD_ID, isDraftRecordId, useStonecrop, useValidationStore } from "@stonecrop/stonecrop";
|
|
3
3
|
import { AForm, resolvedFieldsToColumns } from "@stonecrop/aform";
|
|
4
|
-
import './assets/index.css';//#region src/components/
|
|
5
|
-
var _hoisted_1$3 = { class: "
|
|
6
|
-
var _hoisted_2$3 =
|
|
7
|
-
var _hoisted_3$
|
|
8
|
-
var _hoisted_4$2 = { key: 0 };
|
|
9
|
-
var _hoisted_5$2 = { class: "dropdown-header" };
|
|
10
|
-
var _hoisted_6$1 = ["onClick"];
|
|
11
|
-
var _hoisted_7$1 = ["onClick"];
|
|
12
|
-
var _hoisted_8 = { class: "dropdown-container" };
|
|
13
|
-
var _hoisted_9 = { class: "dropdown" };
|
|
14
|
-
var _hoisted_10 = ["onClick"];
|
|
15
|
-
var _hoisted_11 = ["href"];
|
|
16
|
-
var _hoisted_12 = { class: "dropdown-item" };
|
|
17
|
-
var ActionSet_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
18
|
-
__name: "ActionSet",
|
|
19
|
-
props: { elements: { default: () => [] } },
|
|
20
|
-
emits: ["actionClick"],
|
|
21
|
-
setup(__props, { emit: __emit }) {
|
|
22
|
-
const emit = __emit;
|
|
23
|
-
const dropdownStates = ref({});
|
|
24
|
-
const isOpen = ref(true);
|
|
25
|
-
const dropdownOpen = ref([]);
|
|
26
|
-
onMounted(() => {
|
|
27
|
-
closeDropdowns();
|
|
28
|
-
});
|
|
29
|
-
const closeDropdowns = () => {
|
|
30
|
-
dropdownStates.value = {};
|
|
31
|
-
dropdownOpen.value = [];
|
|
32
|
-
};
|
|
33
|
-
const onClick = () => {
|
|
34
|
-
isOpen.value = !isOpen.value;
|
|
35
|
-
};
|
|
36
|
-
const toggleDropdown = (index) => {
|
|
37
|
-
const showDropdown = !dropdownStates.value[index];
|
|
38
|
-
closeDropdowns();
|
|
39
|
-
if (showDropdown) {
|
|
40
|
-
dropdownStates.value[index] = true;
|
|
41
|
-
dropdownOpen.value[index] = true;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const handleClick = (action, label) => {
|
|
45
|
-
emit("actionClick", label, action);
|
|
46
|
-
};
|
|
47
|
-
return (_ctx, _cache) => {
|
|
48
|
-
return openBlock(), createElementBlock("div", { class: normalizeClass([{ collapsed: !isOpen.value }, "action-set"]) }, [
|
|
49
|
-
createElementVNode("div", _hoisted_1$3, [createElementVNode("div", {
|
|
50
|
-
id: "cross",
|
|
51
|
-
class: normalizeClass({ rotated: isOpen.value }),
|
|
52
|
-
onClick
|
|
53
|
-
}, "×", 2)]),
|
|
54
|
-
_cache[0] || (_cache[0] = createElementVNode("div", { style: { "margin-right": "30px" } }, null, -1)),
|
|
55
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.elements, (el, index) => {
|
|
56
|
-
return openBlock(), createElementBlock("div", {
|
|
57
|
-
key: el.label,
|
|
58
|
-
class: "action-element"
|
|
59
|
-
}, [createElementVNode("div", _hoisted_2$3, [el.type == "button" ? (openBlock(), createElementBlock("button", {
|
|
60
|
-
key: 0,
|
|
61
|
-
disabled: el.disabled,
|
|
62
|
-
class: "button-default",
|
|
63
|
-
onClick: ($event) => handleClick(el.action, el.label)
|
|
64
|
-
}, toDisplayString(el.label), 9, _hoisted_3$2)) : createCommentVNode("", true)]), el.type == "dropdown" ? (openBlock(), createElementBlock("div", _hoisted_4$2, [createElementVNode("div", _hoisted_5$2, [createElementVNode("div", {
|
|
65
|
-
class: normalizeClass(["cross", { rotated: dropdownOpen.value[index] }]),
|
|
66
|
-
onClick: ($event) => toggleDropdown(index)
|
|
67
|
-
}, "×", 10, _hoisted_6$1), createElementVNode("button", {
|
|
68
|
-
class: "button-default dropdown-title",
|
|
69
|
-
onClick: ($event) => toggleDropdown(index)
|
|
70
|
-
}, toDisplayString(el.label), 9, _hoisted_7$1)]), withDirectives(createElementVNode("div", _hoisted_8, [createElementVNode("div", _hoisted_9, [(openBlock(true), createElementBlock(Fragment, null, renderList(el.actions, (item) => {
|
|
71
|
-
return openBlock(), createElementBlock("div", { key: item.label }, [item.action != null ? (openBlock(), createElementBlock("button", {
|
|
72
|
-
key: 0,
|
|
73
|
-
class: "dropdown-item",
|
|
74
|
-
onClick: ($event) => handleClick(item.action, item.label)
|
|
75
|
-
}, toDisplayString(item.label), 9, _hoisted_10)) : item.link != null ? (openBlock(), createElementBlock("a", {
|
|
76
|
-
key: 1,
|
|
77
|
-
href: item.link
|
|
78
|
-
}, [createElementVNode("button", _hoisted_12, toDisplayString(item.label), 1)], 8, _hoisted_11)) : createCommentVNode("", true)]);
|
|
79
|
-
}), 128))])], 512), [[vShow, dropdownStates.value[index]]])])) : createCommentVNode("", true)]);
|
|
80
|
-
}), 128))
|
|
81
|
-
], 2);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region \0plugin-vue:export-helper
|
|
87
|
-
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
88
|
-
const target = sfc.__vccOpts || sfc;
|
|
89
|
-
for (const [key, val] of props) target[key] = val;
|
|
90
|
-
return target;
|
|
91
|
-
};
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/components/ActionSet.vue
|
|
94
|
-
var ActionSet_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ActionSet_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8e18f635"]]);
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/components/CommandPalette.vue?vue&type=script&setup=true&lang.ts
|
|
97
|
-
var _hoisted_1$2 = { class: "command-palette-header" };
|
|
98
|
-
var _hoisted_2$2 = ["placeholder"];
|
|
99
|
-
var _hoisted_3$1 = {
|
|
4
|
+
import './assets/index.css';//#region src/components/CommandPalette.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _hoisted_1$3 = { class: "command-palette-header" };
|
|
6
|
+
var _hoisted_2$3 = ["placeholder", "aria-activedescendant"];
|
|
7
|
+
var _hoisted_3$3 = {
|
|
100
8
|
key: 0,
|
|
101
|
-
|
|
9
|
+
id: "command-palette-results",
|
|
10
|
+
class: "command-palette-results",
|
|
11
|
+
role: "listbox",
|
|
12
|
+
"aria-label": "Command results"
|
|
102
13
|
};
|
|
103
|
-
var _hoisted_4$
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
14
|
+
var _hoisted_4$3 = [
|
|
15
|
+
"id",
|
|
16
|
+
"aria-selected",
|
|
17
|
+
"onClick",
|
|
18
|
+
"onMouseover"
|
|
19
|
+
];
|
|
20
|
+
var _hoisted_5$3 = { class: "result-title" };
|
|
21
|
+
var _hoisted_6$2 = { class: "result-content" };
|
|
22
|
+
var _hoisted_7$1 = {
|
|
107
23
|
key: 1,
|
|
108
|
-
class: "command-palette-no-results"
|
|
24
|
+
class: "command-palette-no-results",
|
|
25
|
+
role: "status",
|
|
26
|
+
"aria-live": "polite"
|
|
109
27
|
};
|
|
110
28
|
//#endregion
|
|
111
29
|
//#region src/components/CommandPalette.vue
|
|
@@ -123,6 +41,7 @@ var CommandPalette_default = /* @__PURE__ */ defineComponent({
|
|
|
123
41
|
emits: ["select", "close"],
|
|
124
42
|
setup(__props, { emit: __emit }) {
|
|
125
43
|
const emit = __emit;
|
|
44
|
+
const listboxId = useId();
|
|
126
45
|
const query = ref("");
|
|
127
46
|
const selectedIndex = ref(0);
|
|
128
47
|
const inputRef = useTemplateRef("input");
|
|
@@ -172,41 +91,359 @@ var CommandPalette_default = /* @__PURE__ */ defineComponent({
|
|
|
172
91
|
onClick: closeModal
|
|
173
92
|
}, [createElementVNode("div", {
|
|
174
93
|
class: "command-palette",
|
|
94
|
+
role: "dialog",
|
|
95
|
+
"aria-modal": "true",
|
|
96
|
+
"aria-label": "Command palette",
|
|
175
97
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
|
|
176
|
-
}, [createElementVNode("div", _hoisted_1$
|
|
98
|
+
}, [createElementVNode("div", _hoisted_1$3, [withDirectives(createElementVNode("input", {
|
|
177
99
|
ref: "input",
|
|
178
100
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => query.value = $event),
|
|
179
101
|
type: "text",
|
|
180
102
|
class: "command-palette-input",
|
|
181
103
|
placeholder: __props.placeholder,
|
|
104
|
+
"aria-label": "Search commands",
|
|
105
|
+
"aria-activedescendant": results.value.length && selectedIndex.value >= 0 ? `${unref(listboxId)}-opt-${selectedIndex.value}` : void 0,
|
|
106
|
+
"aria-controls": "command-palette-results",
|
|
182
107
|
autofocus: "",
|
|
183
108
|
onKeydown: handleKeydown
|
|
184
|
-
}, null, 40, _hoisted_2$
|
|
109
|
+
}, null, 40, _hoisted_2$3), [[vModelText, query.value]])]), results.value.length ? (openBlock(), createElementBlock("div", _hoisted_3$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(results.value, (result, index) => {
|
|
185
110
|
return openBlock(), createElementBlock("div", {
|
|
111
|
+
id: `${unref(listboxId)}-opt-${index}`,
|
|
186
112
|
key: index,
|
|
187
113
|
class: normalizeClass(["command-palette-result", { selected: index === selectedIndex.value }]),
|
|
114
|
+
role: "option",
|
|
115
|
+
"aria-selected": index === selectedIndex.value,
|
|
188
116
|
onClick: ($event) => selectResult(result),
|
|
189
117
|
onMouseover: ($event) => selectedIndex.value = index
|
|
190
|
-
}, [createElementVNode("div", _hoisted_5$
|
|
191
|
-
}), 128))])) : query.value && !results.value.length ? (openBlock(), createElementBlock("div", _hoisted_7, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(" No results found for \"" + toDisplayString(query.value) + "\" ", 1)])])) : createCommentVNode("", true)])])) : createCommentVNode("", true)]),
|
|
118
|
+
}, [createElementVNode("div", _hoisted_5$3, [renderSlot(_ctx.$slots, "title", { result })]), createElementVNode("div", _hoisted_6$2, [renderSlot(_ctx.$slots, "content", { result })])], 42, _hoisted_4$3);
|
|
119
|
+
}), 128))])) : query.value && !results.value.length ? (openBlock(), createElementBlock("div", _hoisted_7$1, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(" No results found for \"" + toDisplayString(query.value) + "\" ", 1)])])) : createCommentVNode("", true)])])) : createCommentVNode("", true)]),
|
|
192
120
|
_: 3
|
|
193
121
|
})]);
|
|
194
122
|
};
|
|
195
123
|
}
|
|
196
124
|
});
|
|
197
125
|
//#endregion
|
|
126
|
+
//#region src/icons/index.ts
|
|
127
|
+
/**
|
|
128
|
+
* Shared 24×24 stroke chrome for ActionSet and shell icons.
|
|
129
|
+
* Paths are Lucide (or a reduced Autoreader tray) so 16px tiles stay a distinct silhouette.
|
|
130
|
+
*/
|
|
131
|
+
function actionSetIcon(name, children) {
|
|
132
|
+
return defineComponent({
|
|
133
|
+
name,
|
|
134
|
+
inheritAttrs: false,
|
|
135
|
+
setup(_, { attrs }) {
|
|
136
|
+
return () => h("svg", mergeProps({
|
|
137
|
+
viewBox: "0 0 24 24",
|
|
138
|
+
fill: "none",
|
|
139
|
+
stroke: "currentColor",
|
|
140
|
+
"stroke-width": "2",
|
|
141
|
+
"stroke-linecap": "round",
|
|
142
|
+
"stroke-linejoin": "round",
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
}, attrs), children());
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** Two flowchart nodes and a connecting elbow — FSM / BPA “move”. @public */
|
|
149
|
+
var ActionSetIconActions = actionSetIcon("ActionSetIconActions", () => [
|
|
150
|
+
h("rect", {
|
|
151
|
+
width: "8",
|
|
152
|
+
height: "8",
|
|
153
|
+
x: "3",
|
|
154
|
+
y: "3",
|
|
155
|
+
rx: "2"
|
|
156
|
+
}),
|
|
157
|
+
h("path", { d: "M7 11v4a2 2 0 0 0 2 2h4" }),
|
|
158
|
+
h("rect", {
|
|
159
|
+
width: "8",
|
|
160
|
+
height: "8",
|
|
161
|
+
x: "13",
|
|
162
|
+
y: "13",
|
|
163
|
+
rx: "2"
|
|
164
|
+
})
|
|
165
|
+
]);
|
|
166
|
+
/** Magnifier. @public */
|
|
167
|
+
var ActionSetIconSearch = actionSetIcon("ActionSetIconSearch", () => [h("circle", {
|
|
168
|
+
cx: "11",
|
|
169
|
+
cy: "11",
|
|
170
|
+
r: "8"
|
|
171
|
+
}), h("path", { d: "m21 21-4.3-4.3" })]);
|
|
172
|
+
/** Speech bubble with a tail. @public */
|
|
173
|
+
var ActionSetIconChat = actionSetIcon("ActionSetIconChat", () => [h("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" })]);
|
|
174
|
+
/** Autoreader stacked trays, reduced to 24 viewBox. @public */
|
|
175
|
+
var ActionSetIconEmail = actionSetIcon("ActionSetIconEmail", () => [
|
|
176
|
+
h("rect", {
|
|
177
|
+
x: "5",
|
|
178
|
+
y: "3",
|
|
179
|
+
width: "14",
|
|
180
|
+
height: "8",
|
|
181
|
+
rx: "1.5"
|
|
182
|
+
}),
|
|
183
|
+
h("path", { d: "M8 7h8" }),
|
|
184
|
+
h("path", { d: "M3 12h18" }),
|
|
185
|
+
h("rect", {
|
|
186
|
+
x: "5",
|
|
187
|
+
y: "13",
|
|
188
|
+
width: "14",
|
|
189
|
+
height: "8",
|
|
190
|
+
rx: "1.5"
|
|
191
|
+
}),
|
|
192
|
+
h("path", { d: "M8 17h8" })
|
|
193
|
+
]);
|
|
194
|
+
/** Paperclip — attachments, not another document. @public */
|
|
195
|
+
var ActionSetIconFiles = actionSetIcon("ActionSetIconFiles", () => [h("path", { d: "m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486" })]);
|
|
196
|
+
/** Page with a check — the Approvals stamp, simplified. @public */
|
|
197
|
+
var ActionSetIconApprovals = actionSetIcon("ActionSetIconApprovals", () => [
|
|
198
|
+
h("path", { d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.687.687l3.626 3.626A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z" }),
|
|
199
|
+
h("path", { d: "M14 2v5a1 1 0 0 0 1 1h5" }),
|
|
200
|
+
h("path", { d: "m9 15 2 2 4-4" })
|
|
201
|
+
]);
|
|
202
|
+
/** Three rising bars — reports / BI. @public */
|
|
203
|
+
var ActionSetIconReports = actionSetIcon("ActionSetIconReports", () => [
|
|
204
|
+
h("path", { d: "M5 21v-6" }),
|
|
205
|
+
h("path", { d: "M12 21V3" }),
|
|
206
|
+
h("path", { d: "M19 21V9" })
|
|
207
|
+
]);
|
|
208
|
+
/** Printer. @public */
|
|
209
|
+
var ActionSetIconPrint = actionSetIcon("ActionSetIconPrint", () => [
|
|
210
|
+
h("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
|
|
211
|
+
h("path", { d: "M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" }),
|
|
212
|
+
h("rect", {
|
|
213
|
+
x: "6",
|
|
214
|
+
y: "14",
|
|
215
|
+
width: "12",
|
|
216
|
+
height: "8",
|
|
217
|
+
rx: "1"
|
|
218
|
+
})
|
|
219
|
+
]);
|
|
220
|
+
/** Gear. @public */
|
|
221
|
+
var ActionSetIconSettings = actionSetIcon("ActionSetIconSettings", () => [h("path", { d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" }), h("circle", {
|
|
222
|
+
cx: "12",
|
|
223
|
+
cy: "12",
|
|
224
|
+
r: "3"
|
|
225
|
+
})]);
|
|
226
|
+
/** Circled question mark. @public */
|
|
227
|
+
var ActionSetIconHelp = actionSetIcon("ActionSetIconHelp", () => [
|
|
228
|
+
h("circle", {
|
|
229
|
+
cx: "12",
|
|
230
|
+
cy: "12",
|
|
231
|
+
r: "10"
|
|
232
|
+
}),
|
|
233
|
+
h("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
234
|
+
h("path", { d: "M12 17h.01" })
|
|
235
|
+
]);
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/components/ActionSet.vue?vue&type=script&setup=true&lang.ts
|
|
238
|
+
var _hoisted_1$2 = {
|
|
239
|
+
class: "action-set__tile",
|
|
240
|
+
role: "presentation"
|
|
241
|
+
};
|
|
242
|
+
var _hoisted_2$2 = ["aria-expanded"];
|
|
243
|
+
var _hoisted_3$2 = [
|
|
244
|
+
"aria-label",
|
|
245
|
+
"aria-current",
|
|
246
|
+
"title",
|
|
247
|
+
"onClick"
|
|
248
|
+
];
|
|
249
|
+
var _hoisted_4$2 = {
|
|
250
|
+
key: 1,
|
|
251
|
+
class: "action-set__item-fallback",
|
|
252
|
+
"aria-hidden": "true"
|
|
253
|
+
};
|
|
254
|
+
var _hoisted_5$2 = {
|
|
255
|
+
key: 2,
|
|
256
|
+
class: "action-set__item-badge"
|
|
257
|
+
};
|
|
258
|
+
var _hoisted_6$1 = { class: "action-set__drawer-header" };
|
|
259
|
+
var _hoisted_7 = { class: "action-set__drawer-body" };
|
|
260
|
+
var _hoisted_8 = {
|
|
261
|
+
key: 0,
|
|
262
|
+
class: "action-set__actions-list"
|
|
263
|
+
};
|
|
264
|
+
var _hoisted_9 = ["aria-label"];
|
|
265
|
+
var _hoisted_10 = {
|
|
266
|
+
class: "action-set__actions-group-label",
|
|
267
|
+
"aria-hidden": "true"
|
|
268
|
+
};
|
|
269
|
+
var _hoisted_11 = ["onClick"];
|
|
270
|
+
var _hoisted_12 = ["href"];
|
|
271
|
+
var _hoisted_13 = ["href"];
|
|
272
|
+
var _hoisted_14 = ["disabled", "onClick"];
|
|
273
|
+
var _hoisted_15 = {
|
|
274
|
+
key: 0,
|
|
275
|
+
class: "action-set__actions-empty"
|
|
276
|
+
};
|
|
277
|
+
var _hoisted_16 = {
|
|
278
|
+
key: 1,
|
|
279
|
+
class: "action-set__drawer-empty"
|
|
280
|
+
};
|
|
281
|
+
var ACTIONS_TAB_ID = "__actions__";
|
|
282
|
+
var SEARCH_TAB_ID = "__search__";
|
|
283
|
+
var ActionSet_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
284
|
+
__name: "ActionSet",
|
|
285
|
+
props: {
|
|
286
|
+
slots: { default: () => [] },
|
|
287
|
+
elements: { default: () => [] },
|
|
288
|
+
controller: {}
|
|
289
|
+
},
|
|
290
|
+
emits: ["actionClick", "search"],
|
|
291
|
+
setup(__props, { emit: __emit }) {
|
|
292
|
+
const emit = __emit;
|
|
293
|
+
const isExpanded = ref(true);
|
|
294
|
+
const drawerEl = ref(null);
|
|
295
|
+
const lastFocusedBeforeDrawer = ref(null);
|
|
296
|
+
const activeSlot = computed(() => __props.slots.find((slot) => slot.id === __props.controller.activeSlotId.value) ?? null);
|
|
297
|
+
const hasActions = computed(() => __props.elements.length > 0);
|
|
298
|
+
const activeTabId = computed(() => __props.controller.isActionsOpen.value ? ACTIONS_TAB_ID : __props.controller.activeSlotId.value);
|
|
299
|
+
const drawerOpen = computed(() => __props.controller.isDrawerOpen.value);
|
|
300
|
+
const allTabs = computed(() => {
|
|
301
|
+
const tabs = [{
|
|
302
|
+
id: SEARCH_TAB_ID,
|
|
303
|
+
label: "Search",
|
|
304
|
+
icon: markRaw(ActionSetIconSearch)
|
|
305
|
+
}];
|
|
306
|
+
for (const slot of __props.slots) tabs.push({
|
|
307
|
+
id: slot.id,
|
|
308
|
+
label: slot.label,
|
|
309
|
+
icon: slot.icon,
|
|
310
|
+
badge: slot.badge !== void 0 ? unref(slot.badge) : void 0
|
|
311
|
+
});
|
|
312
|
+
if (hasActions.value) tabs.push({
|
|
313
|
+
id: ACTIONS_TAB_ID,
|
|
314
|
+
label: "Actions",
|
|
315
|
+
icon: markRaw(ActionSetIconActions)
|
|
316
|
+
});
|
|
317
|
+
return tabs;
|
|
318
|
+
});
|
|
319
|
+
function slotFallback(label) {
|
|
320
|
+
return label.trim().charAt(0).toUpperCase() || "?";
|
|
321
|
+
}
|
|
322
|
+
function tabBadge(tab) {
|
|
323
|
+
const count = tab.badge;
|
|
324
|
+
return typeof count === "number" && count > 0 ? count : 0;
|
|
325
|
+
}
|
|
326
|
+
function onDrawerKeydown(event) {
|
|
327
|
+
if (event.key !== "Escape") return;
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
event.stopPropagation();
|
|
330
|
+
__props.controller.close();
|
|
331
|
+
}
|
|
332
|
+
function onToggle() {
|
|
333
|
+
isExpanded.value = !isExpanded.value;
|
|
334
|
+
}
|
|
335
|
+
function onTileClick(tabId) {
|
|
336
|
+
if (tabId === SEARCH_TAB_ID) emit("search");
|
|
337
|
+
else if (drawerOpen.value && activeTabId.value === tabId) __props.controller.close();
|
|
338
|
+
else if (tabId === ACTIONS_TAB_ID) __props.controller.openActions();
|
|
339
|
+
else __props.controller.openSlot(tabId);
|
|
340
|
+
}
|
|
341
|
+
function onActionClick(label, action) {
|
|
342
|
+
if (action) emit("actionClick", label, action);
|
|
343
|
+
}
|
|
344
|
+
watch(drawerOpen, async (open) => {
|
|
345
|
+
if (open) {
|
|
346
|
+
lastFocusedBeforeDrawer.value = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
347
|
+
await nextTick();
|
|
348
|
+
drawerEl.value?.querySelector("button:not([disabled]), [href], input, select, textarea")?.focus();
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
lastFocusedBeforeDrawer.value?.focus();
|
|
352
|
+
lastFocusedBeforeDrawer.value = null;
|
|
353
|
+
});
|
|
354
|
+
return (_ctx, _cache) => {
|
|
355
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(["action-set", {
|
|
356
|
+
"action-set--expanded": isExpanded.value,
|
|
357
|
+
"action-set--drawer-open": drawerOpen.value
|
|
358
|
+
}]) }, [createElementVNode("div", _hoisted_1$2, [createElementVNode("button", {
|
|
359
|
+
type: "button",
|
|
360
|
+
class: normalizeClass(["action-set__toggle", { "action-set__toggle--expanded": isExpanded.value }]),
|
|
361
|
+
"aria-label": "Toggle menu",
|
|
362
|
+
"aria-expanded": isExpanded.value,
|
|
363
|
+
onClick: onToggle
|
|
364
|
+
}, " + ", 10, _hoisted_2$2), isExpanded.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(allTabs.value, (tab) => {
|
|
365
|
+
return openBlock(), createElementBlock("button", {
|
|
366
|
+
key: tab.id,
|
|
367
|
+
type: "button",
|
|
368
|
+
class: normalizeClass(["action-set__item", { "action-set__item--active": drawerOpen.value && activeTabId.value === tab.id }]),
|
|
369
|
+
"aria-label": tab.label,
|
|
370
|
+
"aria-current": drawerOpen.value && activeTabId.value === tab.id ? "page" : void 0,
|
|
371
|
+
title: tab.label,
|
|
372
|
+
onClick: ($event) => onTileClick(tab.id)
|
|
373
|
+
}, [tab.icon ? (openBlock(), createBlock(resolveDynamicComponent(tab.icon), {
|
|
374
|
+
key: 0,
|
|
375
|
+
class: "action-set__item-icon"
|
|
376
|
+
})) : (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(slotFallback(tab.label)), 1)), tabBadge(tab) > 0 ? (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(tabBadge(tab)), 1)) : createCommentVNode("", true)], 10, _hoisted_3$2);
|
|
377
|
+
}), 128)) : createCommentVNode("", true)]), drawerOpen.value ? (openBlock(), createElementBlock("aside", {
|
|
378
|
+
key: 0,
|
|
379
|
+
ref_key: "drawerEl",
|
|
380
|
+
ref: drawerEl,
|
|
381
|
+
class: "action-set__drawer",
|
|
382
|
+
"aria-label": "Side panel",
|
|
383
|
+
onKeydown: onDrawerKeydown
|
|
384
|
+
}, [createElementVNode("header", _hoisted_6$1, [createElementVNode("button", {
|
|
385
|
+
type: "button",
|
|
386
|
+
class: "action-set__drawer-close",
|
|
387
|
+
"aria-label": "Close panel",
|
|
388
|
+
onClick: _cache[0] || (_cache[0] = ($event) => __props.controller.close())
|
|
389
|
+
}, " × ")]), createElementVNode("div", _hoisted_7, [activeTabId.value === ACTIONS_TAB_ID ? (openBlock(), createElementBlock("div", _hoisted_8, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.elements, (el) => {
|
|
390
|
+
return openBlock(), createElementBlock(Fragment, { key: el.label }, [el.type === "dropdown" ? (openBlock(), createElementBlock("div", {
|
|
391
|
+
key: 0,
|
|
392
|
+
class: "action-set__actions-group",
|
|
393
|
+
role: "group",
|
|
394
|
+
"aria-label": el.label
|
|
395
|
+
}, [createElementVNode("p", _hoisted_10, toDisplayString(el.label), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(el.actions, (item) => {
|
|
396
|
+
return openBlock(), createElementBlock(Fragment, { key: item.label }, [item.action ? (openBlock(), createElementBlock("button", {
|
|
397
|
+
key: 0,
|
|
398
|
+
type: "button",
|
|
399
|
+
class: "action-set__actions-list-item action-set__actions-list-item--nested",
|
|
400
|
+
onClick: ($event) => onActionClick(item.label, item.action)
|
|
401
|
+
}, toDisplayString(item.label), 9, _hoisted_11)) : item.link ? (openBlock(), createElementBlock("a", {
|
|
402
|
+
key: 1,
|
|
403
|
+
href: item.link,
|
|
404
|
+
class: "action-set__actions-list-item action-set__actions-list-item--nested"
|
|
405
|
+
}, toDisplayString(item.label), 9, _hoisted_12)) : createCommentVNode("", true)], 64);
|
|
406
|
+
}), 128))], 8, _hoisted_9)) : !el.action && el.link ? (openBlock(), createElementBlock("a", {
|
|
407
|
+
key: 1,
|
|
408
|
+
href: el.link,
|
|
409
|
+
class: "action-set__actions-list-item"
|
|
410
|
+
}, toDisplayString(el.label), 9, _hoisted_13)) : (openBlock(), createElementBlock("button", {
|
|
411
|
+
key: 2,
|
|
412
|
+
type: "button",
|
|
413
|
+
class: "action-set__actions-list-item",
|
|
414
|
+
disabled: el.disabled,
|
|
415
|
+
onClick: ($event) => onActionClick(el.label, el.action)
|
|
416
|
+
}, toDisplayString(el.label), 9, _hoisted_14))], 64);
|
|
417
|
+
}), 128)), __props.elements.length === 0 ? (openBlock(), createElementBlock("p", _hoisted_15, "No actions available")) : createCommentVNode("", true)])) : activeSlot.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [activeSlot.value.component ? (openBlock(), createBlock(resolveDynamicComponent(activeSlot.value.component), { key: activeSlot.value.id })) : (openBlock(), createElementBlock("p", _hoisted_16, "No content"))], 64)) : createCommentVNode("", true)])], 544)) : createCommentVNode("", true)], 2);
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region \0plugin-vue:export-helper
|
|
423
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
424
|
+
const target = sfc.__vccOpts || sfc;
|
|
425
|
+
for (const [key, val] of props) target[key] = val;
|
|
426
|
+
return target;
|
|
427
|
+
};
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/components/ActionSet.vue
|
|
430
|
+
var ActionSet_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ActionSet_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-40295597"]]);
|
|
431
|
+
//#endregion
|
|
198
432
|
//#region src/sheet-nav-toolbar.ts
|
|
199
433
|
/** The id of the element SheetNav renders for footer controls, left of its tabs. */
|
|
200
434
|
var SHEET_NAV_TOOLBAR_ID = "sheetnav-toolbar";
|
|
201
|
-
/**
|
|
435
|
+
/**
|
|
436
|
+
* Teleport target for footer controls rendered anywhere on the page: `<Teleport :to="SHEET_NAV_TOOLBAR_SELECTOR">`.
|
|
437
|
+
* @public
|
|
438
|
+
*/
|
|
202
439
|
var SHEET_NAV_TOOLBAR_SELECTOR = `#${SHEET_NAV_TOOLBAR_ID}`;
|
|
203
440
|
//#endregion
|
|
204
441
|
//#region src/components/SheetNav.vue?vue&type=script&setup=true&lang.ts
|
|
205
442
|
var _hoisted_1$1 = { class: "sheetnav-footer-cluster" };
|
|
206
443
|
var _hoisted_2$1 = ["id"];
|
|
207
|
-
var _hoisted_3 = { class: "tabs" };
|
|
208
|
-
var _hoisted_4 = {
|
|
209
|
-
var _hoisted_5 =
|
|
444
|
+
var _hoisted_3$1 = { class: "tabs" };
|
|
445
|
+
var _hoisted_4$1 = { class: "hidebreadcrumbs" };
|
|
446
|
+
var _hoisted_5$1 = ["aria-label", "aria-expanded"];
|
|
210
447
|
//#endregion
|
|
211
448
|
//#region src/components/SheetNav.vue
|
|
212
449
|
var SheetNav_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
@@ -217,52 +454,39 @@ var SheetNav_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
217
454
|
if (document.querySelectorAll(SHEET_NAV_TOOLBAR_SELECTOR).length > 1) console.warn(`More than one SheetNav is mounted: content teleported to ${SHEET_NAV_TOOLBAR_SELECTOR} lands in the first one only.`);
|
|
218
455
|
});
|
|
219
456
|
const breadcrumbsVisibile = ref(true);
|
|
220
|
-
const searchVisible = ref(false);
|
|
221
|
-
const searchText = ref("");
|
|
222
|
-
const inputRef = useTemplateRef("searchinput");
|
|
223
457
|
const rotateHideTabIcon = computed(() => {
|
|
224
458
|
return breadcrumbsVisibile.value ? "unrotated" : "rotated";
|
|
225
459
|
});
|
|
226
460
|
const toggleBreadcrumbs = () => {
|
|
227
461
|
breadcrumbsVisibile.value = !breadcrumbsVisibile.value;
|
|
228
462
|
};
|
|
229
|
-
const toggleSearch = async () => {
|
|
230
|
-
searchVisible.value = !searchVisible.value;
|
|
231
|
-
await nextTick(() => {
|
|
232
|
-
inputRef.value?.focus();
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
const handleSearchInput = (event) => {
|
|
236
|
-
event.preventDefault();
|
|
237
|
-
event.stopPropagation();
|
|
238
|
-
};
|
|
239
|
-
const handleSearch = async (event) => {
|
|
240
|
-
event.preventDefault();
|
|
241
|
-
event.stopPropagation();
|
|
242
|
-
await toggleSearch();
|
|
243
|
-
};
|
|
244
463
|
const navigateHome = () => {};
|
|
245
464
|
return (_ctx, _cache) => {
|
|
246
465
|
const _component_router_link = resolveComponent("router-link");
|
|
247
466
|
return openBlock(), createElementBlock("footer", null, [createElementVNode("div", _hoisted_1$1, [createElementVNode("div", {
|
|
248
467
|
id: unref(SHEET_NAV_TOOLBAR_ID),
|
|
249
468
|
class: "sheetnav-toolbar"
|
|
250
|
-
}, [renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)], 8, _hoisted_2$1), createElementVNode("ul", _hoisted_3, [
|
|
251
|
-
createElementVNode("li", {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
469
|
+
}, [renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)], 8, _hoisted_2$1), createElementVNode("ul", _hoisted_3$1, [
|
|
470
|
+
createElementVNode("li", _hoisted_4$1, [createElementVNode("button", {
|
|
471
|
+
type: "button",
|
|
472
|
+
class: "hidebreadcrumbs-btn",
|
|
473
|
+
"aria-label": breadcrumbsVisibile.value ? "Hide breadcrumbs" : "Show breadcrumbs",
|
|
474
|
+
"aria-expanded": breadcrumbsVisibile.value,
|
|
475
|
+
onClick: toggleBreadcrumbs
|
|
476
|
+
}, [createElementVNode("span", {
|
|
477
|
+
class: normalizeClass(rotateHideTabIcon.value),
|
|
478
|
+
"aria-hidden": "true"
|
|
479
|
+
}, "×", 2)], 8, _hoisted_5$1)]),
|
|
480
|
+
breadcrumbsVisibile.value ? (openBlock(), createElementBlock("li", {
|
|
481
|
+
key: 0,
|
|
257
482
|
class: "hometab",
|
|
258
|
-
style: normalizeStyle({ display: breadcrumbsVisibile.value ? "flex" : "none" }),
|
|
259
483
|
onClick: navigateHome,
|
|
260
484
|
onKeydown: withKeys(navigateHome, ["enter"])
|
|
261
485
|
}, [createVNode(_component_router_link, {
|
|
262
486
|
to: "/",
|
|
263
487
|
tabindex: "0"
|
|
264
488
|
}, {
|
|
265
|
-
default: withCtx(() => [..._cache[
|
|
489
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
266
490
|
class: "icon",
|
|
267
491
|
"aria-label": "Home",
|
|
268
492
|
viewBox: "0 0 24 24",
|
|
@@ -271,67 +495,103 @@ var SheetNav_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
271
495
|
"stroke-width": "2"
|
|
272
496
|
}, [createElementVNode("path", { d: "M3 12l9-9 9 9" }), createElementVNode("path", { d: "M9 21V12h6v9" })], -1)])]),
|
|
273
497
|
_: 1
|
|
274
|
-
})],
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
style: normalizeStyle({ display: breadcrumbsVisibile.value ? "flex" : "none" })
|
|
278
|
-
}, [createElementVNode("a", _hoisted_5, [withDirectives((openBlock(), createElementBlock("svg", {
|
|
279
|
-
class: "icon search-icon",
|
|
280
|
-
role: "button",
|
|
281
|
-
"aria-label": "Search",
|
|
282
|
-
viewBox: "0 0 24 24",
|
|
283
|
-
fill: "none",
|
|
284
|
-
stroke: "currentColor",
|
|
285
|
-
"stroke-width": "2",
|
|
286
|
-
onClick: toggleSearch,
|
|
287
|
-
onKeydown: withKeys(toggleSearch, ["enter"])
|
|
288
|
-
}, [..._cache[6] || (_cache[6] = [createElementVNode("circle", {
|
|
289
|
-
cx: "11",
|
|
290
|
-
cy: "11",
|
|
291
|
-
r: "7"
|
|
292
|
-
}, null, -1), createElementVNode("path", { d: "M21 21l-4.35-4.35" }, null, -1)])], 544)), [[vShow, !searchVisible.value]]), withDirectives(createElementVNode("input", {
|
|
293
|
-
ref: "searchinput",
|
|
294
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
|
|
295
|
-
type: "text",
|
|
296
|
-
placeholder: "Search...",
|
|
297
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
|
|
298
|
-
onInput: _cache[2] || (_cache[2] = ($event) => handleSearchInput($event)),
|
|
299
|
-
onBlur: _cache[3] || (_cache[3] = ($event) => handleSearch($event)),
|
|
300
|
-
onKeydown: [_cache[4] || (_cache[4] = withKeys(($event) => handleSearch($event), ["enter"])), withKeys(toggleSearch, ["escape"])]
|
|
301
|
-
}, null, 544), [[vShow, searchVisible.value], [vModelText, searchText.value]])])], 6),
|
|
302
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.breadcrumbs, (breadcrumb) => {
|
|
303
|
-
return openBlock(), createElementBlock("li", {
|
|
304
|
-
key: breadcrumb.title,
|
|
305
|
-
style: normalizeStyle({ display: breadcrumbsVisibile.value ? "flex" : "none" })
|
|
306
|
-
}, [createVNode(_component_router_link, {
|
|
498
|
+
})], 32)) : createCommentVNode("", true),
|
|
499
|
+
breadcrumbsVisibile.value ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(__props.breadcrumbs, (breadcrumb) => {
|
|
500
|
+
return openBlock(), createElementBlock("li", { key: breadcrumb.title }, [createVNode(_component_router_link, {
|
|
307
501
|
tabindex: "0",
|
|
308
502
|
to: breadcrumb.to
|
|
309
503
|
}, {
|
|
310
504
|
default: withCtx(() => [createTextVNode(toDisplayString(breadcrumb.title), 1)]),
|
|
311
505
|
_: 2
|
|
312
|
-
}, 1032, ["to"])]
|
|
313
|
-
}), 128))
|
|
506
|
+
}, 1032, ["to"])]);
|
|
507
|
+
}), 128)) : createCommentVNode("", true)
|
|
314
508
|
])])]);
|
|
315
509
|
};
|
|
316
510
|
}
|
|
317
|
-
}), [["__scopeId", "data-v-
|
|
511
|
+
}), [["__scopeId", "data-v-cdbbd2a0"]]);
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/composables/useActionSet.ts
|
|
514
|
+
var actionSetKey = Symbol("actionSet");
|
|
515
|
+
function createActionSet(options) {
|
|
516
|
+
const activeSlotId = ref(null);
|
|
517
|
+
const actionsOpen = ref(false);
|
|
518
|
+
const previewSubject = shallowRef(null);
|
|
519
|
+
const previewId = ref(void 0);
|
|
520
|
+
function openActions() {
|
|
521
|
+
activeSlotId.value = null;
|
|
522
|
+
closePreview();
|
|
523
|
+
actionsOpen.value = true;
|
|
524
|
+
}
|
|
525
|
+
function openSlot(slotId) {
|
|
526
|
+
actionsOpen.value = false;
|
|
527
|
+
if (activeSlotId.value === slotId) return;
|
|
528
|
+
activeSlotId.value = slotId;
|
|
529
|
+
closePreview();
|
|
530
|
+
}
|
|
531
|
+
function present(subject) {
|
|
532
|
+
if (subject.id !== void 0 && subject.id === previewId.value) return;
|
|
533
|
+
previewId.value = subject.id;
|
|
534
|
+
previewSubject.value = {
|
|
535
|
+
...subject,
|
|
536
|
+
view: markRaw(subject.view)
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function closePreview() {
|
|
540
|
+
previewSubject.value = null;
|
|
541
|
+
previewId.value = void 0;
|
|
542
|
+
}
|
|
543
|
+
function close() {
|
|
544
|
+
activeSlotId.value = null;
|
|
545
|
+
actionsOpen.value = false;
|
|
546
|
+
closePreview();
|
|
547
|
+
}
|
|
548
|
+
return {
|
|
549
|
+
doctype: options.doctype,
|
|
550
|
+
recordId: options.recordId,
|
|
551
|
+
activeSlotId: computed(() => activeSlotId.value),
|
|
552
|
+
previewSubject: computed(() => previewSubject.value),
|
|
553
|
+
isPreviewOpen: computed(() => previewSubject.value !== null),
|
|
554
|
+
isActionsOpen: computed(() => actionsOpen.value),
|
|
555
|
+
isDrawerOpen: computed(() => actionsOpen.value || activeSlotId.value !== null),
|
|
556
|
+
present,
|
|
557
|
+
closePreview,
|
|
558
|
+
close,
|
|
559
|
+
openActions,
|
|
560
|
+
openSlot
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
/** @public */
|
|
564
|
+
function useActionSet() {
|
|
565
|
+
const actionSet = inject(actionSetKey, null);
|
|
566
|
+
if (!actionSet) throw new Error("useActionSet() must be called inside a component rendered by Desktop");
|
|
567
|
+
return actionSet;
|
|
568
|
+
}
|
|
318
569
|
//#endregion
|
|
319
570
|
//#region src/components/Desktop.vue?vue&type=script&setup=true&lang.ts
|
|
320
|
-
var _hoisted_1 = {
|
|
321
|
-
|
|
571
|
+
var _hoisted_1 = { class: "desktop__workspace" };
|
|
572
|
+
var _hoisted_2 = { class: "desktop__main" };
|
|
573
|
+
var _hoisted_3 = {
|
|
574
|
+
key: 2,
|
|
322
575
|
class: "loading"
|
|
323
576
|
};
|
|
324
|
-
var
|
|
325
|
-
key:
|
|
577
|
+
var _hoisted_4 = {
|
|
578
|
+
key: 3,
|
|
326
579
|
class: "loading"
|
|
327
580
|
};
|
|
581
|
+
var _hoisted_5 = {
|
|
582
|
+
key: 0,
|
|
583
|
+
class: "desktop__preview"
|
|
584
|
+
};
|
|
585
|
+
var _hoisted_6 = { class: "desktop__preview-body" };
|
|
328
586
|
//#endregion
|
|
329
587
|
//#region src/components/Desktop.vue
|
|
330
|
-
var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
588
|
+
var Desktop_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
331
589
|
__name: "Desktop",
|
|
332
590
|
props: {
|
|
333
591
|
availableDoctypes: { default: () => [] },
|
|
334
|
-
routeAdapter: {}
|
|
592
|
+
routeAdapter: {},
|
|
593
|
+
actionSetSlots: {},
|
|
594
|
+
hostActions: {}
|
|
335
595
|
},
|
|
336
596
|
emits: [
|
|
337
597
|
"action",
|
|
@@ -521,6 +781,7 @@ var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
|
521
781
|
}
|
|
522
782
|
};
|
|
523
783
|
const actionElements = computed(() => {
|
|
784
|
+
if (__props.hostActions) return __props.hostActions;
|
|
524
785
|
const elements = [];
|
|
525
786
|
switch (currentView.value) {
|
|
526
787
|
case "records":
|
|
@@ -887,8 +1148,36 @@ var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
|
887
1148
|
event.preventDefault();
|
|
888
1149
|
commandPaletteOpen.value = true;
|
|
889
1150
|
}
|
|
890
|
-
if (event.key === "Escape"
|
|
1151
|
+
if (event.key === "Escape") {
|
|
1152
|
+
if (commandPaletteOpen.value) {
|
|
1153
|
+
commandPaletteOpen.value = false;
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
if (actionSetController.isPreviewOpen.value) {
|
|
1157
|
+
actionSetController.closePreview();
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
if (actionSetController.isDrawerOpen.value) actionSetController.close();
|
|
1161
|
+
}
|
|
891
1162
|
};
|
|
1163
|
+
const visibleActionSetSlots = computed(() => (__props.actionSetSlots ?? []).filter((slot) => slot.show !== false).map((slot) => Object.assign({}, slot, {
|
|
1164
|
+
icon: slot.icon ? markRaw(slot.icon) : void 0,
|
|
1165
|
+
component: slot.component ? markRaw(slot.component) : void 0
|
|
1166
|
+
})));
|
|
1167
|
+
const actionSetController = createActionSet({
|
|
1168
|
+
doctype: currentDoctype,
|
|
1169
|
+
recordId: currentRecordId
|
|
1170
|
+
});
|
|
1171
|
+
provide(actionSetKey, actionSetController);
|
|
1172
|
+
const actionSetDrawerOpen = computed(() => actionSetController.isDrawerOpen.value);
|
|
1173
|
+
const actionSetPreviewOpen = computed(() => actionSetController.isPreviewOpen.value);
|
|
1174
|
+
const actionSetPreviewSubject = computed(() => actionSetController.previewSubject.value);
|
|
1175
|
+
watch([currentDoctype, currentRecordId], () => {
|
|
1176
|
+
actionSetController.close();
|
|
1177
|
+
});
|
|
1178
|
+
function closeActionSetPreview() {
|
|
1179
|
+
actionSetController.closePreview();
|
|
1180
|
+
}
|
|
892
1181
|
onMounted(() => {
|
|
893
1182
|
document.addEventListener("keydown", handleKeydown);
|
|
894
1183
|
});
|
|
@@ -897,15 +1186,14 @@ var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
|
897
1186
|
});
|
|
898
1187
|
return (_ctx, _cache) => {
|
|
899
1188
|
return openBlock(), createElementBlock("div", {
|
|
900
|
-
class: "desktop",
|
|
1189
|
+
class: normalizeClass(["desktop", {
|
|
1190
|
+
"desktop--action-set-open": actionSetDrawerOpen.value,
|
|
1191
|
+
"desktop--preview-open": actionSetPreviewOpen.value
|
|
1192
|
+
}]),
|
|
901
1193
|
onClick: handleClick
|
|
902
1194
|
}, [
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
onActionClick: handleActionClick
|
|
906
|
-
}, null, 8, ["elements"]),
|
|
907
|
-
currentViewSchema.value.length > 0 ? (openBlock(), createBlock(unref(AForm), {
|
|
908
|
-
key: 0,
|
|
1195
|
+
createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", {}, void 0, true, 0) : currentViewSchema.value.length > 0 ? (openBlock(), createBlock(unref(AForm), {
|
|
1196
|
+
key: 1,
|
|
909
1197
|
data: currentViewData.value,
|
|
910
1198
|
"onUpdate:data": _cache[0] || (_cache[0] = ($event) => currentViewData.value = $event),
|
|
911
1199
|
schema: currentViewSchema.value,
|
|
@@ -914,9 +1202,28 @@ var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
|
914
1202
|
"data",
|
|
915
1203
|
"schema",
|
|
916
1204
|
"errors"
|
|
917
|
-
])) : !unref(stonecrop) ? (openBlock(), createElementBlock("div",
|
|
918
|
-
|
|
919
|
-
|
|
1205
|
+
])) : !unref(stonecrop) ? (openBlock(), createElementBlock("div", _hoisted_3, [..._cache[3] || (_cache[3] = [createElementVNode("p", null, "Initializing Stonecrop...", -1)])])) : (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("p", null, "Loading " + toDisplayString(currentView.value) + " data...", 1)]))]), actionSetPreviewSubject.value ? (openBlock(), createElementBlock("aside", _hoisted_5, [createElementVNode("header", { class: "desktop__preview-header" }, [createElementVNode("button", {
|
|
1206
|
+
type: "button",
|
|
1207
|
+
class: "desktop__preview-close",
|
|
1208
|
+
"aria-label": "Close preview",
|
|
1209
|
+
onClick: closeActionSetPreview
|
|
1210
|
+
}, " × ")]), createElementVNode("div", _hoisted_6, [(openBlock(), createBlock(resolveDynamicComponent(actionSetPreviewSubject.value.view), normalizeProps(guardReactiveProps(actionSetPreviewSubject.value.props ?? {})), null, 16))])])) : createCommentVNode("", true)]),
|
|
1211
|
+
createVNode(ActionSet_default, {
|
|
1212
|
+
slots: visibleActionSetSlots.value,
|
|
1213
|
+
elements: actionElements.value,
|
|
1214
|
+
controller: unref(actionSetController),
|
|
1215
|
+
onActionClick: handleActionClick,
|
|
1216
|
+
onSearch: _cache[1] || (_cache[1] = ($event) => commandPaletteOpen.value = true)
|
|
1217
|
+
}, null, 8, [
|
|
1218
|
+
"slots",
|
|
1219
|
+
"elements",
|
|
1220
|
+
"controller"
|
|
1221
|
+
]),
|
|
1222
|
+
createVNode(SheetNav_default, {
|
|
1223
|
+
class: "desktop__sheetnav",
|
|
1224
|
+
breadcrumbs: navigationBreadcrumbs.value
|
|
1225
|
+
}, {
|
|
1226
|
+
toolbar: withCtx(() => [renderSlot(_ctx.$slots, "sheetnav-toolbar", {}, void 0, true)]),
|
|
920
1227
|
_: 3
|
|
921
1228
|
}, 8, ["breadcrumbs"]),
|
|
922
1229
|
createVNode(CommandPalette_default, {
|
|
@@ -924,16 +1231,16 @@ var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
|
924
1231
|
search: searchCommands,
|
|
925
1232
|
placeholder: "Type a command or search...",
|
|
926
1233
|
onSelect: executeCommand,
|
|
927
|
-
onClose: _cache[
|
|
1234
|
+
onClose: _cache[2] || (_cache[2] = ($event) => commandPaletteOpen.value = false)
|
|
928
1235
|
}, {
|
|
929
1236
|
title: withCtx(({ result }) => [createTextVNode(toDisplayString(result.title), 1)]),
|
|
930
1237
|
content: withCtx(({ result }) => [createTextVNode(toDisplayString(result.description), 1)]),
|
|
931
1238
|
_: 1
|
|
932
1239
|
}, 8, ["is-open"])
|
|
933
|
-
]);
|
|
1240
|
+
], 2);
|
|
934
1241
|
};
|
|
935
1242
|
}
|
|
936
|
-
});
|
|
1243
|
+
}), [["__scopeId", "data-v-378bae6b"]]);
|
|
937
1244
|
//#endregion
|
|
938
1245
|
//#region src/plugins/index.ts
|
|
939
1246
|
/**
|
|
@@ -941,12 +1248,11 @@ var Desktop_default = /* @__PURE__ */ defineComponent({
|
|
|
941
1248
|
* @public
|
|
942
1249
|
*/
|
|
943
1250
|
var plugin = { install: (app) => {
|
|
944
|
-
app.component("ActionSet", ActionSet_default);
|
|
945
1251
|
app.component("CommandPalette", CommandPalette_default);
|
|
946
1252
|
app.component("Desktop", Desktop_default);
|
|
947
1253
|
app.component("SheetNav", SheetNav_default);
|
|
948
1254
|
} };
|
|
949
1255
|
//#endregion
|
|
950
|
-
export {
|
|
1256
|
+
export { ActionSetIconActions, ActionSetIconApprovals, ActionSetIconChat, ActionSetIconEmail, ActionSetIconFiles, ActionSetIconHelp, ActionSetIconPrint, ActionSetIconReports, ActionSetIconSearch, ActionSetIconSettings, CommandPalette_default as CommandPalette, Desktop_default as Desktop, SHEET_NAV_TOOLBAR_SELECTOR, SheetNav_default as SheetNav, plugin as StonecropDesktop, useActionSet };
|
|
951
1257
|
|
|
952
1258
|
//# sourceMappingURL=desktop.js.map
|