prlg-ui 1.8.294 → 1.8.296

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/dist/rekaUI.d.ts CHANGED
@@ -829,7 +829,7 @@ declare type __VLS_PublicProps_5 = {
829
829
  } & __VLS_Props_9;
830
830
 
831
831
  declare type __VLS_PublicProps_6 = {
832
- modelValue: TShedule | null;
832
+ modelValue: TShedule;
833
833
  } & __VLS_Props_10;
834
834
 
835
835
  declare function __VLS_template(): {
@@ -2942,9 +2942,9 @@ size: "small" | "default" | "large";
2942
2942
  export { RadioGroupRoot }
2943
2943
 
2944
2944
  export declare const Schedule: DefineComponent<__VLS_PublicProps_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
2945
- "update:modelValue": (value: TShedule | null) => any;
2945
+ "update:modelValue": (value: TShedule) => any;
2946
2946
  }, string, PublicProps, Readonly<__VLS_PublicProps_6> & Readonly<{
2947
- "onUpdate:modelValue"?: ((value: TShedule | null) => any) | undefined;
2947
+ "onUpdate:modelValue"?: ((value: TShedule) => any) | undefined;
2948
2948
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
2949
2949
 
2950
2950
  export declare const ScrollAreaRoot: __VLS_WithTemplateSlots_66<typeof __VLS_component_66, __VLS_TemplateResult_66["slots"]>;
@@ -3018,7 +3018,7 @@ declare interface TagProps {
3018
3018
  colors?: TagColors;
3019
3019
  }
3020
3020
 
3021
- export declare type TDayWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
3021
+ declare type TDayWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
3022
3022
 
3023
3023
  export declare const Textarea: DefineComponent<__VLS_PublicProps_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
3024
3024
  "update:modelValue": (value: string) => any;
@@ -3091,7 +3091,7 @@ export { TooltipRoot }
3091
3091
 
3092
3092
  export { TooltipTrigger }
3093
3093
 
3094
- export declare type TShedule = Record<TDayWeek, {
3094
+ declare type TShedule = Record<TDayWeek, {
3095
3095
  active: boolean;
3096
3096
  time: TTimeValue[];
3097
3097
  }>;
@@ -4,34 +4,21 @@
4
4
  * @returns отформатированный номер телефона в формате +7 (XXX) XXX-XX-XX
5
5
  */
6
6
  export function phoneMask(value: string): string {
7
- // Удаляем все символы кроме цифр и знака +
8
- let digits = value.replace(/\D/g, "");
7
+ let digits = value.replace(/\D/g, '');
8
+ let result = '';
9
+ let array = [];
10
+ if (digits.length < 12) {
11
+ digits = digits.concat(' ');
12
+ }
13
+ array = digits.match(/(.{1})(.{3})(.{3})(.{2})(.{2})/)!;
14
+ if (array[1] === '8') {
15
+ array[1] = '7';
16
+ }
17
+ result = '+' + array[1] + ' (' + array[2] + ') ' + array[3] + '-' + array[4] + '-' + array[5];
18
+ result = result.trim();
19
+ let newString = result.replace(/[^\d^\s+()-_]/g, '');
20
+ const lastDigitIndex = newString.search(/\d(?!.*\d)/);
21
+ newString = newString.substring(0, lastDigitIndex + 1);
9
22
 
10
- // Ограничиваем количество цифр до 11 (максимум для российских номеров)
11
- if (digits.length > 11) {
12
- digits = digits.substring(0, 11);
13
- }
14
-
15
- // Если цифр нет, возвращаем пустую строку
16
- if (digits.length === 0) {
17
- return "";
18
- }
19
-
20
- // Заменяем 8 на 7 для российских номеров
21
- if (digits[0] === "8") {
22
- digits = "7" + digits.substring(1);
23
- }
24
-
25
- // Формируем маску в зависимости от количества цифр
26
- if (digits.length === 1) {
27
- return `+${digits[0]}`;
28
- } else if (digits.length <= 4) {
29
- return `+${digits[0]} (${digits.substring(1)}`;
30
- } else if (digits.length <= 7) {
31
- return `+${digits[0]} (${digits.substring(1, 4)}) ${digits.substring(4)}`;
32
- } else if (digits.length <= 9) {
33
- return `+${digits[0]} (${digits.substring(1, 4)}) ${digits.substring(4, 7)}-${digits.substring(7)}`;
34
- } else {
35
- return `+${digits[0]} (${digits.substring(1, 4)}) ${digits.substring(4, 7)}-${digits.substring(7, 9)}-${digits.substring(9)}`;
36
- }
23
+ return newString;
37
24
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prlg-ui",
3
3
  "private": false,
4
- "version": "1.8.294",
4
+ "version": "1.8.296",
5
5
  "type": "module",
6
6
  "main": "dist/prlg-ui.umd.js",
7
7
  "module": "dist/prlg-ui.es.js",
Binary file