quasar-ui-danx 0.4.86 → 0.4.88

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.4.86",
3
+ "version": "0.4.88",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@
5
5
  >
6
6
  <QTable
7
7
  ref="actionTable"
8
- :selected="selectedRows"
8
+ :selected="selectedRows || []"
9
9
  :pagination="pagination"
10
10
  :columns="tableColumns"
11
11
  :loading="loadingList || loadingSummary"
@@ -29,7 +29,7 @@
29
29
  v-if="hasData"
30
30
  :label="label"
31
31
  :item-count="summary?.count || 0"
32
- :selected-count="selectedRows.length"
32
+ :selected-count="selectedRows?.length"
33
33
  :sticky-colspan="summaryColSpan"
34
34
  :loading="loadingSummary"
35
35
  :summary="summary"
@@ -75,77 +75,78 @@ import TableSummaryRow from "./TableSummaryRow.vue";
75
75
  defineEmits(["update:selected-rows", "update:pagination"]);
76
76
 
77
77
  export interface Props {
78
- name: string;
79
- label: string;
80
- color?: string;
81
- selectedRows: ActionTargetItem[];
82
- pagination: ListControlsPagination;
83
- loadingList?: boolean;
84
- loadingSummary?: boolean;
85
- pagedItems?: any;
86
- summary: any;
87
- menuActions?: ResourceAction[];
88
- columns: TableColumn[];
89
- rowsPerPageOptions?: number[];
90
- summaryColSpan?: number;
91
- selection: "multiple" | "single";
78
+ name: string;
79
+ label: string;
80
+ color?: string;
81
+ selectedRows?: ActionTargetItem[];
82
+ pagination: ListControlsPagination;
83
+ loadingList?: boolean;
84
+ loadingSummary?: boolean;
85
+ pagedItems?: any;
86
+ summary: any;
87
+ menuActions?: ResourceAction[];
88
+ columns: TableColumn[];
89
+ rowsPerPageOptions?: number[];
90
+ summaryColSpan?: number;
91
+ selection?: "multiple" | "single";
92
92
  }
93
93
 
94
94
  const props = withDefaults(defineProps<Props>(), {
95
- color: "",
96
- pagedItems: null,
97
- summary: null,
98
- loadingSummary: false,
99
- rowsPerPageOptions: () => [10, 25, 50, 100],
100
- summaryColSpan: null,
101
- selection: "multiple"
95
+ color: "",
96
+ pagedItems: null,
97
+ summary: null,
98
+ loadingSummary: false,
99
+ rowsPerPageOptions: () => [10, 25, 50, 100],
100
+ summaryColSpan: null,
101
+ selection: undefined
102
102
  });
103
103
 
104
104
  const actionTable = ref(null);
105
105
  registerStickyScrolling(actionTable);
106
106
 
107
107
  const tableColumns = computed<TableColumn[]>(() => {
108
- const columns = [...props.columns].map((column: TableColumn) => ({
109
- ...column,
110
- field: column.field || column.name
111
- }));
108
+ const columns = [...props.columns].map((column: TableColumn) => ({
109
+ ...column,
110
+ field: column.field || column.name
111
+ }));
112
112
 
113
- // Inject the Action Menu column if there are menu actions
114
- if (props.menuActions?.length) {
115
- const menuColumn = columns.find((column) => column.name === "menu");
116
- const menuColumnOptions: TableColumn = {
117
- name: "menu",
118
- label: "",
119
- required: true,
120
- hideContent: true,
121
- shrink: true,
122
- actionMenu: props.menuActions
123
- };
113
+ // Inject the Action Menu column if there are menu actions
114
+ if (props.menuActions?.length) {
115
+ const menuColumn = columns.find((column) => column.name === "menu");
116
+ const menuColumnOptions: TableColumn = {
117
+ name: "menu",
118
+ label: "",
119
+ required: true,
120
+ hideContent: true,
121
+ shrink: true,
122
+ actionMenu: props.menuActions
123
+ };
124
124
 
125
- if (menuColumn) {
126
- Object.assign(menuColumn, menuColumnOptions);
127
- } else {
128
- columns.unshift(menuColumnOptions);
129
- }
130
- }
125
+ if (menuColumn) {
126
+ Object.assign(menuColumn, menuColumnOptions);
127
+ } else {
128
+ columns.unshift(menuColumnOptions);
129
+ }
130
+ }
131
131
 
132
- return columns;
132
+ return columns;
133
133
  });
134
134
  const hasData = computed(() => props.pagedItems?.data?.length);
135
135
  const COLUMN_SETTINGS_KEY = `column-settings-${props.name}`;
136
136
  const columnSettings = ref(getItem(COLUMN_SETTINGS_KEY) || {});
