quasar-factory-lib 0.0.23 → 0.0.24

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.
@@ -0,0 +1,9 @@
1
+ export const tableStore: import("pinia").StoreDefinition<"tableStore", {
2
+ disableScannerButtons: import("@vueuse/shared").RemovableRef<boolean>;
3
+ filterValue: import("@vueuse/shared").RemovableRef<string>;
4
+ lastFilterValue: import("@vueuse/shared").RemovableRef<string>;
5
+ visiblecolumns: import("@vueuse/shared").RemovableRef<never[]>;
6
+ }, {}, {
7
+ setFilterValue(val: any): void;
8
+ cleanTableFilter(): void;
9
+ }>;
package/package.json CHANGED
@@ -97,6 +97,6 @@
97
97
  "release": "standard-version"
98
98
  },
99
99
  "type": "module",
100
- "version": "0.0.23",
100
+ "version": "0.0.24",
101
101
  "author": ""
102
102
  }
@@ -18,7 +18,7 @@
18
18
  </svg>
19
19
  </q-icon>
20
20
  </q-btn>
21
- <q-btn v-if="showSearch" flat round icon="search" size="lg" @click="onClickBtnSearch" />
21
+ <q-btn v-if="showBtnSearch" color="primary" flat round icon="search" size="lg" @click="onClickBtnSearch" />
22
22
  <q-btn flat round size="lg" @click="onClickBtnMenu">
23
23
  <q-icon id="menu">
24
24
  <svg xmlns="http://www.w3.org/2000/svg" width="30.448" height="28.247" viewBox="0 0 30.448 28.247">
@@ -39,7 +39,7 @@
39
39
  </div>
40
40
  </div>
41
41
  </q-toolbar>
42
- <q-toolbar-title class="text-color-almost-black">
42
+ <q-toolbar-title class="text-color-almost-black q-pl-none">
43
43
  {{ title }}
44
44
  </q-toolbar-title>
45
45
  </div>
