@anglr/datetime 6.0.0 → 6.1.0-beta.20230104111018

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.
Files changed (67) hide show
  1. package/changelog.md +19 -0
  2. package/es2015/src/directives/datePickerInput/datePickerInput.directive.js +37 -0
  3. package/es2015/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -0
  4. package/es2015/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +325 -0
  5. package/es2015/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -0
  6. package/es2015/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +29 -0
  7. package/es2015/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -0
  8. package/es2015/src/directives/index.js +4 -0
  9. package/es2015/src/directives/index.js.map +1 -1
  10. package/es2015/src/directives/withNow/withNow.directive.js +44 -0
  11. package/es2015/src/directives/withNow/withNow.directive.js.map +1 -0
  12. package/es2015/src/directives/withToday/withToday.directive.js +6 -6
  13. package/es2015/src/directives/withToday/withToday.directive.js.map +1 -1
  14. package/es2015/src/misc/utils.js +52 -0
  15. package/es2015/src/misc/utils.js.map +1 -1
  16. package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js +32 -12
  17. package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
  18. package/es2020/src/directives/datePickerInput/datePickerInput.directive.js +37 -0
  19. package/es2020/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -0
  20. package/es2020/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +322 -0
  21. package/es2020/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -0
  22. package/es2020/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +29 -0
  23. package/es2020/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -0
  24. package/es2020/src/directives/index.js +4 -0
  25. package/es2020/src/directives/index.js.map +1 -1
  26. package/es2020/src/directives/withNow/withNow.directive.js +44 -0
  27. package/es2020/src/directives/withNow/withNow.directive.js.map +1 -0
  28. package/es2020/src/directives/withToday/withToday.directive.js +6 -6
  29. package/es2020/src/directives/withToday/withToday.directive.js.map +1 -1
  30. package/es2020/src/misc/utils.js +52 -0
  31. package/es2020/src/misc/utils.js.map +1 -1
  32. package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js +32 -12
  33. package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/directives/datePickerInput/datePickerInput.directive.d.ts +12 -0
  36. package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -0
  37. package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts +86 -0
  38. package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -0
  39. package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts +11 -0
  40. package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -0
  41. package/src/directives/index.d.ts +4 -0
  42. package/src/directives/index.d.ts.map +1 -1
  43. package/src/directives/withNow/withNow.directive.d.ts +22 -0
  44. package/src/directives/withNow/withNow.directive.d.ts.map +1 -0
  45. package/src/directives/withToday/withToday.directive.d.ts +3 -2
  46. package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
  47. package/src/misc/utils.d.ts +18 -1
  48. package/src/misc/utils.d.ts.map +1 -1
  49. package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +19 -6
  50. package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
  51. package/version.bak +1 -1
  52. package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +0 -488
  53. package/es2015/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +0 -1
  54. package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +0 -367
  55. package/es2015/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +0 -1
  56. package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js +0 -488
  57. package/es2020/src/legacy/selector/components/inputDateTime/inputDateTime.component.js.map +0 -1
  58. package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +0 -367
  59. package/es2020/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +0 -1
  60. package/src/legacy/selector/components/inputDateTime/inputDateTime.component.css +0 -9
  61. package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts +0 -1
  62. package/src/legacy/selector/components/inputDateTime/inputDateTime.component.d.ts.map +0 -1
  63. package/src/legacy/selector/components/inputDateTime/inputDateTime.component.html +0 -10
  64. package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.css +0 -9
  65. package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts +0 -1
  66. package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts.map +0 -1
  67. package/src/legacy/selector/components/simpleInputDateTime/simpleInputDateTime.component.html +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/misc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAIhF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAG5C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAkB,KAAqD,EACrD,OAAuB,EACvB,cAAkD,EAClD,YAAmC;IAE9E,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB;QACI,OAAO,KAAK,CAAC;KAChB;IAED,qBAAqB;IACrB,IAAG,SAAS,CAAC,cAAc,CAAC,EAC5B;QACI,4DAA4D;QAC5D,IAAG,cAAc,IAAI,mBAAmB,CAAC,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,EACjF;YACI,MAAM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AmB,CAAC,aAAa,EACtD;QACI,KAAK,CAAC,aAAa,EAAE,CAAC;KACzB;IAED,OAAO,KAAK,CAAC,KAAK,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAkB,KAAc;IAE3D,OAAO,UAAU,CAAC,KAAK,CAAC;QACjB,MAAM,CAAgB,MAAM,CAAC,IAAI,KAAK;QACtC,MAAM,CAAgB,IAAI,CAAC,IAAI,KAAK,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAQ,KAAqD;IAE/F,IAAG,eAAe,CAAC,KAAK,CAAC,EACzB;QACI,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;KAC7F;IAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import {isBlank, isJsObject, isPresent, isString, nameof} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../interfaces';\nimport {DateApi, DateApiObject, DateValue} from '../services';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from './types';\n\n/**\n * Parses date time input output value\n * @param value - Value to be parsed\n * @param dateApi - Date api used for obtaining result\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used\n * @param stringFormat - String format for parsing string dates, required only for string dates\n */\nexport function parseDateTime<TDate = unknown>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,): DateTimeObjectValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //format is specified\n if(isPresent(dateTimeFormat))\n {\n //string format required, but format string was not provided\n if(dateTimeFormat == DateTimeValueFormat.FormattedString && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n //requirested format is different\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: requested datetime format is not range, but value is range!');\n }\n\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n ];\n }\n\n //value should be date instance, or number, or string, but it is not\n if(dateTimeFormat != DateTimeValueFormat.DateInstance &&\n dateTimeFormat != DateTimeValueFormat.FormattedString &&\n dateTimeFormat != DateTimeValueFormat.UnixTimestamp)\n {\n throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance , null) as DateApiObject<TDate>,\n ];\n }\n\n //string format, but format string was not provided\n if(isString(value) && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n}\n\n/**\n * Formats value into specified format of date time\n * @param value - Value that should be converted to input output date time value\n * @param dateTimeFormat - Date time format type\n * @param stringFormat - String format for parsing string dates, required only for string dates\n */\nexport function formatDateTime<TDate = unknown>(value: DateTimeObjectValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat,\n stringFormat: string|undefined|null): DateTimeInputOutputValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //value is range\n if(Array.isArray(value))\n {\n //range is expected\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is array of values, but format is not range!');\n }\n\n return {\n from: value[0]?.value ?? null,\n to: value[1]?.value ?? null,\n };\n }\n\n //range is not expected\n if(dateTimeFormat == DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is not array of values, but format is range!');\n }\n\n //string date time\n if(dateTimeFormat == DateTimeValueFormat.FormattedString)\n {\n //string format is missing for string date time\n if(isBlank(stringFormat))\n {\n throw new Error('DateTime: missing string format for string date time!');\n }\n\n return value.format(stringFormat);\n }\n\n if(dateTimeFormat == DateTimeValueFormat.UnixTimestamp)\n {\n value.unixTimestamp();\n }\n\n return value.value;\n}\n\n/**\n * Tests whether value is `DateTimeValue`\n * @param value - Value that is tested\n */\nexport function isDateTimeValue<TDate = unknown>(value: unknown): value is DateTimeValue<TDate>\n{\n return isJsObject(value) &&\n nameof<DateTimeValue>('from') in value &&\n nameof<DateTimeValue>('to') in value;\n}\n\n/**\n * Gets single date time value, use in places where ranged date time can not be used\n * @param value - Value to be examined\n */\nexport function getSingleDateTimeValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null): DateValue|TDate|null|undefined\n{\n if(isDateTimeValue(value))\n {\n throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');\n }\n\n return value;\n}"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/misc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAKhF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAG5C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAkB,KAAqD,EACrD,OAAuB,EACvB,cAAkD,EAClD,YAAmC;IAE9E,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB;QACI,OAAO,KAAK,CAAC;KAChB;IAED,qBAAqB;IACrB,IAAG,SAAS,CAAC,cAAc,CAAC,EAC5B;QACI,4DAA4D;QAC5D,IAAG,cAAc,IAAI,mBAAmB,CAAC,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,EACjF;YACI,MAA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,OAAO,CAAC,aAAa,CAAC,EAC/B;QACI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,aAAa,CAAC;QAEjC,IAAG,IAAI,EACP;YACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;YAE/E,IAAG,GAAG,EACN;gBACI,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;aACvE;SACJ;QAED,IAAG,EAAE,EACL;YACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;YAE3E,IAAG,GAAG,EACN;gBACI,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;aACvE;SACJ;KACJ;SAED;QACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;QAExF,IAAG,GAAG,EACN;YACI,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;SACpE;KACJ;IAED,OAAO,aAAa,CAAC;AACzB,CAAC","sourcesContent":["import {isBlank, isJsObject, isPresent, isString, nameof} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../interfaces';\nimport type {DateTimeSADirective} from '../modules/dateTime/directives/dateTime/dateTime.directive';\nimport {DateApi, DateApiObject, DateValue, DateValueProvider} from '../services';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from './types';\n\n/**\n * Parses date time input output value\n * @param value - Value to be parsed\n * @param dateApi - Date api used for obtaining result\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used\n * @param stringFormat - String format for parsing string dates, required only for string dates\n */\nexport function parseDateTime<TDate = unknown>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,): DateTimeObjectValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //format is specified\n if(isPresent(dateTimeFormat))\n {\n //string format required, but format string was not provided\n if(dateTimeFormat == DateTimeValueFormat.FormattedString && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n //requirested format is different\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: requested datetime format is not range, but value is range!');\n }\n\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n ];\n }\n\n //value should be date instance, or number, or string, but it is not\n if(dateTimeFormat != DateTimeValueFormat.DateInstance &&\n dateTimeFormat != DateTimeValueFormat.FormattedString &&\n dateTimeFormat != DateTimeValueFormat.UnixTimestamp)\n {\n throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance , null) as DateApiObject<TDate>,\n ];\n }\n\n //string format, but format string was not provided\n if(isString(value) && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n}\n\n/**\n * Formats value into specified format of date time\n * @param value - Value that should be converted to input output date time value\n * @param dateTimeFormat - Date time format type\n * @param stringFormat - String format for parsing string dates, required only for string dates\n */\nexport function formatDateTime<TDate = unknown>(value: DateTimeObjectValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat,\n stringFormat: string|undefined|null): DateTimeInputOutputValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //value is range\n if(Array.isArray(value))\n {\n //range is expected\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is array of values, but format is not range!');\n }\n\n return {\n from: value[0]?.value ?? null,\n to: value[1]?.value ?? null,\n };\n }\n\n //range is not expected\n if(dateTimeFormat == DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is not array of values, but format is range!');\n }\n\n //string date time\n if(dateTimeFormat == DateTimeValueFormat.FormattedString)\n {\n //string format is missing for string date time\n if(isBlank(stringFormat))\n {\n throw new Error('DateTime: missing string format for string date time!');\n }\n\n return value.format(stringFormat);\n }\n\n if(dateTimeFormat == DateTimeValueFormat.UnixTimestamp)\n {\n value.unixTimestamp();\n }\n\n return value.value;\n}\n\n/**\n * Tests whether value is `DateTimeValue`\n * @param value - Value that is tested\n */\nexport function isDateTimeValue<TDate = unknown>(value: unknown): value is DateTimeValue<TDate>\n{\n return isJsObject(value) &&\n nameof<DateTimeValue>('from') in value &&\n nameof<DateTimeValue>('to') in value;\n}\n\n/**\n * Gets single date time value, use in places where ranged date time can not be used\n * @param value - Value to be examined\n */\nexport function getSingleDateTimeValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null): DateValue|TDate|null|undefined\n{\n if(isDateTimeValue(value))\n {\n throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');\n }\n\n return value;\n}\n\n/**\n * Parses raw value into internal value and value\n * @param rawValue - Raw value to be parsed\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n */\nexport function parseRawInput<TDate>(rawValue: string, \n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeSADirective<TDate>,\n valueProvider: DateValueProvider<TDate>,): [DateTimeObjectValue<TDate>|undefined|null, DateTimeInputOutputValue<TDate>|undefined|null]\n{\n if(!rawValue)\n {\n return [null, null];\n }\n\n const internalValue = getInternalValue(rawValue, dateApi, dateTimeData, valueProvider);\n const value = formatDateTime(internalValue, dateTimeData.valueFormat, dateTimeData.customFormat);\n\n return [internalValue, value];\n}\n\n/**\n * Gets internal value and fix lowest time difference\n * @param value - Value to be get as internal value\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n */\nexport function getInternalValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeSADirective<TDate>,\n valueProvider: DateValueProvider<TDate>,): DateTimeObjectValue<TDate>|undefined|null\n{\n let internalValue = parseDateTime(value, dateApi, null, dateTimeData.customFormat);\n\n if(isBlank(internalValue))\n {\n return;\n }\n\n //update for specified format, round value\n\n //ranged value\n if(Array.isArray(internalValue))\n {\n const [from, to] = internalValue;\n\n if(from)\n {\n const val = valueProvider.getValue(from.value, dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue[0] = dateApi.getValue(val, dateTimeData.customFormat);\n }\n }\n\n if(to)\n {\n const val = valueProvider.getValue(to.value, dateTimeData.customFormat).to;\n\n if(val)\n {\n internalValue[1] = dateApi.getValue(val, dateTimeData.customFormat);\n }\n }\n }\n else\n {\n const val = valueProvider.getValue(internalValue.value, dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue = dateApi.getValue(val, dateTimeData.customFormat);\n }\n }\n\n return internalValue;\n}"]}
