@king-design/intact 3.5.2 → 3.6.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.
Files changed (260) hide show
  1. package/components/.DS_Store +0 -0
  2. package/components/button/index.md +1 -0
  3. package/components/cascader/index.spec.ts +7 -6
  4. package/components/datepicker/basepicker.ts +26 -267
  5. package/components/datepicker/calendar.ts +8 -2
  6. package/components/datepicker/calendar.vdt +23 -6
  7. package/components/datepicker/dayjs.ts +8 -2
  8. package/components/datepicker/demos/multiple.md +1 -1
  9. package/components/datepicker/demos/yearMonth.md +1 -1
  10. package/components/datepicker/helpers.ts +10 -12
  11. package/components/datepicker/index.md +2 -2
  12. package/components/datepicker/index.spec.ts +619 -190
  13. package/components/datepicker/index.ts +22 -21
  14. package/components/datepicker/index.vdt +47 -42
  15. package/components/datepicker/shortcuts.ts +1 -1
  16. package/components/datepicker/styles.ts +112 -4
  17. package/components/datepicker/useConfirm.ts +82 -0
  18. package/components/datepicker/useDisabled.ts +31 -33
  19. package/components/datepicker/useFormats.ts +10 -4
  20. package/components/datepicker/useHighlight.ts +81 -0
  21. package/components/datepicker/useKeyboards.ts +2 -1
  22. package/components/datepicker/useMergeRange.ts +54 -0
  23. package/components/datepicker/useMonths.ts +6 -3
  24. package/components/datepicker/usePanel.ts +19 -19
  25. package/components/datepicker/useQuarters.ts +47 -0
  26. package/components/datepicker/useShowDate.ts +14 -3
  27. package/components/datepicker/useStatus.ts +34 -15
  28. package/components/datepicker/useValue.ts +41 -39
  29. package/components/datepicker/useValueBase.ts +309 -0
  30. package/components/datepicker/useWeeks.ts +58 -0
  31. package/components/datepicker/useYears.ts +7 -3
  32. package/components/descriptions/.DS_Store +0 -0
  33. package/components/dialog/useFixBody.ts +7 -64
  34. package/components/dropdown/dropdown.ts +5 -4
  35. package/components/dropdown/index.md +1 -0
  36. package/components/dropdown/item.ts +1 -1
  37. package/components/dropdown/useKeyboard.ts +0 -1
  38. package/components/ellipsis/styles.ts +4 -0
  39. package/components/form/styles.ts +1 -0
  40. package/components/input/index.spec.ts +42 -0
  41. package/components/input/index.ts +8 -0
  42. package/components/input/index.vdt +3 -4
  43. package/components/input/useAutoWidth.ts +19 -1
  44. package/components/menu/.DS_Store +0 -0
  45. package/components/menu/demos/.DS_Store +0 -0
  46. package/components/scrollSelect/index.spec.ts +3 -3
  47. package/components/scrollSelect/useMouseEvents.ts +24 -10
  48. package/components/select/base.ts +3 -2
  49. package/components/select/base.vdt +3 -1
  50. package/components/select/demos/creatable.md +13 -0
  51. package/components/select/index.md +1 -0
  52. package/components/select/index.spec.ts +225 -6
  53. package/components/select/option.ts +10 -1
  54. package/components/select/select.ts +3 -0
  55. package/components/select/styles.ts +3 -1
  56. package/components/select/useFilterable.ts +1 -1
  57. package/components/select/useInput.ts +7 -9
  58. package/components/select/useSearchable.ts +2 -2
  59. package/components/table/.DS_Store +0 -0
  60. package/components/table/index.spec.ts +69 -1
  61. package/components/table/useStickyHeader.ts +1 -1
  62. package/components/timepicker/demos/step.md +1 -1
  63. package/components/timepicker/index.spec.ts +145 -27
  64. package/components/timepicker/panelPicker.ts +10 -4
  65. package/components/timepicker/panelPicker.vdt +5 -3
  66. package/components/timepicker/useConfirm.ts +33 -0
  67. package/components/timepicker/useDefaultValue.ts +30 -0
  68. package/components/timepicker/useDisabled.ts +17 -4
  69. package/components/timepicker/useFormats.ts +1 -1
  70. package/components/timepicker/useValue.ts +22 -19
  71. package/components/tour/.DS_Store +0 -0
  72. package/components/tour/demos/basic.md +73 -0
  73. package/components/tour/demos/beforeChange.md +109 -0
  74. package/components/tour/demos/closable.md +70 -0
  75. package/components/tour/demos/custom.md +98 -0
  76. package/components/tour/demos/customText.md +94 -0
  77. package/components/tour/demos/declarative.md +72 -0
  78. package/components/tour/demos/events.md +101 -0
  79. package/components/tour/demos/maskClosable.md +76 -0
  80. package/components/tour/demos/notarget.md +59 -0
  81. package/components/tour/index.md +48 -0
  82. package/components/tour/index.spec.ts +259 -0
  83. package/components/tour/index.ts +2 -0
  84. package/components/tour/step.ts +55 -0
  85. package/components/tour/step.vdt +75 -0
  86. package/components/tour/styles.ts +283 -0
  87. package/components/tour/tour.ts +107 -0
  88. package/components/tour/tour.vdt +83 -0
  89. package/components/tour/useArrow.ts +46 -0
  90. package/components/tour/useFixBody.ts +22 -0
  91. package/components/tour/useHighlight.ts +36 -0
  92. package/components/tour/useMaskClosable.ts +26 -0
  93. package/components/tour/useNavigation.ts +46 -0
  94. package/components/tour/usePosition.ts +91 -0
  95. package/components/tour/useSteps.ts +80 -0
  96. package/components/virtualList/.DS_Store +0 -0
  97. package/components/virtualList/demos/.DS_Store +0 -0
  98. package/es/components/cascader/index.spec.js +18 -19
  99. package/es/components/datepicker/basepicker.d.ts +6 -25
  100. package/es/components/datepicker/basepicker.js +22 -234
  101. package/es/components/datepicker/calendar.d.ts +36 -6
  102. package/es/components/datepicker/calendar.js +4 -0
  103. package/es/components/datepicker/calendar.vdt.js +21 -5
  104. package/es/components/datepicker/dayjs.d.ts +2 -2
  105. package/es/components/datepicker/dayjs.js +6 -0
  106. package/es/components/datepicker/helpers.d.ts +8 -7
  107. package/es/components/datepicker/helpers.js +2 -3
  108. package/es/components/datepicker/index.d.ts +26 -19
  109. package/es/components/datepicker/index.js +21 -13
  110. package/es/components/datepicker/index.spec.js +1389 -633
  111. package/es/components/datepicker/index.vdt.js +43 -46
  112. package/es/components/datepicker/shortcuts.d.ts +1 -1
  113. package/es/components/datepicker/styles.d.ts +22 -0
  114. package/es/components/datepicker/styles.js +26 -4
  115. package/es/components/datepicker/useConfirm.d.ts +6 -0
  116. package/es/components/datepicker/useConfirm.js +65 -0
  117. package/es/components/datepicker/useDisabled.d.ts +7 -5
  118. package/es/components/datepicker/useDisabled.js +22 -27
  119. package/es/components/datepicker/useFormats.d.ts +2 -2
  120. package/es/components/datepicker/useFormats.js +9 -3
  121. package/es/components/datepicker/useHighlight.d.ts +14 -0
  122. package/es/components/datepicker/useHighlight.js +60 -0
  123. package/es/components/datepicker/useKeyboards.js +2 -1
  124. package/es/components/datepicker/useMergeRange.d.ts +5 -0
  125. package/es/components/datepicker/useMergeRange.js +45 -0
  126. package/es/components/datepicker/useMonths.js +5 -3
  127. package/es/components/datepicker/usePanel.d.ts +1 -10
  128. package/es/components/datepicker/usePanel.js +19 -32
  129. package/es/components/datepicker/useQuarters.d.ts +15 -0
  130. package/es/components/datepicker/useQuarters.js +36 -0
  131. package/es/components/datepicker/useShowDate.js +10 -2
  132. package/es/components/datepicker/useStatus.d.ts +1 -1
  133. package/es/components/datepicker/useStatus.js +33 -16
  134. package/es/components/datepicker/useValue.d.ts +12 -6
  135. package/es/components/datepicker/useValue.js +49 -45
  136. package/es/components/datepicker/useValueBase.d.ts +28 -0
  137. package/es/components/datepicker/useValueBase.js +277 -0
  138. package/es/components/datepicker/useWeeks.d.ts +19 -0
  139. package/es/components/datepicker/useWeeks.js +48 -0
  140. package/es/components/datepicker/useYears.js +6 -3
  141. package/es/components/dialog/useFixBody.js +6 -58
  142. package/es/components/dropdown/dropdown.d.ts +1 -0
  143. package/es/components/dropdown/dropdown.js +7 -4
  144. package/es/components/ellipsis/styles.js +1 -1
  145. package/es/components/form/styles.js +1 -1
  146. package/es/components/input/index.d.ts +2 -0
  147. package/es/components/input/index.js +6 -0
  148. package/es/components/input/index.spec.js +45 -0
  149. package/es/components/input/index.vdt.js +4 -3
  150. package/es/components/input/useAutoWidth.d.ts +2 -0
  151. package/es/components/input/useAutoWidth.js +19 -1
  152. package/es/components/scrollSelect/index.spec.js +4 -6
  153. package/es/components/scrollSelect/useMouseEvents.js +22 -9
  154. package/es/components/select/base.d.ts +1 -1
  155. package/es/components/select/base.js +3 -2
  156. package/es/components/select/base.vdt.js +5 -2
  157. package/es/components/select/index.spec.js +329 -82
  158. package/es/components/select/option.d.ts +1 -0
  159. package/es/components/select/option.js +10 -2
  160. package/es/components/select/select.d.ts +1 -0
  161. package/es/components/select/select.js +4 -2
  162. package/es/components/select/styles.d.ts +79 -0
  163. package/es/components/select/styles.js +1 -0
  164. package/es/components/select/useFilterable.js +2 -1
  165. package/es/components/select/useInput.d.ts +1 -1
  166. package/es/components/select/useInput.js +7 -4
  167. package/es/components/select/useSearchable.js +1 -0
  168. package/es/components/table/index.spec.js +84 -6
  169. package/es/components/table/useStickyHeader.js +1 -1
  170. package/es/components/timepicker/index.spec.js +298 -128
  171. package/es/components/timepicker/panelPicker.d.ts +23 -17
  172. package/es/components/timepicker/panelPicker.js +7 -4
  173. package/es/components/timepicker/panelPicker.vdt.js +8 -4
  174. package/es/components/timepicker/selectPicker.d.ts +5 -4
  175. package/es/components/timepicker/useConfirm.d.ts +6 -0
  176. package/es/components/timepicker/useConfirm.js +19 -0
  177. package/es/components/timepicker/useDefaultValue.d.ts +4 -0
  178. package/es/components/timepicker/useDefaultValue.js +27 -0
  179. package/es/components/timepicker/useDisabled.d.ts +7 -4
  180. package/es/components/timepicker/useDisabled.js +13 -4
  181. package/es/components/timepicker/useFormats.d.ts +1 -1
  182. package/es/components/timepicker/useValue.d.ts +14 -8
  183. package/es/components/timepicker/useValue.js +14 -15
  184. package/es/components/tour/index.d.ts +2 -0
  185. package/es/components/tour/index.js +2 -0
  186. package/es/components/tour/index.spec.d.ts +1 -0
  187. package/es/components/tour/index.spec.js +356 -0
  188. package/es/components/tour/step.d.ts +23 -0
  189. package/es/components/tour/step.js +46 -0
  190. package/es/components/tour/step.vdt.js +74 -0
  191. package/es/components/tour/styles.d.ts +7 -0
  192. package/es/components/tour/styles.js +84 -0
  193. package/es/components/tour/tour.d.ts +73 -0
  194. package/es/components/tour/tour.js +70 -0
  195. package/es/components/tour/tour.vdt.js +66 -0
  196. package/es/components/tour/useArrow.d.ts +4 -0
  197. package/es/components/tour/useArrow.js +40 -0
  198. package/es/components/tour/useFixBody.d.ts +4 -0
  199. package/es/components/tour/useFixBody.js +17 -0
  200. package/es/components/tour/useHighlight.d.ts +4 -0
  201. package/es/components/tour/useHighlight.js +31 -0
  202. package/es/components/tour/useMaskClosable.d.ts +1 -0
  203. package/es/components/tour/useMaskClosable.js +25 -0
  204. package/es/components/tour/useNavigation.d.ts +5 -0
  205. package/es/components/tour/useNavigation.js +103 -0
  206. package/es/components/tour/usePosition.d.ts +6 -0
  207. package/es/components/tour/usePosition.js +93 -0
  208. package/es/components/tour/useSteps.d.ts +6 -0
  209. package/es/components/tour/useSteps.js +68 -0
  210. package/es/hooks/useFixBody.d.ts +11 -0
  211. package/es/hooks/useFixBody.js +72 -0
  212. package/es/index.d.ts +3 -2
  213. package/es/index.js +3 -2
  214. package/es/site/data/components/datepicker/demos/multiple/react.js +2 -2
  215. package/es/site/data/components/select/demos/creatable/index.d.ts +1 -0
  216. package/es/site/data/components/select/demos/creatable/index.js +2 -1
  217. package/es/site/data/components/select/demos/creatable/react.d.ts +1 -0
  218. package/es/site/data/components/select/demos/creatable/react.js +31 -2
  219. package/es/site/data/components/tour/demos/basic/index.d.ts +17 -0
  220. package/es/site/data/components/tour/demos/basic/index.js +46 -0
  221. package/es/site/data/components/tour/demos/basic/react.d.ts +16 -0
  222. package/es/site/data/components/tour/demos/basic/react.js +82 -0
  223. package/es/site/data/components/tour/demos/beforeChange/index.d.ts +20 -0
  224. package/es/site/data/components/tour/demos/beforeChange/index.js +69 -0
  225. package/es/site/data/components/tour/demos/beforeChange/react.d.ts +19 -0
  226. package/es/site/data/components/tour/demos/beforeChange/react.js +129 -0
  227. package/es/site/data/components/tour/demos/closable/index.d.ts +18 -0
  228. package/es/site/data/components/tour/demos/closable/index.js +42 -0
  229. package/es/site/data/components/tour/demos/closable/react.d.ts +17 -0
  230. package/es/site/data/components/tour/demos/closable/react.js +85 -0
  231. package/es/site/data/components/tour/demos/custom/index.d.ts +11 -0
  232. package/es/site/data/components/tour/demos/custom/index.js +35 -0
  233. package/es/site/data/components/tour/demos/custom/react.d.ts +11 -0
  234. package/es/site/data/components/tour/demos/custom/react.js +108 -0
  235. package/es/site/data/components/tour/demos/customText/index.d.ts +33 -0
  236. package/es/site/data/components/tour/demos/customText/index.js +55 -0
  237. package/es/site/data/components/tour/demos/customText/react.d.ts +33 -0
  238. package/es/site/data/components/tour/demos/customText/react.js +99 -0
  239. package/es/site/data/components/tour/demos/declarative/index.d.ts +11 -0
  240. package/es/site/data/components/tour/demos/declarative/index.js +36 -0
  241. package/es/site/data/components/tour/demos/declarative/react.d.ts +10 -0
  242. package/es/site/data/components/tour/demos/declarative/react.js +80 -0
  243. package/es/site/data/components/tour/demos/events/index.d.ts +18 -0
  244. package/es/site/data/components/tour/demos/events/index.js +58 -0
  245. package/es/site/data/components/tour/demos/events/react.d.ts +18 -0
  246. package/es/site/data/components/tour/demos/events/react.js +101 -0
  247. package/es/site/data/components/tour/demos/maskClosable/index.d.ts +18 -0
  248. package/es/site/data/components/tour/demos/maskClosable/index.js +47 -0
  249. package/es/site/data/components/tour/demos/maskClosable/react.d.ts +17 -0
  250. package/es/site/data/components/tour/demos/maskClosable/react.js +95 -0
  251. package/es/site/data/components/tour/demos/notarget/index.d.ts +11 -0
  252. package/es/site/data/components/tour/demos/notarget/index.js +35 -0
  253. package/es/site/data/components/tour/demos/notarget/react.d.ts +10 -0
  254. package/es/site/data/components/tour/demos/notarget/react.js +61 -0
  255. package/es/site/data/components/tour/index.d.ts +57 -0
  256. package/es/site/data/components/tour/index.js +32 -0
  257. package/hooks/useFixBody.ts +87 -0
  258. package/index.ts +3 -2
  259. package/package.json +2 -2
  260. package/styles/.DS_Store +0 -0
