mediacube-ui 0.1.300 → 0.1.301

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
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.301](https://github.com/MediaCubeCo/mcui/compare/v0.1.300...v0.1.301) (2024-08-01)
6
+
5
7
  ### [0.1.300](https://github.com/MediaCubeCo/mcui/compare/v0.1.299...v0.1.300) (2024-07-31)
6
8
 
7
9
  ### [0.1.299](https://github.com/MediaCubeCo/mcui/compare/v0.1.298...v0.1.299) (2024-07-22)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediacube-ui",
3
- "version": "0.1.300",
3
+ "version": "0.1.301",
4
4
  "description": "Design system for Mediacube services",
5
5
  "author": "Mediacube",
6
6
  "private": false,
@@ -49,6 +49,8 @@
49
49
  v-on="listeners"
50
50
  @input="prepareHandleInput"
51
51
  @keydown="prepareHandleKeyDown"
52
+ @focus="handleFocus"
53
+ @blur="handleBlur"
52
54
  />
53
55
  </template>
54
56
  </label>
@@ -156,6 +158,7 @@ export default {
156
158
  * кастомный amount_format - форматирует ввод числовых данных разделяя на разряды(1 000 000)
157
159
  * date - добавляет placeholder, маску и ограничения ввода
158
160
  * uppercase\lowercase - форматирует текст согласну значению (верхний\нижний регистр)
161
+ * phone_number - добавляет '+' к номеру телефона при фокусе без возможности удалить его
159
162
  */
160
163
  type: {
161
164
  type: String,
@@ -639,10 +642,25 @@ export default {
639
642
  e.target.value = value
640
643
  this.setCaretPos(e.target, cursor_position, cursor_position)
641
644
  break
645
+ case 'phone_number':
646
+ if (value.length === 0) value = '+'
647
+ value = value.replace(/[^+\d]/g, '')
648
+ e.target.value = value
649
+ break
642
650
  }
643
651
 
644
652
  this.handleInput(value)
645
653
  },
654
+ handleFocus(e) {
655
+ if (this.type === 'phone_number' && e.target.value.length === 0) {
656
+ e.target.value = '+'
657
+ }
658
+ },
659
+ handleBlur(e) {
660
+ if (this.type === 'phone_number' && e.target.value === '+') {
661
+ e.target.value = ''
662
+ }
663
+ },
646
664
  prepareHandleKeyDown(e) {
647
665
  switch (this.type) {
648
666
  case 'amount_format':