quasar-factory-lib 0.0.62 → 0.0.64

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.62",
100
+ "version": "0.0.64",
101
101
  "author": ""
102
102
  }
@@ -77,7 +77,12 @@ export default defineComponent({
77
77
  },
78
78
  endTask () {
79
79
  this.$emit('endTask')
80
- }
80
+ },
81
+ showConfirmedTaskAnSetValues (total: number, selected: number): void {
82
+ this.alert = true
83
+ this.values.total = total
84
+ this.values.selected = selected
85
+ },
81
86
  },
82
87
  mounted () {}
83
88
  })
@@ -66,6 +66,7 @@
66
66
  @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
67
67
  @on-save-value-popup-edit="onSaveValuePopupEdit"
68
68
  @on-click-button="onClickButton"
69
+ @on-click-button-with-tool-tip="onClickButtonWithToolTip"
69
70
  @click="onRowClick(props.row)"
70
71
  />
71
72
  </template>
@@ -80,6 +81,7 @@
80
81
  @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
81
82
  @on-save-value-popup-edit="onSaveValuePopupEdit"
82
83
  @on-click-button="onClickButton"
84
+ @on-click-button-with-tool-tip="onClickButtonWithToolTip"
83
85
  @click="onRowClick(props.row)"
84
86
  />
85
87
  </template>