@@ -2,46 +2,49 @@ import { TypeDefs } from 'intact';
2
2
  import { BasePicker } from '../datepicker/basepicker';
3
3
  import dayjs from '../datepicker/dayjs';
4
4
  import { State } from '../../hooks/useState';
5
- import { PanelTypes } from '../datepicker/usePanel';
6
5
  import { TimepickerProps, TimepickerEvents, TimepickerBlocks } from './constants';
6
+ import { StateValueItem } from '../datepicker/useValueBase';
7
7
  export declare class PanelPicker<Multipe extends boolean = false, Range extends boolean = false> extends BasePicker<TimepickerProps<Multipe, Range>, TimepickerEvents, TimepickerBlocks> {
8
8
  static template: string | import("intact").Template<any>;
9
9
  static typeDefs: Required<TypeDefs<TimepickerProps<boolean, boolean>>>;
10
10
  formats: {
11
11
  getValueFormat: () => string;
12
12
  getShowFormat: () => string;
13
- createDateByValueFormat: (value: import("../datepicker/basepicker").Value) => dayjs.Dayjs;
14
- createDateByShowFormat: (value: import("../datepicker/basepicker").Value) => dayjs.Dayjs;
13
+ createDateByValueFormat: (value: import("../datepicker/useValueBase").Value) => dayjs.Dayjs;
14
+ createDateByShowFormat: (value: import("../datepicker/useValueBase").Value) => dayjs.Dayjs;
15
15
  getShowString: (value: dayjs.Dayjs) => string;
16
16
  getValueString: (value: dayjs.Dayjs) => string;
17
17
  };
18
+ defaultValue: {
19
+ get: () => StateValueItem;
20
+ };
18
21
  disabled: {
19
- isDisabled: (value: dayjs.Dayjs, type?: dayjs.OpUnitType) => boolean;
20
- isDisabledConfirm: () => boolean;
22
+ isDisabled: (value: dayjs.Dayjs, type?: "h" | "s" | "y" | "date" | "month" | "week" | "millisecond" | "second" | "minute" | "hour" | "day" | "year" | "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "months" | "years" | "dates" | "d" | "D" | "M" | "m" | "ms" | "weeks" | "w" | "quarter" | "quarters" | "Q") => boolean;
21
23
  maxDate: State<dayjs.Dayjs | null>;
22
24
  minDate: State<dayjs.Dayjs | null>;
23
- isDisabledTime: (value: dayjs.Dayjs, flag: import("../datepicker/usePanel").PanelFlags) => boolean;
25
+ isDisabledTime: (value: dayjs.Dayjs) => boolean;
24
26
  isDisabledTimeByStep: (value: string, flag: import("../datepicker/usePanel").PanelFlags) => boolean;
27
+ isDisabledConfirm: () => boolean;
28
+ isDisabledValue: (value: StateValueItem) => boolean;
25
29
  };
26
30
  panel: {
27
- startPanel: State<PanelTypes>;
28
- endPanel: State<PanelTypes>;
29
- changePanel: (type: PanelTypes, flag?: import("../datepicker/usePanel").PanelFlags) => void;
30
- getPanel: (flag: import("../datepicker/usePanel").PanelFlags) => State<PanelTypes>;
31
- reset: () => void;
32
31
  startRef: import("intact").RefObject<import("../datepicker/calendar").DatepickerCalendar>;
33
32
  endRef: import("intact").RefObject<import("../datepicker/calendar").DatepickerCalendar>;
34
33
  };
35
34
  value: {
36
35
  format: () => string | string[];
37
- onConfirm: () => void;
38
- getTimeValue: (flag: import("../datepicker/usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
39
- convertToDayjs: (v: import("../datepicker/basepicker").Value | [import("../datepicker/basepicker").Value, import("../datepicker/basepicker").Value] | import("../datepicker/basepicker").Value[] | [import("../datepicker/basepicker").Value, import("../datepicker/basepicker").Value][] | null | undefined) => import("../datepicker/basepicker").DayjsValue;
40
- value: State<import("../datepicker/basepicker").StateValue>;
41
- setValue: (v: import("../datepicker/basepicker").StateValueItem, fromInput: boolean) => void;
42
- getDayjsValue: () => import("../datepicker/basepicker").DayjsValue;
36
+ formatSingleValue: (value: StateValueItem) => string;
37
+ convertToDayjs: (v: import("../datepicker/useValueBase").Value | [import("../datepicker/useValueBase").Value, import("../datepicker/useValueBase").Value] | import("../datepicker/useValueBase").Value[] | [import("../datepicker/useValueBase").Value, import("../datepicker/useValueBase").Value][] | null | undefined) => import("../datepicker/useValueBase").DayjsValue;
38
+ unique: () => void;
39
+ setMoment: () => void;
40
+ updateValue: () => void;
41
+ allValuesUpdatedInMultipleMode: () => boolean | undefined;
42
+ value: State<import("../datepicker/useValueBase").StateValue>;
43
+ setValue: (v: StateValueItem, fromInput: boolean) => void;
44
+ getDayjsValue: () => import("../datepicker/useValueBase").DayjsValue;
43
45
  onChangeTime: (date: dayjs.Dayjs, flag: import("../datepicker/usePanel").PanelFlags) => void;
44
46
  onChangeTimeByStep: (v: string, flag: import("../datepicker/usePanel").PanelFlags) => void;
47
+ getTimeValue: (flag: import("../datepicker/usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
45
48
  };
46
49
  step: {
47
50
  options: State<{
@@ -49,6 +52,9 @@ export declare class PanelPicker<Multipe extends boolean = false, Range extends
49
52
  label: string;
50
53
  }[] | null>;
51
54
  };
55
+ confirm: {
56
+ onConfirm: () => void;
57
+ };
52
58
  protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
53
59
  protected getLabel(): string | string[];
54
60
  }
@@ -8,9 +8,10 @@ import { useFormats } from './useFormats';
8
8
  import { useValue } from './useValue';
9
9
  import { useDisabled } from './useDisabled';
10
10
  import { usePanel } from '../datepicker/usePanel';
11
- import { PanelTypes } from '../datepicker/usePanel';
12
11
  import { useStep } from './useStep';
13
12
  import { typeDefs } from './constants';
13
+ import { useConfirm } from './useConfirm';
14
+ import { useDefaultValue } from './useDefaultValue';
14
15
  export var PanelPicker = /*#__PURE__*/function (_BasePicker) {
15
16
  _inheritsLoose(PanelPicker, _BasePicker);
16
17
  function PanelPicker() {
@@ -21,10 +22,12 @@ export var PanelPicker = /*#__PURE__*/function (_BasePicker) {
21
22
  }
22
23
  _this = _BasePicker.call.apply(_BasePicker, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
23
24
  _this.formats = useFormats();
24
- _this.disabled = useDisabled(_this.formats);
25
- _this.panel = usePanel(PanelTypes.Time);
26
- _this.value = useValue(_this.formats, _this.disabled, _this.panel);
25
+ _this.defaultValue = useDefaultValue();
26
+ _this.disabled = useDisabled(_this.formats, _this.defaultValue);
27
+ _this.panel = usePanel();
28
+ _this.value = useValue(_this.formats, _this.disabled, _this.panel, _this.defaultValue);
27
29
  _this.step = useStep(_this.disabled, _this.formats);
30
+ _this.confirm = useConfirm(_this.value, _this.formats.getValueString, _this.defaultValue);
28
31
  return _this;
29
32
  }
30
33
  var _proto = PanelPicker.prototype;
@@ -8,6 +8,7 @@ import { Button } from '../button';
8
8
  import { PanelFlags } from '../datepicker/usePanel';
9
9
  import { last } from '../datepicker/helpers';
10
10
  import { ScrollSelect } from '../scrollSelect';
11
+ import { makeStyles as makeStylesInheritDatepicker } from '../datepicker/styles';
11
12
  export default function ($props, $blocks, $__proto__) {
12
13
  var _classNameObj;
13
14
  $blocks || ($blocks = {});
@@ -16,15 +17,18 @@ export default function ($props, $blocks, $__proto__) {
16
17
  var _this$get = this.get(),
17
18
  className = _this$get.className,
18
19
  range = _this$get.range,
19
- multiple = _this$get.multiple;
20
+ multiple = _this$get.multiple,
21
+ min = _this$get.min,
22
+ max = _this$get.max;
20
23
  var _this$value = this.value,
21
24
  value = _this$value.value.value,
22
- onConfirm = _this$value.onConfirm,
23
25
  onChangeTime = _this$value.onChangeTime,
24
26
  onChangeTimeByStep = _this$value.onChangeTimeByStep,
25
- getTimeValue = _this$value.getTimeValue;
27
+ getTimeValue = _this$value.getTimeValue,
28
+ setMoment = _this$value.setMoment;
26
29
  var lastValue = last(value);
27
30
  var k = this.config.k;
31
+ var onConfirm = this.confirm.onConfirm;
28
32
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-time-content"] = true, _classNameObj[k + "-range"] = range, _classNameObj[className] = className, _classNameObj[makePanelStyles(k)] = true, _classNameObj);
29
33
  var options = this.step.options.value;
30
34
  var _this$disabled = this.disabled,
@@ -56,7 +60,7 @@ export default function ($props, $blocks, $__proto__) {
56
60
  }), 2, _$cn(k + "-datepicker-time"))], 0, _$cn(k + "-datepicker-calendar-wrapper"));
57
61
  };
58
62
  return _$su.call($this, {
59
- 'className': _$cn(k + "-timepicker")
63
+ 'className': _$cn(k + "-timepicker " + makeStylesInheritDatepicker(k))
60
64
  }, function ($blocks) {
61
65
  var _$blocks = {},
62
66
  __$blocks = _$ex({}, $blocks);
@@ -6,15 +6,16 @@ export declare class SelectPicker extends Component<TimepickerProps, TimepickerE
6
6
  formats: {
7
7
  getValueFormat: () => string;
8
8
  getShowFormat: () => string;
9
- createDateByValueFormat: (value: import("../datepicker/basepicker").Value) => import("dayjs").Dayjs;
10
- createDateByShowFormat: (value: import("../datepicker/basepicker").Value) => import("dayjs").Dayjs;
9
+ createDateByValueFormat: (value: import("../datepicker/useValueBase").Value) => import("dayjs").Dayjs;
10
+ createDateByShowFormat: (value: import("../datepicker/useValueBase").Value) => import("dayjs").Dayjs;
11
11
  getShowString: (value: import("dayjs").Dayjs) => string;
12
12
  getValueString: (value: import("dayjs").Dayjs) => string;
13
13
  };
14
14
  disabled: {
15
- isDisabled: (value: import("dayjs").Dayjs, type?: import("dayjs").OpUnitType) => boolean;
16
- isDisabledTime: (value: import("dayjs").Dayjs, flag: import("../datepicker/usePanel").PanelFlags) => boolean;
15
+ isDisabled: (value: import("dayjs").Dayjs, type?: "h" | "s" | "y" | "date" | "month" | "week" | "millisecond" | "second" | "minute" | "hour" | "day" | "year" | "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "months" | "years" | "dates" | "d" | "D" | "M" | "m" | "ms" | "weeks" | "w" | "quarter" | "quarters" | "Q") => boolean;
16
+ isDisabledTime: (value: import("dayjs").Dayjs) => boolean;
17
17
  isDisabledConfirm: () => boolean;
18
+ isDisabledValue: (value: import("../datepicker/useValueBase").StateValueItem) => boolean;
18
19
  maxDate: import("../../hooks/useState").State<import("dayjs").Dayjs | null>;
19
20
  minDate: import("../../hooks/useState").State<import("dayjs").Dayjs | null>;
20
21
  };
@@ -0,0 +1,6 @@
1
+ import type { useFormats } from './useFormats';
2
+ import { useValue } from './useValue';
3
+ import type { useDefaultValue } from './useDefaultValue';
4
+ export declare function useConfirm(value: ReturnType<typeof useValue>, getValueString: ReturnType<typeof useFormats>['getValueString'], defaultValue: ReturnType<typeof useDefaultValue>): {
5
+ onConfirm: () => void;
6
+ };
@@ -0,0 +1,19 @@
1
+ import { useInstance } from 'intact';
2
+ export function useConfirm(value, getValueString, defaultValue) {
3
+ var instance = useInstance();
4
+ function onConfirm() {
5
+ var _instance$get = instance.get(),
6
+ multiple = _instance$get.multiple;
7
+ // if we click confirm button directly, set the value to placeholder values
8
+ value.setValue(defaultValue.get(), false);
9
+ if (!multiple) {
10
+ instance.hide();
11
+ } else {
12
+ value.unique();
13
+ }
14
+ value.updateValue();
15
+ }
16
+ return {
17
+ onConfirm: onConfirm
18
+ };
19
+ }
@@ -0,0 +1,4 @@
1
+ import { StateValueItem } from '../datepicker/useValueBase';
2
+ export declare function useDefaultValue(): {
3
+ get: () => StateValueItem;
4
+ };
@@ -0,0 +1,27 @@
1
+ import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
2
+ import { useInstance } from 'intact';
3
+ import { last } from '../datepicker/helpers';
4
+ import { NOW_START, NOW_END } from './constants';
5
+ import { isArray } from 'intact-shared';
6
+ export function useDefaultValue() {
7
+ var instance = useInstance();
8
+ function get() {
9
+ var _value = instance.value.value.value;
10
+ var lastValue = last(_value);
11
+ var _instance$get = instance.get(),
12
+ range = _instance$get.range;
13
+ if (range) {
14
+ // consider the second last value to maintain consistency
15
+ var penulimate = getPenulimate(_value);
16
+ return _Object$assign([NOW_START, NOW_END], penulimate, lastValue);
17
+ }
18
+ return lastValue || NOW_START;
19
+ }
20
+ return {
21
+ get: get
22
+ };
23
+ }
24
+ function getPenulimate(value) {
25
+ if (!isArray(value)) return;
26
+ return value[value.length - 2];
27
+ }
@@ -1,10 +1,13 @@
1
1
  import type { useFormats } from './useFormats';
2
2
  import { PanelFlags } from '../datepicker/usePanel';
3
- export declare function useDisabled(formats: ReturnType<typeof useFormats>): {
4
- isDisabled: (value: import("dayjs").Dayjs, type?: import("dayjs").OpUnitType) => boolean;
5
- isDisabledConfirm: () => boolean;
3
+ import { StateValueItem } from '../datepicker/useValueBase';
4
+ import type { useDefaultValue } from './useDefaultValue';
5
+ export declare function useDisabled(formats: ReturnType<typeof useFormats>, defaultValue: ReturnType<typeof useDefaultValue>): {
6
+ isDisabled: (value: import("dayjs").Dayjs, type?: "h" | "s" | "y" | "date" | "month" | "week" | "millisecond" | "second" | "minute" | "hour" | "day" | "year" | "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "months" | "years" | "dates" | "d" | "D" | "M" | "m" | "ms" | "weeks" | "w" | "quarter" | "quarters" | "Q") => boolean;
6
7
  maxDate: import("../../hooks/useState").State<import("dayjs").Dayjs | null>;
7
8
  minDate: import("../../hooks/useState").State<import("dayjs").Dayjs | null>;
8
- isDisabledTime: (value: import("dayjs").Dayjs, flag: PanelFlags) => boolean;
9
+ isDisabledTime: (value: import("dayjs").Dayjs) => boolean;
9
10
  isDisabledTimeByStep: (value: string, flag: PanelFlags) => boolean;
11
+ isDisabledConfirm: () => boolean;
12
+ isDisabledValue: (value: StateValueItem) => boolean;
10
13
  };
@@ -1,16 +1,25 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["isDisabledTime"];
3
+ var _excluded = ["isDisabledTime", "isDisabledConfirm", "isDisabledValue"];
4
+ import { useInstance } from 'intact';
4
5
  import { useDisabled as useDisabledBase } from '../datepicker/useDisabled';
5
- export function useDisabled(formats) {
6
+ export function useDisabled(formats, defaultValue) {
7
+ var instance = useInstance();
6
8
  var _useDisabledBase = useDisabledBase(formats),
7
9
  isDisabledTime = _useDisabledBase.isDisabledTime,
10
+ isDisabledConfirmBase = _useDisabledBase.isDisabledConfirm,
11
+ isDisabledValue = _useDisabledBase.isDisabledValue,
8
12
  rest = _objectWithoutPropertiesLoose(_useDisabledBase, _excluded);
9
13
  function isDisabledTimeByStep(value, flag) {
10
- return isDisabledTime(formats.createDateByValueFormat(value), flag);
14
+ return isDisabledTime(formats.createDateByValueFormat(value));
15
+ }
16
+ function isDisabledConfirm() {
17
+ return isDisabledValue(defaultValue.get());
11
18
  }
12
19
  return _extends({
13
20
  isDisabledTime: isDisabledTime,
14
- isDisabledTimeByStep: isDisabledTimeByStep
21
+ isDisabledTimeByStep: isDisabledTimeByStep,
22
+ isDisabledConfirm: isDisabledConfirm,
23
+ isDisabledValue: isDisabledValue
15
24
  }, rest);
16
25
  }
@@ -1,7 +1,7 @@
1
1
  import { Component } from 'intact';
2
2
  import dayjs, { Dayjs } from '../datepicker/dayjs';
3
3
  import type { TimepickerProps } from './';
4
- import type { Value } from '../datepicker/basepicker';
4
+ import type { Value } from '../datepicker/useValueBase';
5
5
  export declare function useFormats<T extends Component<TimepickerProps>>(): {
6
6
  getValueFormat: () => string;
7
7
  getShowFormat: () => string;
@@ -1,16 +1,22 @@
1
1
  import type { useFormats } from './useFormats';
2
- import { StateValueItem } from '../datepicker/basepicker';
2
+ import { StateValueItem, DayjsValue } from '../datepicker/useValueBase';
3
3
  import type { useDisabled } from '../datepicker/useDisabled';
4
4
  import type { usePanel } from '../datepicker/usePanel';
5
5
  import { PanelFlags } from '../datepicker/usePanel';
6
- export declare function useValue(formats: ReturnType<typeof useFormats>, disabled: ReturnType<typeof useDisabled>, panel: ReturnType<typeof usePanel>): {
6
+ import type Dayjs from 'dayjs';
7
+ import type { useDefaultValue } from './useDefaultValue';
8
+ export declare function useValue(formats: ReturnType<typeof useFormats>, disabled: ReturnType<typeof useDisabled>, panel: ReturnType<typeof usePanel>, defaultValue: ReturnType<typeof useDefaultValue>): {
7
9
  format: () => string | string[];
8
- onConfirm: () => void;
9
- getTimeValue: (flag: PanelFlags) => import("dayjs").Dayjs | null | undefined;
10
- convertToDayjs: (v: import("../datepicker/basepicker").Value | [import("../datepicker/basepicker").Value, import("../datepicker/basepicker").Value] | import("../datepicker/basepicker").Value[] | [import("../datepicker/basepicker").Value, import("../datepicker/basepicker").Value][] | null | undefined) => import("../datepicker/basepicker").DayjsValue;
11
- value: import("../../hooks/useState").State<import("../datepicker/basepicker").StateValue>;
10
+ formatSingleValue: (value: StateValueItem) => string;
11
+ convertToDayjs: (v: import("../datepicker/useValueBase").Value | [import("../datepicker/useValueBase").Value, import("../datepicker/useValueBase").Value] | import("../datepicker/useValueBase").Value[] | [import("../datepicker/useValueBase").Value, import("../datepicker/useValueBase").Value][] | null | undefined) => DayjsValue;
12
+ unique: () => void;
13
+ setMoment: () => void;
14
+ updateValue: () => void;
15
+ allValuesUpdatedInMultipleMode: () => boolean | undefined;
16
+ value: import("../../hooks/useState").State<import("../datepicker/useValueBase").StateValue>;
12
17
  setValue: (v: StateValueItem, fromInput: boolean) => void;
13
- getDayjsValue: () => import("../datepicker/basepicker").DayjsValue;
14
- onChangeTime: (date: import("dayjs").Dayjs, flag: PanelFlags) => void;
18
+ getDayjsValue: () => DayjsValue;
19
+ onChangeTime: (date: Dayjs.Dayjs, flag: PanelFlags) => void;
15
20
  onChangeTimeByStep: (v: string, flag: PanelFlags) => void;
21
+ getTimeValue: (flag: PanelFlags) => Dayjs.Dayjs | null | undefined;
16
22
  };
@@ -1,19 +1,17 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["value", "getDayjsValue", "setValue", "onChangeTime"];
3
+ var _excluded = ["value", "getDayjsValue", "setValue", "onChangeTime", "getTimeValue"];
4
4
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
5
5
  import { useInstance } from 'intact';
6
- import { last } from '../utils';
7
- import { useValue as useValueBase } from '../datepicker/basepicker';
8
- import { NOW_START, NOW_END } from './constants';
9
- export function useValue(formats, disabled, panel) {
6
+ import { useValueBase } from '../datepicker/useValueBase';
7
+ export function useValue(formats, disabled, panel, defaultValue) {
10
8
  var instance = useInstance();
11
9
  var _useValueBase = useValueBase(formats, disabled, panel, function (v) {
12
10
  return false;
13
11
  }, function (v) {
14
12
  // pop the last value when input
15
13
  // because it is a placeholder date
16
- value.value.pop();
14
+ // value.value.pop(); // no placeholder any more
17
15
  setValue(v, true);
18
16
  }, function () {
19
17
  return 'second';
@@ -24,24 +22,25 @@ export function useValue(formats, disabled, panel) {
24
22
  getDayjsValue = _useValueBase.getDayjsValue,
25
23
  setValue = _useValueBase.setValue,
26
24
  onChangeTime = _useValueBase.onChangeTime,
25
+ getTimeValueBase = _useValueBase.getTimeValue,
27
26
  rest = _objectWithoutPropertiesLoose(_useValueBase, _excluded);
28
- setValue(getPlaceholderDates(), false);
29
- instance.watch('value', function (value) {
30
- var dayjsValue = getDayjsValue();
31
- setValue(last(dayjsValue) || getPlaceholderDates(), false);
32
- });
33
- function getPlaceholderDates() {
34
- return instance.get('range') ? [NOW_START, NOW_END] : NOW_START;
35
- }
36
27
  function onChangeTimeByStep(v, flag) {
37
28
  var date = formats.createDateByValueFormat(v);
38
29
  onChangeTime(date, flag);
39
30
  }
31
+ function getTimeValue(flag) {
32
+ var value = defaultValue.get();
33
+ if (instance.get('range')) {
34
+ return value[flag];
35
+ }
36
+ return value;
37
+ }
40
38
  return _extends({
41
39
  value: value,
42
40
  setValue: setValue,
43
41
  getDayjsValue: getDayjsValue,
44
42
  onChangeTime: onChangeTime,
45
- onChangeTimeByStep: onChangeTimeByStep
43
+ onChangeTimeByStep: onChangeTimeByStep,
44
+ getTimeValue: getTimeValue
46
45
  }, rest);
47
46
  }
@@ -0,0 +1,2 @@
1
+ export * from './tour';
2
+ export * from './step';
@@ -0,0 +1,2 @@
1
+ export * from './tour';
2
+ export * from './step';
@@ -0,0 +1 @@
1
+ export {};