cnhis-design-vue 3.2.8-beta.7 → 3.2.8-beta.8

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 (98) hide show
  1. package/README.md +87 -87
  2. package/es/components/ai-chat/index.d.ts +75 -0
  3. package/es/components/ai-chat/index.js +1 -0
  4. package/es/components/ai-chat/src/Index.vue.d.ts +77 -0
  5. package/es/components/ai-chat/src/Index.vue.js +1 -0
  6. package/es/components/ai-chat/src/Index.vue2.js +1 -0
  7. package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +14 -0
  8. package/es/components/ai-chat/src/components/ChatFooter.vue.js +1 -0
  9. package/es/components/ai-chat/src/components/ChatFooter.vue2.js +1 -0
  10. package/es/components/ai-chat/src/components/ChatMain.d.ts +8 -0
  11. package/es/components/ai-chat/src/components/ChatMain.js +1 -0
  12. package/es/components/ai-chat/src/types/index.d.ts +20 -0
  13. package/es/components/ai-chat/src/types/index.js +1 -0
  14. package/es/components/ai-chat/style/index.css +1 -0
  15. package/es/components/annotation-edit/src/AnnotationEdit.js +1 -1
  16. package/es/components/audio-sdk/src/components/recordingDialog.vue2.js +1 -1
  17. package/es/components/calendar/src/Calendar.vue2.js +1 -1
  18. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  19. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  20. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  21. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  22. package/es/components/field-set/src/components/condition.vue2.js +1 -1
  23. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
  24. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  25. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  26. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
  27. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  28. package/es/components/form-render/src/components/renderer/levelSearchCascader/index.js +1 -1
  29. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  30. package/es/components/form-render/src/components/renderer/select.js +1 -1
  31. package/es/components/form-render/src/hooks/useFormContext.js +1 -1
  32. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  33. package/es/components/guide/src/renderer.js +1 -1
  34. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  35. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  36. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  37. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  38. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue2.js +1 -1
  39. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  40. package/es/components/index.css +1 -1
  41. package/es/components/index.d.ts +2 -1
  42. package/es/components/index.js +1 -1
  43. package/es/components/info-header/src/InfoHeader.vue2.js +1 -1
  44. package/es/components/keyboard/src/Keyboard.vue2.js +1 -1
  45. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  46. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  47. package/es/components/shortcut-provider/src/ShortcutProvider.vue2.js +1 -1
  48. package/es/components/shortcut-setter/src/ShortcutSetter.vue2.js +1 -1
  49. package/es/components/step-notice/src/StepNotice.vue2.js +1 -1
  50. package/es/components/step-notice/src/hooks/useTheme.js +1 -1
  51. package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
  52. package/es/components/time-picker/src/TimePicker.vue2.js +1 -1
  53. package/es/components/tooth-bitmap/src/ToothBitmap.vue2.js +1 -1
  54. package/es/shared/assets/img/ai__avatar.png.js +1 -0
  55. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  56. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  57. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  58. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  59. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  60. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  61. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  62. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  63. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  64. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  65. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  66. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  67. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  68. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  69. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  70. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  71. package/es/shared/assets/img/failure.png.js +1 -1
  72. package/es/shared/assets/img/no-permission.png.js +1 -1
  73. package/es/shared/assets/img/nodata.png.js +1 -1
  74. package/es/shared/assets/img/notfound.png.js +1 -1
  75. package/es/shared/assets/img/qr.png.js +1 -1
  76. package/es/shared/assets/img/success.png.js +1 -1
  77. package/es/shared/assets/img/table_style_2.png.js +1 -1
  78. package/es/shared/assets/img/video.png.js +1 -1
  79. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  80. package/es/shared/assets/img/xb_big.png.js +1 -1
  81. package/es/shared/assets/img/xb_small.png.js +1 -1
  82. package/es/shared/hooks/index.d.ts +1 -0
  83. package/es/shared/hooks/index.js +1 -1
  84. package/es/shared/hooks/selectHooks/useOptionFiltered.js +1 -1
  85. package/es/shared/hooks/selectHooks/useSelectRenders.js +1 -1
  86. package/es/shared/hooks/useFormRequest/index.js +1 -1
  87. package/es/shared/hooks/useLevelSearchCascader.js +1 -1
  88. package/es/shared/hooks/useScrollLoading.d.ts +2 -0
  89. package/es/shared/hooks/useScrollLoading.js +1 -0
  90. package/es/shared/package.json.js +1 -1
  91. package/package.json +2 -2
  92. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  93. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  94. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  95. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  96. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  97. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  98. package/es/shared/utils/tapable/index.d.ts +0 -139
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
+ ```
@@ -0,0 +1,75 @@
1
+ import { SFCWithInstall } from '../../shared/types';
2
+ declare const AiChat: SFCWithInstall<import("vue").DefineComponent<{
3
+ userAvatar: {
4
+ type: StringConstructor;
5
+ required: true;
6
+ };
7
+ shortcutList: {
8
+ type: import("vue").PropType<string[]>;
9
+ };
10
+ queryData: {
11
+ type: import("vue").PropType<import("./src/types").QueryData>;
12
+ reuired: boolean;
13
+ };
14
+ queryRecord: {
15
+ type: import("vue").PropType<import("./src/types").QueryRecord>;
16
+ reuired: boolean;
17
+ };
18
+ }, {
19
+ cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
20
+ props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
21
+ userAvatar: {
22
+ type: StringConstructor;
23
+ required: true;
24
+ };
25
+ shortcutList: {
26
+ type: import("vue").PropType<string[]>;
27
+ };
28
+ queryData: {
29
+ type: import("vue").PropType<import("./src/types").QueryData>;
30
+ reuired: boolean;
31
+ };
32
+ queryRecord: {
33
+ type: import("vue").PropType<import("./src/types").QueryRecord>;
34
+ reuired: boolean;
35
+ };
36
+ }>> & {}>>;
37
+ state: import("../../shared/types").AnyObject;
38
+ ChatMain: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
39
+ [x: string]: unknown;
40
+ }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<readonly string[] | import("vue").ExtractPropTypes<Readonly<import("vue").ComponentObjectPropsOptions<{
41
+ [x: string]: unknown;
42
+ }>>>> & {}, {
43
+ readonly [x: number]: string;
44
+ } | {}>;
45
+ ChatFooter: import("vue").DefineComponent<{}, {
46
+ shortcutList: any;
47
+ state: any;
48
+ content: import("vue").Ref<string>;
49
+ btnDisabled: import("vue").ComputedRef<boolean>;
50
+ handleKeyDown: (event: KeyboardEvent) => void;
51
+ isWrap: (event: KeyboardEvent) => boolean;
52
+ handleSend: () => void;
53
+ NButton: any;
54
+ NInput: any;
55
+ NIcon: any;
56
+ PaperPlane: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
57
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
58
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
59
+ userAvatar: {
60
+ type: StringConstructor;
61
+ required: true;
62
+ };
63
+ shortcutList: {
64
+ type: import("vue").PropType<string[]>;
65
+ };
66
+ queryData: {
67
+ type: import("vue").PropType<import("./src/types").QueryData>;
68
+ reuired: boolean;
69
+ };
70
+ queryRecord: {
71
+ type: import("vue").PropType<import("./src/types").QueryRecord>;
72
+ reuired: boolean;
73
+ };
74
+ }>>, {}>>;
75
+ export default AiChat;
@@ -0,0 +1 @@
1
+ import{COMPONENT_NAMESPACE as r}from"../../shared/global/variable.js";import{safeComponentRegister as o}from"../../shared/utils/index.js";import s from"./src/Index.vue.js";const t=s;t.install=function(s){o(s,t,r+"AiChat")};export{t as default};
@@ -0,0 +1,77 @@
1
+ import { type PropType } from 'vue';
2
+ import { QueryData, QueryRecord } from './types';
3
+ import { AnyObject } from '../../../shared/types';
4
+ declare const _default: import("vue").DefineComponent<{
5
+ userAvatar: {
6
+ type: StringConstructor;
7
+ required: true;
8
+ };
9
+ shortcutList: {
10
+ type: PropType<string[]>;
11
+ };
12
+ queryData: {
13
+ type: PropType<QueryData>;
14
+ reuired: boolean;
15
+ };
16
+ queryRecord: {
17
+ type: PropType<QueryRecord>;
18
+ reuired: boolean;
19
+ };
20
+ }, {
21
+ cssVars: import("vue").ComputedRef<AnyObject>;
22
+ props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
23
+ userAvatar: {
24
+ type: StringConstructor;
25
+ required: true;
26
+ };
27
+ shortcutList: {
28
+ type: PropType<string[]>;
29
+ };
30
+ queryData: {
31
+ type: PropType<QueryData>;
32
+ reuired: boolean;
33
+ };
34
+ queryRecord: {
35
+ type: PropType<QueryRecord>;
36
+ reuired: boolean;
37
+ };
38
+ }>> & {}>>;
39
+ state: AnyObject;
40
+ ChatMain: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
41
+ [x: string]: unknown;
42
+ }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<readonly string[] | import("vue").ExtractPropTypes<Readonly<import("vue").ComponentObjectPropsOptions<{
43
+ [x: string]: unknown;
44
+ }>>>> & {}, {
45
+ readonly [x: number]: string;
46
+ } | {}>;
47
+ ChatFooter: import("vue").DefineComponent<{}, {
48
+ shortcutList: any;
49
+ state: any;
50
+ content: import("vue").Ref<string>;
51
+ btnDisabled: import("vue").ComputedRef<boolean>;
52
+ handleKeyDown: (event: KeyboardEvent) => void;
53
+ isWrap: (event: KeyboardEvent) => boolean;
54
+ handleSend: () => void;
55
+ NButton: any;
56
+ NInput: any;
57
+ NIcon: any;
58
+ PaperPlane: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
59
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
60
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
61
+ userAvatar: {
62
+ type: StringConstructor;
63
+ required: true;
64
+ };
65
+ shortcutList: {
66
+ type: PropType<string[]>;
67
+ };
68
+ queryData: {
69
+ type: PropType<QueryData>;
70
+ reuired: boolean;
71
+ };
72
+ queryRecord: {
73
+ type: PropType<QueryRecord>;
74
+ reuired: boolean;
75
+ };
76
+ }>>, {}>;
77
+ export default _default;
@@ -0,0 +1 @@
1
+ import e from"./Index.vue2.js";import r from"../../../_virtual/_plugin-vue_export-helper.js";var o=r(e,[["__file","Index.vue"]]);export{o as default};
@@ -0,0 +1 @@
1
+ import{defineComponent as e,reactive as o,provide as r,toRefs as t,openBlock as s,createElementBlock as i,normalizeStyle as n,unref as a,createVNode as p}from"vue";import m from"./components/ChatMain.js";import u from"./components/ChatFooter.vue.js";import{useTheme as d}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"naive-ui";import"../../../shared/hooks/useScrollLoading.js";import{InjectionAIChat as h}from"./types/index.js";var c=e({__name:"Index",props:{userAvatar:{type:String,required:!0},shortcutList:{type:Array},queryData:{type:Function,reuired:!0},queryRecord:{type:Function,reuired:!0}},setup(e){const c=e,v=d(),y=o({beingSent:!1,sendContent:""});return r(h,{...t(c),state:y}),(e,o)=>(s(),i("div",{class:"ai-chat",style:n(a(v))},[p(a(m)),p(u)],4))}});export{c as default};
@@ -0,0 +1,14 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ shortcutList: any;
3
+ state: any;
4
+ content: import("vue").Ref<string>;
5
+ btnDisabled: import("vue").ComputedRef<boolean>;
6
+ handleKeyDown: (event: KeyboardEvent) => void;
7
+ isWrap: (event: KeyboardEvent) => boolean;
8
+ handleSend: () => void;
9
+ NButton: any;
10
+ NInput: any;
11
+ NIcon: any;
12
+ PaperPlane: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
13
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
14
+ export default _default;
@@ -0,0 +1 @@
1
+ import e from"./ChatFooter.vue2.js";import r from"../../../../_virtual/_plugin-vue_export-helper.js";var o=r(e,[["__file","ChatFooter.vue"]]);export{o as default};
@@ -0,0 +1 @@
1
+ import{defineComponent as e,inject as t,ref as n,computed as l,openBlock as a,createElementBlock as s,normalizeClass as i,unref as o,Fragment as r,renderList as u,createBlock as c,withCtx as d,createTextVNode as p,toDisplayString as f,createCommentVNode as v,createElementVNode as b,createVNode as m}from"vue";import{NButton as y,NInput as h,NIcon as x}from"naive-ui";import{PaperPlane as g}from"@vicons/ionicons5";import{InjectionAIChat as K}from"../types/index.js";const k={key:0,class:"menu-box fillet-8"},w={class:"input-wrapper fillet-10"},S={class:"input-box"},z={class:"btn-box"},C=["disabled"];var _=e({__name:"ChatFooter",setup(e){const{shortcutList:_,state:E}=t(K),R=n(""),j=l((()=>!R.value.replace(/(&nbsp;|\s|<br>)+/g,"")));function D(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),F()))}function F(){j.value||(E.beingSent=!0,E.sendContent=R.value.replace(/\\n|\n|\r/g,"<br>"),R.value="")}return(e,t)=>(a(),s("section",{class:i(["chat-footer",o(E).beingSent?"disabled":""])},[o(_)&&o(_).length>0?(a(),s("div",k,[(a(!0),s(r,null,u(o(_),(e=>(a(),c(o(y),{secondary:"",size:"small",key:e},{default:d((()=>[p(f(e),1)])),_:2},1024)))),128))])):v("v-if",!0),b("div",w,[b("div",S,[m(o(h),{type:"textarea",placeholder:"请向我提问,Shift+Enter换行",disabled:o(E).beingSent,autosize:{minRows:2,maxRows:7},value:R.value,"onUpdate:value":t[0]||(t[0]=e=>R.value=e),onKeydown:D},null,8,["disabled","value"])]),b("div",z,[b("span",{class:i(["btn-send","fillet-8",o(j)?"disabled":""]),disabled:o(j),onClick:F},[m(o(x),{color:"#fff",size:"22",component:o(g)},null,8,["component"])],10,C)])])],2))}});export{_ as default};
@@ -0,0 +1,8 @@
1
+ declare const _default: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
2
+ [x: string]: unknown;
3
+ }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<readonly string[] | import("vue").ExtractPropTypes<Readonly<import("vue").ComponentObjectPropsOptions<{
4
+ [x: string]: unknown;
5
+ }>>>> & {}, {
6
+ readonly [x: number]: string;
7
+ } | {}>;
8
+ export default _default;
@@ -0,0 +1 @@
1
+ import{defineComponent as e,inject as t,ref as s,watch as n,createVNode as r,createTextVNode as a}from"vue";import{NAvatar as o,NSpin as i}from"naive-ui";import{InjectionAIChat as l}from"../types/index.js";import u from"../../../../shared/assets/img/ai__avatar.png.js";import{isArray as c,isFunction as m}from"lodash";import"../../../../shared/utils/index.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useScrollLoading as p}from"../../../../shared/hooks/useScrollLoading.js";var d=e({name:"ChatMain",inheritAttrs:!1,props:{},emits:[],setup(e,{attrs:d,slots:h,emit:v}){const{userAvatar:f,queryData:g,state:y,queryRecord:M}=t(l),b=s(null),j=s([]),C={page:0,hasMore:!0};async function S(){if(!C.hasMore)return;C.page++;const e=await M.value({page:C.page});if(!Array.isArray(e)||0===e.length)return C.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");j.value=C.page>1?[...e,...j.value]:e}return p(b,(()=>{S()}),"top"),S(),n((()=>y.beingSent),(async e=>{if(e){j.value.unshift({createdByMe:!0,content:y.sendContent});const e=await g.value({content:y.sendContent.split("<br>").join("\n"),contentType:"text"});c(e)&&j.value.unshift(...e),y.beingSent=!1,y.sendContent=""}})),()=>r("section",{class:"chat-main",ref:b},[[y.beingSent?r("div",{class:"message-item"},[r(o,{round:!0,size:40,src:u},null),r("div",{class:"content fillet-10 loading"},[r(i,{size:22,stroke:"#4170EE"},null),r("span",null,[a("正在加载中,请稍等...")])])]):null,j.value.map((e=>r("div",{class:"message-item"},[r(o,{round:!0,size:40,src:e.createdByMe?f.value:u},null),r("div",{class:["content",e.createdByMe?"fillet-8 mine":"fillet-10"]},[m(e.render)?e.render():e.content.split("<br>").map(((e,t,s)=>[e,t===s.length-1?null:r("br",null,null)]))])])))]])}});export{d as default};
@@ -0,0 +1,20 @@
1
+ import { InjectionKey, VNodeChild } from 'vue';
2
+ import { AnyObject } from '../../../../shared/types';
3
+ export declare const InjectionAIChat: InjectionKey<AnyObject>;
4
+ export declare const InjectionAIChatEmits: InjectionKey<(event: string, ...args: any[]) => void>;
5
+ export type QueryData = (props: {
6
+ content: string;
7
+ contentType: string;
8
+ }) => Promise<Array<{
9
+ content: string;
10
+ render?: () => VNodeChild;
11
+ [key: string]: any;
12
+ }>>;
13
+ export type QueryRecord = (props: {
14
+ page: number;
15
+ }) => Promise<Array<{
16
+ createdByMe: boolean;
17
+ content: string;
18
+ render?: () => VNodeChild;
19
+ [key: string]: any;
20
+ }>>;
@@ -0,0 +1 @@
1
+ const t=Symbol("InjectionAIChat"),o=Symbol("InjectionAIChatEmits");export{t as InjectionAIChat,o as InjectionAIChatEmits};
@@ -0,0 +1 @@
1
+ .ai-chat{background:linear-gradient(135deg,#c9dbfb,#c9dbfb 20%,rgba(237,237,253,.5) 70%,rgba(151,97,251,.2));display:flex;flex-flow:column nowrap;height:100%;padding:45px 0 60px;width:100%}.ai-chat *{box-sizing:border-box}.ai-chat .fillet-10{border-radius:10px}.ai-chat .fillet-8{border-radius:8px}.ai-chat .n-avatar{background-color:var(--c-primary-color)}.ai-chat .chat-main{display:flex;flex:1;flex-flow:column-reverse nowrap;overflow-y:scroll;padding:0 130px 0 82px;row-gap:16px}.ai-chat .chat-main::-webkit-scrollbar{width:5px}.ai-chat .chat-main::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:5px}.ai-chat .chat-main .message-item{column-gap:8px;display:flex;flex-flow:row nowrap}.ai-chat .chat-main .message-item .n-avatar{flex-shrink:0}.ai-chat .chat-main .message-item .content{background:#fff;padding:10px 12px}.ai-chat .chat-main .message-item .content.mine{background:hsla(0,0%,100%,.48)}.ai-chat .chat-main .message-item .content.loading{align-items:center;color:#999;column-gap:10px;display:flex}.ai-chat .chat-footer{padding:30px 130px 0}.ai-chat .chat-footer.disabled{cursor:not-allowed}.ai-chat .chat-footer .menu-box{background:#fff;column-gap:8px;display:flex;margin-bottom:8px;padding:10px}.ai-chat .chat-footer .input-wrapper{background:#fff;box-shadow:0 3px 4px 0 rgba(0,0,0,.1);padding:15px 20px}.ai-chat .chat-footer .input-wrapper .n-input__border,.ai-chat .chat-footer .input-wrapper .n-input__state-border{border:none}.ai-chat .chat-footer .input-wrapper .n-input:not(.n-input--disabled).n-input--focus .n-input__state-border{box-shadow:unset}.ai-chat .chat-footer .input-wrapper .btn-box{display:flex;justify-content:flex-end}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send{align-items:center;background:linear-gradient(178deg,#8f66f7,#4170ee);cursor:pointer;display:flex;height:46px;justify-content:center;width:58px}.ai-chat .chat-footer .input-wrapper .btn-box .btn-send.disabled{cursor:not-allowed}
@@ -1 +1 @@
1
- import{defineComponent as e,computed as o,ref as l,onDeactivated as t,createVNode as a,unref as u,createTextVNode as n}from"vue";import{useTheme as r}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isString as i,isObject as s,isArray as d,isFunction as m}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import{promiseTimeout as v}from"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import{FileTrayFull as c,FileTray as p}from"@vicons/ionicons5";import{NPopover as f,NDivider as h,NEllipsis as V,NIcon as g,NPopselect as y,NButton as b,NInput as w}from"naive-ui";var x=e({props:{modelValue:{type:[String,Object],default:""},shortcuts:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(e,{emit:x}){const k=r(),T=o({get:()=>i(e.modelValue)?e.modelValue:s(e.modelValue)&&e.modelValue.content||"",set(o){let l=o;s(e.modelValue)&&(l={...e.modelValue,content:o}),x("update:modelValue",l)}}),P=l(!1),R=o({get:()=>P.value,async set(e){P.value=e,!e&&M.value&&(await new Promise((e=>setTimeout(e,200))),M.value=!1)}}),_=o((()=>{let o=e.shortcuts||[];return s(e.modelValue)&&(d(e.modelValue.shortcuts)?o=e.modelValue.shortcuts:Reflect.has(e.modelValue,"shortcuts")&&(o=[])),o.map((e=>i(e)?{label:e,value:e}:e))})),j=l(),M=l(!1);let C,U;async function z(){var e,o;await v(50),null==(o=null==(e=j.value)?void 0:e.syncPosition)||o.call(e)}function L(e){e.stopPropagation(),clearTimeout(C),R.value&&M.value?R.value=!1:u(T)||(C=setTimeout((()=>(M.value=R.value=!0,z())),200))}function S(e){if(e.stopPropagation(),clearTimeout(C),u(T))return M.value=R.value=!0,z()}function W(e){e.stopPropagation(),clearTimeout(U),u(T)&&(R.value=!0)}function A(e){e.stopPropagation(),clearTimeout(U),u(T)&&!M.value&&(U=setTimeout((()=>{R.value=!1}),300))}return t((()=>{R.value=!1})),function(){return a("section",{class:["annotation-edit",{"is-active":!!u(T)}],style:{"--icon-right":"-5",...k.value},"annotation-hover-show":!u(T)&&!M.value},[a(f,{ref:j,to:"body",flip:!0,"keep-alive-on-hover":!0,style:{maxWidth:"360px",wordBreak:"break-all"},show:R.value,"onUpdate:show":e=>R.value=e,trigger:"manual",duration:100,onClickoutside:L},{default:function(){return a("section",{onMouseleave:A,onMouseenter:W},[a("div",null,[M.value?[_.value.length?a(y,{options:_.value,"onUpdate:value":e=>T.value+=e,scrollable:!0},{default:()=>a(b,{style:"margin-bottom: 8px;"},{default:()=>"短语"})}):null,a(w,{resizable:!1,autosize:{minRows:3,maxRows:5},"show-count":!0,class:"annotation-edit__textarea",type:"textarea",value:T.value,"onUpdate:value":e=>T.value=e},null)]:a("span",null,[u(T)])]),s(e.modelValue)&&(m(e.modelValue.footerRender)||e.modelValue.author||e.modelValue.date)?[a(h,{style:{margin:"4px 0",minWidth:"360px"}},null),a("section",{class:"annotation-edit__footer"},[m(e.modelValue.footerRender)?e.modelValue.footerRender(e.modelValue):[a(V,null,{default:()=>{var o;return[null!=(o=e.modelValue.authorLabel)?o:"质控人",n(": "),e.modelValue.author]}}),a(V,null,{default:()=>{var o;return[null!=(o=e.modelValue.dateLabel)?o:"质控时间",n(": "),e.modelValue.date]}})]])]:null])},trigger:function(){return a("div",{class:"annotation-edit__icon",onMouseleave:A,onMouseenter:W,onDblclick:S,onClick:L},[a(g,{component:u(T)?c:p},null)])}})])}}});export{x as default};
1
+ import{defineComponent as e,computed as o,ref as l,onDeactivated as t,createVNode as a,unref as u,createTextVNode as n}from"vue";import{useTheme as r}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isString as s,isObject as i,isArray as d,isFunction as m}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import{promiseTimeout as c}from"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import{FileTrayFull as v,FileTray as p}from"@vicons/ionicons5";import{NPopover as f,NDivider as h,NEllipsis as V,NIcon as g,NPopselect as y,NButton as b,NInput as k}from"naive-ui";import"../../../shared/hooks/useScrollLoading.js";var w=e({props:{modelValue:{type:[String,Object],default:""},shortcuts:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(e,{emit:w}){const x=r(),T=o({get:()=>s(e.modelValue)?e.modelValue:i(e.modelValue)&&e.modelValue.content||"",set(o){let l=o;i(e.modelValue)&&(l={...e.modelValue,content:o}),w("update:modelValue",l)}}),P=l(!1),R=o({get:()=>P.value,async set(e){P.value=e,!e&&M.value&&(await new Promise((e=>setTimeout(e,200))),M.value=!1)}}),_=o((()=>{let o=e.shortcuts||[];return i(e.modelValue)&&(d(e.modelValue.shortcuts)?o=e.modelValue.shortcuts:Reflect.has(e.modelValue,"shortcuts")&&(o=[])),o.map((e=>s(e)?{label:e,value:e}:e))})),j=l(),M=l(!1);let C,L;async function S(){var e,o;await c(50),null==(o=null==(e=j.value)?void 0:e.syncPosition)||o.call(e)}function U(e){e.stopPropagation(),clearTimeout(C),R.value&&M.value?R.value=!1:u(T)||(C=setTimeout((()=>(M.value=R.value=!0,S())),200))}function z(e){if(e.stopPropagation(),clearTimeout(C),u(T))return M.value=R.value=!0,S()}function W(e){e.stopPropagation(),clearTimeout(L),u(T)&&(R.value=!0)}function A(e){e.stopPropagation(),clearTimeout(L),u(T)&&!M.value&&(L=setTimeout((()=>{R.value=!1}),300))}return t((()=>{R.value=!1})),function(){return a("section",{class:["annotation-edit",{"is-active":!!u(T)}],style:{"--icon-right":"-5",...x.value},"annotation-hover-show":!u(T)&&!M.value},[a(f,{ref:j,to:"body",flip:!0,"keep-alive-on-hover":!0,style:{maxWidth:"360px",wordBreak:"break-all"},show:R.value,"onUpdate:show":e=>R.value=e,trigger:"manual",duration:100,onClickoutside:U},{default:function(){return a("section",{onMouseleave:A,onMouseenter:W},[a("div",null,[M.value?[_.value.length?a(y,{options:_.value,"onUpdate:value":e=>T.value+=e,scrollable:!0},{default:()=>a(b,{style:"margin-bottom: 8px;"},{default:()=>"短语"})}):null,a(k,{resizable:!1,autosize:{minRows:3,maxRows:5},"show-count":!0,class:"annotation-edit__textarea",type:"textarea",value:T.value,"onUpdate:value":e=>T.value=e},null)]:a("span",null,[u(T)])]),i(e.modelValue)&&(m(e.modelValue.footerRender)||e.modelValue.author||e.modelValue.date)?[a(h,{style:{margin:"4px 0",minWidth:"360px"}},null),a("section",{class:"annotation-edit__footer"},[m(e.modelValue.footerRender)?e.modelValue.footerRender(e.modelValue):[a(V,null,{default:()=>{var o;return[null!=(o=e.modelValue.authorLabel)?o:"质控人",n(": "),e.modelValue.author]}}),a(V,null,{default:()=>{var o;return[null!=(o=e.modelValue.dateLabel)?o:"质控时间",n(": "),e.modelValue.date]}})]])]:null])},trigger:function(){return a("div",{class:"annotation-edit__icon",onMouseleave:A,onMouseenter:W,onDblclick:z,onClick:U},[a(g,{component:u(T)?v:p},null)])}})])}}});export{w as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,onMounted as t,watch as s,openBlock as n,createBlock as i,unref as r,normalizeStyle as a,withCtx as c,createElementVNode as l,toDisplayString as p,createVNode as u}from"vue";import{NModal as d,NIcon as m}from"naive-ui";import{Mic as v}from"@vicons/ionicons5";import{useTheme as f}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";const h={class:"c-recording-wrapper"},k={class:"content"},y=l("div",{class:"animation"},null,-1),w=l("p",{class:"tip"},"按下空格键停止录音",-1);var g=e({__name:"recordingDialog",props:{visible:{type:Boolean,default:!1},content:{type:String,default:""}},setup(e){const g=e,b=f(),j=o(!0);function x(e){" "!==e.key&&"Space"!==e.code||(e.preventDefault(),C())}function C(){j.value=!1,document.removeEventListener("keydown",x)}return t((()=>{document.addEventListener("keydown",x)})),s((()=>g.visible),(e=>{j.value=e})),(o,t)=>(n(),i(r(d),{show:j.value,"onUpdate:show":t[0]||(t[0]=e=>j.value=e),style:a(r(b)),onEsc:C,onMaskClick:C},{default:c((()=>[l("div",h,[l("p",k,p(e.content||"正在聆听..."),1),y,l("div",{class:"icon-box",onClick:C},[u(r(m),{size:"60",color:"#fff",component:r(v)},null,8,["component"])]),w])])),_:1},8,["show","style"]))}});export{g as default};
1
+ import{defineComponent as e,ref as o,onMounted as s,watch as t,openBlock as n,createBlock as i,unref as r,normalizeStyle as a,withCtx as c,createElementVNode as l,toDisplayString as p,createVNode as u}from"vue";import{NModal as d,NIcon as m}from"naive-ui";import{Mic as v}from"@vicons/ionicons5";import{useTheme as f}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../shared/hooks/useScrollLoading.js";const h={class:"c-recording-wrapper"},k={class:"content"},y=l("div",{class:"animation"},null,-1),w=l("p",{class:"tip"},"按下空格键停止录音",-1);var g=e({__name:"recordingDialog",props:{visible:{type:Boolean,default:!1},content:{type:String,default:""}},setup(e){const g=e,j=f(),S=o(!0);function b(e){" "!==e.key&&"Space"!==e.code||(e.preventDefault(),x())}function x(){S.value=!1,document.removeEventListener("keydown",b)}return s((()=>{document.addEventListener("keydown",b)})),t((()=>g.visible),(e=>{S.value=e})),(o,s)=>(n(),i(r(d),{show:S.value,"onUpdate:show":s[0]||(s[0]=e=>S.value=e),style:a(r(j)),onEsc:x,onMaskClick:x},{default:c((()=>[l("div",h,[l("p",k,p(e.content||"正在聆听..."),1),y,l("div",{class:"icon-box",onClick:x},[u(r(m),{size:"60",color:"#fff",component:r(v)},null,8,["component"])]),w])])),_:1},8,["show","style"]))}});export{g as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,reactive as n,createVNode as a,createTextVNode as o,watch as r,openBlock as s,createElementBlock as i,normalizeStyle as l,unref as d,createElementVNode as u,Fragment as c,renderList as m,normalizeClass as p,toDisplayString as v,createCommentVNode as y,createBlock as f,nextTick as h}from"vue";import{NIcon as C}from"naive-ui";import{ChevronBackOutline as g,ChevronForwardOutline as M}from"@vicons/ionicons5";import D from"@fullcalendar/vue3";import k from"@fullcalendar/resource-timegrid";import w from"@fullcalendar/scrollgrid";import b from"@fullcalendar/interaction";import{useTheme as H}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import{format as R,isSameDay as x,toDate as L,startOfMonth as j,endOfMonth as N,eachDayOfInterval as z,getDay as O,isSameMonth as S,startOfDay as T,endOfDay as F}from"date-fns";import{isFunction as I,cloneDeep as _}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";const A={key:0,class:"select-day-wrapper"},E={class:"day-wrapper"},G=["onClick"];var P=e({__name:"Calendar",props:{showDateNavigation:{type:Boolean,default:!0},date:{type:Date,default:new Date},events:{type:Array,default:()=>[]},resources:{type:Array,default:()=>[]},eventContentRender:{type:Function},resourceLabelContentRender:{type:Function},options:{type:Object,default:()=>({})}},emits:["select","eventDrag","eventClick","eventResize","dateChange"],setup(e,{expose:P,emit:B}){const K=e,V=["周一","周二","周三","周四","周五","周六","周日"],W=H(),q=t(),J=t(new Date),Q=t([]),U=t(!1),X=n({schedulerLicenseKey:"GPL-My-Project-Is-Open-Source",plugins:[k,w,b],initialView:"resourceTimeGridDay",initialDate:R(J.value,"yyyy-MM-dd"),headerToolbar:{left:"",center:"",right:""},allDaySlot:!1,slotLabelInterval:{minute:30},slotLabelFormat:{hour:"2-digit",minute:"2-digit",meridiem:!1,hour12:!1},slotLabelContent:e=>R(e.date,"HH:mm"),nowIndicator:!0,dayMaxEvents:!0,eventOverlap:!1,slotMinTime:{hour:0},slotMaxTime:{hour:24},dayMinWidth:100,expandRows:!0,droppable:!0,editable:!0,selectable:!0,refetchResourcesOnNavigate:!0,resources:[],events:[],dayCellClassNames:["custom-day-cell"],eventClassNames:["custom-event"],eventContent:function(e){const{start:t,end:n,title:r}=e.event;return I(K.eventContentRender)?K.eventContentRender(e):[a("p",{class:"text"},[R(t,"HH:mm"),o("-"),R(n,"HH:mm")]),a("p",{class:"text"},[r])]},resourceLabelContent:function(e){const{title:t}=e.resource;return I(K.resourceLabelContentRender)?K.resourceLabelContentRender(e):a("span",null,[t])},select:(...e)=>B("select",...e),eventDrop:(...e)=>B("eventDrag",...e),eventResize:(...e)=>B("eventResize",...e),eventClick:(...e)=>B("eventClick",...e)});function Y(e){const t=L(J.value);"prev"===e?t.setMonth(t.getMonth()-1):t.setMonth(t.getMonth()+1),Z(t),B("dateChange",$())}function Z(e){const t=j(e),n=N(e),a=z({start:t,end:n});Q.value=a.map((e=>({date:e,formatDate:R(e,"yyyy-MM-dd HH:mm:ss"),day:e.getDate(),week:V[O(e)]}))),J.value=S(e,new Date)?new Date:Q.value[0].date}function $(){const e=T(J.value),t=F(J.value);return{start:e,end:t,startStr:R(e,"yyyy-MM-dd HH:mm:ss"),endStr:R(t,"yyyy-MM-dd HH:mm:ss")}}return r((()=>J.value),(e=>{!async function(e){U.value=!1,await h(),e(),U.value=!0}((()=>{X.initialDate=R(e,"yyyy-MM-dd")}))})),r((()=>K.date),(e=>{Z(e)}),{immediate:!0}),r((()=>K.events),(e=>{X.events=_(e).map((e=>({...e,resourceEditable:!1})))}),{deep:!0,immediate:!0}),r((()=>K.resources),(e=>{X.resources=_(e)}),{deep:!0,immediate:!0}),r((()=>K.options),(()=>{Object.assign(X,K.options)}),{deep:!0,immediate:!0}),P({gotoDate:function(e){J.value=e}}),(t,n)=>(s(),i("div",{class:"c-calendar",style:l({...d(W),"--nav-height":e.showDateNavigation?"70px":"0px"})},[e.showDateNavigation?(s(),i("div",A,[a(d(C),{size:"20",component:d(g),onClick:n[0]||(n[0]=()=>Y("prev"))},null,8,["component"]),u("div",E,[(s(!0),i(c,null,m(Q.value,((e,t)=>(s(),i("div",{class:p(["day",{"day--active":d(x)(e.date,J.value)}]),key:t,onClick:()=>async function(e){J.value=e.date,B("dateChange",$())}(e)},[u("p",null,v(e.day),1),u("span",null,v(e.week),1)],10,G)))),128))]),a(d(C),{size:"20",component:d(M),onClick:n[1]||(n[1]=()=>Y("next"))},null,8,["component"])])):y("v-if",!0),U.value?(s(),f(d(D),{key:1,ref_key:"calendarRef",ref:q,options:X},null,8,["options"])):y("v-if",!0)],4))}});export{P as default};
1
+ import{defineComponent as e,ref as t,reactive as n,createVNode as a,createTextVNode as o,watch as r,openBlock as s,createElementBlock as i,normalizeStyle as l,unref as d,createElementVNode as u,Fragment as c,renderList as m,normalizeClass as p,toDisplayString as v,createCommentVNode as y,createBlock as f,nextTick as h}from"vue";import{NIcon as C}from"naive-ui";import{ChevronBackOutline as g,ChevronForwardOutline as M}from"@vicons/ionicons5";import D from"@fullcalendar/vue3";import k from"@fullcalendar/resource-timegrid";import w from"@fullcalendar/scrollgrid";import b from"@fullcalendar/interaction";import{useTheme as H}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import{format as R,isSameDay as x,toDate as L,startOfMonth as j,endOfMonth as N,eachDayOfInterval as S,getDay as z,isSameMonth as O,startOfDay as T,endOfDay as F}from"date-fns";import{isFunction as I,cloneDeep as _}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../shared/hooks/useScrollLoading.js";const A={key:0,class:"select-day-wrapper"},E={class:"day-wrapper"},G=["onClick"];var P=e({__name:"Calendar",props:{showDateNavigation:{type:Boolean,default:!0},date:{type:Date,default:new Date},events:{type:Array,default:()=>[]},resources:{type:Array,default:()=>[]},eventContentRender:{type:Function},resourceLabelContentRender:{type:Function},options:{type:Object,default:()=>({})}},emits:["select","eventDrag","eventClick","eventResize","dateChange"],setup(e,{expose:P,emit:B}){const K=e,V=["周一","周二","周三","周四","周五","周六","周日"],W=H(),q=t(),J=t(new Date),Q=t([]),U=t(!1),X=n({schedulerLicenseKey:"GPL-My-Project-Is-Open-Source",plugins:[k,w,b],initialView:"resourceTimeGridDay",initialDate:R(J.value,"yyyy-MM-dd"),headerToolbar:{left:"",center:"",right:""},allDaySlot:!1,slotLabelInterval:{minute:30},slotLabelFormat:{hour:"2-digit",minute:"2-digit",meridiem:!1,hour12:!1},slotLabelContent:e=>R(e.date,"HH:mm"),nowIndicator:!0,dayMaxEvents:!0,eventOverlap:!1,slotMinTime:{hour:0},slotMaxTime:{hour:24},dayMinWidth:100,expandRows:!0,droppable:!0,editable:!0,selectable:!0,refetchResourcesOnNavigate:!0,resources:[],events:[],dayCellClassNames:["custom-day-cell"],eventClassNames:["custom-event"],eventContent:function(e){const{start:t,end:n,title:r}=e.event;return I(K.eventContentRender)?K.eventContentRender(e):[a("p",{class:"text"},[R(t,"HH:mm"),o("-"),R(n,"HH:mm")]),a("p",{class:"text"},[r])]},resourceLabelContent:function(e){const{title:t}=e.resource;return I(K.resourceLabelContentRender)?K.resourceLabelContentRender(e):a("span",null,[t])},select:(...e)=>B("select",...e),eventDrop:(...e)=>B("eventDrag",...e),eventResize:(...e)=>B("eventResize",...e),eventClick:(...e)=>B("eventClick",...e)});function Y(e){const t=L(J.value);"prev"===e?t.setMonth(t.getMonth()-1):t.setMonth(t.getMonth()+1),Z(t),B("dateChange",$())}function Z(e){const t=j(e),n=N(e),a=S({start:t,end:n});Q.value=a.map((e=>({date:e,formatDate:R(e,"yyyy-MM-dd HH:mm:ss"),day:e.getDate(),week:V[z(e)]}))),J.value=O(e,new Date)?new Date:Q.value[0].date}function $(){const e=T(J.value),t=F(J.value);return{start:e,end:t,startStr:R(e,"yyyy-MM-dd HH:mm:ss"),endStr:R(t,"yyyy-MM-dd HH:mm:ss")}}return r((()=>J.value),(e=>{!async function(e){U.value=!1,await h(),e(),U.value=!0}((()=>{X.initialDate=R(e,"yyyy-MM-dd")}))})),r((()=>K.date),(e=>{Z(e)}),{immediate:!0}),r((()=>K.events),(e=>{X.events=_(e).map((e=>({...e,resourceEditable:!1})))}),{deep:!0,immediate:!0}),r((()=>K.resources),(e=>{X.resources=_(e)}),{deep:!0,immediate:!0}),r((()=>K.options),(()=>{Object.assign(X,K.options)}),{deep:!0,immediate:!0}),P({gotoDate:function(e){J.value=e}}),(t,n)=>(s(),i("div",{class:"c-calendar",style:l({...d(W),"--nav-height":e.showDateNavigation?"70px":"0px"})},[e.showDateNavigation?(s(),i("div",A,[a(d(C),{size:"20",component:d(g),onClick:n[0]||(n[0]=()=>Y("prev"))},null,8,["component"]),u("div",E,[(s(!0),i(c,null,m(Q.value,((e,t)=>(s(),i("div",{class:p(["day",{"day--active":d(x)(e.date,J.value)}]),key:t,onClick:()=>async function(e){J.value=e.date,B("dateChange",$())}(e)},[u("p",null,v(e.day),1),u("span",null,v(e.week),1)],10,G)))),128))]),a(d(C),{size:"20",component:d(M),onClick:n[1]||(n[1]=()=>Y("next"))},null,8,["component"])])):y("v-if",!0),U.value?(s(),f(d(D),{key:1,ref_key:"calendarRef",ref:q,options:X},null,8,["options"])):y("v-if",!0)],4))}});export{P as default};
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as t,ref as a,computed as l,watch as n,openBlock as o,createBlock as u,unref as r,isRef as i,createSlots as s,renderList as d,withCtx as c,renderSlot as f,nextTick as m}from"vue";import{NDatePicker as p}from"naive-ui";import"../../../shared/utils/index.js";import{useDateTime as v,handleInputEvent as y}from"../../../shared/hooks/useDateTime.js";import{isArray as h,isEqual as g,isString as w}from"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{format as V,sub as k,startOfDay as R,endOfDay as D}from"date-fns";var S=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function},formattedValue:{type:[String,Array]},placeholder:{type:String},allowedInvalidValue:{type:String},to:{type:[Object,String,Boolean],default:"body"}},emits:["update:formatted-value"],setup(e,{expose:S,emit:I}){const C=e,M=t(),_=a(null),b=a(null),$=a();let j="";const P=l({get:()=>T(C.formattedValue)?null:C.formattedValue,set(e){h(e)&&h(j)&&g(j,e)||j===e||(I("update:formatted-value",e,w(e)?Date.parse(e):h(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),j=e)}}),U=l((()=>{const e=Reflect.get(M,"type")||"";return["datetime","datetimerange"].includes(e)})),x=l((()=>{if(Reflect.get(M,"format"))return M.format;const e=M.type||"";return U.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),H=l((()=>U.value?x.value.split(" "):"")),{focus:q,blur:A,handleConfirm:B}=v(_,{formatRef:x,attrs:M,emit:I,allowedInvalidValue:C.allowedInvalidValue});async function F(e){e&&U.value&&(await m(),async function e(t=0){var a;t>2||(b.value=null==(a=_.value)?void 0:a.panelInstRef,b.value?v(b,{formatRef:H,attrs:M,isPanel:!0}):(await m(),e(++t)))}())}async function O(...e){var t,a,l,n,o,u;const r=Reflect.get(M,"type")||"",i=null==(n=null==(l=null==(a=null==(t=_.value)?void 0:t.inputInstRef)?void 0:a.$el)?void 0:l.querySelector)?void 0:n.call(l,"input");if(r.includes("range")?null==(o=C.onConfirm)||o.call(C,...e):(await m(),i.focus(),B(i),i.blur(),null==(u=C.onConfirm)||u.call(C,Date.parse(i.value),i.value)),!(null==i?void 0:i.value)||!C.updateUnchangedValue||r.includes("range"))return;const s=i.value;y(i,V(new Date,x.value)),y(i,s)}function T(e){return C.allowedInvalidValue&&C.allowedInvalidValue===e}return n((()=>C.formattedValue),(e=>{$.value=T(e)?e:C.placeholder?C.placeholder:"选择日期时间",T(e)||(j=e)}),{immediate:!0}),S({$datePicker:_,focus:q,blur:A,setShortcutValue:async function(e){const t=Reflect.get(M,"type")||"";if(!t||!t.includes("range")||!_.value)return;const a=_.value.$el.querySelectorAll(".n-input__input-el");let l,n;const o=new Date;if("week"===e){const e=k(o,{weeks:1});l=V(R(e),x.value)}else{const e=k(o,{months:1});l=V(R(e),x.value)}n=V(D(o),x.value),y(a[0],l),await m(),y(a[1],n)}}),(t,a)=>(o(),u(r(p),{ref_key:"datePickerRef",ref:_,"onUpdate:show":F,onConfirm:O,placeholder:$.value,to:e.to,"formatted-value":r(P),"onUpdate:formatted-value":a[0]||(a[0]=e=>i(P)?P.value=e:null)},s({_:2},[d(t.$slots,((e,a)=>({name:a,fn:c((()=>[f(t.$slots,a)]))})))]),1032,["placeholder","to","formatted-value"]))}});export{S as default};
1
+ import{defineComponent as e,useAttrs as t,ref as a,computed as l,watch as o,openBlock as n,createBlock as u,unref as r,isRef as i,createSlots as s,renderList as d,withCtx as c,renderSlot as f,nextTick as m}from"vue";import{NDatePicker as p}from"naive-ui";import"../../../shared/utils/index.js";import{useDateTime as v,handleInputEvent as y}from"../../../shared/hooks/useDateTime.js";import{isArray as h,isEqual as g,isString as w}from"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{format as V,sub as k,startOfDay as R,endOfDay as S}from"date-fns";var D=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function},formattedValue:{type:[String,Array]},placeholder:{type:String},allowedInvalidValue:{type:String},to:{type:[Object,String,Boolean],default:"body"}},emits:["update:formatted-value"],setup(e,{expose:D,emit:I}){const C=e,M=t(),_=a(null),b=a(null),j=a();let $="";const P=l({get:()=>O(C.formattedValue)?null:C.formattedValue,set(e){h(e)&&h($)&&g($,e)||$===e||(I("update:formatted-value",e,w(e)?Date.parse(e):h(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),$=e)}}),U=l((()=>{const e=Reflect.get(M,"type")||"";return["datetime","datetimerange"].includes(e)})),x=l((()=>{if(Reflect.get(M,"format"))return M.format;const e=M.type||"";return U.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),H=l((()=>U.value?x.value.split(" "):"")),{focus:q,blur:A,handleConfirm:B}=v(_,{formatRef:x,attrs:M,emit:I,allowedInvalidValue:C.allowedInvalidValue});async function F(e){e&&U.value&&(await m(),async function e(t=0){var a;t>2||(b.value=null==(a=_.value)?void 0:a.panelInstRef,b.value?v(b,{formatRef:H,attrs:M,isPanel:!0}):(await m(),e(++t)))}())}async function L(...e){var t,a,l,o,n,u;const r=Reflect.get(M,"type")||"",i=null==(o=null==(l=null==(a=null==(t=_.value)?void 0:t.inputInstRef)?void 0:a.$el)?void 0:l.querySelector)?void 0:o.call(l,"input");if(r.includes("range")?null==(n=C.onConfirm)||n.call(C,...e):(await m(),i.focus(),B(i),i.blur(),null==(u=C.onConfirm)||u.call(C,Date.parse(i.value),i.value)),!(null==i?void 0:i.value)||!C.updateUnchangedValue||r.includes("range"))return;const s=i.value;y(i,V(new Date,x.value)),y(i,s)}function O(e){return C.allowedInvalidValue&&C.allowedInvalidValue===e}return o((()=>C.formattedValue),(e=>{j.value=O(e)?e:C.placeholder?C.placeholder:"选择日期时间",O(e)||($=e)}),{immediate:!0}),D({$datePicker:_,focus:q,blur:A,setShortcutValue:async function(e){const t=Reflect.get(M,"type")||"";if(!t||!t.includes("range")||!_.value)return;const a=_.value.$el.querySelectorAll(".n-input__input-el");let l,o;const n=new Date;if("week"===e){const e=k(n,{weeks:1});l=V(R(e),x.value)}else{const e=k(n,{months:1});l=V(R(e),x.value)}o=V(S(n),x.value),y(a[0],l),await m(),y(a[1],o)}}),(t,a)=>(n(),u(r(p),{ref_key:"datePickerRef",ref:_,"onUpdate:show":F,onConfirm:L,placeholder:j.value,to:e.to,"formatted-value":r(P),"onUpdate:formatted-value":a[0]||(a[0]=e=>i(P)?P.value=e:null)},s({_:2},[d(t.$slots,((e,a)=>({name:a,fn:c((()=>[f(t.$slots,a)]))})))]),1032,["placeholder","to","formatted-value"]))}});export{D as default};
@@ -486,9 +486,9 @@ declare const _default: import("vue").DefineComponent<{
486
486
  }>;
487
487
  developMode: boolean;
488
488
  draggable: boolean;
489
- isHighlightRow: boolean;
490
489
  idx: number;
491
490
  isHighlight: boolean;
491
+ isHighlightRow: boolean;
492
492
  isFieldSet: boolean;
493
493
  fieldDescribeMode: "column" | "tooltip";
494
494
  }>;
@@ -508,9 +508,9 @@ declare const _default: import("vue").DefineComponent<{
508
508
  }>;
509
509
  developMode: boolean;
510
510
  draggable: boolean;
511
- isHighlightRow: boolean;
512
511
  idx: number;
513
512
  isHighlight: boolean;
513
+ isHighlightRow: boolean;
514
514
  isFieldSet: boolean;
515
515
  fieldDescribeMode: "column" | "tooltip";
516
516
  }>;
@@ -646,9 +646,9 @@ declare const _default: import("vue").DefineComponent<{
646
646
  }>;
647
647
  developMode: boolean;
648
648
  draggable: boolean;
649
- isHighlightRow: boolean;
650
649
  idx: number;
651
650
  isHighlight: boolean;
651
+ isHighlightRow: boolean;
652
652
  isFieldSet: boolean;
653
653
  fieldDescribeMode: "column" | "tooltip";
654
654
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as l,ref as n,unref as o,openBlock as t,createElementBlock as i,normalizeStyle as a,createElementVNode as u,createVNode as s,Fragment as c,renderList as d,toDisplayString as p,createCommentVNode as r,withDirectives as m,vShow as f}from"vue";import{NIcon as v,NSelect as _,NInput as T,NInputNumber as E}from"naive-ui";import{AddCircleSharp as N,RemoveCircle as O}from"@vicons/ionicons5";import{CUSTOM_INPUT_OPTIONS as U,InjectionFieldList as y,InjectionQueryWordbookData as h,BOOLEAN_OPTIONS as I,UNIT_OPTIONS as k,FIELD_TYPE_LIST as b,SHOWSETTING_OPTIONS as Q,WORDBOOK_OPTIONS as g}from"../constants/index.js";import S from"../../../date-picker/index.js";import{useTheme as V}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{cloneDeep as L,isArray as x,isFunction as A}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";const D=u("span",{style:{"margin-left":"5px"}},"添加操作",-1),F={class:"condition-wrapper"},j={class:"item-index"},w={class:"sql-expression-wrapper"},R=u("span",null,"筛选器逻辑编辑,不设置默认为AND",-1),H=u("br",null,null,-1),C=u("span",null,"例子 (1 AND 2) OR 3",-1);var B=e({__name:"condition",props:{data:{type:Object,default:null}},setup(e,{expose:B}){const M=e,G=U[0].columnName,J=V(),P=L(l(y)),q=l(h),z=n([]),W=n("");function X(e,l=!1){var n,o;l||(e.compareFieldOptions=[],e.con="",Y(e));const{field_key:t}=e,i=P.find((e=>e.columnName===t));if(!i)return void(e.conOptions=[]);const{fieldType:a,settingObj:u={}}=i;e.fieldType=a;const s=L((null==(n=b.find((e=>e.name===a)))?void 0:n.conList)||[]),{showSetting:c,wordbook:d}=u;(null==c?void 0:c.length)&&s.unshift(...Q),(null==(o=Object.keys(d||{}))?void 0:o.length)&&s.unshift(...g),e.conOptions=s}async function K(e,l=!1){e.compareFieldOptions=[],l||Y(e);const{field_key:n,fieldType:o,con:t}=e,i=P.find((e=>e.columnName===n));if(!i)return void(e.conOptions=[]);const{settingObj:a={}}=i||{},{showSetting:u,wordbook:s}=a,c=[];if(["IN","NEQ","BIG","LESS","BIGEQ","LESSEQ","EQ"].includes(t)){c.push(...U),l||(e.compare_field=G);const t=P.filter((e=>e.fieldType===o&&e.columnName!==n));c.push(...t)}if(g.map((e=>e.name)).includes(t)&&A(q)){const l=await q(s);c.push(...(d=l,p="label",r="value",d.map((e=>({...e,title:e[p],columnName:e[r]}))))),e.multiple=!0}var d,p,r;if(Q.map((e=>e.name)).includes(t)&&(null==u?void 0:u.length)){const l=u.map((e=>({...e,title:e.change_text,columnName:JSON.stringify(e.filter||[])})));c.push(...l),e.multiple=!0}e.compareFieldOptions=c}function Y(e){e.multiple=!1,e.compare_field=null,e.value="",e.numberValue=null,e.dateValue=null,e.unit=null}function Z(e){const{con:l,fieldType:n}=e;return"BOOLEAN"===n&&l&&["EQ","NEQ"].includes(l)}function $(e){const{compare_field:l,con:n,fieldType:o}=e;return!(!n||["CONVERT","QUOTE","QUOTE_NOT"].includes(n))&&(!(!["TEXT","JSONB"].includes(o)||["NULL","NOT_NULL"].includes(n))&&(!["EQ","NEQ"].includes(n)||l===G))}function ee(e){if($(e))return!1;const{compare_field:l,con:n,field_key:o,fieldType:t}=e;return!(!n||["CONVERT","QUOTE","QUOTE_NOT"].includes(n))&&("NUMBER"===t?!["NULL","NOT_NULL"].includes(n)&&l===G:!!["DATE","DATETIME","TIME"].includes(t)&&["L_","N_","IN_THE_PAST","IN_THE_FUTURE","IN_THE_PAST_DI","IN_THE_FUTURE_DI"].includes(n))}function le(e){const{compare_field:l,con:n,field_key:o,fieldType:t}=e;return!!n&&(!!["DATE","DATETIME","TIME"].includes(t)&&["L_","N_","IN_THE_PAST","IN_THE_FUTURE","IN_THE_PAST_DI","IN_THE_FUTURE_DI"].includes(n))}function ne(e){const{compare_field:l,con:n,field_key:o,fieldType:t}=e;return!!n&&(!!["DATE","DATETIME","TIME"].includes(t)&&(["IN","NEQ","BIG","LESS","BIGEQ","LESSEQ"].includes(n)&&l===G))}function oe(e){return["IN","NEQ"].includes(e.con)?"datetimerange":"datetime"}function te(){const e={field_key:P[0].columnName,fieldType:"",con:"",conOptions:[],compare_field:"",compareFieldOptions:[],unit:"",numberValue:null,dateValue:null,multiple:!1};X(e),e.con="",z.value.push(e)}return function(){const{condition:e=[],sqlExpression:l=""}=M.data||{};e.length&&(z.value=e);l&&(W.value=l);z.value.forEach((e=>{X(e,!0),K(e,!0);const{con:l,value:n,start_val:o,end_val:t}=e;"CONVERT"===l&&(e.compare_field=x(n)?n.map((e=>JSON.stringify(e))):n),"QUOTE"!==l&&"QUOTE_NOT"!==l||(e.compare_field=n.split("|#|")),ee(e)&&(e.numberValue=+n),ne(e)&&(oe(e).endsWith("range")?e.dateValue=o&&t?[o,t]:null:e.dateValue=n)}))}(),B({getData:()=>({condition:z.value.map((e=>{const{field_key:l,con:n,value:o,compare_field:t,numberValue:i,dateValue:a,unit:u,fieldType:s,compareFieldOptions:c}=e;let d,p,r,m,f=o,v=t;return"CONVERT"===n&&(f=x(t)?t.map((e=>JSON.parse(e))):t,v=""),"QUOTE"!==n&&"QUOTE_NOT"!==n||(f=x(t)?t.join("|#|"):t,d=c.filter((e=>t.includes(e.columnName))),v=""),ee(e)&&(f=i,v=G),ne(e)&&(oe(e).endsWith("range")?(f="",r=x(a)?a[0]:"",m=x(a)?a[1]:""):f=a),le(e)&&(p=u),$(e)&&e.compareFieldOptions.length>0&&(v=G),{field_key:l,fieldType:s,con:n,value:f,compare_field:v,is_compare_field:!!v,start_val:r,end_val:m,wordbookValueList:d,unit:p}})),sqlExpression:o(W)})}),(e,l)=>(t(),i("div",{class:"c-field-set__condition",style:a(o(J))},[u("span",{class:"opt-btn",onClick:te},[s(o(v),{component:o(N),size:"20",color:"var(--c-primary-color)"},null,8,["component"]),D]),u("section",F,[(t(!0),i(c,null,d(z.value,((e,l)=>(t(),i("div",{class:"condition-wrapper__item",key:l},[u("span",j,p(l+1),1),r(" 选择 field_key "),s(o(_),{value:e.field_key,"onUpdate:value":[l=>e.field_key=l,l=>X(e)],placeholder:"请选择字段名","label-field":"title","value-field":"columnName",clearable:"",options:o(P)},null,8,["value","onUpdate:value","options"]),r(" 选择 关系 "),s(o(_),{value:e.con,"onUpdate:value":[l=>e.con=l,l=>K(e)],"label-field":"text","value-field":"name",options:e.conOptions},null,8,["value","onUpdate:value","options"]),r(" 下拉框展示本列表相同数据类型 "),m(s(o(_),{value:e.compare_field,"onUpdate:value":l=>e.compare_field=l,"label-field":"title","value-field":"columnName",clearable:"",multiple:e.multiple,options:e.compareFieldOptions},null,8,["value","onUpdate:value","multiple","options"]),[[f,e.compareFieldOptions.length>0]]),r(" 布尔值类型字段选择是否相等的值 "),m(s(o(_),{value:e.value,"onUpdate:value":l=>e.value=l,options:o(I)},null,8,["value","onUpdate:value","options"]),[[f,Z(e)]]),r(" 自定义内容 "),m(s(o(T),{value:e.value,"onUpdate:value":l=>e.value=l},null,8,["value","onUpdate:value"]),[[f,$(e)]]),r(" 自定义内容/数字框/日期 "),m(s(o(E),{value:e.numberValue,"onUpdate:value":l=>e.numberValue=l},null,8,["value","onUpdate:value"]),[[f,ee(e)]]),r(" 自定义日期的单位 "),m(s(o(_),{style:{width:"80px"},value:e.unit,"onUpdate:value":l=>e.unit=l,options:o(k)},null,8,["value","onUpdate:value","options"]),[[f,le(e)]]),m(s(o(S),{type:oe(e),"formatted-value":e.dateValue,"onUpdate:formatted-value":l=>e.dateValue=l},null,8,["type","formatted-value","onUpdate:formatted-value"]),[[f,ne(e)]]),s(o(v),{component:o(O),size:"20",color:"red",onClick:()=>function(e){z.value.splice(e,1)}(l)},null,8,["component","onClick"])])))),128))]),m(u("section",w,[R,H,C,s(o(T),{type:"textarea",value:W.value,"onUpdate:value":l[0]||(l[0]=e=>W.value=e)},null,8,["value"])],512),[[f,z.value.length>1]])],4))}});export{B as default};
1
+ import{defineComponent as e,inject as l,ref as n,unref as o,openBlock as t,createElementBlock as i,normalizeStyle as a,createElementVNode as u,createVNode as s,Fragment as c,renderList as d,toDisplayString as p,createCommentVNode as r,withDirectives as m,vShow as f}from"vue";import{NIcon as v,NSelect as _,NInput as T,NInputNumber as E}from"naive-ui";import{AddCircleSharp as N,RemoveCircle as O}from"@vicons/ionicons5";import{CUSTOM_INPUT_OPTIONS as U,InjectionFieldList as y,InjectionQueryWordbookData as h,BOOLEAN_OPTIONS as I,UNIT_OPTIONS as k,FIELD_TYPE_LIST as b,SHOWSETTING_OPTIONS as g,WORDBOOK_OPTIONS as Q}from"../constants/index.js";import S from"../../../date-picker/index.js";import{useTheme as L}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{cloneDeep as V,isArray as x,isFunction as A}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../shared/hooks/useScrollLoading.js";const D=u("span",{style:{"margin-left":"5px"}},"添加操作",-1),F={class:"condition-wrapper"},j={class:"item-index"},w={class:"sql-expression-wrapper"},R=u("span",null,"筛选器逻辑编辑,不设置默认为AND",-1),H=u("br",null,null,-1),C=u("span",null,"例子 (1 AND 2) OR 3",-1);var B=e({__name:"condition",props:{data:{type:Object,default:null}},setup(e,{expose:B}){const M=e,G=U[0].columnName,J=L(),P=V(l(y)),q=l(h),z=n([]),W=n("");function X(e,l=!1){var n,o;l||(e.compareFieldOptions=[],e.con="",Y(e));const{field_key:t}=e,i=P.find((e=>e.columnName===t));if(!i)return void(e.conOptions=[]);const{fieldType:a,settingObj:u={}}=i;e.fieldType=a;const s=V((null==(n=b.find((e=>e.name===a)))?void 0:n.conList)||[]),{showSetting:c,wordbook:d}=u;(null==c?void 0:c.length)&&s.unshift(...g),(null==(o=Object.keys(d||{}))?void 0:o.length)&&s.unshift(...Q),e.conOptions=s}async function K(e,l=!1){e.compareFieldOptions=[],l||Y(e);const{field_key:n,fieldType:o,con:t}=e,i=P.find((e=>e.columnName===n));if(!i)return void(e.conOptions=[]);const{settingObj:a={}}=i||{},{showSetting:u,wordbook:s}=a,c=[];if(["IN","NEQ","BIG","LESS","BIGEQ","LESSEQ","EQ"].includes(t)){c.push(...U),l||(e.compare_field=G);const t=P.filter((e=>e.fieldType===o&&e.columnName!==n));c.push(...t)}if(Q.map((e=>e.name)).includes(t)&&A(q)){const l=await q(s);c.push(...(d=l,p="label",r="value",d.map((e=>({...e,title:e[p],columnName:e[r]}))))),e.multiple=!0}var d,p,r;if(g.map((e=>e.name)).includes(t)&&(null==u?void 0:u.length)){const l=u.map((e=>({...e,title:e.change_text,columnName:JSON.stringify(e.filter||[])})));c.push(...l),e.multiple=!0}e.compareFieldOptions=c}function Y(e){e.multiple=!1,e.compare_field=null,e.value="",e.numberValue=null,e.dateValue=null,e.unit=null}function Z(e){const{con:l,fieldType:n}=e;return"BOOLEAN"===n&&l&&["EQ","NEQ"].includes(l)}function $(e){const{compare_field:l,con:n,fieldType:o}=e;return!(!n||["CONVERT","QUOTE","QUOTE_NOT"].includes(n))&&(!(!["TEXT","JSONB"].includes(o)||["NULL","NOT_NULL"].includes(n))&&(!["EQ","NEQ"].includes(n)||l===G))}function ee(e){if($(e))return!1;const{compare_field:l,con:n,field_key:o,fieldType:t}=e;return!(!n||["CONVERT","QUOTE","QUOTE_NOT"].includes(n))&&("NUMBER"===t?!["NULL","NOT_NULL"].includes(n)&&l===G:!!["DATE","DATETIME","TIME"].includes(t)&&["L_","N_","IN_THE_PAST","IN_THE_FUTURE","IN_THE_PAST_DI","IN_THE_FUTURE_DI"].includes(n))}function le(e){const{compare_field:l,con:n,field_key:o,fieldType:t}=e;return!!n&&(!!["DATE","DATETIME","TIME"].includes(t)&&["L_","N_","IN_THE_PAST","IN_THE_FUTURE","IN_THE_PAST_DI","IN_THE_FUTURE_DI"].includes(n))}function ne(e){const{compare_field:l,con:n,field_key:o,fieldType:t}=e;return!!n&&(!!["DATE","DATETIME","TIME"].includes(t)&&(["IN","NEQ","BIG","LESS","BIGEQ","LESSEQ"].includes(n)&&l===G))}function oe(e){return["IN","NEQ"].includes(e.con)?"datetimerange":"datetime"}function te(){const e={field_key:P[0].columnName,fieldType:"",con:"",conOptions:[],compare_field:"",compareFieldOptions:[],unit:"",numberValue:null,dateValue:null,multiple:!1};X(e),e.con="",z.value.push(e)}return function(){const{condition:e=[],sqlExpression:l=""}=M.data||{};e.length&&(z.value=e);l&&(W.value=l);z.value.forEach((e=>{X(e,!0),K(e,!0);const{con:l,value:n,start_val:o,end_val:t}=e;"CONVERT"===l&&(e.compare_field=x(n)?n.map((e=>JSON.stringify(e))):n),"QUOTE"!==l&&"QUOTE_NOT"!==l||(e.compare_field=n.split("|#|")),ee(e)&&(e.numberValue=+n),ne(e)&&(oe(e).endsWith("range")?e.dateValue=o&&t?[o,t]:null:e.dateValue=n)}))}(),B({getData:()=>({condition:z.value.map((e=>{const{field_key:l,con:n,value:o,compare_field:t,numberValue:i,dateValue:a,unit:u,fieldType:s,compareFieldOptions:c}=e;let d,p,r,m,f=o,v=t;return"CONVERT"===n&&(f=x(t)?t.map((e=>JSON.parse(e))):t,v=""),"QUOTE"!==n&&"QUOTE_NOT"!==n||(f=x(t)?t.join("|#|"):t,d=c.filter((e=>t.includes(e.columnName))),v=""),ee(e)&&(f=i,v=G),ne(e)&&(oe(e).endsWith("range")?(f="",r=x(a)?a[0]:"",m=x(a)?a[1]:""):f=a),le(e)&&(p=u),$(e)&&e.compareFieldOptions.length>0&&(v=G),{field_key:l,fieldType:s,con:n,value:f,compare_field:v,is_compare_field:!!v,start_val:r,end_val:m,wordbookValueList:d,unit:p}})),sqlExpression:o(W)})}),(e,l)=>(t(),i("div",{class:"c-field-set__condition",style:a(o(J))},[u("span",{class:"opt-btn",onClick:te},[s(o(v),{component:o(N),size:"20",color:"var(--c-primary-color)"},null,8,["component"]),D]),u("section",F,[(t(!0),i(c,null,d(z.value,((e,l)=>(t(),i("div",{class:"condition-wrapper__item",key:l},[u("span",j,p(l+1),1),r(" 选择 field_key "),s(o(_),{value:e.field_key,"onUpdate:value":[l=>e.field_key=l,l=>X(e)],placeholder:"请选择字段名","label-field":"title","value-field":"columnName",clearable:"",options:o(P)},null,8,["value","onUpdate:value","options"]),r(" 选择 关系 "),s(o(_),{value:e.con,"onUpdate:value":[l=>e.con=l,l=>K(e)],"label-field":"text","value-field":"name",options:e.conOptions},null,8,["value","onUpdate:value","options"]),r(" 下拉框展示本列表相同数据类型 "),m(s(o(_),{value:e.compare_field,"onUpdate:value":l=>e.compare_field=l,"label-field":"title","value-field":"columnName",clearable:"",multiple:e.multiple,options:e.compareFieldOptions},null,8,["value","onUpdate:value","multiple","options"]),[[f,e.compareFieldOptions.length>0]]),r(" 布尔值类型字段选择是否相等的值 "),m(s(o(_),{value:e.value,"onUpdate:value":l=>e.value=l,options:o(I)},null,8,["value","onUpdate:value","options"]),[[f,Z(e)]]),r(" 自定义内容 "),m(s(o(T),{value:e.value,"onUpdate:value":l=>e.value=l},null,8,["value","onUpdate:value"]),[[f,$(e)]]),r(" 自定义内容/数字框/日期 "),m(s(o(E),{value:e.numberValue,"onUpdate:value":l=>e.numberValue=l},null,8,["value","onUpdate:value"]),[[f,ee(e)]]),r(" 自定义日期的单位 "),m(s(o(_),{style:{width:"80px"},value:e.unit,"onUpdate:value":l=>e.unit=l,options:o(k)},null,8,["value","onUpdate:value","options"]),[[f,le(e)]]),m(s(o(S),{type:oe(e),"formatted-value":e.dateValue,"onUpdate:formatted-value":l=>e.dateValue=l},null,8,["type","formatted-value","onUpdate:formatted-value"]),[[f,ne(e)]]),s(o(v),{component:o(O),size:"20",color:"red",onClick:()=>function(e){z.value.splice(e,1)}(l)},null,8,["component","onClick"])])))),128))]),m(u("section",w,[R,H,C,s(o(T),{type:"textarea",value:W.value,"onUpdate:value":l[0]||(l[0]=e=>W.value=e)},null,8,["value"])],512),[[f,z.value.length>1]])],4))}});export{B as default};
@@ -1 +1 @@
1
- import{defineComponent as e,inject as l,ref as o,computed as a,reactive as t,openBlock as i,createBlock as r,unref as s,withCtx as n,createVNode as u,normalizeStyle as c,createElementVNode as d,createCommentVNode as m}from"vue";import{useMessage as p,NModal as f,NForm as v,NFormItem as b,NInput as h,NColorPicker as g,NSelect as k,NCheckbox as _,NRadioGroup as w,NSpace as y,NRadio as C}from"naive-ui";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import x from"./condition.vue.js";import F from"./edit-filter.vue.js";import{COLOR_MAP as N,InjectionFieldList as U}from"../constants/index.js";var O=e({__name:"edit-dialog",props:{visible:{type:Boolean,default:!1},isFieldColor:{type:Boolean,default:!0},row:{type:Object,default:null}},emits:["update:visible","confirm"],setup(e,{emit:O}){const q=e,S=j(),B=p(),E=Object.entries(N).map((([e,l])=>({label:l,value:e}))),R=Object.entries(N).map((([e])=>e)),D=l(U),H=o(),P=o(),T=o(!1),W=a((()=>q.row?q.isFieldColor?"修改":"过滤条件":"新增")),z=t({name:"",color:"",status:!0,columnName:"",colorScope:q.isFieldColor?"font":"background",condition:[],sqlExpression:""}),A=t({name:[{required:!0,message:"请输入名称",trigger:["blur"]}],color:[{required:!0,message:"请选择颜色",trigger:["blur"]}],columnName:[{required:!0,validator:(e,l)=>!(!l&&q.isFieldColor)||new Error("请选择字段"),trigger:["blur"]}]});function G(e){return u("span",{style:{"--color":e.value},class:"c-field-set__color-block"},[e.label])}function I(){var e;console.log(z),null==(e=H.value)||e.validate((async e=>{var l,o;if(e){const l=await e;B.warning(l[0][0].message)}else{if(q.isFieldColor||Object.assign(z,P.value.getData()),!(null==(l=z.condition)?void 0:l.length))return void B.warning("请配置过滤条件");const e=q.isFieldColor?{title:null==(o=D.find((e=>e.columnName===z.columnName)))?void 0:o.title}:{};O("confirm",{...z,...e}),J()}}))}function J(){O("update:visible",!1)}function K(e){Object.assign(z,e)}return function(){if(!q.row)return;Object.assign(z,q.row)}(),(l,o)=>(i(),r(s(f),{preset:"dialog",style:{width:"860px"},title:s(W),"close-on-esc":!1,"show-icon":!1,"mask-closable":!1,"positive-text":"确定","negative-text":"取消","trap-focus":!1,show:e.visible,onPositiveClick:I,onNegativeClick:J,onClose:J},{default:n((()=>[u(s(v),{ref_key:"formRef",ref:H,model:z,rules:A,"label-placement":"left","label-width":"auto","show-feedback":!1,"show-require-mark":!1,style:c({maxWidth:"500px",...s(S)})},{default:n((()=>[u(s(b),{label:"名称:",path:"name",style:{"margin-bottom":"10px"}},{default:n((()=>[u(s(h),{value:z.name,"onUpdate:value":o[0]||(o[0]=e=>z.name=e),placeholder:"请填写名称",clearable:""},null,8,["value"])])),_:1}),e.isFieldColor?(i(),r(s(b),{key:0,label:"颜色:",path:"color"},{default:n((()=>[u(s(g),{clearable:"",placeholder:"请选择颜色",value:z.color,"onUpdate:value":o[1]||(o[1]=e=>z.color=e),swatches:s(R),modes:["hex"],class:"c-field-set__color-picker"},null,8,["value","swatches"])])),_:1})):(i(),r(s(b),{key:1,label:"颜色:",path:"color"},{default:n((()=>[u(s(k),{value:z.color,"onUpdate:value":o[2]||(o[2]=e=>z.color=e),placeholder:"请选择颜色","render-label":G,options:s(E)},null,8,["value","options"])])),_:1})),u(s(b),{label:"显示:",path:"status"},{default:n((()=>[u(s(_),{checked:z.status,"onUpdate:checked":o[3]||(o[3]=e=>z.status=e)},null,8,["checked"])])),_:1}),u(s(b),{label:"颜色应用于:",path:"colorScope"},{default:n((()=>[u(s(w),{value:z.colorScope,"onUpdate:value":o[4]||(o[4]=e=>z.colorScope=e)},{default:n((()=>[u(s(y),null,{default:n((()=>[u(s(C),{label:"字体",value:"font"}),u(s(C),{label:"背景",value:"background"})])),_:1})])),_:1},8,["value"])])),_:1}),e.isFieldColor?(i(),r(s(b),{key:2,label:"字段:",path:"columnName",style:{"margin-bottom":"10px"}},{default:n((()=>[u(s(y),{class:"c-field-set__space",align:"center"},{default:n((()=>[u(s(k),{value:z.columnName,"onUpdate:value":o[5]||(o[5]=e=>z.columnName=e),placeholder:"请选择字段名","label-field":"title","value-field":"columnName",options:s(D)},null,8,["value","options"]),d("span",{class:"filter-btn",onClick:o[6]||(o[6]=()=>T.value=!0)},"筛选")])),_:1})])),_:1})):m("v-if",!0)])),_:1},8,["model","rules","style"]),e.isFieldColor?(i(),r(F,{key:1,visible:T.value,"onUpdate:visible":o[7]||(o[7]=e=>T.value=e),model:z,onConfirm:K},null,8,["visible","model"])):(i(),r(x,{key:0,ref_key:"conditionRef",ref:P,data:z},null,8,["data"]))])),_:1},8,["title","show"]))}});export{O as default};
1
+ import{defineComponent as e,inject as l,ref as o,computed as a,reactive as t,openBlock as i,createBlock as s,unref as r,withCtx as n,createVNode as u,normalizeStyle as c,createElementVNode as d,createCommentVNode as m}from"vue";import{useMessage as p,NModal as f,NForm as v,NFormItem as b,NInput as h,NColorPicker as g,NSelect as k,NCheckbox as _,NRadioGroup as w,NSpace as y,NRadio as C}from"naive-ui";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../../shared/hooks/useScrollLoading.js";import x from"./condition.vue.js";import F from"./edit-filter.vue.js";import{COLOR_MAP as N,InjectionFieldList as U}from"../constants/index.js";var O=e({__name:"edit-dialog",props:{visible:{type:Boolean,default:!1},isFieldColor:{type:Boolean,default:!0},row:{type:Object,default:null}},emits:["update:visible","confirm"],setup(e,{emit:O}){const S=e,q=j(),B=p(),E=Object.entries(N).map((([e,l])=>({label:l,value:e}))),R=Object.entries(N).map((([e])=>e)),D=l(U),H=o(),L=o(),P=o(!1),T=a((()=>S.row?S.isFieldColor?"修改":"过滤条件":"新增")),W=t({name:"",color:"",status:!0,columnName:"",colorScope:S.isFieldColor?"font":"background",condition:[],sqlExpression:""}),z=t({name:[{required:!0,message:"请输入名称",trigger:["blur"]}],color:[{required:!0,message:"请选择颜色",trigger:["blur"]}],columnName:[{required:!0,validator:(e,l)=>!(!l&&S.isFieldColor)||new Error("请选择字段"),trigger:["blur"]}]});function A(e){return u("span",{style:{"--color":e.value},class:"c-field-set__color-block"},[e.label])}function G(){var e;console.log(W),null==(e=H.value)||e.validate((async e=>{var l,o;if(e){const l=await e;B.warning(l[0][0].message)}else{if(S.isFieldColor||Object.assign(W,L.value.getData()),!(null==(l=W.condition)?void 0:l.length))return void B.warning("请配置过滤条件");const e=S.isFieldColor?{title:null==(o=D.find((e=>e.columnName===W.columnName)))?void 0:o.title}:{};O("confirm",{...W,...e}),I()}}))}function I(){O("update:visible",!1)}function J(e){Object.assign(W,e)}return function(){if(!S.row)return;Object.assign(W,S.row)}(),(l,o)=>(i(),s(r(f),{preset:"dialog",style:{width:"860px"},title:r(T),"close-on-esc":!1,"show-icon":!1,"mask-closable":!1,"positive-text":"确定","negative-text":"取消","trap-focus":!1,show:e.visible,onPositiveClick:G,onNegativeClick:I,onClose:I},{default:n((()=>[u(r(v),{ref_key:"formRef",ref:H,model:W,rules:z,"label-placement":"left","label-width":"auto","show-feedback":!1,"show-require-mark":!1,style:c({maxWidth:"500px",...r(q)})},{default:n((()=>[u(r(b),{label:"名称:",path:"name",style:{"margin-bottom":"10px"}},{default:n((()=>[u(r(h),{value:W.name,"onUpdate:value":o[0]||(o[0]=e=>W.name=e),placeholder:"请填写名称",clearable:""},null,8,["value"])])),_:1}),e.isFieldColor?(i(),s(r(b),{key:0,label:"颜色:",path:"color"},{default:n((()=>[u(r(g),{clearable:"",placeholder:"请选择颜色",value:W.color,"onUpdate:value":o[1]||(o[1]=e=>W.color=e),swatches:r(R),modes:["hex"],class:"c-field-set__color-picker"},null,8,["value","swatches"])])),_:1})):(i(),s(r(b),{key:1,label:"颜色:",path:"color"},{default:n((()=>[u(r(k),{value:W.color,"onUpdate:value":o[2]||(o[2]=e=>W.color=e),placeholder:"请选择颜色","render-label":A,options:r(E)},null,8,["value","options"])])),_:1})),u(r(b),{label:"显示:",path:"status"},{default:n((()=>[u(r(_),{checked:W.status,"onUpdate:checked":o[3]||(o[3]=e=>W.status=e)},null,8,["checked"])])),_:1}),u(r(b),{label:"颜色应用于:",path:"colorScope"},{default:n((()=>[u(r(w),{value:W.colorScope,"onUpdate:value":o[4]||(o[4]=e=>W.colorScope=e)},{default:n((()=>[u(r(y),null,{default:n((()=>[u(r(C),{label:"字体",value:"font"}),u(r(C),{label:"背景",value:"background"})])),_:1})])),_:1},8,["value"])])),_:1}),e.isFieldColor?(i(),s(r(b),{key:2,label:"字段:",path:"columnName",style:{"margin-bottom":"10px"}},{default:n((()=>[u(r(y),{class:"c-field-set__space",align:"center"},{default:n((()=>[u(r(k),{value:W.columnName,"onUpdate:value":o[5]||(o[5]=e=>W.columnName=e),placeholder:"请选择字段名","label-field":"title","value-field":"columnName",options:r(D)},null,8,["value","options"]),d("span",{class:"filter-btn",onClick:o[6]||(o[6]=()=>P.value=!0)},"筛选")])),_:1})])),_:1})):m("v-if",!0)])),_:1},8,["model","rules","style"]),e.isFieldColor?(i(),s(F,{key:1,visible:P.value,"onUpdate:visible":o[7]||(o[7]=e=>P.value=e),model:W,onConfirm:J},null,8,["visible","model"])):(i(),s(x,{key:0,ref_key:"conditionRef",ref:L,data:W},null,8,["data"]))])),_:1},8,["title","show"]))}});export{O as default};