cnhis-design-vue 3.3.3-beta.74 → 3.3.3-beta.76

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 (41) hide show
  1. package/es/components/classification/index.d.ts +16 -258
  2. package/es/components/classification/src/components/search-filter/index.vue.d.ts +16 -258
  3. package/es/components/classification/src/components/set-classification/index.vue.d.ts +16 -258
  4. package/es/components/classification/src/index.vue.d.ts +16 -258
  5. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  6. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  7. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  8. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  9. package/es/components/field-set/src/constants/index.js +4 -4
  10. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +36 -4
  11. package/es/components/info-header/index.d.ts +9 -17
  12. package/es/components/info-header/src/InfoHeader.vue.d.ts +9 -17
  13. package/es/components/info-header/src/InfoHeader.vue2.js +2 -2
  14. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +3 -2
  15. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue2.js +1 -1
  16. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +9 -17
  17. package/es/components/info-header/src/constants/index.d.ts +1 -1
  18. package/es/components/shortcut-provider/src/hooks/useShortcuts.js +1 -1
  19. package/es/components/shortcut-provider/src/types/index.d.ts +1 -0
  20. package/es/components/shortcut-provider/src/utils/index.d.ts +1 -1
  21. package/es/components/shortcut-provider/src/utils/index.js +3 -1
  22. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +14 -258
  23. package/es/components/table-filter/src/components/classify-filter/components/Base/DateOption.vue.d.ts +7 -129
  24. package/es/components/table-filter/src/components/classify-filter/components/Base/DateOption.vue2.js +107 -13
  25. package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +7 -129
  26. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +7 -129
  27. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +2 -8
  28. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +14 -258
  29. package/es/components/table-filter/src/components/classify-filter/helpers/options.js +30 -5
  30. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +16 -258
  31. package/es/components/table-filter/src/components/classify-filter/index.vue2.js +3 -1
  32. package/es/components/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +16 -1
  33. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  34. package/es/components/table-filter/src/types/enums.d.ts +1 -0
  35. package/es/components/table-filter/src/types/enums.js +1 -0
  36. package/es/components/time-picker/index.d.ts +36 -4
  37. package/es/components/time-picker/src/TimePicker.vue.d.ts +36 -4
  38. package/es/components/time-picker/src/TimePicker.vue2.js +98 -13
  39. package/es/shared/hooks/useDateTime.d.ts +1 -1
  40. package/es/shared/package.json.js +1 -1
  41. package/package.json +2 -3
@@ -1,13 +1,14 @@
1
- import { defineComponent, useAttrs, ref, computed, openBlock, createBlock, unref, createSlots, renderList, withCtx, renderSlot } from 'vue';
2
- import { NTimePicker } from 'naive-ui';
1
+ import { defineComponent, useAttrs, ref, computed, openBlock, createElementBlock, createVNode, unref, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps, createCommentVNode, createBlock, Teleport, Fragment, createTextVNode, toDisplayString, nextTick } from 'vue';
2
+ import { NTimePicker, NScrollbar, NSpace, NButton } from 'naive-ui';
3
3
  import '../../../shared/utils/index.js';
4
4
  import { useDateTime } from '../../../shared/hooks/useDateTime.js';
5
- import 'lodash-es';
5
+ import { isFunction } from 'lodash-es';
6
6
  import '@vue/shared';
7
7
  import '@vueuse/shared';
8
8
  import '../../../shared/hooks/selectHooks/useSearchContent.js';
9
9
  import '@vicons/ionicons5';
10
10
  import '../../../shared/hooks/useScrollLoading.js';
11
+ import { parse, isValid, getHours, getMinutes, getSeconds } from 'date-fns';
11
12
 
