@simsustech/quasar-components 0.5.0 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @simsustech/quasar-components
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7799b8f: fix(DateInput): fix style
8
+
9
+ ## 0.5.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 4d55fc8: feat(DateInput): add stack-label; fix(DateInput): set year to undefined on invalid values
14
+
3
15
  ## 0.5.0
4
16
 
5
17
  ### Minor Changes
package/dist/form.js CHANGED
@@ -327,7 +327,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
327
327
  };
328
328
  }
329
329
  });
330
- const _hoisted_1 = { class: "row items-center justify-end" };
330
+ const _hoisted_1 = {
331
+ key: 0,
332
+ style: { "padding": "0px", "margin": "0px", "font-size": "18px" }
333
+ };
334
+ const _hoisted_2 = { class: "row items-center justify-end" };
331
335
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
332
336
  __name: "DateInput",
333
337
  props: {
@@ -352,6 +356,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
352
356
  const nr = Number(val);
353
357
  if (nr && nr > 1e3 && nr < 1e4)
354
358
  year.value = nr;
359
+ else
360
+ year.value = void 0;
355
361
  };
356
362
  const setMonth = (val) => {
357
363
  const nr = Number(val);
@@ -425,8 +431,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
425
431
  YYYY: {
426
432
  modelValue: year.value,
427
433
  placeholder: lang2.value.datePicker.YYYY,
428
- style: "max-width: 6ch",
429
- suffix: format.value === "YYYY-MM-DD" ? "-" : void 0,
434
+ style: "max-width: 6.5ch",
435
+ // suffix: format.value === 'YYYY-MM-DD' ? '-' : undefined,
430
436
  class: format.value !== "YYYY-MM-DD" ? "q-mb-none q-ml-xs" : void 0,
431
437
  "onUpdate:modelValue": setYear,
432
438
  onKeydown: goToNextElement
@@ -434,8 +440,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
434
440
  MM: {
435
441
  modelValue: month.value ? String(month.value).padStart(2, "0") : "",
436
442
  placeholder: lang2.value.datePicker.MM,
437
- style: "max-width: 4ch",
438
- suffix: "-",
443
+ style: "max-width: 4.5ch",
444
+ // suffix: '-',
439
445
  class: "q-ml-xs",
440
446
  "onUpdate:modelValue": setMonth,
441
447
  onKeydown: goToNextElement
@@ -443,8 +449,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
443
449
  DD: {
444
450
  modelValue: day.value ? String(day.value).padStart(2, "0") : "",
445
451
  placeholder: lang2.value.datePicker.DD,
446
- style: "max-width: 4ch",
447
- suffix: format.value === "DD-MM-YYYY" ? "-" : void 0,
452
+ style: "max-width: 4.5ch",
453
+ // suffix: format.value === 'DD-MM-YYYY' ? '-' : undefined,
448
454
  class: format.value === "YYYY-MM-DD" ? "q-ml-xs" : void 0,
449
455
  "onUpdate:modelValue": setDay,
450
456
  onKeydown: goToNextElement
@@ -471,14 +477,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
471
477
  return openBlock(), createBlock(_component_q_field, {
472
478
  "model-value": unref(modelValue),
473
479
  "bottom-slots": "",
474
- rules: validations.value
480
+ rules: validations.value,
481
+ label: _ctx.label,
482
+ "stack-label": ""
475
483
  }, {
476
484
  control: withCtx(() => [
477
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(format).split("-"), (part) => {
485
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(format).split("-"), (part, index) => {
478
486
  return openBlock(), createBlock(resolveDynamicComponent(unref(QInput)), mergeProps({
479
487
  key: part,
480
488
  borderless: ""
481
- }, dateProps.value[part]), null, 16);
489
+ }, dateProps.value[part]), {
490
+ after: withCtx(() => [
491
+ index < 2 ? (openBlock(), createElementBlock("a", _hoisted_1, "-")) : createCommentVNode("", true)
492
+ ]),
493
+ _: 2
494
+ }, 1040);
482
495
  }), 128))
483
496
  ]),
484
497
  append: withCtx(() => [
@@ -512,7 +525,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
512
525
  "onUpdate:modelValue": setDate
513
526
  }), {
514
527
  default: withCtx(() => [
515
- createElementVNode("div", _hoisted_1, [
528
+ createElementVNode("div", _hoisted_2, [
516
529
  withDirectives(createVNode(_component_q_btn, {
517
530
  label: unref(lang2).buttons.close,
518
531
  color: "primary",
@@ -533,7 +546,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
533
546
  })
534
547
  ]),
535
548
  _: 1
536
- }, 8, ["model-value", "rules"]);
549
+ }, 8, ["model-value", "rules", "label"]);
537
550
  };
538
551
  }
539
552
  });
