cnhis-design-vue 3.3.2-beta.19 → 3.3.2-beta.24

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 (37) hide show
  1. package/README.md +87 -87
  2. package/es/components/audio-sdk/index.d.ts +14 -0
  3. package/es/components/audio-sdk/src/Index.vue.d.ts +14 -0
  4. package/es/components/audio-sdk/src/Index.vue2.js +5 -1
  5. package/es/components/audio-sdk/src/audioSDK.js +1 -2
  6. package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +1 -0
  7. package/es/components/audio-sdk/src/components/recording.vue.d.ts +1 -0
  8. package/es/components/audio-sdk/src/components/recording.vue2.js +2 -1
  9. package/es/components/audio-sdk/src/hooks/useChartAudioContext.js +2 -2
  10. package/es/components/callback/src/components/render/popupMaps.d.ts +2 -2
  11. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  12. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  13. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  14. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  15. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  16. package/es/components/form-config/index.d.ts +30 -0
  17. package/es/components/form-config/src/FormConfig.vue.d.ts +30 -0
  18. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +24 -0
  19. package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +6 -0
  20. package/es/components/form-render/index.js +1 -1
  21. package/es/components/form-render/src/components/renderer/date.js +64 -55
  22. package/es/components/form-render/src/hooks/useFieldNormalize.js +4 -3
  23. package/es/components/form-render/src/types/fieldItem.d.ts +8 -0
  24. package/es/components/form-render/src/utils/business.d.ts +2 -1
  25. package/es/components/form-render/src/utils/business.js +45 -2
  26. package/es/components/form-render/src/utils/index.js +1 -1
  27. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  28. package/es/components/iho-table/index.d.ts +2 -2
  29. package/es/components/iho-table/src/IhoTable.vue.d.ts +2 -2
  30. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +17 -3
  31. package/es/components/index.js +1 -1
  32. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  33. package/es/components/shortcut-setter/index.d.ts +6 -0
  34. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -0
  35. package/es/env.d.ts +25 -25
  36. package/es/shared/package.json.js +1 -1
  37. package/package.json +2 -2
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -28,6 +28,10 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
28
28
  type: StringConstructor;
29
29
  default: string;
30
30
  };
31
+ textPrefix: {
32
+ type: StringConstructor;
33
+ default: string;
34
+ };
31
35
  }, {
32
36
  consultationRecordUrl: string;
33
37
  cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
@@ -57,6 +61,10 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
57
61
  type: StringConstructor;
58
62
  default: string;
59
63
  };
64
+ textPrefix: {
65
+ type: StringConstructor;
66
+ default: string;
67
+ };
60
68
  }>> & {
61
69
  onSuccess?: ((...args: any[]) => any) | undefined;
62
70
  onClose?: ((...args: any[]) => any) | undefined;
@@ -217,6 +225,7 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
217
225
  onPause: () => Promise<void>;
218
226
  onPlay: () => Promise<void>;
219
227
  onZoom: () => Promise<void>;
228
+ isSpining: import("vue").ComputedRef<boolean>;
220
229
  isFailStatus: import("vue").ComputedRef<boolean>;
221
230
  isActiveStatus: import("vue").ComputedRef<boolean>;
222
231
  isWarningStatus: import("vue").ComputedRef<boolean>;
@@ -354,6 +363,10 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
354
363
  type: StringConstructor;
355
364
  default: string;
356
365
  };
366
+ textPrefix: {
367
+ type: StringConstructor;
368
+ default: string;
369
+ };
357
370
  }>> & {
358
371
  onSuccess?: ((...args: any[]) => any) | undefined;
359
372
  onClose?: ((...args: any[]) => any) | undefined;
@@ -364,5 +377,6 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
364
377
  realTimeRecognition: boolean;
365
378
  allowPunctuationMark: boolean;
366
379
  useSource: string;
380
+ textPrefix: string;
367
381
  }>>;
368
382
  export default AudioSdk;
@@ -26,6 +26,10 @@ declare const _default: import("vue").DefineComponent<{
26
26
  type: StringConstructor;
27
27
  default: string;
28
28
  };
29
+ textPrefix: {
30
+ type: StringConstructor;
31
+ default: string;
32
+ };
29
33
  }, {
30
34
  consultationRecordUrl: string;
31
35
  cssVars: import("vue").ComputedRef<AnyObject>;
@@ -55,6 +59,10 @@ declare const _default: import("vue").DefineComponent<{
55
59
  type: StringConstructor;
56
60
  default: string;
57
61
  };
62
+ textPrefix: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
58
66
  }>> & {
59
67
  onSuccess?: ((...args: any[]) => any) | undefined;
60
68
  onClose?: ((...args: any[]) => any) | undefined;
@@ -215,6 +223,7 @@ declare const _default: import("vue").DefineComponent<{
215
223
  onPause: () => Promise<void>;
216
224
  onPlay: () => Promise<void>;
217
225
  onZoom: () => Promise<void>;
226
+ isSpining: import("vue").ComputedRef<boolean>;
218
227
  isFailStatus: import("vue").ComputedRef<boolean>;
219
228
  isActiveStatus: import("vue").ComputedRef<boolean>;
220
229
  isWarningStatus: import("vue").ComputedRef<boolean>;
@@ -352,6 +361,10 @@ declare const _default: import("vue").DefineComponent<{
352
361
  type: StringConstructor;
353
362
  default: string;
354
363
  };
364
+ textPrefix: {
365
+ type: StringConstructor;
366
+ default: string;
367
+ };
355
368
  }>> & {
356
369
  onSuccess?: ((...args: any[]) => any) | undefined;
357
370
  onClose?: ((...args: any[]) => any) | undefined;
@@ -362,5 +375,6 @@ declare const _default: import("vue").DefineComponent<{
362
375
  realTimeRecognition: boolean;
363
376
  allowPunctuationMark: boolean;
364
377
  useSource: string;
378
+ textPrefix: string;
365
379
  }>;
366
380
  export default _default;
@@ -40,6 +40,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40
40
  useSource: {
41
41
  type: String,
42
42
  default: ""
43
+ },
44
+ textPrefix: {
45
+ type: String,
46
+ default: ""
43
47
  }
44
48
  },
45
49
  emits: ["close", "success", "fail", "recordingHeightChange"],
@@ -127,7 +131,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
127
131
  data
128
132
  } = await axios.post(consultationRecordUrl, {
129
133
  taskId: 1,
130
- audioText,
134
+ audioText: props.textPrefix + audioText,
131
135
  intentionCode: props.intentionCode,
132
136
  configs: props.configs || {}
133
137
  }, {
@@ -156,8 +156,7 @@ const _AudioSDK = class {
156
156
  props: {
157
157
  contentRef: this.contentRef,
158
158
  wsConnected: this.wsConnected,
159
- recorderStatus: this.recorderStatus,
160
- recorderClosing: this.recorderClosing
159
+ recorderStatus: this.recorderStatus
161
160
  }
162
161
  });
163
162
  }