12
13
  var _sfc_main = /* @__PURE__ */ defineComponent({
13
14
  __name: "TimePicker",
@@ -15,24 +16,78 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
15
16
  to: {
16
17
  type: [Object, String, Boolean],
17
18
  default: "body"
19
+ },
20
+ shortcuts: {
21
+ type: Array,
22
+ default: () => []
18
23
  }
19
24
  },
25
+ emits: ["update:formatted-value", "update:show"],
20
26
  setup(__props, {
21
- expose
27
+ expose,
28
+ emit
22
29
  }) {
30
+ const props = __props;
23
31
  const attrs = useAttrs();
24
- const timePickerRef = ref(null);
32
+ const timePickerRef = ref();
33
+ const isTimePickerOpen = ref(false);
34
+ const panelContainer = ref();
35
+ const timePickerAttrs = computed(() => {
36
+ const {
37
+ shortcuts,
38
+ ...restAttrs
39
+ } = attrs;
40
+ return restAttrs;
41
+ });
25
42
  const formatRef = computed(() => {
26
43
  if (Reflect.get(attrs, "format"))
27
44
  return attrs["format"];
28
45
  return "HH:mm:ss";
29
46
  });
47
+ const handleFormattedTimeUpdate = (value) => {
48
+ emit("update:formatted-value", value);
49
+ };
50
+ const handleShortcutClick = (shortcut) => {
51
+ const timeValue = shortcut;
52
+ emit("update:formatted-value", timeValue);
53
+ emit("update:show", false);
54
+ isTimePickerOpen.value = false;
55
+ };
56
+ const isDisabled = (value) => {
57
+ const parsedTime = parse(value, formatRef.value, new Date());
58
+ if (!isValid(parsedTime))
59
+ return false;
60
+ const hours = getHours(parsedTime);
61
+ const minutes = getMinutes(parsedTime);
62
+ const seconds = getSeconds(parsedTime);
63
+ const attrs2 = timePickerAttrs.value;
64
+ const isHourDisabled = isFunction(attrs2.isHourDisabled) ? attrs2.isHourDisabled(hours) : false;
65
+ const isMinuteDisabled = isFunction(attrs2.isMinuteDisabled) ? attrs2.isMinuteDisabled(minutes, hours) : false;
66
+ const isSecondDisabled = isFunction(attrs2.isSecondDisabled) ? attrs2.isSecondDisabled(seconds, minutes, hours) : false;
67
+ return isHourDisabled || isMinuteDisabled || isSecondDisabled;
68
+ };
69
+ const onUpdateShow = (show) => {
70
+ emit("update:show", show);
71
+ isTimePickerOpen.value = show;
72
+ if (show && props.shortcuts && props.shortcuts.length > 0) {
73
+ nextTick(() => {
74
+ var _a, _b;
75
+ const panel = (_b = (_a = timePickerRef.value) == null ? void 0 : _a.panelInstRef) == null ? void 0 : _b.$el;
76
+ const teleportTo = panel == null ? void 0 : panel.querySelector(".n-time-picker-cols");
77
+ if (teleportTo) {
78
+ panelContainer.value = teleportTo;
79
+ }
80
+ });
81
+ } else {
82
+ panelContainer.value = null;
83
+ }
84
+ };
30
85
  const {
31
86
  focus,
32
87
  blur
33
88
  } = useDateTime(timePickerRef, {
34
89
  formatRef,
35
- attrs
90
+ attrs: timePickerAttrs
36
91
  });
37
92
  expose({
38
93
  $timePicker: timePickerRef,
@@ -40,18 +95,48 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40
95
  blur
41
96
  });
42
97
  return (_ctx, _cache) => {
43
- return openBlock(), createBlock(unref(NTimePicker), {
98
+ return openBlock(), createElementBlock("div", null, [createVNode(unref(NTimePicker), mergeProps({
44
99
  ref_key: "timePickerRef",
45
- ref: timePickerRef,
46
- to: __props.to
47
- }, createSlots({
100
+ ref: timePickerRef
101
+ }, unref(timePickerAttrs), {
102
+ to: __props.to,
103
+ "onUpdate:formattedValue": handleFormattedTimeUpdate,
104
+ "onUpdate:show": onUpdateShow
105
+ }), createSlots({
48
106
  _: 2
49
- }, [renderList(_ctx.$slots, (v, k) => {
107
+ }, [renderList(_ctx.$slots, (_, k) => {
50
108
  return {
51
109
  name: k,
52
- fn: withCtx(() => [renderSlot(_ctx.$slots, k)])
110
+ fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, k, normalizeProps(guardReactiveProps(slotProps || {})))])
53
111
  };
54
- })]), 1032, ["to"]);
112
+ })]), 1040, ["to"]), createCommentVNode(" \u5FEB\u6377\u9009\u9879 - \u901A\u8FC7CSS\u63D2\u5165\u5230\u9762\u677F\u5185\u90E8 "), __props.shortcuts && __props.shortcuts.length > 0 && isTimePickerOpen.value && panelContainer.value ? (openBlock(), createBlock(Teleport, {
113
+ key: 0,
114
+ to: panelContainer.value
115
+ }, [createVNode(unref(NScrollbar), {
116
+ style: {
117
+ "max-height": "255px",
118
+ "margin": "8px"
119
+ }
120
+ }, {
121
+ default: withCtx(() => [createVNode(unref(NSpace), {
122
+ vertical: "",
123
+ wrap: false
124
+ }, {
125
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.shortcuts, (shortcut) => {
126
+ return openBlock(), createBlock(unref(NButton), {
127
+ size: "tiny",
128
+ disabled: isDisabled(shortcut),
129
+ key: shortcut,
130
+ onClick: ($event) => handleShortcutClick(shortcut)
131
+ }, {
132
+ default: withCtx(() => [createTextVNode(toDisplayString(shortcut), 1)]),
133
+ _: 2
134
+ }, 1032, ["disabled", "onClick"]);
135
+ }), 128))]),
136
+ _: 1
137
+ })]),
138
+ _: 1
139
+ })], 8, ["to"])) : createCommentVNode("v-if", true)]);
55
140
  };
56
141
  }
57
142
  });
@@ -1,7 +1,7 @@
1
1
  import { Ref, ComputedRef } from 'vue';
2
2
  import { AnyObject, AnyFn } from '../../shared/types';
3
3
  export declare function handleInputEvent(target: HTMLInputElement, value?: string): void;
4
- export declare function useDateTime(datePickerRef: Ref<AnyObject | null>, { formatRef, attrs, emit, allowedInvalidValue, isPanel }: {
4
+ export declare function useDateTime(datePickerRef: Ref<AnyObject | null | undefined>, { formatRef, attrs, emit, allowedInvalidValue, isPanel }: {
5
5
  formatRef: ComputedRef<string | [string, string]>;
6
6
  attrs: AnyObject;
7
7
  allowedInvalidValue?: string;
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.3.3-beta.74";
2
+ var version = "3.3.3-beta.76";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.3.3-beta.74",
3
+ "version": "3.3.3-beta.76",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -62,7 +62,6 @@
62
62
  "video.js": "^7.19.2",
63
63
  "videojs-contrib-hls": "^5.15.0",
64
64
  "viewerjs": "^1.10.5",
65
- "vue": "^3.5.0",
66
65
  "vue-simple-uploader": "^1.0.0-beta.5",
67
66
  "xe-utils": "^3.5.4"
68
67
  },
@@ -74,5 +73,5 @@
74
73
  "iOS 7",
75
74
  "last 3 iOS versions"
76
75
  ],
77
- "gitHead": "e4daf2ab84e560a83587973475b91dc530d1c30c"
76
+ "gitHead": "c5ca3c0973aa44c9235ce5d60662317954130ec9"
78
77
  }