sanity-plugin-recurring-dates 1.1.0 → 1.2.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/README.md +6 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.esm.js +302 -4864
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +306 -4868
- package/dist/index.js.map +1 -1
- package/package.json +27 -26
- package/src/components/CustomRule/CustomRule.tsx +100 -107
- package/src/components/CustomRule/Monthly.tsx +1 -1
- package/src/components/CustomRule/Weekly.tsx +1 -1
- package/src/components/DateInputs/CommonDateTimeInput.tsx +5 -4
- package/src/components/DateInputs/DateInput.tsx +1 -1
- package/src/components/DateInputs/DateTimeInput.tsx +1 -1
- package/src/components/DateInputs/base/DatePicker.tsx +4 -2
- package/src/components/DateInputs/base/DateTimeInput.tsx +8 -4
- package/src/components/DateInputs/base/LazyTextInput.tsx +13 -14
- package/src/components/DateInputs/base/calendar/Calendar.tsx +18 -16
- package/src/components/DateInputs/base/calendar/CalendarDay.tsx +1 -1
- package/src/components/DateInputs/base/calendar/CalendarMonth.tsx +3 -2
- package/src/components/DateInputs/base/calendar/YearInput.tsx +4 -3
- package/src/components/RecurringDate.tsx +21 -4
- package/src/components/RemoveEndDate.tsx +3 -2
- package/src/schema/recurringDates.tsx +9 -5
- package/src/types.ts +6 -2
package/README.md
CHANGED
|
@@ -108,6 +108,12 @@ defineField({
|
|
|
108
108
|
|
|
109
109
|
// Changes the date picker to date only, no time
|
|
110
110
|
dateOnly: true, // defaults to false
|
|
111
|
+
|
|
112
|
+
// override the default validation
|
|
113
|
+
validation: {
|
|
114
|
+
startDate: (Rule) => Rule.required() // defaults to (Rule) => Rule.required()
|
|
115
|
+
endDate: (Rule) => Rule.min(Rule.valueOfField('startDate')) // defaults to (Rule) => Rule.min(Rule.valueOfField('startDate'))
|
|
116
|
+
}
|
|
111
117
|
},
|
|
112
118
|
})
|
|
113
119
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type {DateRule} from 'sanity'
|
|
1
2
|
import type {DatetimeOptions} from 'sanity'
|
|
2
3
|
import type {ObjectDefinition} from 'sanity'
|
|
3
4
|
import {Plugin as Plugin_2} from 'sanity'
|
|
@@ -8,12 +9,16 @@ export declare interface PluginConfig {
|
|
|
8
9
|
hideCustom?: boolean
|
|
9
10
|
dateTimeOptions?: DatetimeOptions
|
|
10
11
|
dateOnly?: boolean
|
|
12
|
+
validation?: {
|
|
13
|
+
startDate?: (Rule: DateRule) => DateRule
|
|
14
|
+
endDate?: (Rule: DateRule) => DateRule
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
export declare interface RecurringDate {
|
|
14
19
|
rrule: string
|
|
15
20
|
startDate: string
|
|
16
|
-
endDate:
|
|
21
|
+
endDate: string
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export declare type RecurringDateFieldOptions = Omit<ObjectDefinition, 'type' | 'fields'> & {
|