quasar-ui-danx 0.4.90 → 0.4.91
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/dist/danx.es.js +1864 -1792
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +39 -39
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Utility/Buttons/ActionButton.vue +11 -2
- package/src/helpers/actions.ts +15 -12
package/package.json
CHANGED
@@ -67,6 +67,7 @@ import {
|
|
67
67
|
FaSolidCopy as CopyIcon,
|
68
68
|
FaSolidDatabase as DatabaseIcon,
|
69
69
|
FaSolidEye as ViewIcon,
|
70
|
+
FaSolidFile as DocumentIcon,
|
70
71
|
FaSolidFileExport as ExportIcon,
|
71
72
|
FaSolidFileImport as ImportIcon,
|
72
73
|
FaSolidFloppyDisk as SaveIcon,
|
@@ -83,8 +84,8 @@ import { computed, ref } from "vue";
|
|
83
84
|
import { ActionTarget, ResourceAction } from "../../../types";
|
84
85
|
|
85
86
|
export interface ActionButtonProps {
|
86
|
-
type?: "save" | "trash" | "back" | "create" | "edit" | "copy" | "folder" | "play" | "stop" | "pause" | "refresh" | "restart" | "confirm" | "cancel" | "export" | "import" | "minus" | "merge" | "check" | "clock" | "view" | "database";
|
87
|
-
color?: "red" | "blue" | "blue-invert" | "sky" | "sky-invert" | "green" | "green-invert" | "lime" | "white" | "gray" | "slate" | "slate-invert" | "yellow" | "orange";
|
87
|
+
type?: "save" | "trash" | "back" | "create" | "edit" | "copy" | "folder" | "document" | "play" | "stop" | "pause" | "refresh" | "restart" | "confirm" | "cancel" | "export" | "import" | "minus" | "merge" | "check" | "clock" | "view" | "database";
|
88
|
+
color?: "red" | "blue" | "blue-invert" | "sky" | "sky-invert" | "green" | "green-invert" | "lime" | "white" | "gray" | "slate" | "slate-invert" | "yellow" | "orange" | "purple" | "teal" | "teal-invert";
|
88
89
|
size?: "xxs" | "xs" | "sm" | "md" | "lg";
|
89
90
|
icon?: object | string;
|
90
91
|
iconClass?: string;
|
@@ -164,6 +165,10 @@ const colorClass = computed(() => {
|
|
164
165
|
return "text-blue-900 bg-blue-300 hover:bg-blue-400";
|
165
166
|
case "blue-invert":
|
166
167
|
return "text-blue-300 bg-blue-900 hover:bg-blue-800";
|
168
|
+
case "teal":
|
169
|
+
return "text-teal-800 bg-teal-200 hover:bg-teal-400";
|
170
|
+
case "teal-invert":
|
171
|
+
return "text-teal-200 bg-teal-500 hover:bg-teal-600";
|
167
172
|
case "sky":
|
168
173
|
return "text-sky-900 bg-sky-300 hover:bg-sky-400";
|
169
174
|
case "sky-invert":
|
@@ -180,6 +185,8 @@ const colorClass = computed(() => {
|
|
180
185
|
return "text-slate-900 bg-slate-300 hover:bg-slate-400";
|
181
186
|
case "slate-invert":
|
182
187
|
return "text-slate-300 bg-slate-900 hover:bg-slate-800";
|
188
|
+
case "purple":
|
189
|
+
return "text-purple-300 bg-purple-900 hover:bg-purple-800";
|
183
190
|
default:
|
184
191
|
return "";
|
185
192
|
}
|
@@ -211,6 +218,8 @@ const typeOptions = computed(() => {
|
|
211
218
|
return { icon: CopyIcon };
|
212
219
|
case "folder":
|
213
220
|
return { icon: FolderIcon };
|
221
|
+
case "document":
|
222
|
+
return { icon: DocumentIcon };
|
214
223
|
case "clock":
|
215
224
|
return { icon: ClockIcon };
|
216
225
|
case "play":
|
package/src/helpers/actions.ts
CHANGED
@@ -25,11 +25,12 @@ export function useActions(actions: ActionOptions[], globalOptions: ActionGlobal
|
|
25
25
|
|
26
26
|
/**
|
27
27
|
* Extend an action so the base action can be modified without affecting other places the action is used.
|
28
|
-
* This isolates the action to the provided id, so it is still re-usable across the system, but does not affect
|
28
|
+
* This isolates the action to the provided id, so it is still re-usable across the system, but does not affect
|
29
|
+
* behavior elsewhere.
|
29
30
|
*
|
30
|
-
* For example, when you have a list of items and you want to perform a callback on the action on a single item,
|
31
|
-
* with the id of the item you want to perform the action on, allowing you to perform
|
32
|
-
* in the list receiving the same callback.
|
31
|
+
* For example, when you have a list of items and you want to perform a callback on the action on a single item,
|
32
|
+
* you can extend the action with the id of the item you want to perform the action on, allowing you to perform
|
33
|
+
* behavior on a single item, instead of all instances in the list receiving the same callback.
|
33
34
|
*/
|
34
35
|
function extendAction(actionName: string, extendedId: string | number, actionOptions: Partial<ActionOptions>): ResourceAction {
|
35
36
|
const action = getAction(actionName);
|
@@ -134,7 +135,8 @@ export function useActions(actions: ActionOptions[], globalOptions: ActionGlobal
|
|
134
135
|
confirm: async (confirmInput: any) => {
|
135
136
|
|
136
137
|
// Resolve the input based on the useInputFromConfirm option
|
137
|
-
// Not setting useInputFromConfirm will merge the input from the confirm dialog with the input
|
138
|
+
// Not setting useInputFromConfirm will merge the input from the confirm dialog with the input
|
139
|
+
// from the action
|
138
140
|
let resolvedInput;
|
139
141
|
if (action.useInputFromConfirm === false) {
|
140
142
|
resolvedInput = input;
|
@@ -207,7 +209,8 @@ function setTargetSavingState(target: ActionTarget, saving: boolean) {
|
|
207
209
|
/**
|
208
210
|
* Execute the confirmed action on the target (ie: calling the server, or whatever the callback function does).
|
209
211
|
*
|
210
|
-
* 1. If the action has an optimistic callback, it will be called before the actual action to immediately update the UI
|
212
|
+
* 1. If the action has an optimistic callback, it will be called before the actual action to immediately update the UI
|
213
|
+
* (non batch actions only).
|
211
214
|
* 2. Call the onBatchAction or onAction callback of the action object, depending on if the target is an array or not.
|
212
215
|
* 3. Call the onSuccess or onError callback based on the result of the action.
|
213
216
|
* 4. Call the onFinish callback of the action object.
|
@@ -310,11 +313,11 @@ async function onConfirmAction(action: ActionOptions, target: ActionTarget, inpu
|
|
310
313
|
export function withDefaultActions(label: string, listController?: ListController): ActionOptions[] {
|
311
314
|
return [
|
312
315
|
{
|
313
|
-
name: "
|
314
|
-
alias: "create"
|
316
|
+
name: "create"
|
315
317
|
},
|
316
318
|
{
|
317
|
-
name: "create",
|
319
|
+
name: "create-with-name",
|
320
|
+
alias: "create",
|
318
321
|
label: "Create " + label,
|
319
322
|
vnode: () => h(CreateNewWithNameDialog, { title: "Create " + label }),
|
320
323
|
onFinish: listController && ((result) => {
|
@@ -345,11 +348,11 @@ export function withDefaultActions(label: string, listController?: ListControlle
|
|
345
348
|
onAction: (action, target) => listController?.activatePanel(target, "edit")
|
346
349
|
},
|
347
350
|
{
|
348
|
-
name: "
|
349
|
-
alias: "delete"
|
351
|
+
name: "delete"
|
350
352
|
},
|
351
353
|
{
|
352
|
-
name: "delete",
|
354
|
+
name: "delete-with-confirm",
|
355
|
+
alias: "delete",
|
353
356
|
label: "Delete",
|
354
357
|
class: "text-red-500",
|
355
358
|
iconClass: "text-red-500",
|