package/dist/style.css CHANGED
@@ -12,3 +12,14 @@
12
12
  .q-field--standard.q-field--dense .q-field__control {
13
13
  padding-top: 0;
14
14
  }
15
+ .q-field--auto-height.q-field--labeled .q-field__control-container {
16
+ padding-top: 13px;
17
+ }
18
+ .q-field--auto-height.q-field--labeled .q-field__native {
19
+ padding-bottom: 0px;
20
+ }
21
+ .q-field__after {
22
+ height: 1em;
23
+ margin-top: 0.5em;
24
+ margin-left: -8px;
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simsustech/quasar-components",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "author": "Stefan van Herwijnen",
5
5
  "description": "High level components for Quasar Framework",
6
6
  "license": "MIT",
@@ -1,13 +1,25 @@
1
1
  <template>
2
- <q-field :model-value="modelValue" bottom-slots :rules="validations">
2
+ <q-field
3
+ :model-value="modelValue"
4
+ bottom-slots
5
+ :rules="validations"
6
+ :label="label"
7
+ stack-label
8
+ >
3
9
  <template #control>
4
10
  <component
5
11
  :is="QInput"
6
- v-for="part in format.split('-')"
12
+ v-for="(part, index) in format.split('-')"
7
13
  :key="part"
8
14
  borderless
9
15
  v-bind="dateProps[part]"
10
- />
16
+ >
17
+ <template #after>
18
+ <a v-if="index < 2" style="padding: 0px; margin: 0px; font-size: 18px"
19
+ >-</a
20
+ >
21
+ </template></component
22
+ >
11
23
  </template>
12
24
 
13
25
  <template #append>
@@ -86,6 +98,7 @@ const setYear: InstanceType<typeof QInput>['$props']['onUpdate:modelValue'] = (
86
98
  ) => {
87
99
  const nr = Number(val)
88
100
  if (nr && nr > 1e3 && nr < 1e4) year.value = nr
101
+ else year.value = undefined
89
102
  }
90
103
 
91
104
  const setMonth: InstanceType<typeof QInput>['$props']['onUpdate:modelValue'] = (
@@ -172,8 +185,8 @@ const dateProps = computed<Record<string, QInputProps>>(() => ({
172
185
  YYYY: {
173
186
  modelValue: year.value,
174
187
  placeholder: lang.value.datePicker.YYYY,
175
- style: 'max-width: 6ch',
176
- suffix: format.value === 'YYYY-MM-DD' ? '-' : undefined,
188
+ style: 'max-width: 6.5ch',
189
+ // suffix: format.value === 'YYYY-MM-DD' ? '-' : undefined,
177
190
  class: format.value !== 'YYYY-MM-DD' ? 'q-mb-none q-ml-xs' : undefined,
178
191
  'onUpdate:modelValue': setYear,
179
192
  onKeydown: goToNextElement
@@ -181,8 +194,8 @@ const dateProps = computed<Record<string, QInputProps>>(() => ({
181
194
  MM: {
182
195
  modelValue: month.value ? String(month.value).padStart(2, '0') : '',
183
196
  placeholder: lang.value.datePicker.MM,
184
- style: 'max-width: 4ch',
185
- suffix: '-',
197
+ style: 'max-width: 4.5ch',
198
+ // suffix: '-',
186
199
  class: 'q-ml-xs',
187
200
  'onUpdate:modelValue': setMonth,
188
201
  onKeydown: goToNextElement
@@ -190,8 +203,8 @@ const dateProps = computed<Record<string, QInputProps>>(() => ({
190
203
  DD: {
191
204
  modelValue: day.value ? String(day.value).padStart(2, '0') : '',
192
205
  placeholder: lang.value.datePicker.DD,
193
- style: 'max-width: 4ch',
194
- suffix: format.value === 'DD-MM-YYYY' ? '-' : undefined,
206
+ style: 'max-width: 4.5ch',
207
+ // suffix: format.value === 'DD-MM-YYYY' ? '-' : undefined,
195
208
  class: format.value === 'YYYY-MM-DD' ? 'q-ml-xs' : undefined,
196
209
  'onUpdate:modelValue': setDay,
197
210
  onKeydown: goToNextElement
@@ -224,4 +237,15 @@ if (props.required)
224
237
  .q-field--standard.q-field--dense .q-field__control {
225
238
  padding-top: 0;
226
239
  }
240
+ .q-field--auto-height.q-field--labeled .q-field__control-container {
241
+ padding-top: 13px;
242
+ }
243
+ .q-field--auto-height.q-field--labeled .q-field__native {
244
+ padding-bottom: 0px;
245
+ }
246
+ .q-field__after {
247
+ height: 1em;
248
+ margin-top: 0.5em;
249
+ margin-left: -8px;
250
+ }
227
251
  </style>