@3mo/date-time-fields 0.15.1 → 0.16.0
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/FieldDateTimeBase.d.ts +1 -0
- package/dist/FieldDateTimeBase.d.ts.map +1 -1
- package/dist/FieldDateTimeBase.js +1 -1
- package/dist/FieldTime.d.ts +49 -4
- package/dist/FieldTime.d.ts.map +1 -1
- package/dist/FieldTime.js +201 -9
- package/dist/custom-elements.json +153 -97
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/segments/DateTimeSegment.d.ts +20 -0
- package/dist/segments/DateTimeSegment.d.ts.map +1 -0
- package/dist/segments/DateTimeSegment.js +4 -0
- package/dist/segments/DateTimeSegmenter.d.ts +68 -0
- package/dist/segments/DateTimeSegmenter.d.ts.map +1 -0
- package/dist/segments/DateTimeSegmenter.js +247 -0
- package/dist/segments/DateTimeSegmentsController.d.ts +90 -0
- package/dist/segments/DateTimeSegmentsController.d.ts.map +1 -0
- package/dist/segments/DateTimeSegmentsController.js +235 -0
- package/dist/segments/index.d.ts +5 -0
- package/dist/segments/index.d.ts.map +1 -0
- package/dist/segments/index.js +4 -0
- package/dist/segments/segmentsStyles.d.ts +3 -0
- package/dist/segments/segmentsStyles.d.ts.map +1 -0
- package/dist/segments/segmentsStyles.js +46 -0
- package/dist/selection/Calendar.d.ts.map +1 -1
- package/dist/selection/Calendar.js +3 -0
- package/dist/selection/HourList.d.ts +4 -0
- package/dist/selection/HourList.d.ts.map +1 -1
- package/dist/selection/HourList.js +24 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -1526,26 +1526,17 @@
|
|
|
1526
1526
|
{
|
|
1527
1527
|
"name": "mo-field-time",
|
|
1528
1528
|
"path": ".\\packages\\DateTimeFields\\FieldTime.ts",
|
|
1529
|
+
"description": "A time-of-day field. Its value is the 24-hour `HH:mm` (or `HH:mm:ss` at second precision) string the\nnative time input uses, so that it drops in where one was, while the segments follow the language's\nown clock — \"02:07 PM\" for English, \"14:07\" for German — and the popover offers the hour and minute wheels.",
|
|
1529
1530
|
"attributes": [
|
|
1530
1531
|
{
|
|
1531
|
-
"name": "
|
|
1532
|
-
"
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
"name": "maxLength",
|
|
1536
|
-
"type": "number | undefined"
|
|
1537
|
-
},
|
|
1538
|
-
{
|
|
1539
|
-
"name": "pattern",
|
|
1540
|
-
"type": "string | undefined"
|
|
1541
|
-
},
|
|
1542
|
-
{
|
|
1543
|
-
"name": "autoComplete",
|
|
1544
|
-
"type": "FieldTextAutoComplete | undefined"
|
|
1532
|
+
"name": "open",
|
|
1533
|
+
"description": "Whether the time picker is open",
|
|
1534
|
+
"type": "boolean",
|
|
1535
|
+
"default": "false"
|
|
1545
1536
|
},
|
|
1546
1537
|
{
|
|
1547
|
-
"name": "
|
|
1548
|
-
"description": "
|
|
1538
|
+
"name": "pickerHidden",
|
|
1539
|
+
"description": "Hide the time picker",
|
|
1549
1540
|
"type": "boolean",
|
|
1550
1541
|
"default": "false"
|
|
1551
1542
|
},
|
|
@@ -1555,9 +1546,26 @@
|
|
|
1555
1546
|
"type": "boolean",
|
|
1556
1547
|
"default": "false"
|
|
1557
1548
|
},
|
|
1549
|
+
{
|
|
1550
|
+
"name": "precision",
|
|
1551
|
+
"description": "'minute' (default) or 'second'",
|
|
1552
|
+
"type": "FieldDateTimePrecision",
|
|
1553
|
+
"default": "\"Minute\""
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
"name": "hourCycle",
|
|
1557
|
+
"description": "The hour cycle of the segments ('h11', 'h12', 'h23' or 'h24'). Defaults to the language's convention.",
|
|
1558
|
+
"type": "HourCycle | undefined"
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
"name": "shortcutReferenceDate",
|
|
1562
|
+
"description": "The date the units the user leaves out are taken from. Defaults to now.",
|
|
1563
|
+
"type": "DateTime",
|
|
1564
|
+
"default": "\"new DateTime()\""
|
|
1565
|
+
},
|
|
1558
1566
|
{
|
|
1559
1567
|
"name": "value",
|
|
1560
|
-
"description": "The
|
|
1568
|
+
"description": "The time as `HH:mm` or `HH:mm:ss`",
|
|
1561
1569
|
"type": "string | undefined"
|
|
1562
1570
|
},
|
|
1563
1571
|
{
|
|
@@ -1587,37 +1595,31 @@
|
|
|
1587
1595
|
],
|
|
1588
1596
|
"properties": [
|
|
1589
1597
|
{
|
|
1590
|
-
"name": "
|
|
1591
|
-
"type": "
|
|
1592
|
-
|
|
1593
|
-
{
|
|
1594
|
-
"name": "minLength",
|
|
1595
|
-
"attribute": "minLength",
|
|
1596
|
-
"type": "number | undefined"
|
|
1597
|
-
},
|
|
1598
|
-
{
|
|
1599
|
-
"name": "maxLength",
|
|
1600
|
-
"attribute": "maxLength",
|
|
1601
|
-
"type": "number | undefined"
|
|
1598
|
+
"name": "navigationDate",
|
|
1599
|
+
"type": "DateTime",
|
|
1600
|
+
"default": "\"new DateTime()\""
|
|
1602
1601
|
},
|
|
1603
1602
|
{
|
|
1604
|
-
"name": "
|
|
1605
|
-
"
|
|
1606
|
-
"
|
|
1603
|
+
"name": "segments",
|
|
1604
|
+
"type": "DateTimeSegmentsController<this>",
|
|
1605
|
+
"default": "\"new DateTimeSegmentsController(this, host => ({\\n\\t\\ttimeOnly: true,\\n\\t\\tget value() { return host.selectedDate },\\n\\t\\tget precision() { return host.precision },\\n\\t\\tget referenceDate() { return host.shortcutReferenceDate },\\n\\t\\tget hourCycle() { return host.hourCycle },\\n\\t\\tget label() { return host._label },\\n\\t\\tget disabled() { return host.disabled },\\n\\t\\tget readonly() { return host.readonly },\\n\\t\\tget required() { return host.required },\\n\\t\\tget invalid() { return host.invalid },\\n\\t\\thandleInput: value => host.handleInput(host.toValue(value)),\\n\\t\\thandleChange: value => host.handleChange(host.toValue(value)),\\n\\t}))\""
|
|
1607
1606
|
},
|
|
1608
1607
|
{
|
|
1609
|
-
"name": "
|
|
1610
|
-
"
|
|
1611
|
-
"type": "
|
|
1608
|
+
"name": "selectedDate",
|
|
1609
|
+
"description": "The value as a time on the reference day, which is all the segments need to render and edit it.",
|
|
1610
|
+
"type": "DateTime | undefined"
|
|
1612
1611
|
},
|
|
1613
1612
|
{
|
|
1614
|
-
"name": "
|
|
1615
|
-
"
|
|
1613
|
+
"name": "open",
|
|
1614
|
+
"attribute": "open",
|
|
1615
|
+
"description": "Whether the time picker is open",
|
|
1616
|
+
"type": "boolean",
|
|
1617
|
+
"default": "false"
|
|
1616
1618
|
},
|
|
1617
1619
|
{
|
|
1618
|
-
"name": "
|
|
1619
|
-
"attribute": "
|
|
1620
|
-
"description": "
|
|
1620
|
+
"name": "pickerHidden",
|
|
1621
|
+
"attribute": "pickerHidden",
|
|
1622
|
+
"description": "Hide the time picker",
|
|
1621
1623
|
"type": "boolean",
|
|
1622
1624
|
"default": "false"
|
|
1623
1625
|
},
|
|
@@ -1628,6 +1630,26 @@
|
|
|
1628
1630
|
"type": "boolean",
|
|
1629
1631
|
"default": "false"
|
|
1630
1632
|
},
|
|
1633
|
+
{
|
|
1634
|
+
"name": "precision",
|
|
1635
|
+
"attribute": "precision",
|
|
1636
|
+
"description": "'minute' (default) or 'second'",
|
|
1637
|
+
"type": "FieldDateTimePrecision",
|
|
1638
|
+
"default": "\"Minute\""
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
"name": "hourCycle",
|
|
1642
|
+
"attribute": "hourCycle",
|
|
1643
|
+
"description": "The hour cycle of the segments ('h11', 'h12', 'h23' or 'h24'). Defaults to the language's convention.",
|
|
1644
|
+
"type": "HourCycle | undefined"
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
"name": "shortcutReferenceDate",
|
|
1648
|
+
"attribute": "shortcutReferenceDate",
|
|
1649
|
+
"description": "The date the units the user leaves out are taken from. Defaults to now.",
|
|
1650
|
+
"type": "DateTime",
|
|
1651
|
+
"default": "\"new DateTime()\""
|
|
1652
|
+
},
|
|
1631
1653
|
{
|
|
1632
1654
|
"name": "change",
|
|
1633
1655
|
"type": "EventDispatcher<T | undefined>"
|
|
@@ -1640,14 +1662,10 @@
|
|
|
1640
1662
|
"name": "validityChange",
|
|
1641
1663
|
"type": "EventDispatcher<boolean>"
|
|
1642
1664
|
},
|
|
1643
|
-
{
|
|
1644
|
-
"name": "isPopulated",
|
|
1645
|
-
"type": "boolean"
|
|
1646
|
-
},
|
|
1647
1665
|
{
|
|
1648
1666
|
"name": "value",
|
|
1649
1667
|
"attribute": "value",
|
|
1650
|
-
"description": "The
|
|
1668
|
+
"description": "The time as `HH:mm` or `HH:mm:ss`",
|
|
1651
1669
|
"type": "string | undefined"
|
|
1652
1670
|
},
|
|
1653
1671
|
{
|
|
@@ -1709,8 +1727,16 @@
|
|
|
1709
1727
|
],
|
|
1710
1728
|
"cssParts": [
|
|
1711
1729
|
{
|
|
1712
|
-
"name": "
|
|
1713
|
-
"description": "The
|
|
1730
|
+
"name": "segments",
|
|
1731
|
+
"description": "The group of segments making up the time"
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
"name": "segment",
|
|
1735
|
+
"description": "An editable unit of the time"
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
"name": "literal",
|
|
1739
|
+
"description": "A separator between the units"
|
|
1714
1740
|
},
|
|
1715
1741
|
{
|
|
1716
1742
|
"name": "container",
|
|
@@ -3443,38 +3469,41 @@
|
|
|
3443
3469
|
{
|
|
3444
3470
|
"name": "mo-field-time",
|
|
3445
3471
|
"path": ".\\packages\\DateTimeFields\\dist\\FieldTime.d.ts",
|
|
3472
|
+
"description": "A time-of-day field. Its value is the 24-hour `HH:mm` (or `HH:mm:ss` at second precision) string the\nnative time input uses, so that it drops in where one was, while the segments follow the language's\nown clock — \"02:07 PM\" for English, \"14:07\" for German — and the popover offers the hour and minute wheels.",
|
|
3446
3473
|
"attributes": [
|
|
3447
3474
|
{
|
|
3448
|
-
"name": "
|
|
3449
|
-
"
|
|
3475
|
+
"name": "open",
|
|
3476
|
+
"description": "Whether the time picker is open",
|
|
3477
|
+
"type": "boolean"
|
|
3450
3478
|
},
|
|
3451
3479
|
{
|
|
3452
|
-
"name": "
|
|
3453
|
-
"
|
|
3480
|
+
"name": "pickerHidden",
|
|
3481
|
+
"description": "Hide the time picker",
|
|
3482
|
+
"type": "boolean"
|
|
3454
3483
|
},
|
|
3455
3484
|
{
|
|
3456
|
-
"name": "
|
|
3457
|
-
"
|
|
3485
|
+
"name": "dense",
|
|
3486
|
+
"description": "Whether the field is dense",
|
|
3487
|
+
"type": "boolean"
|
|
3458
3488
|
},
|
|
3459
3489
|
{
|
|
3460
|
-
"name": "
|
|
3461
|
-
"
|
|
3490
|
+
"name": "precision",
|
|
3491
|
+
"description": "'minute' (default) or 'second'",
|
|
3492
|
+
"type": "FieldDateTimePrecision"
|
|
3462
3493
|
},
|
|
3463
3494
|
{
|
|
3464
|
-
"name": "
|
|
3465
|
-
"description": "
|
|
3466
|
-
"type": "
|
|
3467
|
-
"default": "false"
|
|
3495
|
+
"name": "hourCycle",
|
|
3496
|
+
"description": "The hour cycle of the segments ('h11', 'h12', 'h23' or 'h24'). Defaults to the language's convention.",
|
|
3497
|
+
"type": "HourCycle | undefined"
|
|
3468
3498
|
},
|
|
3469
3499
|
{
|
|
3470
|
-
"name": "
|
|
3471
|
-
"description": "
|
|
3472
|
-
"type": "
|
|
3473
|
-
"default": "false"
|
|
3500
|
+
"name": "shortcutReferenceDate",
|
|
3501
|
+
"description": "The date the units the user leaves out are taken from. Defaults to now.",
|
|
3502
|
+
"type": "DateTime"
|
|
3474
3503
|
},
|
|
3475
3504
|
{
|
|
3476
3505
|
"name": "value",
|
|
3477
|
-
"description": "The
|
|
3506
|
+
"description": "The time as `HH:mm` or `HH:mm:ss`",
|
|
3478
3507
|
"type": "string | undefined"
|
|
3479
3508
|
},
|
|
3480
3509
|
{
|
|
@@ -3504,46 +3533,53 @@
|
|
|
3504
3533
|
],
|
|
3505
3534
|
"properties": [
|
|
3506
3535
|
{
|
|
3507
|
-
"name": "
|
|
3508
|
-
"type": "
|
|
3536
|
+
"name": "navigationDate",
|
|
3537
|
+
"type": "DateTime"
|
|
3509
3538
|
},
|
|
3510
3539
|
{
|
|
3511
|
-
"name": "
|
|
3512
|
-
"
|
|
3513
|
-
"type": "number | undefined"
|
|
3540
|
+
"name": "segments",
|
|
3541
|
+
"type": "DateTimeSegmentsController<this>"
|
|
3514
3542
|
},
|
|
3515
3543
|
{
|
|
3516
|
-
"name": "
|
|
3517
|
-
"
|
|
3518
|
-
"type": "
|
|
3544
|
+
"name": "selectedDate",
|
|
3545
|
+
"description": "The value as a time on the reference day, which is all the segments need to render and edit it.",
|
|
3546
|
+
"type": "DateTime | undefined"
|
|
3519
3547
|
},
|
|
3520
3548
|
{
|
|
3521
|
-
"name": "
|
|
3522
|
-
"attribute": "
|
|
3523
|
-
"
|
|
3549
|
+
"name": "open",
|
|
3550
|
+
"attribute": "open",
|
|
3551
|
+
"description": "Whether the time picker is open",
|
|
3552
|
+
"type": "boolean"
|
|
3524
3553
|
},
|
|
3525
3554
|
{
|
|
3526
|
-
"name": "
|
|
3527
|
-
"attribute": "
|
|
3528
|
-
"
|
|
3555
|
+
"name": "pickerHidden",
|
|
3556
|
+
"attribute": "pickerHidden",
|
|
3557
|
+
"description": "Hide the time picker",
|
|
3558
|
+
"type": "boolean"
|
|
3529
3559
|
},
|
|
3530
3560
|
{
|
|
3531
|
-
"name": "
|
|
3532
|
-
"
|
|
3561
|
+
"name": "dense",
|
|
3562
|
+
"attribute": "dense",
|
|
3563
|
+
"description": "Whether the field is dense",
|
|
3564
|
+
"type": "boolean"
|
|
3533
3565
|
},
|
|
3534
3566
|
{
|
|
3535
|
-
"name": "
|
|
3536
|
-
"attribute": "
|
|
3537
|
-
"description": "
|
|
3538
|
-
"type": "
|
|
3539
|
-
"default": "false"
|
|
3567
|
+
"name": "precision",
|
|
3568
|
+
"attribute": "precision",
|
|
3569
|
+
"description": "'minute' (default) or 'second'",
|
|
3570
|
+
"type": "FieldDateTimePrecision"
|
|
3540
3571
|
},
|
|
3541
3572
|
{
|
|
3542
|
-
"name": "
|
|
3543
|
-
"attribute": "
|
|
3544
|
-
"description": "
|
|
3545
|
-
"type": "
|
|
3546
|
-
|
|
3573
|
+
"name": "hourCycle",
|
|
3574
|
+
"attribute": "hourCycle",
|
|
3575
|
+
"description": "The hour cycle of the segments ('h11', 'h12', 'h23' or 'h24'). Defaults to the language's convention.",
|
|
3576
|
+
"type": "HourCycle | undefined"
|
|
3577
|
+
},
|
|
3578
|
+
{
|
|
3579
|
+
"name": "shortcutReferenceDate",
|
|
3580
|
+
"attribute": "shortcutReferenceDate",
|
|
3581
|
+
"description": "The date the units the user leaves out are taken from. Defaults to now.",
|
|
3582
|
+
"type": "DateTime"
|
|
3547
3583
|
},
|
|
3548
3584
|
{
|
|
3549
3585
|
"name": "change",
|
|
@@ -3557,14 +3593,10 @@
|
|
|
3557
3593
|
"name": "validityChange",
|
|
3558
3594
|
"type": "EventDispatcher<boolean>"
|
|
3559
3595
|
},
|
|
3560
|
-
{
|
|
3561
|
-
"name": "isPopulated",
|
|
3562
|
-
"type": "boolean"
|
|
3563
|
-
},
|
|
3564
3596
|
{
|
|
3565
3597
|
"name": "value",
|
|
3566
3598
|
"attribute": "value",
|
|
3567
|
-
"description": "The
|
|
3599
|
+
"description": "The time as `HH:mm` or `HH:mm:ss`",
|
|
3568
3600
|
"type": "string | undefined"
|
|
3569
3601
|
},
|
|
3570
3602
|
{
|
|
@@ -3626,8 +3658,16 @@
|
|
|
3626
3658
|
],
|
|
3627
3659
|
"cssParts": [
|
|
3628
3660
|
{
|
|
3629
|
-
"name": "
|
|
3630
|
-
"description": "The
|
|
3661
|
+
"name": "segments",
|
|
3662
|
+
"description": "The group of segments making up the time"
|
|
3663
|
+
},
|
|
3664
|
+
{
|
|
3665
|
+
"name": "segment",
|
|
3666
|
+
"description": "An editable unit of the time"
|
|
3667
|
+
},
|
|
3668
|
+
{
|
|
3669
|
+
"name": "literal",
|
|
3670
|
+
"description": "A separator between the units"
|
|
3631
3671
|
},
|
|
3632
3672
|
{
|
|
3633
3673
|
"name": "container",
|
|
@@ -3939,6 +3979,11 @@
|
|
|
3939
3979
|
"name": "mo-hour-list",
|
|
3940
3980
|
"path": ".\\packages\\DateTimeFields\\dist\\selection\\HourList.d.ts",
|
|
3941
3981
|
"properties": [
|
|
3982
|
+
{
|
|
3983
|
+
"name": "hourCycle",
|
|
3984
|
+
"description": "Defaults to the language's convention, so English lists \"02 PM\" where German lists \"14\".",
|
|
3985
|
+
"type": "\"h11\" | \"h12\" | \"h23\" | \"h24\" | undefined"
|
|
3986
|
+
},
|
|
3942
3987
|
{
|
|
3943
3988
|
"name": "change",
|
|
3944
3989
|
"type": "EventDispatcher<DateTime>"
|
|
@@ -4113,6 +4158,11 @@
|
|
|
4113
4158
|
"name": "mo-hour-list",
|
|
4114
4159
|
"path": ".\\packages\\DateTimeFields\\selection\\HourList.ts",
|
|
4115
4160
|
"attributes": [
|
|
4161
|
+
{
|
|
4162
|
+
"name": "hourCycle",
|
|
4163
|
+
"description": "Defaults to the language's convention, so English lists \"02 PM\" where German lists \"14\".",
|
|
4164
|
+
"type": "\"h11\" | \"h12\" | \"h23\" | \"h24\" | undefined"
|
|
4165
|
+
},
|
|
4116
4166
|
{
|
|
4117
4167
|
"name": "navigationDate",
|
|
4118
4168
|
"type": "DateTime"
|
|
@@ -4123,6 +4173,12 @@
|
|
|
4123
4173
|
}
|
|
4124
4174
|
],
|
|
4125
4175
|
"properties": [
|
|
4176
|
+
{
|
|
4177
|
+
"name": "hourCycle",
|
|
4178
|
+
"attribute": "hourCycle",
|
|
4179
|
+
"description": "Defaults to the language's convention, so English lists \"02 PM\" where German lists \"14\".",
|
|
4180
|
+
"type": "\"h11\" | \"h12\" | \"h23\" | \"h24\" | undefined"
|
|
4181
|
+
},
|
|
4126
4182
|
{
|
|
4127
4183
|
"name": "change",
|
|
4128
4184
|
"type": "EventDispatcher<DateTime>"
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import '@3mo/tab';
|
|
|
9
9
|
import '@3mo/scroller';
|
|
10
10
|
import '@3mo/list';
|
|
11
11
|
import '@3mo/line';
|
|
12
|
+
import '@3mo/switch';
|
|
13
|
+
export * from './segments/index.js';
|
|
12
14
|
export * from './selection/index.js';
|
|
13
15
|
export * from './FieldTime.js';
|
|
14
16
|
export * from './FieldDateTimePrecision.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AACvB,OAAO,WAAW,CAAA;AAClB,OAAO,kBAAkB,CAAA;AACzB,OAAO,cAAc,CAAA;AACrB,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,CAAA;AAClB,OAAO,YAAY,CAAA;AACnB,OAAO,UAAU,CAAA;AACjB,OAAO,eAAe,CAAA;AACtB,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,CAAA;AAClB,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mCAAmC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AACvB,OAAO,WAAW,CAAA;AAClB,OAAO,kBAAkB,CAAA;AACzB,OAAO,cAAc,CAAA;AACrB,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,CAAA;AAClB,OAAO,YAAY,CAAA;AACnB,OAAO,UAAU,CAAA;AACjB,OAAO,eAAe,CAAA;AACtB,OAAO,WAAW,CAAA;AAClB,OAAO,WAAW,CAAA;AAClB,OAAO,aAAa,CAAA;AACpB,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mCAAmC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import '@3mo/tab';
|
|
|
9
9
|
import '@3mo/scroller';
|
|
10
10
|
import '@3mo/list';
|
|
11
11
|
import '@3mo/line';
|
|
12
|
+
import '@3mo/switch';
|
|
13
|
+
export * from './segments/index.js';
|
|
12
14
|
export * from './selection/index.js';
|
|
13
15
|
export * from './FieldTime.js';
|
|
14
16
|
export * from './FieldDateTimePrecision.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type EditableSegment, type LiteralSegment } from '@3mo/segmented-input';
|
|
2
|
+
export type DateTimeSegmentType = 'era' | 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'literal';
|
|
3
|
+
export declare const editableDateTimeSegmentTypes: readonly ["year", "month", "week", "day", "hour", "minute", "second", "dayPeriod"];
|
|
4
|
+
export type EditableDateTimeSegmentType = typeof editableDateTimeSegmentTypes[number];
|
|
5
|
+
export declare function isEditableDateTimeSegmentType(type: DateTimeSegmentType): type is EditableDateTimeSegmentType;
|
|
6
|
+
/** One unit of a date or time as the field renders it, or a literal separator between two of them. */
|
|
7
|
+
export type DateTimeSegment = DateTimeLiteralSegment | EditableDateTimeSegment;
|
|
8
|
+
export interface DateTimeLiteralSegment extends LiteralSegment {
|
|
9
|
+
readonly type: DateTimeSegmentType;
|
|
10
|
+
}
|
|
11
|
+
export interface EditableDateTimeSegment extends EditableSegment {
|
|
12
|
+
readonly type: EditableDateTimeSegmentType;
|
|
13
|
+
/** The unit's numeric value, in the numbers the user sees (a 12-hour clock reports 1–12). */
|
|
14
|
+
readonly value?: number;
|
|
15
|
+
readonly min?: number;
|
|
16
|
+
readonly max?: number;
|
|
17
|
+
/** What assistive technology reads for the value where the number alone is not enough (month names, "2 PM"). */
|
|
18
|
+
readonly valueText?: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=DateTimeSegment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimeSegment.d.ts","sourceRoot":"","sources":["../../segments/DateTimeSegment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEhF,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;AAEpI,eAAO,MAAM,4BAA4B,oFAAqF,CAAA;AAE9H,MAAM,MAAM,2BAA2B,GAAG,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAA;AAErF,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,IAAI,2BAA2B,CAE5G;AAED,sGAAsG;AACtG,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG,uBAAuB,CAAA;AAE9E,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC7D,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAA;CAClC;AAED,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC/D,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAA;IAC1C,6FAA6F;IAC7F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,gHAAgH;IAChH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type LanguageCode } from '@3mo/localization';
|
|
2
|
+
import { FieldDateTimePrecision } from '../FieldDateTimePrecision.js';
|
|
3
|
+
import { type DateTimeSegment, type EditableDateTimeSegmentType } from './DateTimeSegment.js';
|
|
4
|
+
export type HourCycle = 'h11' | 'h12' | 'h23' | 'h24';
|
|
5
|
+
/** Reads an `hourCycle` attribute, ignoring anything which is not one of the four cycles. */
|
|
6
|
+
export declare const hourCycleConverter: (value: unknown) => HourCycle | undefined;
|
|
7
|
+
export type DateTimeSegmenterOptions = {
|
|
8
|
+
readonly precision: FieldDateTimePrecision;
|
|
9
|
+
readonly language?: LanguageCode;
|
|
10
|
+
readonly calendar?: string;
|
|
11
|
+
readonly timeZone?: string;
|
|
12
|
+
readonly hourCycle?: HourCycle;
|
|
13
|
+
/** Renders only the time units, for time-only fields. */
|
|
14
|
+
readonly timeOnly?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Derives the segments of a date-time value for a language, calendar and precision from
|
|
18
|
+
* `Intl.DateTimeFormat.formatToParts`, and edits them with Temporal's calendar arithmetic.
|
|
19
|
+
*/
|
|
20
|
+
export declare class DateTimeSegmenter {
|
|
21
|
+
static readonly pageSteps: Partial<Record<EditableDateTimeSegmentType, number>>;
|
|
22
|
+
static defaultHourCycle(language: LanguageCode): HourCycle;
|
|
23
|
+
readonly precision: FieldDateTimePrecision;
|
|
24
|
+
readonly language: LanguageCode;
|
|
25
|
+
readonly calendar: string;
|
|
26
|
+
readonly timeZone: string;
|
|
27
|
+
readonly hourCycle: HourCycle;
|
|
28
|
+
readonly timeOnly: boolean;
|
|
29
|
+
readonly direction: 'ltr' | 'rtl';
|
|
30
|
+
readonly formatOptions: Intl.DateTimeFormatOptions;
|
|
31
|
+
readonly formatter: Intl.DateTimeFormat;
|
|
32
|
+
private readonly displayNames?;
|
|
33
|
+
private readonly digits;
|
|
34
|
+
private readonly dayPeriods;
|
|
35
|
+
private readonly monthFormatter;
|
|
36
|
+
private readonly hourFormatter;
|
|
37
|
+
constructor(options: DateTimeSegmenterOptions);
|
|
38
|
+
/** Identifies the configuration, so a consumer can tell when its segmenter is stale. */
|
|
39
|
+
get key(): string;
|
|
40
|
+
get twelveHours(): boolean;
|
|
41
|
+
private buildFormatOptions;
|
|
42
|
+
/** Brings a date into this segmenter's calendar and time zone. */
|
|
43
|
+
adopt(date: DateTime): import("@3mo/date-time/DateTime.js").DateTime;
|
|
44
|
+
/** The editable unit types present, in rendering order. */
|
|
45
|
+
get types(): ReadonlyArray<EditableDateTimeSegmentType>;
|
|
46
|
+
segments(date: DateTime, filled: ReadonlySet<EditableDateTimeSegmentType>): Array<DateTimeSegment>;
|
|
47
|
+
private parts;
|
|
48
|
+
private typeOf;
|
|
49
|
+
labelOf(type: EditableDateTimeSegmentType): string;
|
|
50
|
+
private placeholderOf;
|
|
51
|
+
limits(date: DateTime, type: EditableDateTimeSegmentType): {
|
|
52
|
+
min: number;
|
|
53
|
+
max: number;
|
|
54
|
+
};
|
|
55
|
+
private static weeksInYear;
|
|
56
|
+
valueOf(date: DateTime, type: EditableDateTimeSegmentType): number;
|
|
57
|
+
private valueTextOf;
|
|
58
|
+
set(date: DateTime, type: EditableDateTimeSegmentType, value: number): DateTime;
|
|
59
|
+
/** Moves a unit by `delta`, wrapping at its limits — except the year, which is clamped. */
|
|
60
|
+
step(date: DateTime, type: EditableDateTimeSegmentType, delta: number): DateTime;
|
|
61
|
+
/** The numeric value of a typed character in the language's numbering system or ASCII, if it is a digit. */
|
|
62
|
+
digitOf(character: string): number | undefined;
|
|
63
|
+
/** Which day period a typed character selects, matching the first character of the localized "AM"/"PM". */
|
|
64
|
+
dayPeriodOf(character: string): 0 | 1 | undefined;
|
|
65
|
+
/** The whole value as one localized string, for the group's accessible description. */
|
|
66
|
+
describe(date: DateTime): string;
|
|
67
|
+
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