quasar-factory-lib 0.0.52 → 0.0.54

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
@@ -97,6 +97,6 @@
97
97
  "release": "standard-version"
98
98
  },
99
99
  "type": "module",
100
- "version": "0.0.52",
100
+ "version": "0.0.54",
101
101
  "author": ""
102
102
  }
@@ -127,14 +127,6 @@ export default defineComponent({
127
127
  type: Array as () => string[],
128
128
  required: true
129
129
  },
130
- // filterMethod: {
131
- // type: Function,
132
- // default: function () {}
133
- // },
134
- // sortMethod: {
135
- // type: Function,
136
- // default: function () {}
137
- // },
138
130
  selectionType: {
139
131
  type: String as () => 'none' | 'single' | 'multiple',
140
132
  default: 'none'
@@ -207,7 +199,6 @@ export default defineComponent({
207
199
  return {
208
200
  selected: [],
209
201
  filter: '',
210
- visibleColumnsData: this.visibleColumns,
211
202
  rowsData: [] as object[],
212
203
  gridRowsSelected: false,
213
204
  selectedRows: [] as number[],
@@ -250,9 +241,6 @@ export default defineComponent({
250
241
  watch: {
251
242
  rows (val) {
252
243
  this.rowsData = val
253
- },
254
- visibleColumns (val: string [] | []) {
255
- this.visibleColumnsData = val
256
244
  }
257
245
  },
258
246
  mounted () {
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <q-popup-edit
3
+ v-slot="scope"
4
+ v-model="modelData"
5
+ buttons
6
+ :label-set="$t('table.confirm')"
7
+ :label-cancel="$t('table.cancel')"
8
+ @save="validate"
9
+ @cancel="() => {}"
10
+ >
11
+ <q-input
12
+ v-if="!showSelectNumberOptions"
13
+ ref="inputNumber"
14
+ v-model="scope.value"
15
+ :data-cy="dataCy"
16
+ :label="label"
17
+ type="text"
18
+ mask="#####"
19
+ dense
20
+ autofocus
21
+ @keyup.enter.stop
22
+ />
23
+ <q-select
24
+ v-if="showSelectNumberOptions"
25
+ ref="selectField"
26
+ v-model="scope.value"
27
+ :data-cy="dataCy"
28
+ dense
29
+ :options="popupEditNumberOptions"
30
+ />
31
+ </q-popup-edit>
32
+ </template>
33
+ <script lang="ts">
34
+ import type { QInput } from 'quasar'
35
+ export default {
36
+ name: 'PopupEditNumber',
37
+ props: {
38
+ model: {
39
+ type: [String, Number, Boolean, Array, Object],
40
+ required: true
41
+ },
42
+ label: {
43
+ type: String,
44
+ required: true
45
+ },
46
+ dataCy: {
47
+ type: String,
48
+ required: true
49
+ },
50
+ popupEditNumberOptions: {
51
+ type: Array as () => number[],
52
+ default: () => []
53
+ },
54
+ showSelectNumberOptions: {
55
+ type: Boolean,
56
+ required: false
57
+ }
58
+ },
59
+ emits: ['popupEditUpdated', 'popupEditEmit', 'save'],
60
+ data () {
61
+ return {
62
+ modelData: this.model
63
+ }
64
+ },
65
+ methods: {
66
+ validate (val: string) {
67
+ const input = this.$refs.inputNumber as QInput
68
+ if (input.validate()) {
69
+ this.$emit('save', val)
70
+ } else {
71
+ this.$q.notify({
72
+ type: 'negative',
73
+ message: 'Value not accepted',
74
+ position: 'bottom'
75
+ })
76
+ }
77
+ }
78
+ }
79
+ }
80
+ </script>
@@ -9,13 +9,11 @@
9
9
  @cancel="() => {}"
10
10
  >
11
11
  <q-input
12
- v-if="showInputPopupEdit"
13
- ref="inputField"
12
+ ref="inputText"
14
13
  v-model="scope.value"
15
14
  :data-cy="dataCy"
16
15
  :label="label"
17
16
  :type="inputType"
18
- :mask="mask"
19
17
  :autogrow="inputType === 'textarea'"
20
18
  :rules="[
21
19
  (val: string | string[]) => (val && val.length > 0) || $t('form.rules.emptyField'),
@@ -26,21 +24,12 @@
26
24
  autofocus
27
25
  @keyup.enter.stop
28
26
  />
29
-
30
- <q-select
31
- v-if="showSelectNumberOptions"
32
- ref="selectField"
33
- v-model="scope.value"
34
- :data-cy="dataCy"
35
- dense
36
- :options="popupEditNumberOptions"
37
- />
38
27
  </q-popup-edit>
39
28
  </template>
40
29
  <script lang="ts">
41
30
  import type { QInput } from 'quasar'
42
31
  export default {
43
- name: 'PopupEdit',
32
+ name: 'PopupEditText',
44
33
  props: {
45
34
  model: {
46
35
  type: [String, Number, Boolean, Array, Object],
@@ -54,29 +43,13 @@ export default {
54
43
  type: String,
55
44
  required: true
56
45
  },
57
- mask: {
58
- type: String,
59
- required: true
60
- },
61
46
  inputType: {
62
- type: String as () =>'text' | 'textarea'| 'number',
47
+ type: String as () =>'text' | 'textarea',
63
48
  required: true
64
49
  },
65
50
  inputMaxLength: {
66
51
  type: Number,
67
52
  required: true
68
- },
69
- popupEditNumberOptions: {
70
- type: Array as () => number[],
71
- default: () => []
72
- },
73
- showInputPopupEdit: {
74
- type: Boolean,
75
- required: true
76
- },
77
- showSelectNumberOptions: {
78
- type: Boolean,
79
- required: false
80
53
  }
81
54
  },
82
55
  emits: ['popupEditUpdated', 'popupEditEmit', 'save'],
@@ -87,7 +60,7 @@ export default {
87
60
  },
88
61
  methods: {
89
62
  validate (val: string) {
90
- const input = this.$refs.inputField as QInput
63
+ const input = this.$refs.inputText as QInput
91
64
  if (input.validate()) {
92
65
  this.$emit('save', val)
93
66
  } else {
@@ -42,13 +42,11 @@ export default {
42
42
  emits: ['onSelectVisibleColumns'],
43
43
  data () {
44
44
  return {
45
- visibleColumnsData: [] as { name: string; required: boolean; label: string }[]
45
+ visibleColumnsData: []
46
46
  }
47
47
  },
48
- watch: {
49
- visibleColumns (value): void {
50
- this.visibleColumnsData = value
51
- }
48
+ mounted () {
49
+ this.visibleColumnsData = this.visibleColumns
52
50
  },
53
51
  methods: {
54
52
  onSelectVisibleColumns (columns: string[]): void {
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <q-input
3
3
  ref="filterRef"
4
+ data-cy="input-filter"
4
5
  v-model="localStore.filterValue"
5
6
  borderless
6
7
  dense
@@ -31,22 +31,31 @@
31
31
  size="sm"
32
32
  class="cursor-pointer"
33
33
  />
34
- <TablePopupEdit
35
- v-if="col.editable"
34
+ <PopupEditNumber
35
+ v-if="col.editable && col.popupEditInputtype === 'number'"
36
+ :model="tablePropsData.row[col.name] || ''"
37
+ :label="col.label"
38
+ :data-cy="col.popupEditDataCy + '-' + tablePropsData.row.id"
39
+ :showSelectNumberOptions="col.showSelectNumberOptions"
40
+ :popupEditNumberOptions="col.popupEditNumberOptions || []"
41
+ @save="(val: object) => {
42
+ tablePropsData.row[col.name] = val
43
+ $emit(col.popupEditEmit, tablePropsData.row)
44
+ }"
45
+ />
46
+ <PopupEditText
47
+ v-if="col.editable && (col.popupEditInputtype === 'text' || col.popupEditInputtype === 'textarea')"
36
48
  :model="tablePropsData.row[col.name] || ''"
37
49
  :label="col.label"
38
50
  :data-cy="col.popupEditDataCy + '-' + tablePropsData.row.id"
39
51
  :input-max-length="col.inputMaxLength || 20"
40
- :mask="col.popupEditMask || ''"
41
- :input-type="col.popupEditInputtype || 'text'"
42
- :show-input-popup-edit="col.showInputPopupEdit || true"
43
- :show-select-number-options="col.showSelectNumberOptions || false"
44
- :popup-edit-number-options="col.popupEditNumberOptions || []"
52
+ :input-type="col.popupEditInputtype"
45
53
  @save="(val: object) => {
46
54
  tablePropsData.row[col.name] = val
47
55
  $emit(col.popupEditEmit, tablePropsData.row)
48
56
  }"
49
57
  />
58
+
50
59
  <BasicCheckBox
51
60
  v-if="col.showBasicCheckbox"
52
61
  :table-props="tablePropsData"
@@ -92,15 +101,17 @@
92
101
  </tr>
93
102
  </template>
94
103
  <script lang="ts">
95
- import TablePopupEdit from './TablePopupEdit.vue'
104
+ import PopupEditNumber from './PopupEditNumber.vue'
105
+ import PopupEditText from './PopupEditText.vue'
96
106
  import BasicCheckBox from './BasicCheckBox.vue'
97
107
  import CustomizedCheckBox from './CustomizedCheckBox.vue'
98
108
  import CustomizedIcon from './CustomizedIcon.vue'
99
109
  import CustomizedButton from './CustomizedButton.vue'
100
110
  export default {
101
- name: 'KTableSlotBody',
111
+ name: 'TableSlotBody',
102
112
  components: {
103
- TablePopupEdit,
113
+ PopupEditNumber,
114
+ PopupEditText,
104
115
  BasicCheckBox,
105
116
  CustomizedCheckBox,
106
117
  CustomizedIcon,
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div
3
+ :id="'card-container-' + tablePropsData.row.id"
3
4
  :class="'q-pa-xs col-xs-12 col-sm-6 col-md-4 col-lg-3 grid-style-transition'"
4
5
  :style="tablePropsData.selected ? 'transform: scale(0.95);' : ''"
5
6
  >
@@ -17,6 +18,7 @@
17
18
  >
18
19
  <q-card-section>
19
20
  <q-checkbox
21
+ :data-cy="'checkbox-' + tablePropsData.row.id"
20
22
  v-if="selectionType != 'none'"
21
23
  v-model="tablePropsData.selected"
22
24
  dense
@@ -41,6 +43,7 @@
41
43
  class="itemsFontSize text-color-almostBlack"
42
44
  :class="getCellClass(tablePropsData.row, col)"
43
45
  >
46
+ <span v-html="tablePropsData.row[col.name]" />
44
47
  <q-icon
45
48
  v-if="col.editable"
46
49
  name="edit"
@@ -48,17 +51,25 @@
48
51
  size="sm"
49
52
  class="cursor-pointer"
50
53
  />
51
- <span v-html="tablePropsData.row[col.name]" />
52
- <TablePopupEdit
54
+ <PopupEditNumber
55
+ v-if="col.editable && col.popupEditInputtype === 'number'"
56
+ :model="tablePropsData.row[col.name] || ''"
57
+ :label="col.label"
58
+ :data-cy="col.popupEditDataCy + '-' + tablePropsData.row.id"
59
+ :showSelectNumberOptions="col.showSelectNumberOptions"
60
+ :popupEditNumberOptions="col.popupEditNumberOptions || []"
61
+ @save="(val: object) => {
62
+ tablePropsData.row[col.name] = val
63
+ $emit(col.popupEditEmit, tablePropsData.row)
64
+ }"
65
+ />
66
+ <PopupEditText
67
+ v-if="col.editable && (col.popupEditInputtype === 'text' || col.popupEditInputtype === 'textarea')"
53
68
  :model="tablePropsData.row[col.name] || ''"
54
69
  :label="col.label"
55
70
  :data-cy="col.popupEditDataCy + '-' + tablePropsData.row.id"
56
71
  :input-max-length="col.inputMaxLength || 20"
57
- :mask="col.popupEditMask || ''"
58
- :input-type="col.popupEditInputtype || 'text'"
59
- :show-input-popup-edit="col.showInputPopupEdit || true"
60
- :show-select-number-options="col.showSelectNumberOptions || false"
61
- :popup-edit-number-options="col.popupEditNumberOptions || []"
72
+ :input-type="col.popupEditInputtype"
62
73
  @save="(val: object) => {
63
74
  tablePropsData.row[col.name] = val
64
75
  $emit(col.popupEditEmit, tablePropsData.row)
@@ -121,16 +132,18 @@
121
132
  </div>
122
133
  </template>
123
134
  <script lang="ts">
124
- import TablePopupEdit from './TablePopupEdit.vue'
135
+ import PopupEditNumber from './PopupEditNumber.vue'
136
+ import PopupEditText from './PopupEditText.vue'
125
137
  import BasicCheckBox from './BasicCheckBox.vue'
126
138
  import CustomizedCheckBox from './CustomizedCheckBox.vue'
127
139
  import CustomizedIcon from './CustomizedIcon.vue'
128
140
  import CustomizedButton from './CustomizedButton.vue'
129
141
 
130
142
  export default {
131
- name: 'KTableSlotGrid',
143
+ name: 'TableSlotGrid',
132
144
  components: {
133
- TablePopupEdit,
145
+ PopupEditNumber,
146
+ PopupEditText,
134
147
  BasicCheckBox,
135
148
  CustomizedCheckBox,
136
149
  CustomizedIcon,
@@ -179,7 +192,4 @@ export default {
179
192
  }
180
193
  </script>
181
194
  <style>
182
- /* .q-btn {
183
- padding: unset;
184
- } */
185
195
  </style>
@@ -6,7 +6,7 @@
6
6
  <img :src="logo" class="logo">
7
7
  <span id="mobile-title">{{ title }}</span>
8
8
  </div>
9
- <div class="col-5 text-right">
9
+ <div class="col-5 text-right" data-cy="back">
10
10
  <q-icon v-if="showBtnBack" size="md" class="cursor-pointer" @click="onClickBtnBack">
11
11
  <svg class="text-h4" xmlns="http://www.w3.org/2000/svg" width="30" height="30"
12
12
  viewBox="0 0 23.648 22.836">
@@ -23,9 +23,10 @@
23
23
  :name="showIconSearch ?'search' : 'search_off'"
24
24
  size="md"
25
25
  class="q-ml-md cursor-pointer"
26
+ data-cy="search"
26
27
  @click="onClickBtnSearch">
27
28
  </q-icon>
28
- <q-icon id="iconMenu" size="md" @click="onClickBtnMenu" class="q-ml-md cursor-pointer">
29
+ <q-icon id="iconMenu" size="md" @click="onClickBtnMenu" class="q-ml-md cursor-pointer" data-cy="menu">
29
30
  <svg xmlns="http://www.w3.org/2000/svg" width="30.448" height="28.247" viewBox="0 0 30.448 28.247">
30
31
  <g id="Componente_11_3" data-name="Componente 11 – 3" transform="translate(0 1)">
31
32
  <path id="Caminho_702" data-name="Caminho 702" d="M38.053,40.174H24"
@@ -23,14 +23,15 @@
23
23
  ref="table"
24
24
  :rows="rows"
25
25
  :columns="columns"
26
- :visible-columns="visibleColumns"
26
+ :visible-columns="store.visiblecolumns"
27
27
  :small-device="smallDevice"
28
28
  :store="store"
29
29
  :table-style="tableStyle"
30
- :show-skeleton="false"
30
+ :show-skeleton="showSkeleton"
31
31
  :selection-type="'multiple'"
32
- :filter-method="filterMethod"
33
- @on-select-visible-columns="saveSelectedColumns"
32
+ @on-select-visible-columns="(columns) => {
33
+ store.visiblecolumns = columns
34
+ }"
34
35
  @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
35
36
  @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
36
37
  @on-click-button="setItemNotFound"
@@ -50,7 +51,6 @@
50
51
  import Table from '../components/Table/Table.vue'
51
52
  import setTableHeight from '../components/Table/utils/setTableHeight'
52
53
  import infiniteScroll from '../components/Table/utils/infiniteScroll'
53
- import FilterMethod from '../components/Table/utils/filterMethod'
54
54
  import { tableStore } from '../store/table.js'
55
55
  export default {
56
56
  components: {
@@ -102,9 +102,10 @@ export default {
102
102
  editable: true,
103
103
  showEditIcon: true,
104
104
  popupEditEmit: 'onSaveValuePopupEdit',
105
- popupEditInputtype: 'number',
106
105
  popupEditDataCy: '',
107
- popupEditMask: '#####'
106
+ mask: '#####',
107
+ showSelectNumberOptions: false,
108
+ popupEditInputtype: 'number'
108
109
  },
109
110
  {
110
111
  name: 'fat',
@@ -120,7 +121,12 @@ export default {
120
121
  {
121
122
  name: 'carbs',
122
123
  label: 'Carbs (g)',
123
- field: 'carbs'
124
+ field: 'carbs',
125
+ editable: true,
126
+ popupEditEmit: 'onSaveValuePopupEdit',
127
+ popupEditDataCy: '',
128
+ inputMaxLength: 200,
129
+ popupEditInputtype: 'textarea'
124
130
  },
125
131
  {
126
132
  name: 'checked',
@@ -309,23 +315,22 @@ export default {
309
315
  iron: '6%'
310
316
  }
311
317
  ],
312
- visibleColumns: []
318
+ showSkeleton: false
313
319
  }
314
320
  },
315
321
  mounted () {
322
+ this.showSkeleton = true
316
323
  this.store.cleanTableFilter()
317
324
  this.tableStyle = setTableHeight.setTableHeight()
318
325
  infiniteScroll.handleInfiniteScrollNewTable(this)
319
- this.visibleColumns = this.store.visiblecolumns
320
- this.rows = this.rowsData
326
+ this.getRows()
321
327
  },
322
328
  methods: {
323
- saveSelectedColumns (columns: string []): void {
324
- this.store.visiblecolumns = columns
325
- this.visibleColumns = columns
326
- },
327
- filterMethod (rows: string | [], terms: { search: string }): object[] | [] {
328
- return FilterMethod.filter(this, rows, terms)
329
+ getRows () {
330
+ setTimeout(()=> {
331
+ this.showSkeleton = false
332
+ }, 1000)
333
+ this.rows = this.rowsData
329
334
  },
330
335
  onUpdateBasicCheckboxValue (rows: object []) {
331
336
  console.log(rows, 'onUpdateBasicCheckboxValue')
@@ -9,6 +9,7 @@
9
9
  >
10
10
  <ConfirmDialog
11
11
  ref="ConfirmRef"
12
+ dataCy="confirm-dialog"
12
13
  @onClickBtnConfirm="onClickBtnConfirm"
13
14
  @onClickBtnCancel="onClickBtnCancel"
14
15
  />
@@ -7,23 +7,24 @@
7
7
  <div
8
8
  class="full-width"
9
9
  >
10
- {{ store.prepared }}
11
10
  <q-btn @click="store.prepared = !store.prepared">Click</q-btn>
12
11
  <Table
13
12
  ref="table"
14
13
  :rows="rows"
15
14
  :columns="columns"
16
- :visible-columns="visibleColumns"
15
+ :visible-columns="store.visiblecolumns"
17
16
  :small-device="false"
18
17
  :store="store"
19
18
  :table-style="tableStyle"
20
- :show-skeleton="false"
19
+ :show-skeleton="showSkeleton"
21
20
  :selection-type="'multiple'"
22
21
  :getCellClass="getCellClass"
23
22
  :filterComputedOptions="{ preparedQuantity: store.prepared}"
24
23
  :additional-sort-conditions="additionalSortConditions"
25
24
  :additional-filter-conditions="additionalFilterConditions"
26
- @on-select-visible-columns="saveSelectedColumns"
25
+ @on-select-visible-columns="(columns) => {
26
+ store.visiblecolumns = columns
27
+ }"
27
28
  @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
28
29
  @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
29
30
  @on-click-button="setItemNotFound"
@@ -36,8 +37,6 @@
36
37
  import Table from '../components/Table/Table.vue'
37
38
  import setTableHeight from '../components/Table/utils/setTableHeight'
38
39
  import infiniteScroll from '../components/Table/utils/infiniteScroll'
39
- // import FilterMethod from '../components/Table/utils/filterMethod'
40
- // import TableSort from '../components/Table/utils/sort.js'
41
40
  import { tableStore } from '../store/table.js'
42
41
  export default {
43
42
  components: {
@@ -45,6 +44,7 @@ export default {
45
44
  },
46
45
  data () {
47
46
  return {
47
+ showSkeleton: true,
48
48
  showDialog: false,
49
49
  store: tableStore(),
50
50
  tableStyle: '',
@@ -325,13 +325,11 @@ export default {
325
325
  calcium: '12%',
326
326
  iron: '6%'
327
327
  }
328
- ],
329
- visibleColumns: []
328
+ ]
330
329
  }
331
330
  },
332
331
  mounted () {
333
332
  this.store.cleanTableFilter()
334
- this.visibleColumns = this.store.visiblecolumns
335
333
  this.tableStyle = setTableHeight.setTableHeight()
336
334
  infiniteScroll.handleInfiniteScrollNewTable(this)
337
335
  this.getRows()
@@ -359,10 +357,9 @@ export default {
359
357
  iron: lista[i].iron
360
358
  })
361
359
  }
362
- },
363
- saveSelectedColumns (columns: string []): void {
364
- this.store.visiblecolumns = columns
365
- this.visibleColumns = columns
360
+ setTimeout(() => {
361
+ this.showSkeleton = false
362
+ }, 1000);
366
363
  },
367
364
  onUpdateBasicCheckboxValue (rows: object []) {
368
365
  console.log(rows, 'onUpdateBasicCheckboxValue')