@@ -72,23 +72,20 @@ export default defineComponent({
72
72
  showBtnSearch: {
73
73
  type: Boolean,
74
74
  default: true
75
- },
76
- showSearch: {
77
- type: Boolean,
78
- default: true
79
75
  }
80
76
  },
81
- emits: ['search', 'back'],
77
+ emits: ['onClickBtnMenu', 'onClickBtnSearch', 'onClickBtnBack'],
82
78
  methods: {
83
79
  onClickBtnMenu() {
84
- console.log('toggleRightDrawer')
80
+ this.$emit('onClickBtnMenu')
81
+ console.log('menu')
85
82
  },
86
83
  onClickBtnSearch() {
87
- this.$emit('search')
84
+ this.$emit('onClickBtnSearch')
88
85
  console.log('search')
89
86
  },
90
87
  onClickBtnBack() {
91
- this.$emit('back')
88
+ this.$emit('onClickBtnBack')
92
89
  console.log('back')
93
90
  }
94
91
  },
@@ -0,0 +1,341 @@
1
+ <template>
2
+ <q-page-container class=" full-width column justify-center">
3
+ <q-page
4
+ class="full-width column justify-center align-center items-center"
5
+ style="height: 70vh;"
6
+ >
7
+ <div
8
+ class="full-width"
9
+ >
10
+ <Table
11
+ :rows="rows"
12
+ :columns="columns"
13
+ :visible-columns="visibleColumns"
14
+ :small-device="false"
15
+ :store="store"
16
+ :table-style="tableStyle"
17
+ :show-skeleton="false"
18
+ :selection-type="'multiple'"
19
+ :filter-method="filterMethod"
20
+ :filter-computed="filter"
21
+ @on-select-visible-columns="saveSelectedColumns"
22
+ @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
23
+ @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
24
+ @on-click-button="setItemNotFound"
25
+ />
26
+ <q-dialog v-model="showDialog" >
27
+ <div>
28
+ <q-btn @click="close">Close</q-btn>
29
+ <Table
30
+ :rows="rows"
31
+ :columns="columns"
32
+ :visible-columns="visibleColumns"
33
+ :small-device="false"
34
+ :store="store"
35
+ :table-style="tableStyle"
36
+ :show-skeleton="false"
37
+ :selection-type="'multiple'"
38
+ :filter-method="filterMethod"
39
+ :filter-computed="filter"
40
+ />
41
+ </div>
42
+ </q-dialog>
43
+ </div>
44
+ </q-page>
45
+ </q-page-container>
46
+ </template>
47
+ <script lang="ts">
48
+ import Table from '../components/Table/Table.vue'
49
+ // import rows from '../testData.js'
50
+ import setTableHeight from '../components/Table/utils/setTableHeight'
51
+ import infiniteScroll from '../components/Table/utils/infiniteScroll'
52
+ import FilterMethod from '../components/Table/utils/filterMethod'
53
+ import { tableStore } from '../store/table.js'
54
+ export default {
55
+ components: {
56
+ Table
57
+ },
58
+ data () {
59
+ return {
60
+ showDialog: false,
61
+ forceRender: false,
62
+ store: tableStore(),
63
+ totalPage: 0,
64
+ pageSize: 20,
65
+ tableStyle: '',
66
+ columns: [{
67
+ name: 'name',
68
+ required: true,
69
+ label: 'Dessert (100g serving)',
70
+ align: 'left',
71
+ sortable: true
72
+ },
73
+ {
74
+ name: 'available',
75
+ required: true,
76
+ label: 'Available',
77
+ align: 'left',
78
+ sortable: true,
79
+ showBasicCheckbox: true
80
+ },
81
+ {
82
+ name: 'booleanIcon',
83
+ required: true,
84
+ label: 'Boolean Icon',
85
+ align: 'left',
86
+ sortable: true,
87
+ showCustomizedIcon: true
88
+ },
89
+ {
90
+ name: 'calories',
91
+ align: 'center',
92
+ label: 'Calories',
93
+ field: 'calories',
94
+ sortable: true,
95
+ editable: true,
96
+ showEditIcon: true,
97
+ popupEditEmit: 'onSaveValuePopupEdit',
98
+ popupEditInputtype: 'number',
99
+ popupEditDataCy: '',
100
+ popupEditMask: '#####'
101
+ },
102
+ {
103
+ name: 'fat',
104
+ label: 'Fat (g)',
105
+ field: 'fat',
106
+ sortable: true,
107
+ showCustomizedButton: true,
108
+ btnIcon: 'save',
109
+ btnEmit: 'onClickButton',
110
+ dataCy: 'onClickButton',
111
+ btnColor: 'primary'
112
+ },
113
+ {
114
+ name: 'carbs',
115
+ label: 'Carbs (g)',
116
+ field: 'carbs'
117
+ },
118
+ {
119
+ name: 'checked',
120
+ label: 'Checked',
121
+ field: 'carbs',
122
+ sortable: true,
123
+ required: true,
124
+ showCustomizedCheckBox: true,
125
+ checkedIcon: 'check_circle',
126
+ uncheckedIcon: 'cancel',
127
+ checkBoxColorCaseTrue: 'positive',
128
+ checkBoxColorCaseFalse: 'negative',
129
+ checkBoxDataCy: ''
130
+ },
131
+ {
132
+ name: 'protein',
133
+ label: 'Protein (g)',
134
+ field: 'protein',
135
+ sortable: true,
136
+ required: true,
137
+ editable: true,
138
+ showEditIcon: true,
139
+ popupEditEmit: 'onSaveValuePopupEdit',
140
+ popupEditInputtype: 'text',
141
+ popupEditDataCy: '',
142
+ showInputPopupEdit: true
143
+ },
144
+ {
145
+ name: 'sodium',
146
+ label: 'Sodium (mg)',
147
+ field: 'sodium'
148
+ },
149
+ {
150
+ name: 'calcium',
151
+ label: 'Calcium (%)',
152
+ field: 'calcium',
153
+ sortable: true
154
+ },
155
+ {
156
+ name: 'iron',
157
+ label: 'Iron (%)',
158
+ field: 'iron',
159
+ sortable: true
160
+ }
161
+ ],
162
+ rows: [],
163
+ rowsData: [
164
+ {
165
+ name: 'Frozen Yogurt',
166
+ booleanIcon: true,
167
+ available: true,
168
+ calories: 159,
169
+ fat: 6.0,
170
+ carbs: 24,
171
+ checked: false,
172
+ protein: 4.0,
173
+ sodium: 87,
174
+ calcium: '14%',
175
+ iron: '1%'
176
+ },
177
+ {
178
+ name: 'Ice cream sandwich',
179
+ booleanIcon: true,
180
+ available: false,
181
+ calories: 237,
182
+ fat: 9.0,
183
+ carbs: 37,
184
+ checked: false,
185
+ protein: 4.3,
186
+ sodium: 129,
187
+ calcium: '8%',
188
+ iron: '1%'
189
+ },
190
+ {
191
+ name: 'Eclair',
192
+ booleanIcon: true,
193
+ available: true,
194
+ calories: 262,
195
+ fat: 16.0,
196
+ carbs: 23,
197
+ checked: false,
198
+ protein: 6.0,
199
+ sodium: 337,
200
+ calcium: '6%',
201
+ iron: '7%'
202
+ },
203
+ {
204
+ name: 'Cupcake',
205
+ booleanIcon: false,
206
+ available: false,
207
+ calories: 305,
208
+ fat: 3.7,
209
+ carbs: 67,
210
+ checked: false,
211
+ protein: 4.3,
212
+ sodium: 413,
213
+ calcium: '3%',
214
+ iron: '8%'
215
+ },
216
+ {
217
+ name: 'Gingerbread',
218
+ booleanIcon: true,
219
+ available: true,
220
+ calories: 356,
221
+ fat: 16.0,
222
+ carbs: 49,
223
+ checked: false,
224
+ protein: 3.9,
225
+ sodium: 327,
226
+ calcium: '7%',
227
+ iron: '16%'
228
+ },
229
+ {
230
+ name: 'Jelly bean',
231
+ booleanIcon: false,
232
+ available: false,
233
+ calories: 375,
234
+ fat: 0.0,
235
+ carbs: 94,
236
+ checked: true,
237
+ protein: 0.0,
238
+ sodium: 50,
239
+ calcium: '0%',
240
+ iron: '0%'
241
+ },
242
+ {
243
+ name: 'Lollipop',
244
+ booleanIcon: true,
245
+ available: true,
246
+ calories: 392,
247
+ fat: 0.2,
248
+ carbs: 98,
249
+ checked: false,
250
+ protein: 0,
251
+ sodium: 38,
252
+ calcium: '0%',
253
+ iron: '2%'
254
+ },
255
+ {
256
+ name: 'Honeycomb',
257
+ booleanIcon: true,
258
+ available: false,
259
+ calories: 408,
260
+ fat: 3.2,
261
+ carbs: 87,
262
+ checked: true,
263
+ protein: 6.5,
264
+ sodium: 562,
265
+ calcium: '0%',
266
+ iron: '45%'
267
+ },
268
+ {
269
+ name: 'Donut',
270
+ booleanIcon: true,
271
+ available: true,
272
+ calories: 452,
273
+ fat: 25.0,
274
+ carbs: 51,
275
+ checked: false,
276
+ protein: 4.9,
277
+ sodium: 326,
278
+ calcium: '2%',
279
+ iron: '22%'
280
+ },
281
+ {
282
+ name: 'KitKat',
283
+ booleanIcon: false,
284
+ available: false,
285
+ calories: 518,
286
+ fat: 26.0,
287
+ carbs: 65,
288
+ checked: true,
289
+ protein: 7,
290
+ sodium: 54,
291
+ calcium: '12%',
292
+ iron: '6%'
293
+ }
294
+ ],
295
+ visibleColumns: []
296
+ }
297
+ },
298
+ computed: {
299
+ pageLength (): number {
300
+ return (this.totalPage + 1) * this.pageSize
301
+ },
302
+ filter ():object {
303
+ return {
304
+ search: this.store.filterValue,
305
+ forceRender: this.forceRender
306
+ }
307
+ }
308
+ },
309
+ mounted () {
310
+ this.store.cleanTableFilter()
311
+ this.tableStyle = setTableHeight.setTableHeight()
312
+ infiniteScroll.handleInfiniteScrollNewTable(this)
313
+ this.rows = this.rowsData
314
+ this.visibleColumns = this.store.visiblecolumns
315
+ },
316
+ methods: {
317
+ saveSelectedColumns (columns: string []): void {
318
+ this.store.visiblecolumns = columns
319
+ this.visibleColumns = columns
320
+ },
321
+ filterMethod (rows: string | [], terms: { search: string }): object[] | [] {
322
+ return FilterMethod.filter(this, rows, terms)
323
+ },
324
+ onUpdateBasicCheckboxValue (rows: object []) {
325
+ console.log(rows, 'onUpdateBasicCheckboxValue')
326
+ },
327
+ onUpdateCustomizedCheckboxValue (rows: object []) {
328
+ console.log(rows, 'onUpdateCustomizedCheckboxValue')
329
+ },
330
+ setItemNotFound (rows: object []) {
331
+ console.log(rows, 'onClickButton')
332
+ this.showDialog = true
333
+ this.store.lastFilterValue = this.store.filterValue
334
+ },
335
+ close () {
336
+ this.showDialog= false
337
+ this.store.filterValue = this.store.lastFilterValue
338
+ }
339
+ }
340
+ }
341
+ </script>
Binary file