@@ -135,6 +135,7 @@ declare const _default: import("vue").DefineComponent<{
135
135
  onPause: () => Promise<void>;
136
136
  onPlay: () => Promise<void>;
137
137
  onZoom: () => Promise<void>;
138
+ isSpining: import("vue").ComputedRef<boolean>;
138
139
  isFailStatus: import("vue").ComputedRef<boolean>;
139
140
  isActiveStatus: import("vue").ComputedRef<boolean>;
140
141
  isWarningStatus: import("vue").ComputedRef<boolean>;
@@ -123,6 +123,7 @@ declare const _default: import("vue").DefineComponent<{
123
123
  onPause: () => Promise<void>;
124
124
  onPlay: () => Promise<void>;
125
125
  onZoom: () => Promise<void>;
126
+ isSpining: import("vue").ComputedRef<boolean>;
126
127
  isFailStatus: import("vue").ComputedRef<boolean>;
127
128
  isActiveStatus: import("vue").ComputedRef<boolean>;
128
129
  isWarningStatus: import("vue").ComputedRef<boolean>;
@@ -146,6 +146,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
146
146
  const onPause = useDebounceFn(handlePause, 500);
147
147
  const onPlay = useDebounceFn(handlePlay, 500);
148
148
  const onZoom = useDebounceFn(handleZoom, 500);
149
+ const isSpining = computed(() => !wsConnected.value || loading.value);
149
150
  const isFailStatus = computed(() => recorderStatus.value === "fail");
150
151
  const isActiveStatus = computed(() => !loading.value && isActive.value && !isWarning.value);
151
152
  const isWarningStatus = computed(() => isFailStatus.value || !loading.value && isActive.value && isWarning.value);
@@ -219,7 +220,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
219
220
  "c-recording-wrapper-show_content": unref(showContent)
220
221
  }])
