vueless 0.0.319 → 0.0.320

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.319",
3
+ "version": "0.0.320",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -119,10 +119,12 @@ export default /*tw*/ {
119
119
  okLabel: "Ok",
120
120
  },
121
121
  defaults: {
122
- userFormat: "j F, Y",
122
+ userDateFormat: "j F, Y",
123
+ userDateTimeFormat: "j F, Y - H:i:S",
123
124
  range: false,
124
125
  timepicker: false,
125
126
  dateFormat: undefined,
127
+ dateTimeFormat: undefined,
126
128
  maxDate: undefined,
127
129
  minDate: undefined,
128
130
  /* icons */
@@ -68,4 +68,4 @@ MinMax.args = {
68
68
  };
69
69
 
70
70
  export const DateFormat = DefaultTemplate.bind({});
71
- DateFormat.args = { dateFormat: "d.m.Y", userFormat: "d.m.Y", value: "28.06.2024" };
71
+ DateFormat.args = { dateFormat: "d.m.Y", userDateFormat: "d.m.Y", value: "28.06.2024" };
@@ -60,7 +60,7 @@
60
60
  :active-date="activeDate"
61
61
  :min-date="minDate"
62
62
  :max-date="maxDate"
63
- :date-format="dateFormat"
63
+ :date-format="actualDateFormat"
64
64
  :locale="locale"
65
65
  :config="config"
66
66
  @input="onInputDate"
@@ -73,7 +73,7 @@
73
73
  :active-date="activeDate"
74
74
  :min-date="minDate"
75
75
  :max-date="maxDate"
76
- :date-format="dateFormat"
76
+ :date-format="actualDateFormat"
77
77
  :locale="locale"
78
78
  :config="config"
79
79
  @input="onInput"
@@ -86,7 +86,7 @@
86
86
  :active-date="activeDate"
87
87
  :min-date="minDate"
88
88
  :max-date="maxDate"
89
- :date-format="dateFormat"
89
+ :date-format="actualDateFormat"
90
90
  :locale="locale"
91
91
  :config="config"
92
92
  @input="onInput"
@@ -231,12 +231,28 @@ const props = defineProps({
231
231
  default: getDefault(defaultConfig, UCalendar).dateFormat,
232
232
  },
233
233
 
234
+ /**
235
+ * Same as date format, but used when timepicker is enabled.
236
+ */
237
+ dateTimeFormat: {
238
+ type: String,
239
+ default: getDefault(defaultConfig, UCalendar).dateTimeFormat,
240
+ },
241
+
234
242
  /**
235
243
  * User friendly date format.
236
244
  */
237
- userFormat: {
245
+ userDateFormat: {
238
246
  type: String,
239
- default: getDefault(defaultConfig, UCalendar).userFormat,
247
+ default: getDefault(defaultConfig, UCalendar).userDateFormat,
248
+ },
249
+
250
+ /**
251
+ * Same as user format, but used when timepicker is enabled.
252
+ */
253
+ userDateTimeFormat: {
254
+ type: String,
255
+ default: getDefault(defaultConfig, UCalendar).userDateTimeFormat,
240
256
  },
241
257
 
242
258
  /**
@@ -386,6 +402,18 @@ const locale = computed(() => {
386
402
  };
387
403
  });
388
404
 
405
+ const isTimepickerEnabled = computed(() => {
406
+ return props.timepicker && !props.range;
407
+ });
408
+
409
+ const actualDateFormat = computed(() => {
410
+ return isTimepickerEnabled.value ? props.dateTimeFormat : props.dateFormat;
411
+ });
412
+
413
+ const actualUserFormat = computed(() => {
414
+ return isTimepickerEnabled.value ? props.userDateTimeFormat : props.userDateFormat;
415
+ });
416
+
389
417
  const userFormatLocale = computed(() => {
390
418
  const { months, weekdays } = currentLocale.value;
391
419
 
@@ -413,10 +441,6 @@ const userFormatLocale = computed(() => {
413
441
  };
414
442
  });
415
443
 
416
- const isTimepickerEnabled = computed(() => {
417
- return props.timepicker && !props.range;
418
- });
419
-
420
444
  const isModelRangeType = computed(() => {
421
445
  return (
422
446
  props.modelValue !== null &&
@@ -433,22 +457,26 @@ const localValue = computed({
433
457
  const to = isModelRangeType.value ? props.modelValue.to : null;
434
458
 
435
459
  return {
436
- from: parseDate(from || null, props.dateFormat, locale.value),
437
- to: parseDate(to || null, props.dateFormat, locale.value),
460
+ from: parseDate(from || null, actualDateFormat.value, locale.value),
461
+ to: parseDate(to || null, actualDateFormat.value, locale.value),
438
462
  };
439
463
  }
440
464
 
441
465
  return isModelRangeType.value
442
- ? parseDate(props.modelValue.from || null, props.dateFormat, locale.value)
443
- : parseDate(props.modelValue || null, props.dateFormat, locale.value);
466
+ ? parseDate(props.modelValue.from || null, actualDateFormat.value, locale.value)
467
+ : parseDate(props.modelValue || null, actualDateFormat.value, locale.value);
444
468
  },
445
469
  set(value) {
446
470
  value = getCurrentValueType(value);
447
471
 
448
- const parsedDate = parseDate(props.range ? value.from : value, props.dateFormat, locale.value);
472
+ const parsedDate = parseDate(
473
+ props.range ? value.from : value,
474
+ actualDateFormat.value,
475
+ locale.value,
476
+ );
449
477
  const parsedDateTo =
450
478
  isModelRangeType.value && props.range
451
- ? parseDate(value.to, props.dateFormat, locale.value)
479
+ ? parseDate(value.to, actualDateFormat.value, locale.value)
452
480
  : undefined;
453
481
 
454
482
  if (parsedDate && isTimepickerEnabled.value) {
@@ -462,19 +490,19 @@ const localValue = computed({
462
490
  props.minDate,
463
491
  props.maxDate,
464
492
  locale.value,
465
- props.dateFormat,
493
+ actualDateFormat.value,
466
494
  );
467
495
 
468
496
  if (isOutOfRange) {
469
497
  return;
470
498
  }
471
499
 
472
- const newDate = props.dateFormat
473
- ? formatDate(parsedDate || null, props.dateFormat, locale.value)
500
+ const newDate = actualDateFormat.value
501
+ ? formatDate(parsedDate || null, actualDateFormat.value, locale.value)
474
502
  : parsedDate;
475
503
 
476
- const newDateTo = props.dateFormat
477
- ? formatDate(parsedDateTo || null, props.dateFormat, locale.value)
504
+ const newDateTo = actualDateFormat.value
505
+ ? formatDate(parsedDateTo || null, actualDateFormat.value, locale.value)
478
506
  : parsedDateTo;
479
507
 
480
508
  emit("update:modelValue", props.range ? { from: newDate, to: newDateTo } : newDate);
@@ -492,23 +520,25 @@ const localValue = computed({
492
520
  const selectedDate = computed(() => {
493
521
  return parseDate(
494
522
  props.range ? localValue.value.from : localValue.value,
495
- props.dateFormat,
523
+ actualDateFormat.value,
496
524
  locale.value,
497
525
  );
498
526
  });
499
527
 
500
528
  const selectedDateTo = computed(() => {
501
- return props.range ? parseDate(localValue.value.to, props.dateFormat, locale.value) : undefined;
529
+ return props.range
530
+ ? parseDate(localValue.value.to, actualDateFormat.value, locale.value)
531
+ : undefined;
502
532
  });
503
533
 
504
534
  const formattedDate = computed(() => {
505
- return formatDate(selectedDate.value, props.dateFormat, locale.value);
535
+ return formatDate(selectedDate.value, actualDateFormat.value, locale.value);
506
536
  });
507
537
 
508
538
  const userFormattedDate = computed(() => {
509
- const date = formatDate(selectedDate.value, props.userFormat, userFormatLocale.value);
539
+ const date = formatDate(selectedDate.value, actualUserFormat.value, userFormatLocale.value);
510
540
  const dateTo = props.range
511
- ? formatDate(selectedDateTo.value, props.userFormat, userFormatLocale.value)
541
+ ? formatDate(selectedDateTo.value, actualUserFormat.value, userFormatLocale.value)
512
542
  : undefined;
513
543
 
514
544
  return props.range ? `${date} ${SEPARATOR} ${dateTo}` : date;
@@ -699,7 +729,7 @@ function arrowKeyHandler(event) {
699
729
  props.minDate,
700
730
  props.maxDate,
701
731
  locale.value,
702
- props.dateFormat,
732
+ actualDateFormat.value,
703
733
  );
704
734
 
705
735
  if (newActiveDate && !isOutOfRange) {
@@ -108,7 +108,8 @@ export default /*tw*/ {
108
108
  okLabel: "Ok",
109
109
  },
110
110
  defaults: {
111
- userFormat: "j F, Y",
111
+ userDateFormat: "j F, Y",
112
+ userDateTimeFormat: "j F, Y - H:i:S",
112
113
  size: "md",
113
114
  openDirectionX: "auto",
114
115
  openDirectionY: "auto",
@@ -116,6 +117,7 @@ export default /*tw*/ {
116
117
  timepicker: false,
117
118
  disabled: false,
118
119
  dateFormat: undefined,
120
+ dateTimeFormat: undefined,
119
121
  maxDate: undefined,
120
122
  minDate: undefined,
121
123
  },
@@ -133,13 +133,13 @@ export const placeholder = DefaultTemplate.bind({});
133
133
  placeholder.args = { placeholder: "some placeholder" };
134
134
 
135
135
  export const DateFormat = DefaultTemplate.bind({});
136
- DateFormat.args = { dateFormat: "d.m.Y", userFormat: "d.m.Y", modelValue: "28.06.2024" };
136
+ DateFormat.args = { dateFormat: "d.m.Y", userDateFormat: "d.m.Y", modelValue: "28.06.2024" };
137
137
 
138
138
  export const Timepicker = DefaultTemplate.bind({});
139
139
  Timepicker.args = {
140
140
  timepicker: true,
141
141
  modelValue: new Date(2024, 2, 14, 12, 24, 14),
142
- userFormat: "j F, Y - H:i:S",
142
+ userDateFormat: "j F, Y - H:i:S",
143
143
  };
144
144
 
145
145
  export const MinMax = DefaultTemplate.bind({});
@@ -47,7 +47,9 @@
47
47
  tabindex="-1"
48
48
  :timepicker="timepicker"
49
49
  :date-format="dateFormat"
50
- :user-format="userFormat"
50
+ :date-time-format="dateTimeFormat"
51
+ :user-date-format="userFormat"
52
+ :user-date-time-format="userDateTimeFormat"
51
53
  :max-date="maxDate"
52
54
  :min-date="minDate"
53
55
  v-bind="calendarAttrs"
@@ -217,12 +219,28 @@ const props = defineProps({
217
219
  default: getDefault(defaultConfig, UDatePicker).dateFormat,
218
220
  },
219
221
 
222
+ /**
223
+ * Same as date format, but used when timepicker is enabled.
224
+ */
225
+ dateTimeFormat: {
226
+ type: String,
227
+ default: getDefault(defaultConfig, UCalendar).dateTimeFormat,
228
+ },
229
+
220
230
  /**
221
231
  * User friendly date format.
222
232
  */
223
- userFormat: {
233
+ userDateFormat: {
234
+ type: String,
235
+ default: getDefault(defaultConfig, UDatePicker).userDateFormat,
236
+ },
237
+
238
+ /**
239
+ * Same as user format, but used when timepicker is enabled.
240
+ */
241
+ userDateTimeFormat: {
224
242
  type: String,
225
- default: getDefault(defaultConfig, UDatePicker).userFormat,
243
+ default: getDefault(defaultConfig, UCalendar).userDateTimeFormat,
226
244
  },
227
245
 
228
246
  /**
@@ -341,7 +359,7 @@ function onBlur(event) {
341
359
  }
342
360
 
343
361
  function formatUserDate(data) {
344
- if (props.userFormat !== STANDARD_USER_FORMAT) return data;
362
+ if (props.userFormat !== STANDARD_USER_FORMAT || props.timepicker) return data;
345
363
 
346
364
  let prefix = "";
347
365
  const formattedDate = data.charAt(0).toUpperCase() + data.toLowerCase().slice(1);
@@ -150,7 +150,7 @@ MinMax.args = {
150
150
  export const DateFormat = DefaultTemplate.bind({});
151
151
  DateFormat.args = {
152
152
  dateFormat: "d.m.Y",
153
- userFormat: "d.m.Y",
153
+ userDateFormat: "d.m.Y",
154
154
  value: { from: "28.06.2024", to: "30.06.2024" },
155
155
  };
156
156
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.319",
4
+ "version": "0.0.320",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -1204,7 +1204,15 @@
1204
1204
  }
1205
1205
  },
1206
1206
  {
1207
- "name": "userFormat",
1207
+ "name": "dateTimeFormat",
1208
+ "description": "Same as date format, but used when timepicker is enabled.",
1209
+ "value": {
1210
+ "kind": "expression",
1211
+ "type": "string"
1212
+ }
1213
+ },
1214
+ {
1215
+ "name": "userDateFormat",
1208
1216
  "description": "User friendly date format.",
1209
1217
  "value": {
1210
1218
  "kind": "expression",
@@ -1212,6 +1220,15 @@
1212
1220
  },
1213
1221
  "default": "j F, Y"
1214
1222
  },
1223
+ {
1224
+ "name": "userDateTimeFormat",
1225
+ "description": "Same as user format, but used when timepicker is enabled.",
1226
+ "value": {
1227
+ "kind": "expression",
1228
+ "type": "string"
1229
+ },
1230
+ "default": "j F, Y - H:i:S"
1231
+ },
1215
1232
  {
1216
1233
  "name": "minDate",
1217
1234
  "description": "Min date in JS Date Object or Date String formatted in provided props.dateFormat.",
@@ -2423,7 +2440,15 @@
2423
2440
  }
2424
2441
  },
2425
2442
  {
2426
- "name": "userFormat",
2443
+ "name": "dateTimeFormat",
2444
+ "description": "Same as date format, but used when timepicker is enabled.",
2445
+ "value": {
2446
+ "kind": "expression",
2447
+ "type": "string"
2448
+ }
2449
+ },
2450
+ {
2451
+ "name": "userDateFormat",
2427
2452
  "description": "User friendly date format.",
2428
2453
  "value": {
2429
2454
  "kind": "expression",
@@ -2431,6 +2456,15 @@
2431
2456
  },
2432
2457
  "default": "j F, Y"
2433
2458
  },
2459
+ {
2460
+ "name": "userDateTimeFormat",
2461
+ "description": "Same as user format, but used when timepicker is enabled.",
2462
+ "value": {
2463
+ "kind": "expression",
2464
+ "type": "string"
2465
+ },
2466
+ "default": "j F, Y - H:i:S"
2467
+ },
2434
2468
  {
2435
2469
  "name": "id",
2436
2470
  "description": "@ignore: Unique element id.",