@@ -194,7 +196,13 @@ export default defineComponent({
194
196
  'deleteItem',
195
197
  'openModalWithTable',
196
198
  'setItemNotFound',
197
- 'onRowClick'],
199
+ 'onClickSeeTaskDetails',
200
+ 'startMaintenanceTicket',
201
+ 'pauseMaintenanceTicket',
202
+ 'finishMaintenanceTicket',
203
+ 'onRowClick',
204
+ 'onClickButtonWithToolTip'
205
+ ],
198
206
  data () {
199
207
  return {
200
208
  selected: [],
@@ -266,6 +274,9 @@ export default defineComponent({
266
274
  onClickButton (emit: 'onClickButton', row: object) {
267
275
  this.$emit(emit, row)
268
276
  },
277
+ onClickButtonWithToolTip (row: object) {
278
+ this.$emit('onClickButtonWithToolTip', row)
279
+ },
269
280
  onRowClick (row: object) {
270
281
  this.$emit('onRowClick', row)
271
282
  },
@@ -331,19 +342,27 @@ export default defineComponent({
331
342
  return (hours * 3600) + (minutes * 60) + seconds;
332
343
  };
333
344
 
345
+ const parsePercentage = (percentageString: string): number => {
346
+ return parseFloat(percentageString.replace('%', '')) / 100;
347
+ };
348
+
334
349
  if (typeof xValue === 'string' && typeof yValue === 'string') {
335
350
  const xDate = parseDate(xValue);
336
351
  const yDate = parseDate(yValue);
337
-
352
+
338
353
  if (!isNaN(xDate.getTime()) && !isNaN(yDate.getTime())) {
339
354
  return xDate.getTime() - yDate.getTime();
340
355
  }
341
356
 
342
357
  const xTime = parseTime(xValue);
343
358
  const yTime = parseTime(yValue);
344
-
359
+
345
360
  if (!isNaN(xTime) && !isNaN(yTime)) {
346
361
  return xTime - yTime;
362
+ } else if (xValue.includes('%') && yValue.includes('%')) {
363
+ const xPercent = parsePercentage(xValue);
364
+ const yPercent = parsePercentage(yValue);
365
+ return xPercent - yPercent;
347
366
  } else {
348
367
  return xValue.localeCompare(yValue);
349
368
  }
@@ -352,6 +371,7 @@ export default defineComponent({
352
371
  return xValue - yValue;
353
372
  }
354
373
  else if (typeof xValue === 'boolean' && typeof yValue === 'boolean') {
374
+ console.log(xValue, yValue)
355
375
  return xValue === yValue ? 0 : xValue ? 1 : -1;
356
376
  }
357
377
  else {
@@ -30,6 +30,11 @@ export default {
30
30
  tablePropsData: this.tableProps,
31
31
  modelData: this.model
32
32
  }
33
+ },
34
+ watch: {
35
+ model (val) {
36
+ this.modelData = val
37
+ }
33
38
  }
34
39
  }
35
40
  </script>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <q-badge
3
+ class="cursor-pointer"
4
+ :data-cy="'badge' + dataCy"
5
+ :color="badgeColor"
6
+ :text-color="badgeTextColor"
7
+ :outline="badgeOutline"
8
+ :rounded="badgeRounded"
9
+ :transparent="badgeTransparent"
10
+ >
11
+ {{ $t(badgeText) }}
12
+ </q-badge>
13
+ </template>
14
+ <script lang="ts">
15
+ export default {
16
+ name: 'CustomizedBadge',
17
+ props: {
18
+ dataCy: {
19
+ type: String,
20
+ required: true
21
+ },
22
+ badgeText: {
23
+ type: String,
24
+ required: true
25
+ },
26
+ badgeColor: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ badgeTextColor: {
31
+ type: String,
32
+ required: true
33
+ },
34
+ badgeOutline: {
35
+ type: Boolean,
36
+ required: true
37
+ },
38
+ badgeRounded: {
39
+ type: Boolean,
40
+ required: true
41
+ },
42
+ badgeTransparent: {
43
+ type: Boolean,
44
+ required: true
45
+ }
46
+ }
47
+ }
48
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <q-btn
3
+ :data-cy="dataCy"
4
+ flat
5
+ round
6
+ :color="btnColor"
7
+ size="md"
8
+ @click="$emit('onClickButtonWithToolTip')"
9
+ >
10
+ <q-icon :name="btnIcon" />
11
+ <q-tooltip
12
+ anchor="top middle"
13
+ self="bottom middle"
14
+ :offset="[10, 10]"
15
+ >
16
+ {{ $t(toolTipText) }}
17
+ </q-tooltip>
18
+ </q-btn>
19
+ </template>
20
+ <script lang="ts">
21
+ export default {
22
+ name: 'CustomizedButtonWithToolTip',
23
+ props: {
24
+ dataCy: {
25
+ type: String,
26
+ required: true
27
+ },
28
+ btnColor: {
29
+ type: String,
30
+ required: true
31
+ },
32
+ btnIcon: {
33
+ type: String,
34
+ required: true
35
+ },
36
+ toolTipText: {
37
+ type: String,
38
+ required: true
39
+ }
40
+ },
41
+ emits: ['onClickButtonWithToolTip']
42
+ }
43
+ </script>
@@ -51,6 +51,11 @@ export default {
51
51
  tablePropsData: this.tableProps,
52
52
  modelData: this.model
53
53
  }
54
+ },
55
+ watch: {
56
+ model (val) {
57
+ this.modelData = val
58
+ }
54
59
  }
55
60
  }
56
61
  </script>
@@ -97,6 +97,26 @@
97
97
  $emit('onClickButton', col.btnEmit, tablePropsData.row)
98
98
  }"
99
99
  />
100
+ <CustomizedButtonWithToolTip
101
+ v-if="col.showCustomizedButtonWithToolTip"
102
+ :data-cy="col.ButtonWithToolTip + '-' + tablePropsData.row.id"
103
+ :btn-color="tablePropsData.row.btnColor || 'primary'"
104
+ :btn-icon="col.btnIcon|| ''"
105
+ :toolTipText="tablePropsData.row.toolTipText || ''"
106
+ @on-click-button-with-tool-tip="() => {
107
+ $emit('onClickButtonWithToolTip', col.btnEmit, tablePropsData.row)
108
+ }"
109
+ />
110
+ <CustomizedBadge
111
+ v-if="col.showBadge"
112
+ :data-cy="col.badgeDataCy + tablePropsData.row.id"
113
+ :badgeText="tablePropsData.row.badgeText"
114
+ :badgeColor="tablePropsData.row.badgeColor"
115
+ :badgeTextColor="col.badgeTextColor || 'primary'"
116
+ :badgeOutline="col.badgeOutline || false"
117
+ :badgeRounded="col.badgeRounded || false"
118
+ :badgeTransparent="col.badgeTransparent || false"
119
+ />
100
120
  </q-td>
101
121
  </tr>
102
122
  </template>
@@ -107,6 +127,8 @@ import BasicCheckBox from './BasicCheckBox.vue'
107
127
  import CustomizedCheckBox from './CustomizedCheckBox.vue'
108
128
  import CustomizedIcon from './CustomizedIcon.vue'
109
129
  import CustomizedButton from './CustomizedButton.vue'
130
+ import CustomizedBadge from './CustomizedBadge.vue'
131
+ import CustomizedButtonWithToolTip from './CustomizedButtonWithToolTip.vue'
110
132
  export default {
111
133
  name: 'TableSlotBody',
112
134
  components: {
@@ -115,7 +137,9 @@ export default {
115
137
  BasicCheckBox,
116
138
  CustomizedCheckBox,
117
139
  CustomizedIcon,
118
- CustomizedButton
140
+ CustomizedButton,
141
+ CustomizedBadge,
142
+ CustomizedButtonWithToolTip
119
143
  },
120
144
  props: {
121
145
  tableProps: {
@@ -136,15 +160,21 @@ export default {
136
160
  this.tablePropsData = val
137
161
  }
138
162
  },
139
- emits: ['onSaveValuePopupEdit', 'onUpdateBasicCheckboxValue', 'onClickButton', 'onUpdateCustomizedCheckboxValue'],
163
+ emits: [
164
+ 'onSaveValuePopupEdit',
165
+ 'onUpdateBasicCheckboxValue',
166
+ 'onClickButton',
167
+ 'onUpdateCustomizedCheckboxValue',
168
+ 'onClickButtonWithToolTip'
169
+ ],
140
170
  data () {
141
171
  return {
142
172
  tablePropsData: this.tableProps
143
173
  }
144
174
  },
145
175
  methods: {
146
- getColumnValue (col: { showBasicCheckbox: boolean; showCustomizedCheckBox: boolean; showCustomizedIcon: boolean; showColumButton: boolean }): boolean {
147
- return !(col.showBasicCheckbox || col.showCustomizedCheckBox || col.showCustomizedIcon || col.showColumButton)
176
+ getColumnValue (col: { showBasicCheckbox: boolean; showCustomizedCheckBox: boolean; showCustomizedIcon: boolean; showColumButton: boolean, showBadge: boolean, showCustomizedButtonWithToolTip: boolean }): boolean {
177
+ return !(col.showBasicCheckbox || col.showCustomizedCheckBox || col.showCustomizedIcon || col.showColumButton || col.showBadge || col.showCustomizedButtonWithToolTip)
148
178
  }
149
179
  }
150
180
  }
@@ -16,7 +16,7 @@
16
16
  : tablePropsData.row.rowBgColor || 'bg-main-color'
17
17
  "
18
18
  >
19
- <q-card-section>
19
+ <q-card-section class="q-py-sm">
20
20
  <q-checkbox
21
21
  :data-cy="'checkbox-' + tablePropsData.row.id"
22
22
  size="sm"
@@ -127,7 +127,31 @@
127
127
  }"
128
128
  />
129
129
  </q-item-section>
130
+ <q-item-section>
131
+ <CustomizedButtonWithToolTip
132
+ v-if="col.showCustomizedButtonWithToolTip"
133
+ :data-cy="col.ButtonWithToolTip + '-' + tablePropsData.row.id"
134
+ :btn-color="tablePropsData.row.btnColor || 'primary'"
135
+ :btn-icon="col.btnIcon|| ''"
136
+ :toolTipText="tablePropsData.row.toolTipText || ''"
137
+ @on-click-button-with-tool-tip="() => {
138
+ $emit('onClickButtonWithToolTip', col.btnEmit, tablePropsData.row)
139
+ }"
140
+ />
141
+ </q-item-section>
142
+ <q-item-section>
143
+ <CustomizedBadge
144
+ v-if="col.showBadge"
145
+ :data-cy="col.badgeDataCy + tablePropsData.row.id"
146
+ :badgeText="tablePropsData.row.badgeText"
147
+ :badgeColor="tablePropsData.row.badgeColor"
148
+ :badgeTextColor="col.badgeTextColor || 'primary'"
149
+ :badgeOutline="col.badgeOutline || false"
150
+ :badgeRounded="col.badgeRounded || false"
151
+ :badgeTransparent="col.badgeTransparent || false"
152
+ />
130
153
  </q-item-section>
154
+ </q-item-section>
131
155
  </q-item>
132
156
  </q-list>
133
157
  </q-card>
@@ -140,6 +164,8 @@ import BasicCheckBox from './BasicCheckBox.vue'
140
164
  import CustomizedCheckBox from './CustomizedCheckBox.vue'
141
165
  import CustomizedIcon from './CustomizedIcon.vue'
142
166
  import CustomizedButton from './CustomizedButton.vue'
167
+ import CustomizedBadge from './CustomizedBadge.vue'
168
+ import CustomizedButtonWithToolTip from './CustomizedButtonWithToolTip.vue'
143
169
 
144
170
  export default {
145
171
  name: 'TableSlotGrid',
@@ -149,7 +175,9 @@ export default {
149
175
  BasicCheckBox,
150
176
  CustomizedCheckBox,
151
177
  CustomizedIcon,
152
- CustomizedButton
178
+ CustomizedButton,
179
+ CustomizedBadge,
180
+ CustomizedButtonWithToolTip
153
181
  },
154
182
  props: {
155
183
  tableProps: {
@@ -172,7 +200,8 @@ export default {
172
200
  'onSaveValuePopupEdit',
173
201
  'onUpdateBasicCheckboxValue',
174
202
  'onClickButton',
175
- 'onUpdateCustomizedCheckboxValue'
203
+ 'onUpdateCustomizedCheckboxValue',
204
+ 'onClickButtonWithToolTip'
176
205
  ],
177
206
  data () {
178
207
  return {
@@ -187,8 +216,8 @@ export default {
187
216
  },
188
217
  mounted () {},
189
218
  methods: {
190
- getColumnValue (col: { showBasicCheckbox: boolean; showCustomizedCheckBox: boolean; showCustomizedIcon: boolean; showColumButton: boolean }): boolean {
191
- return !(col.showBasicCheckbox || col.showCustomizedCheckBox || col.showCustomizedIcon || col.showColumButton)
219
+ getColumnValue (col: { showBasicCheckbox: boolean; showCustomizedCheckBox: boolean; showCustomizedIcon: boolean; showColumButton: boolean, showBadge: boolean, showCustomizedButtonWithToolTip: boolean }): boolean {
220
+ return !(col.showBasicCheckbox || col.showCustomizedCheckBox || col.showCustomizedIcon || col.showColumButton || col.showBadge || col.showCustomizedButtonWithToolTip)
192
221
  }
193
222
  }
194
223
  }
package/src/css/app.css CHANGED
@@ -56,12 +56,9 @@
56
56
  .text-color-negative-bold {
57
57
  color: var(--negative);
58
58
  font-weight: bold;
59
- font-size: 30px;
59
+ font-size: 18px;
60
60
  }
61
61
 
62
62
  .border-bottom-darkGrey{
63
63
  border-bottom: 0.7px solid var(--dark-gray);
64
64
  }
65
-
66
- /* const labelTextColor = 'color: #597765 !important;'
67
- const labelTextColorBold = 'color: #597765 !important; font-weight: bold;' */
@@ -28,6 +28,8 @@
28
28
  @on-update-basic-checkbox-value="onUpdateBasicCheckboxValue"
29
29
  @on-update-customized-checkbox-value="onUpdateCustomizedCheckboxValue"
30
30
  @on-click-button="setItemNotFound"
31
+ @onClickButtonWithToolTip="onClickBadge"
32
+
31
33
  />
32
34
  </div>
33
35
  </q-page>
@@ -88,7 +90,11 @@ export default {
88
90
  label: 'Boolean Icon',
89
91
  align: 'left',
90
92
  sortable: true,
91
- showCustomizedIcon: true
93
+ showCustomizedIcon: true,
94
+ customizedIconNameCaseTrue: 'done',
95
+ customizedIconNameCaseFalse: 'done_all',
96
+ customizedIconColorCaseTrue: 'yellow',
97
+ customizedIconColorCaseFalse: 'blue'
92
98
  },
93
99
  {
94
100
  name: 'calories',
@@ -121,7 +127,14 @@ export default {
121
127
  field: 'carbs',
122
128
  align: 'left',
123
129
  sortable: true,
124
- format: (val: number) => `${val}`
130
+ format: (val: number) => `${val}`,
131
+ showBadge: true,
132
+ badgeDataCy: 'badgeDataCy',
133
+ badgeEmit: 'onClickBadge',
134
+ badgeText: (row: { badgeText: string }) => row.badgeText,
135
+ badgeColor: (row: { badgeColor: string }) => row.badgeColor,
136
+ badgeTextColor: 'black',
137
+ badgeOutline: true
125
138
  },
126
139
  {
127
140
  name: 'checked',
@@ -156,7 +169,14 @@ export default {
156
169
  label: 'Sodium (mg)',
157
170
  align: 'left',
158
171
  field: 'sodium',
159
- sortable: true
172
+ required: true,
173
+ sortable: true,
174
+ showCustomizedButtonWithToolTip: true,
175
+ btnIcon: 'warning',
176
+ btnEmit: 'onClickButtonWithToolTip',
177
+ dataCy: 'onClickButtonWithToolTip',
178
+ btnColor: (row: { btnColor: string }) => row.btnColor,
179
+ toolTipText: (row: { toolTipText: string }) => row.toolTipText,
160
180
  },
161
181
  {
162
182
  name: 'calcium',
@@ -354,12 +374,26 @@ export default {
354
374
  protein: lista[i].protein,
355
375
  sodium: lista[i].sodium,
356
376
  calcium: lista[i].calcium,
357
- iron: lista[i].iron
377
+ iron: lista[i].iron,
378
+ badgeColor: this.getBadgeColor(lista[i].carbs),
379
+ badgeText: this.getBadgeText(lista[i].carbs),
380
+ toolTipText: this.getBadgeText(lista[i].carbs),
381
+ btnColor: this.getBadgeColor(lista[i].carbs)
358
382
  })
359
383
  }
360
384
  setTimeout(() => {
361
385
  this.showSkeleton = false
362
386
  }, 1000);
387
+ console.log('rows', this.rows)
388
+ },
389
+ getBadgeColor(carbs: number) {
390
+ return carbs > 50 ? 'negative': 'secondary'
391
+ },
392
+ getBadgeText (carbs: number) {
393
+ return carbs > 50 ? 'header.hello': 'global.total'
394
+ },
395
+ onClickBadge (rows: object []) {
396
+ console.log(rows, 'onClickBadge')
363
397
  },
364
398
  onUpdateBasicCheckboxValue (rows: object []) {
365
399
  console.log(rows, 'onUpdateBasicCheckboxValue')