@bagelink/vue 1.4.26 → 1.4.30

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.
@@ -5396,40 +5396,227 @@
5396
5396
  }
5397
5397
 
5398
5398
 
5399
- .m_grid-wrap-50 {
5399
+
5400
+ .m_grid-wrap-50,
5401
+ .m_grid-wrap-50-fit {
5400
5402
  grid-template-columns: repeat(auto-fit, minmax(min(50px, 100%), 1fr));
5401
5403
  height: max-content;
5402
- width: 100%
5404
+ width: 100%;
5403
5405
  }
5404
5406
 
5405
- .m_grid-wrap-100 {
5407
+ .m_grid-wrap-100,
5408
+ .m_grid-wrap-100-fit {
5406
5409
  grid-template-columns: repeat(auto-fit, minmax(min(100px, 100%), 1fr));
5407
5410
  height: max-content;
5408
- width: 100%
5411
+ width: 100%;
5412
+ }
5413
+
5414
+ .m_grid-wrap-150,
5415
+ .m_grid-wrap-150-fit {
5416
+ grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
5417
+ height: max-content;
5418
+ width: 100%;
5409
5419
  }
5410
5420
 
5411
- .m_grid-wrap-200 {
5421
+ .m_grid-wrap-200,
5422
+ .m_grid-wrap-200-fit {
5412
5423
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
5413
5424
  height: max-content;
5414
- width: 100%
5425
+ width: 100%;
5415
5426
  }
5416
5427
 
5417
- .m_grid-wrap-300 {
5428
+ .m_grid-wrap-250,
5429
+ .m_grid-wrap-250-fit {
5430
+ grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
5431
+ height: max-content;
5432
+ width: 100%;
5433
+ }
5434
+
5435
+ .m_grid-wrap-300,
5436
+ .m_grid-wrap-300-fit {
5418
5437
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
5419
5438
  height: max-content;
5420
- width: 100%
5439
+ width: 100%;
5421
5440
  }
5422
5441
 
5423
- .m_grid-wrap-400 {
5442
+ .m_grid-wrap-350,
5443
+ .m_grid-wrap-350-fit {
5444
+ grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
5445
+ height: max-content;
5446
+ width: 100%;
5447
+ }
5448
+
5449
+ .m_grid-wrap-400,
5450
+ .m_grid-wrap-400-fit {
5424
5451
  grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
5425
5452
  height: max-content;
5426
- width: 100%
5453
+ width: 100%;
5427
5454
  }
5428
5455
 
5429
- .m_grid-wrap-500 {
5456
+ .m_grid-wrap-450,
5457
+ .m_grid-wrap-450-fit {
5458
+ grid-template-columns: repeat(auto-fit, minmax(min(450px, 100%), 1fr));
5459
+ height: max-content;
5460
+ width: 100%;
5461
+ }
5462
+
5463
+ .m_grid-wrap-500,
5464
+ .m_grid-wrap-500-fit {
5430
5465
  grid-template-columns: repeat(auto-fit, minmax(min(500px, 100%), 1fr));
5431
5466
  height: max-content;
5432
- width: 100%
5467
+ width: 100%;
5468
+ }
5469
+
5470
+ .m_grid-wrap-550,
5471
+ .m_grid-wrap-550-fit {
5472
+ grid-template-columns: repeat(auto-fit, minmax(min(550px, 100%), 1fr));
5473
+ height: max-content;
5474
+ width: 100%;
5475
+ }
5476
+
5477
+ .m_grid-wrap-600,
5478
+ .m_grid-wrap-600-fit {
5479
+ grid-template-columns: repeat(auto-fit, minmax(min(600px, 100%), 1fr));
5480
+ height: max-content;
5481
+ width: 100%;
5482
+ }
5483
+
5484
+ .m_grid-wrap-650,
5485
+ .m_grid-wrap-650-fit {
5486
+ grid-template-columns: repeat(auto-fit, minmax(min(650px, 100%), 1fr));
5487
+ height: max-content;
5488
+ width: 100%;
5489
+ }
5490
+
5491
+ .m_grid-wrap-700,
5492
+ .m_grid-wrap-700-fit {
5493
+ grid-template-columns: repeat(auto-fit, minmax(min(700px, 100%), 1fr));
5494
+ height: max-content;
5495
+ width: 100%;
5496
+ }
5497
+
5498
+ .m_grid-wrap-750,
5499
+ .m_grid-wrap-750-fit {
5500
+ grid-template-columns: repeat(auto-fit, minmax(min(750px, 100%), 1fr));
5501
+ height: max-content;
5502
+ width: 100%;
5503
+ }
5504
+
5505
+ .m_grid-wrap-800,
5506
+ .m_grid-wrap-800-fit {
5507
+ grid-template-columns: repeat(auto-fit, minmax(min(800px, 100%), 1fr));
5508
+ height: max-content;
5509
+ width: 100%;
5510
+ }
5511
+
5512
+ .m_grid-wrap-850,
5513
+ .m_grid-wrap-850-fit {
5514
+ grid-template-columns: repeat(auto-fit, minmax(min(850px, 100%), 1fr));
5515
+ height: max-content;
5516
+ width: 100%;
5517
+ }
5518
+
5519
+ .m_grid-wrap-900,
5520
+ .m_grid-wrap-900-fit {
5521
+ grid-template-columns: repeat(auto-fit, minmax(min(900px, 100%), 1fr));
5522
+ height: max-content;
5523
+ width: 100%;
5524
+ }
5525
+
5526
+ .m_grid-wrap-950,
5527
+ .m_grid-wrap-950-fit {
5528
+ grid-template-columns: repeat(auto-fit, minmax(min(950px, 100%), 1fr));
5529
+ height: max-content;
5530
+ width: 100%;
5531
+ }
5532
+
5533
+ .m_grid-wrap-1000,
5534
+ .m_grid-wrap-1000-fit {
5535
+ grid-template-columns: repeat(auto-fit, minmax(min(1000px, 100%), 1fr));
5536
+ height: max-content;
5537
+ width: 100%;
5538
+ }
5539
+
5540
+
5541
+
5542
+ .m_grid-wrap-50-fill {
5543
+ grid-template-columns: repeat(auto-fill, minmax(min(50px, 100%), 1fr));
5544
+ }
5545
+
5546
+ .m_grid-wrap-100-fill {
5547
+ grid-template-columns: repeat(auto-fill, minmax(min(100px, 100%), 1fr));
5548
+ }
5549
+
5550
+ .m_grid-wrap-150-fill {
5551
+ grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
5552
+ }
5553
+
5554
+ .m_grid-wrap-200-fill {
5555
+ grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
5556
+ }
5557
+
5558
+ .m_grid-wrap-250-fill {
5559
+ grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
5560
+ }
5561
+
5562
+ .m_grid-wrap-300-fill {
5563
+ grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
5564
+ }
5565
+
5566
+ .m_grid-wrap-350-fill {
5567
+ grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr));
5568
+ }
5569
+
5570
+ .m_grid-wrap-400-fill {
5571
+ grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
5572
+ }
5573
+
5574
+ .m_grid-wrap-450-fill {
5575
+ grid-template-columns: repeat(auto-fill, minmax(min(450px, 100%), 1fr));
5576
+ }
5577
+
5578
+ .m_grid-wrap-500-fill {
5579
+ grid-template-columns: repeat(auto-fill, minmax(min(500px, 100%), 1fr));
5580
+ }
5581
+
5582
+ .m_grid-wrap-550-fill {
5583
+ grid-template-columns: repeat(auto-fill, minmax(min(550px, 100%), 1fr));
5584
+ }
5585
+
5586
+ .m_grid-wrap-600-fill {
5587
+ grid-template-columns: repeat(auto-fill, minmax(min(600px, 100%), 1fr));
5588
+ }
5589
+
5590
+ .m_grid-wrap-650-fill {
5591
+ grid-template-columns: repeat(auto-fill, minmax(min(650px, 100%), 1fr));
5592
+ }
5593
+
5594
+ .m_grid-wrap-700-fill {
5595
+ grid-template-columns: repeat(auto-fill, minmax(min(700px, 100%), 1fr));
5596
+ }
5597
+
5598
+ .m_grid-wrap-750-fill {
5599
+ grid-template-columns: repeat(auto-fill, minmax(min(750px, 100%), 1fr));
5600
+ }
5601
+
5602
+ .m_grid-wrap-800-fill {
5603
+ grid-template-columns: repeat(auto-fill, minmax(min(800px, 100%), 1fr));
5604
+ }
5605
+
5606
+ .m_grid-wrap-850-fill {
5607
+ grid-template-columns: repeat(auto-fill, minmax(min(850px, 100%), 1fr));
5608
+ }
5609
+
5610
+ .m_grid-wrap-900-fill {
5611
+ grid-template-columns: repeat(auto-fill, minmax(min(900px, 100%), 1fr));
5612
+ }
5613
+
5614
+ .m_grid-wrap-950-fill {
5615
+ grid-template-columns: repeat(auto-fill, minmax(min(950px, 100%), 1fr));
5616
+ }
5617
+
5618
+ .m_grid-wrap-1000-fill {
5619
+ grid-template-columns: repeat(auto-fill, minmax(min(1000px, 100%), 1fr));
5433
5620
  }
5434
5621
 
5435
5622
  .m_grid-wrap-1 {
@@ -1,4 +1,4 @@
1
- import type { SelectInput, TextInput } from '@bagelink/vue'
1
+ import type { ArrayAttrs, FieldArray, SelectInput, TextInput } from '@bagelink/vue'
2
2
  import type { Paths, Get, IterableElement, OmitIndexSignature } from 'type-fest'
3
3
  import type { ToString } from 'type-fest/source/internal'
4
4
  import type { LiteralStringUnion } from 'type-fest/source/literal-union'
@@ -163,6 +163,16 @@ export interface SelectBagelField<
163
163
  type?: string
164
164
  }
165
165
 
166
+ export interface ArrayBagelField<
167
+ T,
168
+ P extends Path<T, PO>,
169
+ PO extends PathsOptions = DefaultPathsOptions,
170
+ >
171
+ extends BaseBagelField<T, P, PO> {
172
+ $el: 'array' | ComponentExposed<typeof FieldArray>
173
+ attrs?: ArrayAttrs<T, P>
174
+ }
175
+
166
176
  export interface ValidateInputBaseT {
167
177
  validate?: ValidationFn<{ [key: string]: unknown }, string>
168
178
  getFormData?: () => any
@@ -1,7 +1,8 @@
1
- import type { ArrayFieldVal, Attributes, BaseBagelField, BglFormSchemaT, FieldByP, IconType, InputBagelField, Option, Path, SchemaChild, SelectBagelField, ShallowBglFormSchemaT, UploadInputProps } from '@bagelink/vue'
1
+ import type { ArrayBagelField, ArrayFieldVal, Attributes, BaseBagelField, BglFormSchemaT, FieldByP, IconType, InputBagelField, Option, Path, SchemaChild, SelectBagelField, ShallowBglFormSchemaT, UploadInputProps } from '@bagelink/vue'
2
2
  import type { DefaultPathsOptions, PathsOptions } from 'type-fest/source/paths'
3
+ import type { InputTypeHTMLAttribute } from 'vue'
3
4
 
4
- interface InputOptions<
5
+ export interface InputOptions<
5
6
  T,
6
7
  P extends Path<T>
7
8
  > extends Partial<BaseBagelField<T, P>> {
@@ -9,15 +10,15 @@ interface InputOptions<
9
10
  autocomplete?: AutoFillField
10
11
  }
11
12
 
12
- interface DateOptions<T, K extends Path<T>> extends InputOptions<T, K> {
13
+ export interface DateOptions<T, K extends Path<T>> extends InputOptions<T, K> {
13
14
  enableTime?: boolean
14
15
  mode?: 'day' | 'month' | 'year'
15
16
  locale?: string
16
17
  timezone?: string
17
18
  }
18
19
 
19
- interface TextInputOptions<T, K extends Path<T>> extends InputOptions<T, K> {
20
- type?: 'text' | 'tel' | 'email' | 'time'
20
+ export interface TextInputOptions<T, K extends Path<T>> extends InputOptions<T, K> {
21
+ type?: InputTypeHTMLAttribute
21
22
  pattern?: string
22
23
  multiline?: boolean
23
24
  autoheight?: boolean
@@ -27,14 +28,14 @@ interface TextInputOptions<T, K extends Path<T>> extends InputOptions<T, K> {
27
28
  iconStart?: IconType
28
29
  }
29
30
 
30
- interface SlctInputOptions<T, K extends Path<T>> extends InputOptions<T, K> {
31
+ export interface SlctInputOptions<T, K extends Path<T>> extends InputOptions<T, K> {
31
32
  searchable?: boolean
32
33
  multiselect?: boolean
33
34
  clearable?: boolean
34
35
  onSearch?: (search: string) => any
35
36
  }
36
37
 
37
- interface NumFieldOptions<T, K extends Path<T>> extends InputOptions<T, K> {
38
+ export interface NumFieldOptions<T, K extends Path<T>> extends InputOptions<T, K> {
38
39
  max?: number
39
40
  min?: number
40
41
  step?: number
@@ -44,7 +45,7 @@ interface NumFieldOptions<T, K extends Path<T>> extends InputOptions<T, K> {
44
45
  useGrouping?: boolean
45
46
  }
46
47
 
47
- interface RichTextOptions<T, P extends Path<T>> extends InputOptions<T, P> {
48
+ export interface RichTextOptions<T, P extends Path<T>> extends InputOptions<T, P> {
48
49
  height?: number | string
49
50
  }
50
51
 
@@ -408,11 +409,15 @@ export function findBglFieldById<T>(id: string, _schema: ShallowBglFormSchemaT<T
408
409
  return undefined
409
410
  }
410
411
 
411
- export interface ArrayFieldOptions<T, K extends Path<T>> extends InputOptions<T, K> {
412
+ export interface ArrayAttrs<T, P extends Path<T>> extends Attributes<T, P> {
412
413
  delete?: boolean
413
414
  add?: boolean
415
+ // schema?: MaybeRefOrGetter<BglFormSchemaT<ArrayFieldVal<T, P>>>
416
+ // type?: ArrayType
414
417
  }
415
418
 
419
+ export interface ArrayFieldOptions<T, K extends Path<T>> extends InputOptions<T, K>, ArrayAttrs<T, K> {}
420
+
416
421
  export type ArrayType = 'number' | 'text'
417
422
 
418
423
  export function arrField<
@@ -424,13 +429,18 @@ export function arrField<
424
429
  label: string,
425
430
  schemaOrType: BglFormSchemaT<ArrayFieldVal<T, P>> | ArrayType,
426
431
  options?: ArrayFieldOptions<T, P>
427
- ): BaseBagelField<T, P, PO> {
428
- const attrs: Attributes<T, P> = { delete: true, add: true, ...options }
429
-
430
- if (typeof schemaOrType === 'string') {
431
- attrs.type = schemaOrType
432
- } else {
433
- attrs.schema = schemaOrType
432
+ ): ArrayBagelField<T, P, PO> {
433
+ const arraySpecificAttrs = (
434
+ typeof schemaOrType === 'string'
435
+ ? { type: schemaOrType }
436
+ : { schema: schemaOrType }
437
+ )
438
+
439
+ const attrs: ArrayAttrs<T, P> = {
440
+ delete: true,
441
+ add: true,
442
+ ...options,
443
+ ...arraySpecificAttrs,
434
444
  }
435
445
 
436
446
  return {
@@ -469,6 +479,7 @@ export function useForm() {
469
479
  checkField,
470
480
  dateField,
471
481
  numField,
482
+ emailField,
472
483
  frmRow,
473
484
  uploadField,
474
485
  rangeField,
@@ -1,31 +1,43 @@
1
1
  import type { ComputedRef, MaybeRefOrGetter } from 'vue'
2
2
  import { computed, ref, watch, toValue } from 'vue'
3
+
4
+ const htmlReplacers = {
5
+ '': /<[^>]*>?/g,
6
+ ' ': /&nbsp;/g,
7
+ '"': /&quot;/g,
8
+ '\'': /&apos;/g,
9
+ '&': /&amp;/g,
10
+ '<': /&lt;/g,
11
+ '>': /&gt;/g,
12
+ } as const
13
+
3
14
  /**
4
15
  * Clears HTML tags from a string
5
16
  * @param html - HTML string to clean
6
17
  * @returns Plain text without HTML tags
7
18
  */
8
-
9
19
  export function clearHtml(value?: string) {
10
20
  if (!value) return ''
11
- return value
12
- .replace(/<[^>]*>?/g, '')
13
- .replace(/&nbsp;/g, ' ')
14
- .replace(/&quot;/g, '"')
15
- .replace(/&apos;/g, `'`)
16
- .replace(/&amp;/g, '&')
17
- .replace(/&lt;/g, '<')
18
- .replace(/&gt;/g, '>')
21
+ return Object.entries(htmlReplacers)
22
+ .reduce(
23
+ (
24
+ text,
25
+ [replacement, regex]
26
+ ) => (
27
+ text.replace(regex, replacement)
28
+ ),
29
+ value
30
+ )
19
31
  }
20
32
 
33
+ const normalizeSearchChars = /[\p{N}\p{L}\s]/gu
21
34
  /**
22
35
  * Normalizes text by removing special characters and converting to lowercase
23
36
  * @param text - Text to normalize
24
37
  * @returns Normalized text
25
38
  */
26
39
  export function normalizeText(text: string): string {
27
- const searchChars = /[\p{N}\p{L}\s]/gu
28
- return text.match(searchChars)?.join('').toLowerCase() ?? ''
40
+ return text.match(normalizeSearchChars)?.join('').toLowerCase() ?? ''
29
41
  }
30
42
 
31
43
  /**