137
+
137
138
  function onUpdateColumnSettings() {
138
- setItem(COLUMN_SETTINGS_KEY, columnSettings.value);
139
+ setItem(COLUMN_SETTINGS_KEY, columnSettings.value);
139
140
  }
140
141
  </script>
141
142
 
142
143
  <style scoped lang="scss">
143
144
  .dx-action-table {
144
- &.dx-no-data {
145
- :deep(.q-table__middle) {
146
- flex-grow: 0;
147
- flex-shrink: 1;
148
- }
149
- }
145
+ &.dx-no-data {
146
+ :deep(.q-table__middle) {
147
+ flex-grow: 0;
148
+ flex-shrink: 1;
149
+ }
150
+ }
150
151
  }
151
152
  </style>
@@ -125,6 +125,8 @@ onFilesChange(() => {
125
125
  if (uploadedFiles.value.some(file => file.progress < 1)) {
126
126
  emit("uploading");
127
127
  }
128
+
129
+ emit("update:model-value", uploadedFiles.value);
128
130
  });
129
131
  onComplete(() => {
130
132
  emit("update:model-value", uploadedFiles.value);
@@ -15,34 +15,40 @@ export function useMultiFileUpload(options?: FileUploadOptions) {
15
15
  const onFilesChangeCb: Ref<OnFilesChangeCallback | null> = ref(null);
16
16
  const onFilesSelected = (e: any) => {
17
17
  uploadedFiles.value = [...uploadedFiles.value, ...e.target.files];
18
+ triggerFilesChange();
19
+
18
20
  new FileUpload(e.target.files, options)
19
- .prepare()
20
- .onProgress(({ file }) => {
21
- file && updateFileInList(file);
22
- })
23
- .onComplete(({ file, uploadedFile }) => {
24
- file && updateFileInList(file, uploadedFile);
25
- })
26
- .onError(({ file, error }) => {
27
- console.error("Failed to upload", file, error);
28
- FlashMessages.error(`Failed to upload ${file.name}: ${error}`);
29
- })
30
- .onAllComplete(() => {
31
- onCompleteCb.value && onCompleteCb.value({
32
- file: uploadedFiles.value[0],
33
- uploadedFile: uploadedFiles.value[0]
34
- });
35
- onFilesChangeCb.value && onFilesChangeCb.value(uploadedFiles.value);
36
- })
37
- .upload();
21
+ .prepare()
22
+ .onProgress(({ file }) => {
23
+ file && updateFileInList(file);
24
+ })
25
+ .onComplete(({ file, uploadedFile }) => {
26
+ file && updateFileInList(file, uploadedFile);
27
+ })
28
+ .onError(({ file, error }) => {
29
+ console.error("Failed to upload", file, error);
30
+ FlashMessages.error(`Failed to upload ${file.name}: ${error}`);
31
+ })
32
+ .onAllComplete(() => {
33
+ onCompleteCb.value && onCompleteCb.value({
34
+ file: uploadedFiles.value[0],
35
+ uploadedFile: uploadedFiles.value[0]
36
+ });
37
+ triggerFilesChange();
38
+ })
39
+ .upload();
38
40
  };
39
41
 
42
+ function triggerFilesChange() {
43
+ onFilesChangeCb.value && onFilesChangeCb.value(uploadedFiles.value);
44
+ }
45
+
40
46
  function updateFileInList(file: UploadedFile, replace: UploadedFile | null = null) {
41
47
  const index = uploadedFiles.value.findIndex(f => f.id === file.id);
42
48
  if (index !== -1) {
43
49
  uploadedFiles.value.splice(index, 1, replace || file);
44
50
  }
45
- onFilesChangeCb.value && onFilesChangeCb.value(uploadedFiles.value);
51
+ triggerFilesChange();
46
52
  }
47
53
 
48
54
  const onDrop = (e: InputEvent) => {
@@ -59,7 +65,7 @@ export function useMultiFileUpload(options?: FileUploadOptions) {
59
65
 
60
66
  const clearUploadedFiles = () => {
61
67
  uploadedFiles.value = [];
62
- onFilesChangeCb.value && onFilesChangeCb.value(uploadedFiles.value);
68
+ triggerFilesChange();
63
69
  onCompleteCb.value && onCompleteCb.value({ file: null, uploadedFile: null });
64
70
  };
65
71
 
@@ -68,7 +74,7 @@ export function useMultiFileUpload(options?: FileUploadOptions) {
68
74
  if (index !== -1) {
69
75
  uploadedFiles.value.splice(index, 1);
70
76
  }
71
- onFilesChangeCb.value && onFilesChangeCb.value(uploadedFiles.value);
77
+ triggerFilesChange();
72
78
  onCompleteCb.value && onCompleteCb.value({ file, uploadedFile: file });
73
79
  };
74
80