vueless 0.0.573 → 0.0.575

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.573",
3
+ "version": "0.0.575",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -13,8 +13,6 @@ import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
13
13
 
14
14
  import type { Cell, CellObject, Row, RowScopedProps, UTableRowProps } from "./types.ts";
15
15
 
16
- const { hasSlotContent } = useUI(defaultConfig);
17
-
18
16
  const NESTED_ROW_SHIFT_REM = 1;
19
17
  const LAST_NESTED_ROW_SHIFT_REM = 1.1;
20
18
 
@@ -109,7 +109,7 @@ export function parseStringDate<TLocale extends DateLocale>(
109
109
  let parsedDate = new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0);
110
110
 
111
111
  const isRelativeDay = [locale.tomorrow, locale.today, locale.tomorrow].some((word) => {
112
- return dateString.toLowerCase().includes(word.toLowerCase());
112
+ return word && dateString.toLowerCase().includes(word.toLowerCase());
113
113
  });
114
114
 
115
115
  if (!isRelativeDay) {
@@ -1,4 +1,4 @@
1
- import { addDays, isSameDay } from "./utilDate";
1
+ import { addDays, isSameDay } from "./utilDate.ts";
2
2
 
3
3
  export interface DateLocale {
4
4
  weekdays: {
@@ -157,7 +157,11 @@ function onPaste(event: ClipboardEvent) {
157
157
  const relativeTokensAmount = Number(userFormat.match(/(?<!\\)r/g)?.length);
158
158
 
159
159
  // Amount of tokens used in format string without decimeters.
160
- const tokensAmount = userFormat
160
+ const dateFormatTokensAmount = props.userDateFormat
161
+ .split("")
162
+ .filter((char) => Object.keys(TOKEN_REG_EXP).includes(char)).length;
163
+
164
+ const timeFormatTokensAmount = props.userDateTimeFormat
161
165
  .split("")
162
166
  .filter((char) => Object.keys(TOKEN_REG_EXP).includes(char)).length;
163
167
 
@@ -180,13 +184,18 @@ function onPaste(event: ClipboardEvent) {
180
184
  pastedTokensAmount -= relativeTokensAmount;
181
185
  }
182
186
 
183
- if (pastedTokensAmount !== tokensAmount) return;
187
+ if (
188
+ pastedTokensAmount !== dateFormatTokensAmount &&
189
+ pastedTokensAmount !== timeFormatTokensAmount
190
+ ) {
191
+ return;
192
+ }
184
193
 
185
194
  const parsedDate = parseDate(pasteContent, userFormat, locale.value);
186
195
 
187
196
  if (parsedDate) {
188
197
  localValue.value = (
189
- props.dateFormat ? formatDate(parsedDate, props.dateFormat, locale.value) : parsedDate
198
+ props.dateFormat ? formatDate(parsedDate, userFormat, locale.value) : parsedDate
190
199
  ) as TModelValue;
191
200
  }
192
201
  } catch (error) {
@@ -259,8 +268,8 @@ defineExpose({
259
268
  v-bind="isShownCalendar ? datepickerInputActiveAttrs : datepickerInputAttrs"
260
269
  @input="onTextInput"
261
270
  @focus="activate"
262
- @paste="onPaste"
263
271
  @copy="onCopy"
272
+ @paste="onPaste"
264
273
  @keydown.esc="deactivate"
265
274
  @keydown="onTextInputKeyDown"
266
275
  >
@@ -160,7 +160,6 @@ export const Timepicker = DefaultTemplate.bind({});
160
160
  Timepicker.args = {
161
161
  timepicker: true,
162
162
  modelValue: new Date(2024, 2, 14, 12, 24, 14),
163
- userDateFormat: "j F, Y - H:i:S",
164
163
  };
165
164
 
166
165
  export const MinMax = DefaultTemplate.bind({});
@@ -69,6 +69,16 @@ const emit = defineEmits([
69
69
  * @property {number} modelValue
70
70
  */
71
71
  "input",
72
+
73
+ /**
74
+ * Triggers when content copied from the input.
75
+ */
76
+ "copy",
77
+
78
+ /**
79
+ * Triggers when content pasted to the input.
80
+ */
81
+ "paste",
72
82
  ]);
73
83
 
74
84
  const VALIDATION_RULES_REG_EX = {
@@ -186,6 +196,14 @@ function onMousedown(event: MouseEvent) {
186
196
  emit("mousedown", event);
187
197
  }
188
198
 
199
+ function onPaste(event: ClipboardEvent) {
200
+ emit("paste", event);
201
+ }
202
+
203
+ function onCopy(event: ClipboardEvent) {
204
+ emit("copy", event);
205
+ }
206
+
189
207
  function onClickShowPassword() {
190
208
  isShownPassword.value = !isShownPassword.value;
191
209
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.573",
4
+ "version": "0.0.575",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -6013,6 +6013,14 @@
6013
6013
  "name": "modelValue"
6014
6014
  }
6015
6015
  ]
6016
+ },
6017
+ {
6018
+ "name": "copy",
6019
+ "description": "Triggers when content copied from the input."
6020
+ },
6021
+ {
6022
+ "name": "paste",
6023
+ "description": "Triggers when content pasted to the input."
6016
6024
  }
6017
6025
  ],
6018
6026
  "slots": [