221
222
  }, [createVNode(unref(NSpin), {
222
- show: !unref(wsConnected)
223
+ show: unref(isSpining)
223
224
  }, {
224
225
  default: withCtx(() => [unref(isZoomSmall) ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", {
225
226
  ref_key: "audioChartSamllRef",
@@ -120,9 +120,9 @@ function useChartAudioContext(props, emit, options) {
120
120
  emit("resume");
121
121
  };
122
122
  const handleHeightChange = (showContent) => {
123
- let cH = isZoomSmall.value ? 60 : 284;
123
+ let cH = isZoomSmall.value ? 58 : 284;
124
124
  if (showContent) {
125
- cH = isZoomSmall.value ? 212 : 404;
125
+ cH = isZoomSmall.value ? 210 : 436;
126
126
  }
127
127
  emit("heightChange", cH);
128
128
  };
@@ -4243,7 +4243,7 @@ export declare const CallbackMaps: Map<string, {
4243
4243
  dateOperationalForm?: {
4244
4244
  scene: "DIFF" | "CALC";
4245
4245
  precision: string;
4246
- diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
4246
+ diffValUnit: "HOUR" | "DAY" | "MIN" | "DHM";
4247
4247
  diffValField: string;
4248
4248
  startDateField: string;
4249
4249
  endDateField: string;
@@ -7840,7 +7840,7 @@ export declare const CallbackMaps: Map<string, {
7840
7840
  dateOperationalForm?: {
7841
7841
  scene: "DIFF" | "CALC";
7842
7842
  precision: string;
7843
- diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
7843
+ diffValUnit: "HOUR" | "DAY" | "MIN" | "DHM";
7844
7844
  diffValField: string;
7845
7845
  startDateField: string;
7846
7846
  endDateField: string;
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -534,9 +534,9 @@ declare const _default: import("vue").DefineComponent<{
534
534
  }>;
535
535
  developMode: boolean;
536
536
  draggable: boolean;
537
- isHighlightRow: boolean;
538
537
  idx: number;
539
538
  isHighlight: boolean;
539
+ isHighlightRow: boolean;
540
540
  isFieldSet: boolean;
541
541
  fieldDescribeMode: "column" | "tooltip";
542
542
  hideExpressionOption: AnyObject[];
@@ -563,9 +563,9 @@ declare const _default: import("vue").DefineComponent<{
563
563
  }>;
564
564
  developMode: boolean;
565
565
  draggable: boolean;
566
- isHighlightRow: boolean;
567
566
  idx: number;
568
567
  isHighlight: boolean;
568
+ isHighlightRow: boolean;
569
569
  isFieldSet: boolean;
570
570
  fieldDescribeMode: "column" | "tooltip";
571
571
  hideExpressionOption: AnyObject[];
@@ -722,9 +722,9 @@ declare const _default: import("vue").DefineComponent<{
722
722
  }>;
723
723
  developMode: boolean;
724
724
  draggable: boolean;
725
- isHighlightRow: boolean;
726
725
  idx: number;
727
726
  isHighlight: boolean;
727
+ isHighlightRow: boolean;
728
728
  isFieldSet: boolean;
729
729
  fieldDescribeMode: "column" | "tooltip";
730
730
  hideExpressionOption: AnyObject[];
@@ -383,9 +383,9 @@ declare const _default: import("vue").DefineComponent<{
383
383
  }>;
384
384
  developMode: boolean;
385
385
  draggable: boolean;
386
- isHighlightRow: boolean;
387
386
  idx: number;
388
387
  isHighlight: boolean;
388
+ isHighlightRow: boolean;
389
389
  isFieldSet: boolean;
390
390
  fieldDescribeMode: "column" | "tooltip";
391
391
  hideExpressionOption: AnyObject[];
@@ -1963,6 +1963,12 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1963
1963
  updateOriginValue: boolean;
1964
1964
  } | undefined;
1965
1965
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
1966
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1967
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1968
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1969
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1970
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1971
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1966
1972
  fieldTitleColor?: string | undefined;
1967
1973
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
1968
1974
  content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
@@ -2234,6 +2240,12 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2234
2240
  updateOriginValue: boolean;
2235
2241
  } | undefined;
2236
2242
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
2243
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2244
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2245
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2246
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2247
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2248
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2237
2249
  fieldTitleColor?: string | undefined;
2238
2250
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
2239
2251
  content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
@@ -2476,6 +2488,12 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2476
2488
  updateOriginValue: boolean;
2477
2489
  } | undefined;
2478
2490
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
2491
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2492
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2493
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2494
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2495
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2496
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2479
2497
  fieldTitleColor?: string | undefined;
2480
2498
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
2481
2499
  content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
@@ -2726,6 +2744,12 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
2726
2744
  updateOriginValue: boolean;
2727
2745
  } | undefined;
2728
2746
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
2747
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2748
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2749
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2750
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2751
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2752
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2729
2753
  fieldTitleColor?: string | undefined;
2730
2754
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
2731
2755
  content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
@@ -4105,6 +4129,12 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
4105
4129
  updateOriginValue: boolean;
4106
4130
  } | undefined;
4107
4131
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
4132
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
4133
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
4134
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
4135
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
4136
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
4137
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
4108
4138
  fieldTitleColor?: string | undefined;
4109
4139
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
4110
4140
  content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
@@ -1966,6 +1966,12 @@ declare const _default: import("vue").DefineComponent<{
1966
1966
  updateOriginValue: boolean;
1967
1967
  } | undefined;
1968
1968
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
1969
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1970
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1971
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1972
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1973
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1974
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1969
1975
  fieldTitleColor?: string | undefined;
1970
1976
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
1971
1977
  content?: string | import("../../../components/form-render").FormRenderer | Record<string, import("../../../components/form-render").FormRenderer> | undefined;
@@ -2237,6 +2243,12 @@ declare const _default: import("vue").DefineComponent<{
2237
2243
  updateOriginValue: boolean;
2238
2244
  } | undefined;
2239
2245
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
2246
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2247
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2248
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2249
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2250
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2251
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2240
2252
  fieldTitleColor?: string | undefined;
2241
2253
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
2242
2254
  content?: string | import("../../../components/form-render").FormRenderer | Record<string, import("../../../components/form-render").FormRenderer> | undefined;
@@ -2479,6 +2491,12 @@ declare const _default: import("vue").DefineComponent<{
2479
2491
  updateOriginValue: boolean;
2480
2492
  } | undefined;
2481
2493
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
2494
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2495
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2496
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2497
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2498
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2499
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2482
2500
  fieldTitleColor?: string | undefined;
2483
2501
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
2484
2502
  content?: string | import("../../../components/form-render").FormRenderer | Record<string, import("../../../components/form-render").FormRenderer> | undefined;
@@ -2729,6 +2747,12 @@ declare const _default: import("vue").DefineComponent<{
2729
2747
  updateOriginValue: boolean;
2730
2748
  } | undefined;
2731
2749
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
2750
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2751
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2752
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2753
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
2754
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2755
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
2732
2756
  fieldTitleColor?: string | undefined;
2733
2757
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
2734
2758
  content?: string | import("../../../components/form-render").FormRenderer | Record<string, import("../../../components/form-render").FormRenderer> | undefined;
@@ -4108,6 +4132,12 @@ declare const _default: import("vue").DefineComponent<{
4108
4132
  updateOriginValue: boolean;
4109
4133
  } | undefined;
4110
4134
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
4135
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
4136
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
4137
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
4138
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
4139
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
4140
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
4111
4141
  fieldTitleColor?: string | undefined;
4112
4142
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
4113
4143
  content?: string | import("../../../components/form-render").FormRenderer | Record<string, import("../../../components/form-render").FormRenderer> | undefined;
@@ -421,6 +421,12 @@ declare const _default: import("vue").DefineComponent<{
421
421
  updateOriginValue: boolean;
422
422
  } | undefined;
423
423
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
424
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
425
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
426
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
427
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
428
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
429
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
424
430
  fieldTitleColor?: string | undefined;
425
431
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
426
432
  content?: string | import("../../../../components/form-render").FormRenderer | Record<string, import("../../../../components/form-render").FormRenderer> | undefined;
@@ -692,6 +698,12 @@ declare const _default: import("vue").DefineComponent<{
692
698
  updateOriginValue: boolean;
693
699
  } | undefined;
694
700
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
701
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
702
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
703
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
704
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
705
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
706
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
695
707
  fieldTitleColor?: string | undefined;
696
708
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
697
709
  content?: string | import("../../../../components/form-render").FormRenderer | Record<string, import("../../../../components/form-render").FormRenderer> | undefined;
@@ -934,6 +946,12 @@ declare const _default: import("vue").DefineComponent<{
934
946
  updateOriginValue: boolean;
935
947
  } | undefined;
936
948
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
949
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
950
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
951
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
952
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
953
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
954
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
937
955
  fieldTitleColor?: string | undefined;
938
956
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
939
957
  content?: string | import("../../../../components/form-render").FormRenderer | Record<string, import("../../../../components/form-render").FormRenderer> | undefined;
@@ -1184,6 +1202,12 @@ declare const _default: import("vue").DefineComponent<{
1184
1202
  updateOriginValue: boolean;
1185
1203
  } | undefined;
1186
1204
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
1205
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1206
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1207
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1208
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
1209
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1210
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
1187
1211
  fieldTitleColor?: string | undefined;
1188
1212
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
1189
1213
  content?: string | import("../../../../components/form-render").FormRenderer | Record<string, import("../../../../components/form-render").FormRenderer> | undefined;
@@ -184,6 +184,12 @@ declare const _default: import("vue").DefineComponent<{
184
184
  updateOriginValue: boolean;
185
185
  } | undefined;
186
186
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
187
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
188
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
189
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
190
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
191
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
192
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
187
193
  fieldTitleColor?: string | undefined;
188
194
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
189
195
  content?: string | import("../../../../components/form-render").FormRenderer | Record<string, import("../../../../components/form-render").FormRenderer> | undefined;
@@ -27,7 +27,7 @@ export { useWordbookSetting, wordbookSettingHandler } from './src/hooks/useWordb
27
27
  export { useNewLowCodeReactions } from './src/hooks/useNewLowCodeReactions.js';
28
28
  export { useSelectedSetting } from './src/hooks/useSelectedSetting.js';
29
29
  export { FieldListFilter, combineExtendKey, createInputSlot, createSlot, editorUnescape, findItemByValCondition, formRenderLog, getAbsoluteKey, injectOrProvide, isEnter, isNegative, isNestedFieldType, isNestedType, isPositive, isValidWidgetCombination, mergeDeepProperties, parseEnhanceText, parseNumberFromMaybeString, renderDescOption, renderOptionLabel, replace2Any, splitExtendKey, validateMessageParser } from './src/utils/index.js';
30
- export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat } from './src/utils/business.js';
30
+ export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, parseLowCodeDate, transformDateFormat } from './src/utils/business.js';
31
31
  export { findNextWidget, queryDecoratorByAddress, queryDecoratorByFieldKey, queryInput } from './src/utils/dom.js';
32
32
  export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createFieldAddressId, createLinebarId, createObjSchema, createVisitedSetter, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema } from './src/utils/schema.js';
33
33
 
@@ -1,11 +1,12 @@
1
1
  import { defineComponent, computed, watch, ref, onMounted, inject, createVNode, mergeProps } from 'vue';
2
2
  import { generateTimeFormat } from '../../../../../shared/utils/index.js';
3
3
  import { connect, mapProps } from '@formily/vue';
4
- import { isObject, useEventListener } from '@vueuse/core';
4
+ import { useEventListener } from '@vueuse/core';
5
5
  import { promiseTimeout } from '@vueuse/shared';
6
6
  import { format } from 'date-fns';
7
7
  import useLocale from 'naive-ui/es/_mixins/use-locale';
8
8
  import DatePicker from '../../../../date-picker/index.js';
9
+ import '../../../index.js';
9
10
  import { InjectionFormGlobalProps } from '../../constants/index.js';
10
11
  import { useCommonInjection } from '../../hooks/useCommonInjection.js';
11
12
  import '@formily/core';
@@ -15,9 +16,10 @@ import '@vue/shared';
15
16
  import 'lodash-es';
16
17
  import 'naive-ui';
17
18
  import './text.js';
18
- import '../../utils/business.js';
19
+ import { parseLowCodeDate } from '../../utils/business.js';
19
20
  import { assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
20
21
  import script$1 from '../../../../../shared/components/DateIcon/DateIcon.vue.js';
22
+ import { useFormField } from '../../hooks/useFormField.js';
21
23
 
22
24
  const script = /* @__PURE__ */ defineComponent({
23
25
  props: {
@@ -55,63 +57,70 @@ const script = /* @__PURE__ */ defineComponent({
55
57
  injectValueBindKey
56
58
  } = useCommonInjection();
57
59
  injectValueValidate(() => props.value);
58
- function minCurrentDate() {
59
- var _a;
60
- return ((_a = props.validate) == null ? void 0 : _a.min_date) === "currTime";
61
- }
62
- function maxCurrentDate() {
63
- var _a;
64
- return ((_a = props.validate) == null ? void 0 : _a.max_date) === "currTime";
65
- }
66
- function isDateDisabled(time) {
67
- return minCurrentDate() && time < yesterday() || maxCurrentDate() && time > Date.now();
68
- function yesterday() {
69
- return Date.now() - 24 * 60 * 60 * 1e3;
70
- }
71
- }
72
- function isTimeDisabled(time) {
73
- const checkDate = new Date(time);
74
- const currentDate = new Date();
75
- const startCheckDateDuplicate = new Date(checkDate);
76
- startCheckDateDuplicate.setHours(0);
77
- startCheckDateDuplicate.setMinutes(0);
78
- startCheckDateDuplicate.setSeconds(0);
79
- const endCheckDateDuplicate = new Date(checkDate);
80
- endCheckDateDuplicate.setHours(23);
81
- endCheckDateDuplicate.setMinutes(59);
82
- endCheckDateDuplicate.setSeconds(59);
83
- const isOverDate = startCheckDateDuplicate > currentDate;
84
- const isBeforeDate = endCheckDateDuplicate < currentDate;
85
- const checkHour = checkDate.getHours();
86
- const currentHour = currentDate.getHours();
87
- const currentMinute = currentDate.getMinutes();
60
+ function generateDateValidator(params) {
61
+ var _a, _b;
62
+ const minTime = (_a = parseLowCodeDate(params.min_date_unit, params.min_date_condition, params.min_date_value)) == null ? void 0 : _a.getTime();
63
+ const maxTime = (_b = parseLowCodeDate(params.max_date_unit, params.max_date_condition, params.max_date_value)) == null ? void 0 : _b.getTime();
64
+ const getStartOfDay = (time) => {
65
+ if (time === void 0)
66
+ return void 0;
67
+ const date = new Date(time);
68
+ date.setHours(0, 0, 0, 0);
69
+ return date.getTime();
70
+ };
71
+ const minDateTimestamp = getStartOfDay(minTime);
72
+ const maxDateTimestamp = getStartOfDay(maxTime);
73
+ const isDateDisabled = (time) => {
74
+ const dateStart = getStartOfDay(time);
75
+ return !!(minDateTimestamp && dateStart && dateStart < minDateTimestamp || maxDateTimestamp && dateStart && dateStart > maxDateTimestamp);
76
+ };
77
+ const isTimeDisabled = (time) => {
78
+ const current = new Date(time);
79
+ const isMinEdgeDay = minTime ? isSameDate(current, new Date(minTime)) : false;
80
+ const isMaxEdgeDay = maxTime ? isSameDate(current, new Date(maxTime)) : false;
81
+ return {
82
+ isHourDisabled: (hour) => {
83
+ if (isMinEdgeDay)
84
+ return hour < new Date(minTime).getHours();
85
+ if (isMaxEdgeDay)
86
+ return hour > new Date(maxTime).getHours();
87
+ return false;
88
+ },
89
+ isMinuteDisabled: (minute, hour) => {
90
+ if (isMinEdgeDay && hour === new Date(minTime).getHours()) {
91
+ return minute < new Date(minTime).getMinutes();
92
+ }
93
+ if (isMaxEdgeDay && hour === new Date(maxTime).getHours()) {
94
+ return minute > new Date(maxTime).getMinutes();
95
+ }
96
+ return false;
97
+ }
98
+ };
99
+ };
88
100
  return {
89
- isHourDisabled,
90
- isMinuteDisabled
101
+ isDateDisabled: params.min_date_condition || params.max_date_condition ? isDateDisabled : void 0,
102
+ isTimeDisabled: params.min_date_condition || params.max_date_condition ? isTimeDisabled : void 0
91
103
  };
92
- function isHourDisabled(hour) {
93
- return minCurrentDate() && !isOverDate && hour < currentHour || maxCurrentDate() && !isBeforeDate && hour > currentHour;
94
- }
95
- function isMinuteDisabled(minute) {
96
- if (checkHour === currentHour) {
97
- return minCurrentDate() && !isOverDate && minute < currentMinute || maxCurrentDate() && !isBeforeDate && minute > currentMinute;
98
- }
99
- return minCurrentDate() && !isOverDate && checkHour < currentHour || maxCurrentDate() && !isBeforeDate && checkHour > currentHour;
100
- }
101
104
  }
105
+ function isSameDate(a, b) {
106
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
107
+ }
108
+ const {
109
+ getFieldItem
110
+ } = useFormField();
102
111
  const validateConfig = computed(() => {
103
- const result = {};
104
- if (isObject(props.validate)) {
105
- const {
106
- min_date,
107
- max_date
108
- } = props.validate;
109
- if (min_date || max_date) {
110
- result.isDateDisabled = isDateDisabled;
111
- result.isTimeDisabled = isTimeDisabled;
112
- }
113
- }
114
- return result;
112
+ var _a, _b;
113
+ const fieldItem = getFieldItem();
114
+ if (!fieldItem)
115
+ return {};
116
+ return generateDateValidator({
117
+ max_date_unit: fieldItem.max_date_unit,
118
+ min_date_unit: fieldItem.min_date_unit,
119
+ max_date_value: (_a = fieldItem.validate) == null ? void 0 : _a.max_date,
120
+ min_date_value: (_b = fieldItem.validate) == null ? void 0 : _b.min_date,
121
+ max_date_condition: fieldItem.max_date_condition,
122
+ min_date_condition: fieldItem.min_date_condition
123
+ });
115
124
  });
116
125
  const formatConfig = computed(() => {
117
126
  return {
@@ -13,8 +13,8 @@ import { format } from 'date-fns';
13
13
  import { isString, isEmpty } from 'lodash-es';
14
14
  import '../../index.js';
15
15
  import { FIELD_BUSINESS_TYPE } from '../constants/index.js';
16
+ import { transformDateFormat, parseLowCodeDate } from '../utils/business.js';
16
17
  import { isNegative, isPositive, FieldListFilter, findItemByValCondition, parseEnhanceText } from '../utils/index.js';
17
- import { transformDateFormat } from '../utils/business.js';
18
18
 
19
19
  function useFieldNormalize() {
20
20
  const FieldListNormalizeWaterfallHook = new SyncWaterfallHook(["fieldList", "props"]);
@@ -115,8 +115,9 @@ function useFieldNormalize() {
115
115
  break;
116
116
  }
117
117
  case "DATE": {
118
- if (fieldItem.default_val === "current") {
119
- fieldItem.default_val = format(new Date(), fieldItem.date_format || "yyyy-MM-dd");
118
+ const default_val = parseLowCodeDate(fieldItem.unit, fieldItem.condition, fieldItem.default_val);
119
+ if (default_val) {
120
+ fieldItem.default_val = format(default_val, fieldItem.date_format || "yyyy-MM-dd");
120
121
  }
121
122
  break;
122
123
  }
@@ -7,6 +7,8 @@ import { DependKeyType, FormCommonState } from '../../../../components/form-rend
7
7
  type FieldBusinessType = 'password' | 'id_card' | 'age' | 'age_unit' | 'mobile' | 'telephone' | 'email' | 'sex' | 'birthday' | 'bank_card' | 'website' | 'gestational_weeks' | 'gestational_stage' | 'customer_name';
8
8
  type HtmlType = 'INPUT' | 'TEXTAREA' | 'SELECT' | 'LINEBAR' | 'LINE_BREAKS' | 'INPUT_NUMBER' | 'REMOTE_SEARCH' | 'DATE' | 'LEVEL_SEARCH_CASCADER' | 'SEARCH_CASCADER' | 'COMBINATION' | 'RADIO' | 'CHECKBOX' | 'SWITCH' | 'SLIDER' | 'COMPLEX' | 'SEARCH' | 'PHONE_TYPE' | 'IDCARD_TYPE' | 'SEARCH_MORE' | 'DIGITAL' | 'CHECKBOX_BLOCK' | 'RADIO_BLOCK' | 'DATE-INPUT' | 'DATETIME-INPUT' | 'SWITCH_COMPONENT' | 'SLIDER_COMPONENT' | 'LEVEL_SEARCH_CASCADE' | 'SEARCH_CASCADE' | ({} & string);
9
9
  type ValidateType = 'mobile' | 'integer' | 'number' | 'id_card' | 'regular' | string;
10
+ type UnitType = 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'QUARTER' | 'YEAR';
11
+ type ConditionType = '0' | 'IN_THE_PAST' | 'IN_THE_FUTURE' | 'CURRENT_TIME';
10
12
  export type ValidateItem = Partial<{
11
13
  /**
12
14
  * 业务类型
@@ -149,6 +151,12 @@ export type FieldItem = {
149
151
  [key: string]: any;
150
152
  };
151
153
  selected_style: 'RADIO_MARK' | 'CHECK_MARK';
154
+ unit: UnitType;
155
+ condition: ConditionType;
156
+ max_date_unit: UnitType;
157
+ min_date_unit: UnitType;
158
+ max_date_condition: ConditionType;
159
+ min_date_condition: ConditionType;
152
160
  fieldTitleColor: string;
153
161
  fieldType: SchemaTypes;
154
162
  content: string | FormRenderer | Record<string, FormRenderer>;
@@ -1,4 +1,4 @@
1
- import { AgeContext, IdCardParseInfo } from '../../../../components/form-render';
1
+ import { AgeContext, FieldItem, IdCardParseInfo } from '../../../../components/form-render';
2
2
  import { FIELD_AGE_UNIT } from '../../../../components/form-render/src/constants';
3
3
  export declare function parseIdCard(idCardNo: string): IdCardParseInfo;
4
4
  export declare function transformDateFormat(format?: string): "year" | "month" | "date" | "datetime" | "time";
@@ -12,3 +12,4 @@ export declare function parseAgeFromContext(context: AgeContext): {
12
12
  age: number;
13
13
  };
14
14
  export declare function businessDateParser(dateString: string): Date | undefined;
15
+ export declare function parseLowCodeDate(unit?: NonNullable<FieldItem['unit']>, condition?: NonNullable<FieldItem['condition']>, date?: string): Date | null;
@@ -1,5 +1,5 @@
1
1
  import { format, differenceInDays, differenceInMonths, differenceInYears, differenceInHours, differenceInMinutes } from 'date-fns';
2
- import { range, isString } from 'lodash-es';
2
+ import { range, isString, isNumber } from 'lodash-es';
3
3
  import { FIELD_AGE_UNIT, FIELD_SEX_VALUE } from '../constants/index.js';
4
4
 
5
5
  function parseIdCard(idCardNo) {
@@ -204,5 +204,48 @@ function businessDateParser(dateString) {
204
204
  const [, year, month, day, hour, minute, second] = matched;
205
205
  return new Date(`${year}-${month}-${day || "01"} ${hour || "00"}:${minute || "00"}:${second || "00"}`);
206
206
  }
207
+ function parseLowCodeDate(unit, condition, date) {
208
+ if (!date)
209
+ return null;
210
+ if (condition === "0")
211
+ return new Date(date);
212
+ if (condition === "CURRENT_TIME" || date === "current")
213
+ return new Date();
214
+ if (!isNumber(+date) || isNaN(+date))
215
+ return null;
216
+ if (!unit || !condition)
217
+ return null;
218
+ return calculateTime({
219
+ unit,
220
+ condition,
221
+ value: +date
222
+ });
223
+ }
224
+ function calculateTime(params) {
225
+ const now = new Date();
226
+ const date = new Date(now);
227
+ const sign = params.condition === "IN_THE_PAST" ? -1 : 1;
228
+ switch (params.unit) {
229
+ case "HOUR":
230
+ date.setHours(date.getHours() + sign * params.value);
231
+ break;
232
+ case "DAY":
233
+ date.setDate(date.getDate() + sign * params.value);
234
+ break;
235
+ case "WEEK":
236
+ date.setDate(date.getDate() + sign * params.value * 7);
237
+ break;
238
+ case "MONTH":
239
+ date.setMonth(date.getMonth() + sign * params.value);
240
+ break;
241
+ case "QUARTER":
242
+ date.setMonth(date.getMonth() + sign * params.value * 3);
243
+ break;
244
+ case "YEAR":
245
+ date.setFullYear(date.getFullYear() + sign * params.value);
246
+ break;
247
+ }
248
+ return date;
249
+ }
207
250
 
208
- export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat };
251
+ export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, parseLowCodeDate, transformDateFormat };
@@ -9,7 +9,7 @@ import { isString, isFunction, omit, castArray, flattenDeep, isArray } from 'lod
9
9
  import { NTooltip, NIcon } from 'naive-ui';
10
10
  import { NESTED_FORM_ITEM_TYPE } from '../constants/index.js';
11
11
  import { TEXT } from '../components/renderer/text.js';
12
- export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat } from './business.js';
12
+ export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, parseLowCodeDate, transformDateFormat } from './business.js';
13
13
  import '../../index.js';
14
14
 
15
15
  function formRenderLog(message) {
@@ -225,7 +225,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
225
225
  round: "",
226
226
  size: 100,
227
227
  onClickCapture: _cache[0] || (_cache[0] = ($event) => showLargeAvatar.value = true)
228
- }, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\n <n-upload-trigger #="{ handleClick }" abstract>\n <n-button\n circle\n secondary\n class="edit-avatar"\n v-show="userDetail.id === state.userInfo.id"\n @click="handleClick"\n >\n <template #icon>\n <n-icon size="16" color="#666666" :component="Camera" />\n </template>\n </n-button>\n </n-upload-trigger>\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
228
+ }, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\r\n <n-upload-trigger #="{ handleClick }" abstract>\r\n <n-button\r\n circle\r\n secondary\r\n class="edit-avatar"\r\n v-show="userDetail.id === state.userInfo.id"\r\n @click="handleClick"\r\n >\r\n <template #icon>\r\n <n-icon size="16" color="#666666" :component="Camera" />\r\n </template>\r\n </n-button>\r\n </n-upload-trigger>\r\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
229
229
  class: normalizeClass(["iho-chatRole", unref(isDoctorRole)(userDetail.roleInfo) ? "isDoctor" : ""])
230
230
  }, toDisplayString(unref(getRoleName)(userDetail.roleInfo)), 3), [[vShow, unref(getRoleName)(userDetail.roleInfo)]])]), createElementVNode("p", null, toDisplayString(userDetail.orgName), 1)]), createVNode(unref(NButton), {
231
231
  strong: "",
@@ -3226,7 +3226,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
3226
3226
  dateOperationalForm?: {
3227
3227
  scene: "DIFF" | "CALC";
3228
3228
  precision: string;
3229
- diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
3229
+ diffValUnit: "HOUR" | "DAY" | "MIN" | "DHM";
3230
3230
  diffValField: string;
3231
3231
  startDateField: string;
3232
3232
  endDateField: string;
@@ -6823,7 +6823,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
6823
6823
  dateOperationalForm?: {
6824
6824
  scene: "DIFF" | "CALC";
6825
6825
  precision: string;
6826
- diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
6826
+ diffValUnit: "HOUR" | "DAY" | "MIN" | "DHM";
6827
6827
  diffValField: string;
6828
6828
  startDateField: string;
6829
6829
  endDateField: string;
@@ -3224,7 +3224,7 @@ declare const _default: import("vue").DefineComponent<{
3224
3224
  dateOperationalForm?: {
3225
3225
  scene: "DIFF" | "CALC";
3226
3226
  precision: string;
3227
- diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
3227
+ diffValUnit: "HOUR" | "DAY" | "MIN" | "DHM";
3228
3228
  diffValField: string;
3229
3229
  startDateField: string;
3230
3230
  endDateField: string;
@@ -6821,7 +6821,7 @@ declare const _default: import("vue").DefineComponent<{
6821
6821
  dateOperationalForm?: {
6822
6822
  scene: "DIFF" | "CALC";
6823
6823
  precision: string;
6824
- diffValUnit: "DAY" | "MIN" | "HOUR" | "DHM";
6824
+ diffValUnit: "HOUR" | "DAY" | "MIN" | "DHM";
6825
6825
  diffValField: string;
6826
6826
  startDateField: string;
6827
6827
  endDateField: string;
@@ -1,3 +1,5 @@
1
+ import { isArray } from 'lodash-es';
2
+
1
3
  function getDefaultValue(row, item, options = []) {
2
4
  const {
3
5
  aliasField = "",
@@ -5,17 +7,29 @@ function getDefaultValue(row, item, options = []) {
5
7
  valueField = "value"
6
8
  } = (item == null ? void 0 : item.componentProps) || {};
7
9
  const value = row[item.columnName];
8
- if (Array.isArray(value))
10
+ if (isArray(value))
9
11
  return value.map((v) => getValue(v));
10
12
  return getValue(value);
11
13
  function getValue(value2) {
12
14
  var _a, _b, _c;
13
- const findItem = (_a = getArray(options)) == null ? void 0 : _a.find((v) => v[valueField] == value2);
15
+ const findItem = (_a = getGoupFlatten(options)) == null ? void 0 : _a.find((v) => v[valueField] == value2);
14
16
  return (_c = (_b = findItem == null ? void 0 : findItem[aliasField]) != null ? _b : findItem == null ? void 0 : findItem[labelField]) != null ? _c : value2;
15
17
  }
16
18
  }
17
19
  function getArray(list) {
18
- return Array.isArray(list) && !list.length ? null : list;
20
+ return isArray(list) && !list.length ? null : list;
21
+ }
22
+ function getGoupFlatten(list) {
23
+ if (!isArray(list) || !list.length)
24
+ return [];
25
+ return list.reduce((acc, cur) => {
26
+ if (cur.type === "group" && cur.children) {
27
+ acc.push(...getGoupFlatten(cur.children));
28
+ } else if (cur.type !== "group") {
29
+ acc.push(cur);
30
+ }
31
+ return acc;
32
+ }, []);
19
33
  }
20
34
 
21
35
  export { getArray, getDefaultValue };
@@ -129,7 +129,7 @@ export { usePresetScope } from './form-render/src/hooks/usePresetScope.js';
129
129
  export { useWordbookSetting, wordbookSettingHandler } from './form-render/src/hooks/useWordbookSetting.js';
130
130
  export { useNewLowCodeReactions } from './form-render/src/hooks/useNewLowCodeReactions.js';
131
131
  export { useSelectedSetting } from './form-render/src/hooks/useSelectedSetting.js';
132
- export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat } from './form-render/src/utils/business.js';
132
+ export { businessDateParser, isForeignerID, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, parseLowCodeDate, transformDateFormat } from './form-render/src/utils/business.js';
133
133
  export { findNextWidget, queryDecoratorByAddress, queryDecoratorByFieldKey, queryInput } from './form-render/src/utils/dom.js';
134
134
  export { assignClearBindVisited, assignUpdateValue, assignValueBindKey, createFieldAddressId, createLinebarId, createObjSchema, createVisitedSetter, dotEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema } from './form-render/src/utils/schema.js';
135
135
  export { FieldListFilter, combineExtendKey, createInputSlot, createSlot, editorUnescape, findItemByValCondition, formRenderLog, getAbsoluteKey, injectOrProvide, isEnter, isNegative, isNestedFieldType, isNestedType, isPositive, isValidWidgetCombination, mergeDeepProperties, parseEnhanceText, parseNumberFromMaybeString, renderDescOption, renderOptionLabel, replace2Any, splitExtendKey, validateMessageParser } from './form-render/src/utils/index.js';
@@ -193,7 +193,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
193
193
  }]),
194
194
  ref_key: "scaleViewDom",
195
195
  ref: scaleViewDom
196
- }, [createCommentVNode(' <template v-if="state.spinning">\n <n-spin :show="state.spinning" description="\u52A0\u8F7D\u4E2D"></n-spin>\n </template> '), !state.spinning && !state.hasFrontAddress ? (openBlock(), createElementBlock(Fragment, {
196
+ }, [createCommentVNode(' <template v-if="state.spinning">\r\n <n-spin :show="state.spinning" description="\u52A0\u8F7D\u4E2D"></n-spin>\r\n </template> '), !state.spinning && !state.hasFrontAddress ? (openBlock(), createElementBlock(Fragment, {
197
197
  key: 0
198
198
  }, [unref(noDataState).noData ? (openBlock(), createBlock(NoData, {
199
199
  key: 0,
@@ -213,6 +213,12 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
213
213
  updateOriginValue: boolean;
214
214
  } | undefined;
215
215
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
216
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
217
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
218
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
219
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
220
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
221
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
216
222
  fieldTitleColor?: string | undefined;
217
223
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
218
224
  content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
@@ -216,6 +216,12 @@ declare const _default: import("vue").DefineComponent<{
216
216
  updateOriginValue: boolean;
217
217
  } | undefined;
218
218
  selected_style?: "RADIO_MARK" | "CHECK_MARK" | undefined;
219
+ unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
220
+ condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
221
+ max_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
222
+ min_date_unit?: ("HOUR" | "DAY" | "WEEK" | "MONTH" | "QUARTER" | "YEAR") | undefined;
223
+ max_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
224
+ min_date_condition?: ("0" | "IN_THE_PAST" | "IN_THE_FUTURE" | "CURRENT_TIME") | undefined;
219
225
  fieldTitleColor?: string | undefined;
220
226
  fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
221
227
  content?: string | import("../../../components/form-render").FormRenderer | Record<string, import("../../../components/form-render").FormRenderer> | undefined;
package/es/env.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_APP_TYPE: string;
5
- // 更多环境变量...
6
- }
7
-
8
- interface ImportMeta {
9
- readonly env: ImportMetaEnv;
10
- }
11
-
12
- declare module '*.vue' {
13
- // @ts-ignore
14
- import type { App, defineComponent } from 'vue';
15
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
- // // const component: DefineComponent<{}, {}, any>
17
- const component: ReturnType<typeof defineComponent> & {
18
- install(app: App): void;
19
- };
20
- // @ts-ignore
21
- export default component;
22
- }
23
-
24
- declare module '*.js';
25
-
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_APP_TYPE: string;
5
+ // 更多环境变量...
6
+ }
7
+
8
+ interface ImportMeta {
9
+ readonly env: ImportMetaEnv;
10
+ }
11
+
12
+ declare module '*.vue' {
13
+ // @ts-ignore
14
+ import type { App, defineComponent } from 'vue';
15
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
+ // // const component: DefineComponent<{}, {}, any>
17
+ const component: ReturnType<typeof defineComponent> & {
18
+ install(app: App): void;
19
+ };
20
+ // @ts-ignore
21
+ export default component;
22
+ }
23
+
24
+ declare module '*.js';
25
+
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.3.2-beta.19";
2
+ var version = "3.3.2-beta.24";
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.2-beta.19",
3
+ "version": "3.3.2-beta.24",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -72,5 +72,5 @@
72
72
  "iOS 7",
73
73
  "last 3 iOS versions"
74
74
  ],
75
- "gitHead": "becad0d727c3a59994fdcc8ce30e930b51f2a358"
75
+ "gitHead": "22fa6dc0c619d600b00db3a789cad34ac888b3fb"
76
76
  }