quasar-factory-lib 0.0.52 → 0.0.53

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.53",
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 {
@@ -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,
@@ -49,16 +49,25 @@
49
49
  class="cursor-pointer"
50
50
  />
51
51
  <span v-html="tablePropsData.row[col.name]" />
52
- <TablePopupEdit
52
+ <PopupEditNumber
53
+ v-if="col.editable && col.popupEditInputtype === 'number'"
54
+ :model="tablePropsData.row[col.name] || ''"
55
+ :label="col.label"
56
+ :data-cy="col.popupEditDataCy + '-' + tablePropsData.row.id"
57
+ :showSelectNumberOptions="col.showSelectNumberOptions"
58
+ :popupEditNumberOptions="col.popupEditNumberOptions || []"
59
+ @save="(val: object) => {
60
+ tablePropsData.row[col.name] = val
61
+ $emit(col.popupEditEmit, tablePropsData.row)
62
+ }"
63
+ />
64
+ <PopupEditText
65
+ v-if="col.editable && (col.popupEditInputtype === 'text' || col.popupEditInputtype === 'textarea')"
53
66
  :model="tablePropsData.row[col.name] || ''"
54
67
  :label="col.label"
55
68
  :data-cy="col.popupEditDataCy + '-' + tablePropsData.row.id"
56
69
  :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 || []"
70
+ :input-type="col.popupEditInputtype"
62
71
  @save="(val: object) => {
63
72
  tablePropsData.row[col.name] = val
64
73
  $emit(col.popupEditEmit, tablePropsData.row)
@@ -121,16 +130,18 @@
121
130
  </div>
122
131
  </template>
123
132
  <script lang="ts">
124
- import TablePopupEdit from './TablePopupEdit.vue'
133
+ import PopupEditNumber from './PopupEditNumber.vue'
134
+ import PopupEditText from './PopupEditText.vue'
125
135
  import BasicCheckBox from './BasicCheckBox.vue'
126
136
  import CustomizedCheckBox from './CustomizedCheckBox.vue'
127
137
  import CustomizedIcon from './CustomizedIcon.vue'
128
138
  import CustomizedButton from './CustomizedButton.vue'
129
139
 
130
140
  export default {
131
- name: 'KTableSlotGrid',
141
+ name: 'TableSlotGrid',
132
142
  components: {
133
- TablePopupEdit,
143
+ PopupEditNumber,
144
+ PopupEditText,
134
145
  BasicCheckBox,
135
146
  CustomizedCheckBox,
136
147
  CustomizedIcon,
@@ -27,7 +27,7 @@
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
32
  :filter-method="filterMethod"
33
33
  @on-select-visible-columns="saveSelectedColumns"
@@ -59,7 +59,7 @@ export default {
59
59
  },
60
60
  data () {
61
61
  return {
62
- smallDevice: true,
62
+ smallDevice: false,
63
63
  showDialog: false,
64
64
  store: tableStore(),
65
65
  tableStyle: '',
@@ -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',
@@ -141,12 +147,12 @@ export default {
141
147
  field: 'protein',
142
148
  sortable: true,
143
149
  required: true,
144
- editable: true,
145
- showEditIcon: true,
146
- popupEditEmit: 'onSaveValuePopupEdit',
147
- popupEditInputtype: 'text',
148
- popupEditDataCy: '',
149
- showInputPopupEdit: true
150
+ // editable: true,
151
+ // showEditIcon: true,
152
+ // popupEditEmit: 'onSaveValuePopupEdit',
153
+ // popupEditInputtype: 'text',
154
+ // popupEditDataCy: '',
155
+ // showInputPopupEdit: true
150
156
  },
151
157
  {
152
158
  name: 'sodium',
@@ -309,17 +315,27 @@ export default {
309
315
  iron: '6%'
310
316
  }
311
317
  ],
312
- visibleColumns: []
318
+ visibleColumns: [],
319
+ showSkeleton: false
313
320
  }
314
321
  },
315
322
  mounted () {
323
+ this.showSkeleton = true
316
324
  this.store.cleanTableFilter()
317
325
  this.tableStyle = setTableHeight.setTableHeight()
318
326
  infiniteScroll.handleInfiniteScrollNewTable(this)
319
- this.visibleColumns = this.store.visiblecolumns
320
- this.rows = this.rowsData
327
+ this.getRows()
321
328
  },
322
329
  methods: {
330
+ getRows () {
331
+ setTimeout(()=> {
332
+ this.showSkeleton = false
333
+
334
+ // this.visibleColumns = this.store.visiblecolumns
335
+ }, 1000)
336
+ this.rows = this.rowsData
337
+ this.visibleColumns = this.store.visiblecolumns
338
+ },
323
339
  saveSelectedColumns (columns: string []): void {
324
340
  this.store.visiblecolumns = columns
325
341
  this.visibleColumns = columns
@@ -7,17 +7,16 @@
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}"
@@ -36,8 +35,6 @@
36
35
  import Table from '../components/Table/Table.vue'
37
36
  import setTableHeight from '../components/Table/utils/setTableHeight'
38
37
  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
38
  import { tableStore } from '../store/table.js'
42
39
  export default {
43
40
  components: {
@@ -45,6 +42,7 @@ export default {
45
42
  },
46
43
  data () {
47
44
  return {
45
+ showSkeleton: true,
48
46
  showDialog: false,
49
47
  store: tableStore(),
50
48
  tableStyle: '',
@@ -325,13 +323,11 @@ export default {
325
323
  calcium: '12%',
326
324
  iron: '6%'
327
325
  }
328
- ],
329
- visibleColumns: []
326
+ ]
330
327
  }
331
328
  },
332
329
  mounted () {
333
330
  this.store.cleanTableFilter()
334
- this.visibleColumns = this.store.visiblecolumns
335
331
  this.tableStyle = setTableHeight.setTableHeight()
336
332
  infiniteScroll.handleInfiniteScrollNewTable(this)
337
333
  this.getRows()
@@ -359,10 +355,12 @@ export default {
359
355
  iron: lista[i].iron
360
356
  })
361
357
  }
358
+ setTimeout(() => {
359
+ this.showSkeleton = false
360
+ }, 1000);
362
361
  },
363
362
  saveSelectedColumns (columns: string []): void {
364
363
  this.store.visiblecolumns = columns
365
- this.visibleColumns = columns
366
364
  },
367
365
  onUpdateBasicCheckboxValue (rows: object []) {
368
366
  console.log(rows, 'onUpdateBasicCheckboxValue')