@@ -21,14 +21,18 @@ export class DateTimeSADirective {
21
21
  * Subject used for emitting changes in min date time value
22
22
  */
23
23
  this.minDateTimeChangesSubject = new Subject();
24
+ /**
25
+ * Subject used for emitting changes in custom format value
26
+ */
27
+ this.customFormatChangesSubject = new Subject();
24
28
  /**
25
29
  * Date time value format which is being worked with in this date time
26
30
  */
27
- this.ɵValueFormat = DateTimeValueFormat.DateInstance;
31
+ this.ɵvalueFormat = DateTimeValueFormat.DateInstance;
28
32
  /**
29
33
  * Format of string representation of date
30
34
  */
31
- this.ɵFormat = 'date';
35
+ this.ɵformat = 'date';
32
36
  /**
33
37
  * Date api instance, used for date time manipulation
34
38
  */
@@ -40,7 +44,7 @@ export class DateTimeSADirective {
40
44
  /**
41
45
  * Custom format string representation of date
42
46
  */
43
- this.customFormat = this.dateApi.getFormat(this.formatProvider[this.ɵFormat]);
47
+ thiscustomFormat = this.dateApi.getFormat(this.formatProvider[this.ɵformat]);
44
48
  }
45
49
  //######################### public properties #########################
46
50
  /**
@@ -55,35 +59,51 @@ export class DateTimeSADirective {
55
59
  get minDateTimeChanges() {
56
60
  return this.minDateTimeChangesSubject.asObservable();
57
61
  }
62
+ /**
63
+ * Occurs when there are changes in custom format value
64
+ */
65
+ get customFormatChanges() {
66
+ return this.customFormatChangesSubject.asObservable();
67
+ }
58
68
  //######################### public properties - inputs #########################
59
69
  /**
60
70
  * Gets or sets date time value format which is being worked with in this date time
61
71
  */
62
72
  get valueFormat() {
63
- return this.ɵValueFormat;
73
+ return this.ɵvalueFormat;
64
74
  }
65
75
  set valueFormat(value) {
66
76
  if (isString(value)) {
67
- this.ɵValueFormat = DateTimeValueFormat[value];
77
+ this.ɵvalueFormat = DateTimeValueFormat[value];
68
78
  return;
69
79
  }
70
- this.ɵValueFormat = value;
80
+ this.ɵvalueFormat = value;
71
81
  }
72
82
  /**
73
83
  * Gets or sets format of string representation of date
74
84
  */
75
85
  get format() {
76
- return this.ɵFormat;
86
+ return this.ɵformat;
77
87
  }
78
88
  set format(value) {
79
- this.ɵFormat = value;
89
+ this.ɵformat = value;
80
90
  this.customFormat = this.dateApi.getFormat(this.formatProvider[value]);
81
91
  }
92
+ /**
93
+ * Gets or sets custom format string representation of date
94
+ */
95
+ get customFormat() {
96
+ return this.ɵcustomFormat;
97
+ }
98
+ set customFormat(value) {
99
+ this.ɵcustomFormat = value;
100
+ this.customFormatChangesSubject.next();
101
+ }
82
102
  /**
83
103
  * Gets or sets max allowed date for date time
84
104
  */
85
105
  get maxDateTime() {
86
- return this.ɵMaxDateTime;
106
+ return this.ɵmaxDateTime;
87
107
  }
88
108
  set maxDateTime(value) {
89
109
  this.maxDateInstanceChange?.unsubscribe();
@@ -115,7 +135,7 @@ export class DateTimeSADirective {
115
135
  * Gets or sets min allowed date for date time
116
136
  */
117
137
  get minDateTime() {
118
- return this.ɵMinDateTime;
138
+ return this.ɵminDateTime;
119
139
  }
120
140
  set minDateTime(value) {
121
141
  this.minDateInstanceChange?.unsubscribe();
@@ -159,7 +179,7 @@ export class DateTimeSADirective {
159
179
  * @param value - Value to be set
160
180
  */
161
181
  minDateSet(value) {
162
- this.ɵMinDateTime = value;
182
+ this.ɵminDateTime = value;
163
183
  this.minDateTimeChangesSubject.next();
164
184
  this.onMinDateTimeChange();
165
185
  }
@@ -168,7 +188,7 @@ export class DateTimeSADirective {
168
188
  * @param value - Value to be set
169
189
  */
170
190
  maxDateSet(value) {
171
- this.ɵMaxDateTime = value;
191
+ this.ɵmaxDateTime = value;
172
192
  this.maxDateTimeChangesSubject.next();
173
193
  this.onMaxDateTimeChange();
174
194
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dateTime.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTime/dateTime.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAClE,OAAO,EAAU,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAa,OAAO,EAAe,MAAM,MAAM,CAAC;AAGvD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hB,KAAK;gBAeC,YAAY;sBADlB,KAAK;gBAOK,WAAW;sBADrB,KAAK;gBAsDK,WAAW;sBADrB,KAAK;gBAuEI,UAAU,MAYV,UAAU","sourcesContent":["import {Directive, inject, Input, OnDestroy} from '@angular/core';\nimport {Action1, BindThis, isBlank, isString} from '@jscrpt/common';\nimport {Observable, Subject, Subscription} from 'rxjs';\n\nimport {FormatProvider} from '../../../../interfaces';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {getSingleDateTimeValue} from '../../../../misc/utils';\nimport {DateApi, DateValue} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Directive that holds shared data for date time, like formats, restrictions\n */\n@Directive(\n{\n selector: '[dateTime]',\n standalone: true,\n})\nexport class DateTimeSADirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subject used for emitting changes in max date time value\n */\n protected maxDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in min date time value\n */\n protected minDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subscription for max date instance value changes\n */\n protected maxDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Subscription for min date instance value changes\n */\n protected minDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Max allowed value of date time\n */\n protected ɵMaxDateTime: TDate|undefined|null;\n\n /**\n * Min allowed value of date time\n */\n protected ɵMinDateTime: TDate|undefined|null;\n\n /**\n * Date time value format which is being worked with in this date time\n */\n protected ɵValueFormat: DateTimeValueFormat = DateTimeValueFormat.DateInstance;\n\n /**\n * Format of string representation of date\n */\n protected ɵFormat: keyof FormatProvider = 'date';\n\n /**\n * Date api instance, used for date time manipulation\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API) as DateApi<TDate>;\n\n /**\n * Provider for available formats\n */\n protected formatProvider: FormatProvider = inject(FORMAT_PROVIDER);\n\n //######################### public properties #########################\n\n /**\n * Occurs when there are changes in max date time value\n */\n public get maxDateTimeChanges(): Observable<void>\n {\n return this.maxDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in min date time value\n */\n public get minDateTimeChanges(): Observable<void>\n {\n return this.minDateTimeChangesSubject.asObservable();\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets date time value format which is being worked with in this date time\n */\n @Input()\n public get valueFormat(): DateTimeValueFormat\n {\n return this.ɵValueFormat;\n }\n public set valueFormat(value: DateTimeValueFormat)\n {\n if(isString(value))\n {\n this.ɵValueFormat = DateTimeValueFormat[value] as unknown as DateTimeValueFormat;\n\n return;\n }\n\n this.ɵValueFormat = value;\n }\n\n /**\n * Gets or sets format of string representation of date\n */\n @Input()\n public get format(): keyof FormatProvider\n {\n return this.ɵFormat;\n }\n public set format(value: keyof FormatProvider)\n {\n this.ɵFormat = value;\n this.customFormat = this.dateApi.getFormat(this.formatProvider[value]);\n }\n\n /**\n * Custom format string representation of date\n */\n @Input()\n public customFormat: string = this.dateApi.getFormat(this.formatProvider[this.ɵFormat]);\n\n /**\n * Gets or sets max allowed date for date time\n */\n @Input()\n public get maxDateTime(): TDate|undefined|null\n {\n return this.ɵMaxDateTime;\n }\n public set maxDateTime(value: TDate|undefined|null)\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.maxDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase<TDate>)\n {\n this.maxDateInstanceChange = value.valueChange.subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.maxDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n val = v;\n }\n \n this.setMinMaxValue(val, this.maxDateSet);\n }\n\n /**\n * Gets or sets min allowed date for date time\n */\n @Input()\n public get minDateTime(): TDate|undefined|null\n {\n return this.ɵMinDateTime;\n }\n public set minDateTime(value: TDate|undefined|null)\n {\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.minDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase<TDate>)\n {\n this.minDateInstanceChange = value.valueChange.subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.minDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.minDateSet(null);\n\n return;\n }\n\n val = v;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets min date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected minDateSet(value: TDate|undefined|null): void\n {\n this.ɵMinDateTime = value;\n this.minDateTimeChangesSubject.next();\n this.onMinDateTimeChange();\n }\n\n /**\n * Sets max date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected maxDateSet(value: TDate|undefined|null): void\n {\n this.ɵMaxDateTime = value;\n this.maxDateTimeChangesSubject.next();\n this.onMaxDateTimeChange();\n }\n\n /**\n * Sets min or max date time value\n * @param value - Value to be set\n * @param setter - Action used for setting value\n */\n protected setMinMaxValue(value: DateValue|TDate, setter: Action1<TDate|undefined|null>): void\n {\n const val = this.dateApi.getValue(value, this.customFormat);\n\n if(val.isValid())\n {\n setter(val.value);\n }\n else\n {\n setter(null);\n }\n }\n\n /**\n * Called whenever max date time restriction changes\n */\n protected onMaxDateTimeChange(): void\n {\n }\n\n /**\n * Called whenever min date time restriction changes\n */\n protected onMinDateTimeChange(): void\n {\n }\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `valueFormat` input\n */\n public static ngAcceptInputType_valueFormat: keyof typeof DateTimeValueFormat|DateTimeValueFormat;\n\n /**\n * Custom input type for `maxDateTime` input\n */\n public static ngAcceptInputType_maxDateTime: DateValue|DateTimeBase;\n\n /**\n * Custom input type for `minDateTime` input\n */\n public static ngAcceptInputType_minDateTime: DateValue|DateTimeBase;\n}"]}
1
+ {"version":3,"file":"dateTime.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTime/directives/dateTime/dateTime.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAClE,OAAO,EAAU,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAa,OAAO,EAAe,MAAM,MAAM,CAAC;AAGvD,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAC,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AAMH,MAAM,OAAO,mBAAmB;IALhC;QAOI,0EAA0E;QAE1E;;WAEG;QACO,8BAAyB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAEzE;;WAEG;QACO,8BAAyB,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAEzE;;WAEG;QACO,+BAA0B,GAAkB,IAAI,OAAO,EAAQ,CAAC;QAsB1E;;WAEG;QACO,iBAAY,GAAwB,mBAAmB,CA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, inject, Input, OnDestroy} from '@angular/core';\nimport {Action1, BindThis, isBlank, isString} from '@jscrpt/common';\nimport {Observable, Subject, Subscription} from 'rxjs';\n\nimport {FormatProvider} from '../../../../interfaces';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {getSingleDateTimeValue} from '../../../../misc/utils';\nimport {DateApi, DateValue} from '../../../../services';\nimport {DateTimeBase} from '../dateTimeBase';\n\n/**\n * Directive that holds shared data for date time, like formats, restrictions\n */\n@Directive(\n{\n selector: '[dateTime]',\n standalone: true,\n})\nexport class DateTimeSADirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subject used for emitting changes in max date time value\n */\n protected maxDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in min date time value\n */\n protected minDateTimeChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subject used for emitting changes in custom format value\n */\n protected customFormatChangesSubject: Subject<void> = new Subject<void>();\n\n /**\n * Subscription for max date instance value changes\n */\n protected maxDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Subscription for min date instance value changes\n */\n protected minDateInstanceChange: Subscription|undefined|null;\n\n /**\n * Max allowed value of date time\n */\n protected ɵmaxDateTime: TDate|undefined|null;\n\n /**\n * Min allowed value of date time\n */\n protected ɵminDateTime: TDate|undefined|null;\n\n /**\n * Date time value format which is being worked with in this date time\n */\n protected ɵvalueFormat: DateTimeValueFormat = DateTimeValueFormat.DateInstance;\n\n /**\n * Format of string representation of date\n */\n protected ɵformat: keyof FormatProvider = 'date';\n\n /**\n * Date api instance, used for date time manipulation\n */\n protected dateApi: DateApi<TDate> = inject(DATE_API) as DateApi<TDate>;\n\n /**\n * Provider for available formats\n */\n protected formatProvider: FormatProvider = inject(FORMAT_PROVIDER);\n\n /**\n * Custom format string representation of date\n */\n protected ɵcustomFormat: string = this.dateApi.getFormat(this.formatProvider[this.ɵformat]);\n\n //######################### public properties #########################\n\n /**\n * Occurs when there are changes in max date time value\n */\n public get maxDateTimeChanges(): Observable<void>\n {\n return this.maxDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in min date time value\n */\n public get minDateTimeChanges(): Observable<void>\n {\n return this.minDateTimeChangesSubject.asObservable();\n }\n\n /**\n * Occurs when there are changes in custom format value\n */\n public get customFormatChanges(): Observable<void>\n {\n return this.customFormatChangesSubject.asObservable();\n }\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets date time value format which is being worked with in this date time\n */\n @Input()\n public get valueFormat(): DateTimeValueFormat\n {\n return this.ɵvalueFormat;\n }\n public set valueFormat(value: DateTimeValueFormat)\n {\n if(isString(value))\n {\n this.ɵvalueFormat = DateTimeValueFormat[value] as unknown as DateTimeValueFormat;\n\n return;\n }\n\n this.ɵvalueFormat = value;\n }\n\n /**\n * Gets or sets format of string representation of date\n */\n @Input()\n public get format(): keyof FormatProvider\n {\n return this.ɵformat;\n }\n public set format(value: keyof FormatProvider)\n {\n this.ɵformat = value;\n this.customFormat = this.dateApi.getFormat(this.formatProvider[value]);\n }\n\n /**\n * Gets or sets custom format string representation of date\n */\n @Input()\n public get customFormat(): string\n {\n return this.ɵcustomFormat;\n }\n public set customFormat(value: string)\n {\n this.ɵcustomFormat = value;\n this.customFormatChangesSubject.next();\n }\n\n /**\n * Gets or sets max allowed date for date time\n */\n @Input()\n public get maxDateTime(): TDate|undefined|null\n {\n return this.ɵmaxDateTime;\n }\n public set maxDateTime(value: TDate|undefined|null)\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.maxDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase<TDate>)\n {\n this.maxDateInstanceChange = value.valueChange.subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.maxDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.maxDateSet(null);\n\n return;\n }\n\n val = v;\n }\n \n this.setMinMaxValue(val, this.maxDateSet);\n }\n\n /**\n * Gets or sets min allowed date for date time\n */\n @Input()\n public get minDateTime(): TDate|undefined|null\n {\n return this.ɵminDateTime;\n }\n public set minDateTime(value: TDate|undefined|null)\n {\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n\n if(isBlank(value))\n {\n this.minDateSet(value);\n\n return;\n }\n\n let val: DateTimeInputOutputValue<TDate> = value;\n\n if(value instanceof DateTimeBase<TDate>)\n {\n this.minDateInstanceChange = value.valueChange.subscribe(() =>\n {\n const val = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(val))\n {\n this.minDateSet(null);\n\n return;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n });\n\n const v = getSingleDateTimeValue<TDate>(value.value);\n\n if(isBlank(v))\n {\n this.minDateSet(null);\n\n return;\n }\n\n val = v;\n }\n\n this.setMinMaxValue(val, this.minDateSet);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.maxDateInstanceChange?.unsubscribe();\n this.maxDateInstanceChange = null;\n\n this.minDateInstanceChange?.unsubscribe();\n this.minDateInstanceChange = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets min date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected minDateSet(value: TDate|undefined|null): void\n {\n this.ɵminDateTime = value;\n this.minDateTimeChangesSubject.next();\n this.onMinDateTimeChange();\n }\n\n /**\n * Sets max date time and notifies about changes\n * @param value - Value to be set\n */\n @BindThis\n protected maxDateSet(value: TDate|undefined|null): void\n {\n this.ɵmaxDateTime = value;\n this.maxDateTimeChangesSubject.next();\n this.onMaxDateTimeChange();\n }\n\n /**\n * Sets min or max date time value\n * @param value - Value to be set\n * @param setter - Action used for setting value\n */\n protected setMinMaxValue(value: DateValue|TDate, setter: Action1<TDate|undefined|null>): void\n {\n const val = this.dateApi.getValue(value, this.customFormat);\n\n if(val.isValid())\n {\n setter(val.value);\n }\n else\n {\n setter(null);\n }\n }\n\n /**\n * Called whenever max date time restriction changes\n */\n protected onMaxDateTimeChange(): void\n {\n }\n\n /**\n * Called whenever min date time restriction changes\n */\n protected onMinDateTimeChange(): void\n {\n }\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `valueFormat` input\n */\n public static ngAcceptInputType_valueFormat: keyof typeof DateTimeValueFormat|DateTimeValueFormat;\n\n /**\n * Custom input type for `maxDateTime` input\n */\n public static ngAcceptInputType_maxDateTime: DateValue|DateTimeBase;\n\n /**\n * Custom input type for `minDateTime` input\n */\n public static ngAcceptInputType_minDateTime: DateValue|DateTimeBase;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anglr/datetime",
3
- "version": "6.0.0",
3
+ "version": "6.1.0-beta.20230104111018",
4
4
  "description": "Angular library for datetime manipulation components",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -0,0 +1,12 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "../../modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive";
3
+ import * as i2 from "../../modules/dateTime/directives/dateTimeInput/dateTimeInput.directive";
4
+ import * as i3 from "../dateTimeInputHandler/dateTimeInputHandler.directive";
5
+ /**
6
+ * Directive that combines date picker with date input
7
+ */
8
+ export declare class DatePickerInputSADirective {
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<DatePickerInputSADirective, never>;
10
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DatePickerInputSADirective, "input[dateTime][datePickerInput]", never, {}, {}, never, never, true, [{ directive: typeof i1.DateTimePickerSADirective; inputs: { "withPickerOptions": "withPickerOptions"; "pickerOptions": "pickerOptions"; }; outputs: {}; }, { directive: typeof i2.DateTimeInputSADirective; inputs: {}; outputs: {}; }, { directive: typeof i3.DateTimeInputHandlerSADirective; inputs: {}; outputs: {}; }]>;
11
+ }
12
+ //# sourceMappingURL=datePickerInput.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datePickerInput.directive.d.ts","sourceRoot":"","sources":["datePickerInput.directive.ts"],"names":[],"mappings":";;;;AAKA;;GAEG;AACH,qBAsBa,0BAA0B;yCAA1B,0BAA0B;2CAA1B,0BAA0B;CAEtC"}
@@ -0,0 +1,86 @@
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { Action1 } from '@jscrpt/common';
3
+ import { Subscription } from 'rxjs';
4
+ import { DateTimeInput } from '../../interfaces';
5
+ import { DateTimeObjectValue } from '../../misc/types';
6
+ import { DateTimePickerSADirective, DateTimeSADirective } from '../../modules';
7
+ import { DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider } from '../../services';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * Directive that adds handler for date time input, which allows navigation using keyboard and checking restriction of value
11
+ */
12
+ export declare class DateTimeInputHandlerSADirective<TDate = unknown> implements OnInit, OnDestroy {
13
+ protected input: DateTimeInput<TDate>;
14
+ protected dateApi: DateApi<TDate>;
15
+ protected dateTimeData: DateTimeSADirective<TDate>;
16
+ protected parserSvc: DatePositionParserService;
17
+ protected valueProvider: DateValueProvider<TDate>;
18
+ protected picker?: DateTimePickerSADirective<TDate> | undefined;
19
+ /**
20
+ * Subscriptions created during initialization
21
+ */
22
+ protected initSubscriptions: Subscription;
23
+ /**
24
+ * Instance of parser created for specific format
25
+ */
26
+ protected parser: DatePositionParser;
27
+ /**
28
+ * Gets input element as html input
29
+ */
30
+ protected get inputElement(): HTMLInputElement;
31
+ constructor(input: DateTimeInput<TDate>, dateApi: DateApi<TDate>, dateTimeData: DateTimeSADirective<TDate>, parserSvc: DatePositionParserService, valueProvider: DateValueProvider<TDate>, picker?: DateTimePickerSADirective<TDate> | undefined);
32
+ /**
33
+ * Initialize component
34
+ */
35
+ ngOnInit(): void;
36
+ /**
37
+ * Called when component is destroyed
38
+ */
39
+ ngOnDestroy(): void;
40
+ /**
41
+ * Handles selection of text inside of input
42
+ */
43
+ protected handleSelect(): void;
44
+ /**
45
+ * Handles click event inside of input
46
+ */
47
+ protected handleClick(): void;
48
+ /**
49
+ * Handles keyboard events
50
+ * @param event - Keyboard event that occured
51
+ */
52
+ protected handleKeypress(event: KeyboardEvent): void;
53
+ /**
54
+ * Handles keyboard events
55
+ * @param event - Keyboard event that occured
56
+ */
57
+ protected handleKeyboard(event: KeyboardEvent): void;
58
+ /**
59
+ * Tests whether are min or max constraint broken, returns true if constraint is broken
60
+ * @param value - Value to be tested
61
+ */
62
+ protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean;
63
+ /**
64
+ * Runs code with check whether min max constrains was broken
65
+ * @param value - Value to be used checked for constrains
66
+ * @param code - Code that should be executed which can change current value
67
+ */
68
+ protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void;
69
+ /**
70
+ * Runs code for existing and valid value of date time
71
+ * @param singleValueCode - Code to be run when only single value can be inside of date time
72
+ * @param rangeValueCode - Code to be run when range value can be inside of date time
73
+ * @param parsedValueDefault - Default parsed value to be used
74
+ */
75
+ protected runWithValue(singleValueCode: Action1<DateApiObject<TDate>>, rangeValueCode: Action1<[DateApiObject<TDate> | null, DateApiObject<TDate> | null]>, parsedValueDefault?: DateTimeObjectValue<TDate> | undefined | null): void;
76
+ /**
77
+ * Changes current value of date for for specified part by single step
78
+ * @param value - Value to be used checked for constrains
79
+ * @param part - Part of date that should be changed
80
+ * @param increment - Indication whether value should be incremented or decremented
81
+ */
82
+ protected stepChangeValue(value: DateApiObject<TDate>, part: string, increment: boolean): void;
83
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeInputHandlerSADirective<any>, [null, null, null, null, null, { optional: true; }]>;
84
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimeInputHandlerSADirective<any>, "[dateTime][withHandler]", never, {}, {}, never, never, true, never>;
85
+ }
86
+ //# sourceMappingURL=dateTimeInputHandler.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimeInputHandler.directive.d.ts","sourceRoot":"","sources":["dateTimeInputHandler.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,EAAW,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,OAAO,EAAW,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAC,yBAAyB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;AAExH;;GAEG;AACH,qBAKa,+BAA+B,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,MAAM,EAAE,SAAS;IA4BjD,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC;IAC5C,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IACnD,SAAS,CAAC,YAAY,EAAE,mBAAmB,CAAC,KAAK,CAAC;IAClD,SAAS,CAAC,SAAS,EAAE,yBAAyB;IAC9C,SAAS,CAAC,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC;IACrC,SAAS,CAAC,MAAM,CAAC;IA7BzC;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,YAAY,CAAsB;IAE/D;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAErC;;OAEG;IACH,SAAS,KAAK,YAAY,IAAI,gBAAgB,CAQ7C;gBAG8C,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IAAI;yCA3TrF,+BAA+B;2CAA/B,+BAA+B;CA2W3C"}
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "../datePickerInput/datePickerInput.directive";
3
+ import * as i2 from "../withTime/withTime.directive";
4
+ /**
5
+ * Directive that combines date time picker with date time input
6
+ */
7
+ export declare class DateTimePickerInputSADirective {
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateTimePickerInputSADirective, never>;
9
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DateTimePickerInputSADirective, "input[dateTime][dateTimePickerInput]", never, {}, {}, never, never, true, [{ directive: typeof i1.DatePickerInputSADirective; inputs: {}; outputs: {}; }, { directive: typeof i2.WithTimeSADirective; inputs: {}; outputs: {}; }]>;
10
+ }
11
+ //# sourceMappingURL=dateTimePickerInput.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateTimePickerInput.directive.d.ts","sourceRoot":"","sources":["dateTimePickerInput.directive.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,qBAca,8BAA8B;yCAA9B,8BAA8B;2CAA9B,8BAA8B;CAE1C"}
@@ -1,6 +1,10 @@
1
+ export * from './datePickerInput/datePickerInput.directive';
2
+ export * from './dateTimeInputHandler/dateTimeInputHandler.directive';
3
+ export * from './dateTimePickerInput/dateTimePickerInput.directive';
1
4
  export * from './simpleDatePickerInput/simpleDatePickerInput.directive';
2
5
  export * from './simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive';
3
6
  export * from './simpleDateTimePickerInput/simpleDateTimePickerInput.directive';
7
+ export * from './withNow/withNow.directive';
4
8
  export * from './withTime/withTime.directive';
5
9
  export * from './withToday/withToday.directive';
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAC;AACxE,cAAc,mEAAmE,CAAC;AAClF,cAAc,iEAAiE,CAAC;AAChF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uDAAuD,CAAC;AACtE,cAAc,qDAAqD,CAAC;AACpE,cAAc,yDAAyD,CAAC;AACxE,cAAc,mEAAmE,CAAC;AAClF,cAAc,iEAAiE,CAAC;AAChF,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { Subscription } from 'rxjs';
3
+ import { DateTimeInputSADirective } from '../../modules';
4
+ import { DateApi } from '../../services';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Directive that sets current date and time as day and time for empty date time on focus
8
+ */
9
+ export declare class WithNowSADirective<TDate = unknown> implements OnDestroy {
10
+ /**
11
+ * Subscriptions created during initialization
12
+ */
13
+ protected initSubscriptions: Subscription;
14
+ constructor(input: DateTimeInputSADirective<TDate>, dateApi: DateApi<TDate>);
15
+ /**
16
+ * Called when component is destroyed
17
+ */
18
+ ngOnDestroy(): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<WithNowSADirective<any>, never>;
20
+ static ɵdir: i0.ɵɵDirectiveDeclaration<WithNowSADirective<any>, "[dateTime][withNow]", never, {}, {}, never, never, true, never>;
21
+ }
22
+ //# sourceMappingURL=withNow.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withNow.directive.d.ts","sourceRoot":"","sources":["withNow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAEvC;;GAEG;AACH,qBAKa,kBAAkB,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,SAAS;IAIjE;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,YAAY,CAAsB;gBAGnD,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,EACpB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IAarD;;OAEG;IACI,WAAW,IAAI,IAAI;yCA3BjB,kBAAkB;2CAAlB,kBAAkB;CA+B9B"}
@@ -1,15 +1,16 @@
1
1
  import { OnDestroy } from '@angular/core';
2
+ import { Subscription } from 'rxjs';
2
3
  import { DateTimeInputSADirective } from '../../modules';
3
4
  import { DateApi } from '../../services';
4
5
  import * as i0 from "@angular/core";
5
6
  /**
6
- * Directive that sets today as day for empty date time on focus
7
+ * Directive that sets today (start of a day) as day for empty date time on focus
7
8
  */
8
9
  export declare class WithTodaySADirective<TDate = unknown> implements OnDestroy {
9
10
  /**
10
11
  * Subscriptions created during initialization
11
12
  */
12
- private _initSubscriptions;
13
+ protected initSubscriptions: Subscription;
13
14
  constructor(input: DateTimeInputSADirective<TDate>, dateApi: DateApi<TDate>);
14
15
  /**
15
16
  * Called when component is destroyed
@@ -1 +1 @@
1
- {"version":3,"file":"withToday.directive.d.ts","sourceRoot":"","sources":["withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAC,MAAM,eAAe,CAAC;AAI3D,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAEvC;;GAEG;AACH,qBAKa,oBAAoB,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,SAAS;IAInE;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAAoC;gBAGlD,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,EACpB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IAarD;;OAEG;IACI,WAAW,IAAI,IAAI;yCA3BjB,oBAAoB;2CAApB,oBAAoB;CA+BhC"}
1
+ {"version":3,"file":"withToday.directive.d.ts","sourceRoot":"","sources":["withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAEvC;;GAEG;AACH,qBAKa,oBAAoB,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,SAAS;IAInE;;OAEG;IACH,SAAS,CAAC,iBAAiB,EAAE,YAAY,CAAsB;gBAGnD,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,EACpB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC;IAarD;;OAEG;IACI,WAAW,IAAI,IAAI;yCA3BjB,oBAAoB;2CAApB,oBAAoB;CA+BhC"}
@@ -1,5 +1,6 @@
1
1
  import { DateTimeValue } from '../interfaces';
2
- import { DateApi, DateValue } from '../services';
2
+ import type { DateTimeSADirective } from '../modules/dateTime/directives/dateTime/dateTime.directive';
3
+ import { DateApi, DateValue, DateValueProvider } from '../services';
3
4
  import { DateTimeValueFormat } from './enums';
4
5
  import { DateTimeInputOutputValue, DateTimeObjectValue } from './types';
5
6
  /**
@@ -27,4 +28,20 @@ export declare function isDateTimeValue<TDate = unknown>(value: unknown): value
27
28
  * @param value - Value to be examined
28
29
  */
29
30
  export declare function getSingleDateTimeValue<TDate>(value: DateTimeInputOutputValue<TDate> | undefined | null): DateValue | TDate | null | undefined;
31
+ /**
32
+ * Parses raw value into internal value and value
33
+ * @param rawValue - Raw value to be parsed
34
+ * @param dateApi - Date api for manipulation with date
35
+ * @param dateTimeData - Object storing information about format
36
+ * @param valueProvider - Provider used for obtaining rounded value according format
37
+ */
38
+ export declare function parseRawInput<TDate>(rawValue: string, dateApi: DateApi<TDate>, dateTimeData: DateTimeSADirective<TDate>, valueProvider: DateValueProvider<TDate>): [DateTimeObjectValue<TDate> | undefined | null, DateTimeInputOutputValue<TDate> | undefined | null];
39
+ /**
40
+ * Gets internal value and fix lowest time difference
41
+ * @param value - Value to be get as internal value
42
+ * @param dateApi - Date api for manipulation with date
43
+ * @param dateTimeData - Object storing information about format
44
+ * @param valueProvider - Provider used for obtaining rounded value according format
45
+ */
46
+ export declare function getInternalValue<TDate>(value: DateTimeInputOutputValue<TDate> | undefined | null, dateApi: DateApi<TDate>, dateTimeData: DateTimeSADirective<TDate>, valueProvider: DateValueProvider<TDate>): DateTimeObjectValue<TDate> | undefined | null;
30
47
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAiB,SAAS,EAAC,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAC,wBAAwB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,EACrD,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EACvB,cAAc,EAAE,mBAAmB,GAAC,SAAS,GAAC,IAAI,EAClD,YAAY,EAAE,MAAM,GAAC,SAAS,GAAC,IAAI,GAAI,mBAAmB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,CA4D9H;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,EAChD,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AK,CAAC,GAAC,SAAS,GAAC,IAAI,EAChD,cAAc,EAAE,mBAAmB,EACnC,YAAY,EAAE,MAAM,GAAC,SAAS,GAAC,IAAI,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,CA8CnI;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,CAK9F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,GAAG,SAAS,GAAC,KAAK,GAAC,IAAI,GAAC,SAAS,CAQnI;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EACvB,YAAY,EAAE,mBAAmB,CAAC,KAAK,CAAC,EACxC,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,CAAC,CAW1K;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,EACrD,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EACvB,YAAY,EAAE,mBAAmB,CAAC,KAAK,CAAC,EACxC,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAI,mBAAmB,CAAC,KAAK,CAAC,GAAC,SAAS,GAAC,IAAI,CA+C3H"}
@@ -18,6 +18,10 @@ export declare class DateTimeSADirective<TDate = unknown> implements OnDestroy {
18
18
  * Subject used for emitting changes in min date time value
19
19
  */
20
20
  protected minDateTimeChangesSubject: Subject<void>;
21
+ /**
22
+ * Subject used for emitting changes in custom format value
23
+ */
24
+ protected customFormatChangesSubject: Subject<void>;
21
25
  /**
22
26
  * Subscription for max date instance value changes
23
27
  */
@@ -29,19 +33,19 @@ export declare class DateTimeSADirective<TDate = unknown> implements OnDestroy {
29
33
  /**
30
34
  * Max allowed value of date time
31
35
  */
32
- protected ɵMaxDateTime: TDate | undefined | null;
36
+ protected ɵmaxDateTime: TDate | undefined | null;
33
37
  /**
34
38
  * Min allowed value of date time
35
39
  */
36
- protected ɵMinDateTime: TDate | undefined | null;
40
+ protected ɵminDateTime: TDate | undefined | null;
37
41
  /**
38
42
  * Date time value format which is being worked with in this date time
39
43
  */
40
- protected ɵValueFormat: DateTimeValueFormat;
44
+ protected ɵvalueFormat: DateTimeValueFormat;
41
45
  /**
42
46
  * Format of string representation of date
43
47
  */
44
- protected ɵFormat: keyof FormatProvider;
48
+ protected ɵformat: keyof FormatProvider;
45
49
  /**
46
50
  * Date api instance, used for date time manipulation
47
51
  */
@@ -50,6 +54,10 @@ export declare class DateTimeSADirective<TDate = unknown> implements OnDestroy {
50
54
  * Provider for available formats
51
55
  */
52
56
  protected formatProvider: FormatProvider;
57
+ /**
58
+ * Custom format string representation of date
59
+ */
60
+ protected ɵcustomFormat: string;
53
61
  /**
54
62
  * Occurs when there are changes in max date time value
55
63
  */
@@ -58,6 +66,10 @@ export declare class DateTimeSADirective<TDate = unknown> implements OnDestroy {
58
66
  * Occurs when there are changes in min date time value
59
67
  */
60
68
  get minDateTimeChanges(): Observable<void>;
69
+ /**
70
+ * Occurs when there are changes in custom format value
71
+ */
72
+ get customFormatChanges(): Observable<void>;
61
73
  /**
62
74
  * Gets or sets date time value format which is being worked with in this date time
63
75
  */
@@ -69,9 +81,10 @@ export declare class DateTimeSADirective<TDate = unknown> implements OnDestroy {
69
81
  get format(): keyof FormatProvider;
70
82
  set format(value: keyof FormatProvider);
71
83
  /**
72
- * Custom format string representation of date
84
+ * Gets or sets custom format string representation of date
73
85
  */
74
- customFormat: string;
86
+ get customFormat(): string;
87
+ set customFormat(value: string);
75
88
  /**
76
89
  * Gets or sets max allowed date for date time
77
90
  */
@@ -1 +1 @@
1
- {"version":3,"file":"dateTime.directive.d.ts","sourceRoot":"","sources":["dateTime.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,SAAS,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,OAAO,EAA8B,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAEvD,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAI3D,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;;AAE7C;;GAEG;AACH,qBAKa,mBAAmB,CAAC,KAAK,GAAG,OAAO,CAAE,YAAW,SAAS;IAIlE;;OAEG;IACH,SAAS,CAAC,yBAAyB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAuB;IAEzE;;OAEG;IACH,SAAS,CAAC,yBAAyB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAuB;IAEzE;;OAEG;IACH,SAAS,CAAC,qBAAqB,EAAE,YAAY,GAAC,SAAS,GAAC,IAAI,CAAC;IAE7D;;OAEG;IACH,SAAS,CAAC,qBAAqB,EAAE,YAAY,GAAC,SAAS,GAAC,IAAI,CAAC;IAE7D;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,CAAC;IAE7C;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,KAAK,GAAC,SAAS,GAAC,IAAI,CAAC;IAE7C;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,mBAAmB,CAAoC;IAE/E;;OAEG;IACH,SAAS,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