quasar-ui-danx 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/danx.es.js +5246 -5265
- package/dist/danx.es.js.map +1 -1
- package/dist/danx.umd.js +5 -5
- package/dist/danx.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ActionTable/ActionTable.vue +4 -3
- package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +10 -9
- package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +34 -33
- package/src/components/ActionTable/Form/Fields/NumberField.vue +60 -59
- package/src/components/ActionTable/Form/Fields/SelectField.vue +135 -135
- package/src/components/ActionTable/Form/RenderedForm.vue +1 -5
- package/src/components/ActionTable/Layouts/ActionTableLayout.vue +8 -3
- package/src/components/ActionTable/Toolbars/ActionToolbar.vue +7 -7
- package/src/components/ActionTable/tableColumns.ts +66 -66
- package/src/components/Utility/Dialogs/ConfirmDialog.vue +69 -115
- package/src/components/Utility/Dialogs/DialogLayout.vue +95 -0
- package/src/components/Utility/Dialogs/InfoDialog.vue +40 -80
- package/src/components/Utility/Tools/RenderVnode.vue +21 -12
- package/src/helpers/actions.ts +6 -6
- package/src/styles/quasar-reset.scss +79 -68
- package/src/styles/themes/danx/dialogs.scss +43 -0
- package/src/styles/themes/danx/forms.scss +18 -0
- package/src/styles/themes/danx/index.scss +4 -0
package/package.json
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
ref="actionTable"
|
9
9
|
:selected="selectedRows"
|
10
10
|
:pagination="pagination"
|
11
|
-
:columns="
|
11
|
+
:columns="tableColumns"
|
12
12
|
:loading="loadingList"
|
13
13
|
:rows="pagedItems?.data || []"
|
14
14
|
:binary-state-sort="false"
|
@@ -18,7 +18,7 @@
|
|
18
18
|
:color="color"
|
19
19
|
@update:selected="$emit('update:selected-rows', $event)"
|
20
20
|
@update:pagination="() => {}"
|
21
|
-
@request="(e) => $emit('update:pagination', {...e.pagination, __sort: mapSortBy(e.pagination,
|
21
|
+
@request="(e) => $emit('update:pagination', {...e.pagination, __sort: mapSortBy(e.pagination, tableColumns)})"
|
22
22
|
>
|
23
23
|
<template #no-data>
|
24
24
|
<slot name="empty">
|
@@ -33,7 +33,7 @@
|
|
33
33
|
:selected-count="selectedRows.length"
|
34
34
|
:loading="loadingSummary"
|
35
35
|
:summary="summary"
|
36
|
-
:columns="
|
36
|
+
:columns="tableColumns"
|
37
37
|
@clear="$emit('update:selected-rows', [])"
|
38
38
|
/>
|
39
39
|
</template>
|
@@ -116,6 +116,7 @@ const props = defineProps({
|
|
116
116
|
const actionTable = ref(null);
|
117
117
|
registerStickyScrolling(actionTable);
|
118
118
|
|
119
|
+
const tableColumns = computed(() => props.columns.map((column) => ({ ...column, field: column.field || column.name })));
|
119
120
|
const hasData = computed(() => props.pagedItems?.data?.length);
|
120
121
|
const COLUMN_SETTINGS_KEY = `column-settings-${props.name}`;
|
121
122
|
const columnSettings = ref(getItem(COLUMN_SETTINGS_KEY) || {});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<CollapsableSidebar
|
3
|
+
class="dx-collapsable-filters-sidebar"
|
3
4
|
:collapse="!showFilters"
|
4
5
|
disabled
|
5
6
|
:min-width="minWidth"
|
@@ -22,17 +23,17 @@ import { CollapsableSidebar } from "../../Utility";
|
|
22
23
|
defineEmits(["update:active-filter", "update:show-filters"]);
|
23
24
|
|
24
25
|
export interface Props {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
name: string,
|
27
|
+
showFilters?: boolean,
|
28
|
+
activeFilter: ListControlsFilter,
|
29
|
+
minWidth?: string,
|
30
|
+
maxWidth?: string,
|
31
|
+
filters?: FilterField[]
|
31
32
|
}
|
32
33
|
|
33
34
|
withDefaults(defineProps<Props>(), {
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
minWidth: "5rem",
|
36
|
+
maxWidth: "18rem",
|
37
|
+
filters: () => []
|
37
38
|
});
|
38
39
|
</script>
|
@@ -12,8 +12,8 @@
|
|
12
12
|
ref="fileUpload"
|
13
13
|
data-testid="file-upload"
|
14
14
|
type="file"
|
15
|
-
:accept="geolocation ? 'image/*;capture=camera' : undefined"
|
16
|
-
:capture="geolocation ? 'environment' : undefined"
|
15
|
+
:accept="(geolocation && cameraOnly) ? 'image/*;capture=camera' : undefined"
|
16
|
+
:capture="(geolocation && cameraOnly) ? 'environment' : undefined"
|
17
17
|
class="hidden"
|
18
18
|
multiple
|
19
19
|
@change="onAttachFiles"
|
@@ -28,28 +28,29 @@ import { FileUpload } from "../../../../helpers";
|
|
28
28
|
|
29
29
|
defineExpose({ upload });
|
30
30
|
const emit = defineEmits([
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
"uploading",
|
32
|
+
"file-progress",
|
33
|
+
"file-complete",
|
34
|
+
"complete"
|
35
35
|
]);
|
36
36
|
const props = defineProps({
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
...QBtn.props,
|
38
|
+
text: {
|
39
|
+
type: String,
|
40
|
+
default: "Add File"
|
41
|
+
},
|
42
|
+
locationWaitMessage: {
|
43
|
+
type: String,
|
44
|
+
default: "Waiting for location..."
|
45
|
+
},
|
46
|
+
cameraOnly: Boolean,
|
47
|
+
geolocation: Boolean
|
47
48
|
});
|
48
49
|
|
49
50
|
const fileUpload = ref(null);
|
50
51
|
|
51
52
|
function upload() {
|
52
|
-
|
53
|
+
fileUpload.value.click();
|
53
54
|
}
|
54
55
|
|
55
56
|
/**
|
@@ -59,23 +60,23 @@ function upload() {
|
|
59
60
|
* @returns {Promise<void>}
|
60
61
|
*/
|
61
62
|
async function onAttachFiles({ target: { files } }) {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
emit("uploading", files);
|
64
|
+
let fileUpload = new FileUpload(files)
|
65
|
+
.onProgress(({ file, progress }) => {
|
66
|
+
file.progress = progress;
|
67
|
+
emit("file-progress", file);
|
68
|
+
})
|
69
|
+
.onComplete(({ file, uploadedFile }) => {
|
70
|
+
emit("file-complete", { file, uploadedFile });
|
71
|
+
})
|
72
|
+
.onAllComplete(() => {
|
73
|
+
emit("complete", fileUpload.files);
|
74
|
+
});
|
74
75
|
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
if (props.geolocation) {
|
77
|
+
await fileUpload.resolveLocation(props.locationWaitMessage);
|
78
|
+
}
|
78
79
|
|
79
|
-
|
80
|
+
fileUpload.upload();
|
80
81
|
}
|
81
82
|
</script>
|
@@ -1,13 +1,14 @@
|
|
1
1
|
<template>
|
2
2
|
<QInput
|
3
|
+
class="dx-number-field max-w-full"
|
4
|
+
:class="{'dx-no-prepend-label': hidePrependLabel, 'dx-prepend-label': !hidePrependLabel}"
|
3
5
|
:model-value="numberVal"
|
4
6
|
:data-testid="'number-field-' + fieldOptions.id"
|
5
7
|
:placeholder="fieldOptions.placeholder"
|
6
8
|
outlined
|
7
9
|
dense
|
8
10
|
inputmode="numeric"
|
9
|
-
:input-class="
|
10
|
-
:class="{'no-prepend-icon w-32 max-w-full': hidePrependLabel, 'prepend-label': !hidePrependLabel}"
|
11
|
+
:input-class="inputClass"
|
11
12
|
@update:model-value="onInput"
|
12
13
|
>
|
13
14
|
<template #prepend>
|
@@ -27,33 +28,33 @@ import FieldLabel from "./FieldLabel";
|
|
27
28
|
|
28
29
|
const emit = defineEmits(["update:model-value", "update"]);
|
29
30
|
const props = defineProps({
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
31
|
+
modelValue: {
|
32
|
+
type: [String, Number],
|
33
|
+
default: ""
|
34
|
+
},
|
35
|
+
precision: {
|
36
|
+
type: Number,
|
37
|
+
default: 2
|
38
|
+
},
|
39
|
+
label: {
|
40
|
+
type: String,
|
41
|
+
default: undefined
|
42
|
+
},
|
43
|
+
field: {
|
44
|
+
type: Object,
|
45
|
+
default: null
|
46
|
+
},
|
47
|
+
inputClass: {
|
48
|
+
type: [String, Object],
|
49
|
+
default: ""
|
50
|
+
},
|
51
|
+
delay: {
|
52
|
+
type: Number,
|
53
|
+
default: 1000
|
54
|
+
},
|
55
|
+
hidePrependLabel: Boolean,
|
56
|
+
currency: Boolean,
|
57
|
+
showName: Boolean
|
57
58
|
});
|
58
59
|
|
59
60
|
const numberVal = ref(format(props.modelValue));
|
@@ -62,46 +63,46 @@ watch(() => props.modelValue, () => numberVal.value = format(props.modelValue));
|
|
62
63
|
const fieldOptions = computed(() => props.field || { label: props.label || "", placeholder: "", id: "" });
|
63
64
|
|
64
65
|
function format(number) {
|
65
|
-
|
66
|
+
if (!number && number !== 0 && number !== "0") return number;
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
const minimumFractionDigits = Math.min(props.precision, ("" + number).split(".")[1]?.length || 0);
|
69
|
+
let options = {
|
70
|
+
minimumFractionDigits
|
71
|
+
};
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
if (props.currency) {
|
74
|
+
options = {
|
75
|
+
style: "currency",
|
76
|
+
currency: "USD",
|
77
|
+
minimumFractionDigits
|
78
|
+
};
|
79
|
+
}
|
80
|
+
return fNumber(number, options);
|
80
81
|
}
|
81
82
|
|
82
83
|
const onUpdateDebounced = useDebounceFn((val) => emit("update", val), props.delay);
|
83
84
|
|
84
85
|
function onInput(value) {
|
85
|
-
|
86
|
+
let number = "";
|
86
87
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
// Prevent invalid characters
|
89
|
+
if (value.match(/[^\d.,$]/)) {
|
90
|
+
const oldVal = numberVal.value;
|
91
|
+
// XXX: To get QInput to show only the value we want
|
92
|
+
numberVal.value += " ";
|
93
|
+
return nextTick(() => numberVal.value = oldVal);
|
94
|
+
}
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
if (value !== "") {
|
97
|
+
value = value.replace(/[^\d.]/g, "");
|
98
|
+
number = Number(value);
|
99
|
+
numberVal.value = format(number);
|
100
|
+
}
|
100
101
|
|
101
|
-
|
102
|
-
|
102
|
+
number = number === "" ? undefined : number;
|
103
|
+
emit("update:model-value", number);
|
103
104
|
|
104
|
-
|
105
|
-
|
105
|
+
// Delay the change event, so we only see the value after the user has finished
|
106
|
+
onUpdateDebounced(number);
|
106
107
|
}
|
107
108
|
</script>
|