@gx-design-vue/pro-layout-components 0.1.0-alpha.1 → 0.1.0-alpha.2

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 (120) hide show
  1. package/dist/RightContent/Search/Panel.d.ts +16 -39
  2. package/dist/RightContent/Search/Panel.js +138 -134
  3. package/dist/RightContent/Search/index.d.ts +11 -47
  4. package/dist/RightContent/Search/index.js +117 -103
  5. package/dist/RightContent/Search/style.d.ts +4 -7
  6. package/dist/RightContent/Search/style.js +34 -30
  7. package/dist/RightContent/index.d.ts +4 -403
  8. package/dist/RightContent/index.js +162 -146
  9. package/dist/RightContent/interface.d.ts +84 -0
  10. package/dist/RightContent/interface.js +1 -0
  11. package/dist/RightContent/locale.d.ts +6 -0
  12. package/dist/RightContent/locale.js +18 -0
  13. package/dist/RightContent/style.d.ts +4 -7
  14. package/dist/RightContent/style.js +66 -65
  15. package/dist/RightContent/themeOptions.d.ts +6 -0
  16. package/dist/RightContent/themeOptions.js +34 -0
  17. package/dist/RightContent/utils.d.ts +24 -0
  18. package/dist/RightContent/utils.js +66 -0
  19. package/dist/index.d.ts +3 -7
  20. package/dist/index.js +2 -5
  21. package/dist/pro-layout-components.esm.js +897 -5867
  22. package/dist/pro-layout-components.js +1 -5
  23. package/dist/theme/augment.d.ts +10 -0
  24. package/dist/theme/augment.js +1 -0
  25. package/dist/theme/interface/components.d.ts +10 -0
  26. package/dist/theme/interface/components.js +1 -0
  27. package/global.d.ts +0 -1
  28. package/package.json +15 -17
  29. package/dist/AppsLogoComponents/AppLogoList.d.ts +0 -24
  30. package/dist/AppsLogoComponents/AppLogoList.js +0 -43
  31. package/dist/AppsLogoComponents/AppsLogo.d.ts +0 -10
  32. package/dist/AppsLogoComponents/AppsLogo.js +0 -12
  33. package/dist/AppsLogoComponents/DefaultContent.d.ts +0 -27
  34. package/dist/AppsLogoComponents/DefaultContent.js +0 -43
  35. package/dist/AppsLogoComponents/SimpleContent.d.ts +0 -36
  36. package/dist/AppsLogoComponents/SimpleContent.js +0 -63
  37. package/dist/AppsLogoComponents/index.d.ts +0 -32
  38. package/dist/AppsLogoComponents/index.js +0 -71
  39. package/dist/AppsLogoComponents/props.d.ts +0 -26
  40. package/dist/AppsLogoComponents/props.js +0 -12
  41. package/dist/AppsLogoComponents/style/default.d.ts +0 -6
  42. package/dist/AppsLogoComponents/style/default.js +0 -70
  43. package/dist/AppsLogoComponents/style/index.d.ts +0 -7
  44. package/dist/AppsLogoComponents/style/index.js +0 -60
  45. package/dist/AppsLogoComponents/style/simple.d.ts +0 -6
  46. package/dist/AppsLogoComponents/style/simple.js +0 -83
  47. package/dist/Icon/components/Paintbrush.d.ts +0 -6
  48. package/dist/Icon/components/Paintbrush.js +0 -21
  49. package/dist/Icon/components/Palette.d.ts +0 -6
  50. package/dist/Icon/components/Palette.js +0 -20
  51. package/dist/Icon/components/index.d.ts +0 -10
  52. package/dist/Icon/components/index.js +0 -11
  53. package/dist/Icon/index.d.ts +0 -37
  54. package/dist/Icon/index.js +0 -24
  55. package/dist/PageLock/Popup.d.ts +0 -43
  56. package/dist/PageLock/Popup.js +0 -68
  57. package/dist/PageLock/UserForm.d.ts +0 -42
  58. package/dist/PageLock/UserForm.js +0 -68
  59. package/dist/PageLock/index.d.ts +0 -52
  60. package/dist/PageLock/index.js +0 -92
  61. package/dist/PageLock/props.d.ts +0 -51
  62. package/dist/PageLock/props.js +0 -29
  63. package/dist/PageLock/style.d.ts +0 -7
  64. package/dist/PageLock/style.js +0 -108
  65. package/dist/PageLock/useFormState.d.ts +0 -16
  66. package/dist/PageLock/useFormState.js +0 -19
  67. package/dist/Paintbrush-EfUpNqey.js +0 -14
  68. package/dist/Palette-B5wq9KtV.js +0 -13
  69. package/dist/RightContent/Search/props.d.ts +0 -17
  70. package/dist/RightContent/Search/props.js +0 -15
  71. package/dist/RightContent/props.d.ts +0 -64
  72. package/dist/RightContent/props.js +0 -63
  73. package/dist/ThemeEditor/components/BlockCheckbox.d.ts +0 -39
  74. package/dist/ThemeEditor/components/BlockCheckbox.js +0 -42
  75. package/dist/ThemeEditor/components/RegionalChange.d.ts +0 -21
  76. package/dist/ThemeEditor/components/RegionalChange.js +0 -43
  77. package/dist/ThemeEditor/components/Setting/index.d.ts +0 -52
  78. package/dist/ThemeEditor/components/Setting/index.js +0 -125
  79. package/dist/ThemeEditor/components/SwitchTab/index.d.ts +0 -51
  80. package/dist/ThemeEditor/components/SwitchTab/index.js +0 -52
  81. package/dist/ThemeEditor/components/SwitchTab/style.d.ts +0 -6
  82. package/dist/ThemeEditor/components/SwitchTab/style.js +0 -54
  83. package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.d.ts +0 -7
  84. package/dist/ThemeEditor/components/Tokens/Colors/ColorSvg.js +0 -453
  85. package/dist/ThemeEditor/components/Tokens/Colors/Primary.d.ts +0 -7
  86. package/dist/ThemeEditor/components/Tokens/Colors/Primary.js +0 -58
  87. package/dist/ThemeEditor/components/Tokens/Colors/Side.d.ts +0 -7
  88. package/dist/ThemeEditor/components/Tokens/Colors/Side.js +0 -18
  89. package/dist/ThemeEditor/components/Tokens/Colors/index.d.ts +0 -7
  90. package/dist/ThemeEditor/components/Tokens/Colors/index.js +0 -15
  91. package/dist/ThemeEditor/components/Tokens/context.d.ts +0 -9
  92. package/dist/ThemeEditor/components/Tokens/context.js +0 -7
  93. package/dist/ThemeEditor/components/Tokens/index.d.ts +0 -45
  94. package/dist/ThemeEditor/components/Tokens/index.js +0 -69
  95. package/dist/ThemeEditor/components/Tokens/utils/config.d.ts +0 -10
  96. package/dist/ThemeEditor/components/Tokens/utils/config.js +0 -8
  97. package/dist/ThemeEditor/components/Trigger.d.ts +0 -21
  98. package/dist/ThemeEditor/components/Trigger.js +0 -46
  99. package/dist/ThemeEditor/context.d.ts +0 -14
  100. package/dist/ThemeEditor/context.js +0 -7
  101. package/dist/ThemeEditor/index.d.ts +0 -841
  102. package/dist/ThemeEditor/index.js +0 -165
  103. package/dist/ThemeEditor/props.d.ts +0 -57
  104. package/dist/ThemeEditor/props.js +0 -40
  105. package/dist/ThemeEditor/style/animate.d.ts +0 -9
  106. package/dist/ThemeEditor/style/animate.js +0 -38
  107. package/dist/ThemeEditor/style/index.d.ts +0 -10
  108. package/dist/ThemeEditor/style/index.js +0 -318
  109. package/dist/ThemeEditor/style/theme.d.ts +0 -6
  110. package/dist/ThemeEditor/style/theme.js +0 -71
  111. package/dist/ThemeEditor/utils/config.d.ts +0 -37
  112. package/dist/ThemeEditor/utils/config.js +0 -132
  113. package/dist/ThemeEditor/utils/index.d.ts +0 -9
  114. package/dist/ThemeEditor/utils/index.js +0 -64
  115. package/dist/hooks/useClockTime/index.d.ts +0 -11
  116. package/dist/hooks/useClockTime/index.js +0 -28
  117. package/dist/utils/index.d.ts +0 -2
  118. package/dist/utils/index.js +0 -3
  119. package/dist/utils/util.d.ts +0 -10
  120. package/dist/utils/util.js +0 -17
@@ -1,42 +1,19 @@
1
- import * as vue45 from "vue";
2
- import { PropType } from "vue";
3
- import { AppRouteModule } from "@gx-design-vue/pro-layout";
4
- import * as vue_jsx_runtime3 from "vue/jsx-runtime";
1
+ import { RightContentLocale } from "../interface.js";
2
+ import * as _$vue from "vue";
3
+ import { LayoutMenuRoute } from "@gx-design-vue/pro-layout";
5
4
 
6
5
  //#region src/RightContent/Search/Panel.d.ts
7
- declare const _default: vue45.DefineComponent<vue45.ExtractPropTypes<{
8
- className: PropType<string>;
9
- hashId: PropType<string>;
10
- keyword: PropType<string>;
11
- onBlur: PropType<() => void>;
12
- onClose: PropType<(clear?: boolean) => void>;
13
- dataSource: {
14
- type: PropType<AppRouteModule[]>;
15
- default: () => any[];
16
- };
17
- historyKey: PropType<string>;
18
- emptyProps: {
19
- type: PropType<any>;
20
- default: () => {};
21
- };
22
- }>, () => vue_jsx_runtime3.JSX.Element, {}, {}, {}, vue45.ComponentOptionsMixin, vue45.ComponentOptionsMixin, {}, string, vue45.PublicProps, Readonly<vue45.ExtractPropTypes<{
23
- className: PropType<string>;
24
- hashId: PropType<string>;
25
- keyword: PropType<string>;
26
- onBlur: PropType<() => void>;
27
- onClose: PropType<(clear?: boolean) => void>;
28
- dataSource: {
29
- type: PropType<AppRouteModule[]>;
30
- default: () => any[];
31
- };
32
- historyKey: PropType<string>;
33
- emptyProps: {
34
- type: PropType<any>;
35
- default: () => {};
36
- };
37
- }>> & Readonly<{}>, {
38
- dataSource: AppRouteModule[];
39
- emptyProps: any;
40
- }, {}, {}, {}, string, vue45.ComponentProvideOptions, true, {}, any>;
6
+ interface SearchPanelProps {
7
+ className?: string;
8
+ hashId?: string;
9
+ keyword?: string;
10
+ dataSource?: LayoutMenuRoute[];
11
+ historyKey?: string;
12
+ emptyProps?: Record<string, unknown>;
13
+ locale: RightContentLocale;
14
+ onBlur?: () => void;
15
+ onClose?: (clear?: boolean) => void;
16
+ }
17
+ declare const GSearchPanel: _$vue.DefineSetupFnComponent<SearchPanelProps, {}, {}, SearchPanelProps & {}, _$vue.PublicProps>;
41
18
  //#endregion
42
- export { _default as default };
19
+ export { SearchPanelProps, GSearchPanel as default };
@@ -1,146 +1,150 @@
1
- import { commonProps } from "./props.js";
2
- import { uniqueByField } from "../../utils/util.js";
3
- import { Fragment, cloneVNode, createTextVNode, createVNode, defineComponent, nextTick, onMounted, ref, unref, watch } from "vue";
4
- import { classNames, cloneDeep, getPrefixCls, isArray, isString, isUrl } from "@gx-design-vue/pro-utils";
5
- import { Empty } from "ant-design-vue";
6
- import { useProLayoutMenuContext } from "@gx-design-vue/pro-layout";
7
- import { CloseOutlined } from "@ant-design/icons-vue";
1
+ import { searchMenuItems, uniqueByField } from "../utils.js";
2
+ import { Fragment, cloneVNode, createVNode, defineComponent, nextTick, onMounted, ref, unref, watch } from "vue";
3
+ import { CloseOutlined } from "@antdv-next/icons";
4
+ import { classNames, getPrefixCls, isArray, isString, isUrl } from "@gx-design-vue/pro-utils";
8
5
  import { onKeyStroke, useLocalStorage, useThrottleFn } from "@vueuse/core";
6
+ import { Empty } from "antdv-next";
9
7
  import { useProAppContext } from "@gx-design-vue/pro-app";
10
- import { pinyin } from "pinyin-pro";
8
+ import { cloneDeep } from "es-toolkit";
11
9
  import { useRouter } from "vue-router";
12
-
13
10
  //#region src/RightContent/Search/Panel.tsx
14
- const NoResult = ({ className, value }) => {
11
+ const NoResult = ({ className, value, locale }) => {
15
12
  if (value) return createVNode(Empty, {
16
13
  "image": Empty.PRESENTED_IMAGE_SIMPLE,
17
- "description": `未找到搜索结果 "${value}"`
14
+ "description": locale.noResult?.(value)
18
15
  }, null);
19
- return createVNode("div", { "class": className }, [createTextVNode("没有搜索历史")]);
16
+ return createVNode("div", { "class": className }, [locale.noHistory]);
20
17
  };
21
- var Panel_default = /* @__PURE__ */ defineComponent({
22
- props: {
23
- ...commonProps,
24
- className: String,
25
- hashId: String,
26
- keyword: String,
27
- onBlur: Function,
28
- onClose: Function
29
- },
30
- setup(props) {
31
- const router = useRouter();
32
- const { syncMatchedKeys } = useProLayoutMenuContext();
33
- const { emptyText } = useProAppContext();
34
- const searchHistory = useLocalStorage(props.historyKey || getPrefixCls({
35
- suffixCls: "search-history",
36
- isPor: true
37
- }), []);
38
- const activeIndex = ref(0);
39
- const searchResults = ref(cloneDeep(unref(searchHistory)));
40
- const handleSearch = useThrottleFn(search, 200);
41
- function search(searchKey) {
42
- searchKey = searchKey.trim();
43
- if (!searchKey) {
44
- searchResults.value = [];
45
- return;
46
- }
47
- const results = [];
48
- props.dataSource.forEach((item) => {
49
- if (item.meta?.hideInMenu) return;
50
- const name = item.meta?.title || item.name || "";
51
- if (name.includes(searchKey)) results.push(item);
52
- if (pinyin(name, {
53
- toneType: "none",
54
- type: "array",
55
- pattern: "first"
56
- }).includes(searchKey.toLowerCase())) results.push(item);
57
- if (pinyin(name, {
58
- toneType: "none",
59
- type: "array",
60
- pattern: "pinyin"
61
- }).includes(searchKey.toLowerCase())) results.push(item);
62
- });
63
- searchResults.value = results;
64
- if (results.length > 0) activeIndex.value = 0;
65
- activeIndex.value = 0;
66
- }
67
- watch(() => props.keyword, (val) => {
68
- if (val) handleSearch(val);
69
- else searchResults.value = cloneDeep(unref(searchHistory));
70
- });
71
- function scrollIntoView() {
72
- const element = document.querySelector(`[data-search-item="${activeIndex.value}"]`);
73
- if (element) element.scrollIntoView({ block: "nearest" });
74
- }
75
- async function handleEnter() {
76
- if (searchResults.value.length === 0) return;
77
- const index = activeIndex.value;
78
- if (searchResults.value.length === 0 || index < 0) return;
79
- const row = searchResults.value[index];
80
- if (row) {
81
- const toPath = isString(row.redirect) ? row.redirect : row.path || "";
82
- const target = row.meta?.link || "";
83
- const hasUrl = isUrl(target);
84
- if (searchHistory.value.every((item) => item.name !== row.name)) searchHistory.value.push(cloneDeep(row));
85
- props.onClose?.(true);
86
- await nextTick();
87
- if (hasUrl && target && row.meta?.linkStatus === 1) window.open(target, "_blank");
88
- else {
89
- router.push({ path: toPath });
90
- syncMatchedKeys(60);
91
- }
92
- }
93
- }
94
- function handleUp() {
95
- if (searchResults.value.length === 0) return;
96
- props.onBlur?.();
97
- activeIndex.value--;
98
- if (activeIndex.value < 0) activeIndex.value = searchResults.value.length - 1;
99
- scrollIntoView();
100
- }
101
- function handleDown() {
102
- if (searchResults.value.length === 0) return;
103
- props.onBlur?.();
104
- activeIndex.value++;
105
- if (activeIndex.value > searchResults.value.length - 1) activeIndex.value = 0;
106
- scrollIntoView();
107
- }
108
- onMounted(() => {
109
- onKeyStroke("Enter", handleEnter);
110
- onKeyStroke("ArrowUp", handleUp);
111
- onKeyStroke("ArrowDown", handleDown);
112
- });
113
- function handleMouseenter(index) {
114
- activeIndex.value = index;
115
- }
116
- function removeItem(e, row) {
117
- e.stopPropagation();
118
- searchResults.value = searchResults.value.filter((item) => item.name !== row.name);
119
- searchHistory.value = searchHistory.value.filter((item) => item.name !== row.name);
120
- activeIndex.value = activeIndex.value - 1 >= 0 ? activeIndex.value - 1 : 0;
121
- scrollIntoView();
18
+ const GSearchPanel = /* @__PURE__ */ defineComponent((props) => {
19
+ const router = useRouter();
20
+ const { emptyText } = useProAppContext();
21
+ const searchHistory = useLocalStorage(props.historyKey || getPrefixCls({
22
+ suffixCls: "search-history",
23
+ isPor: true
24
+ }), []);
25
+ const activeIndex = ref(0);
26
+ const searchResults = ref(cloneDeep(unref(searchHistory)));
27
+ const handleSearch = useThrottleFn((searchKey) => {
28
+ const trimmed = searchKey.trim();
29
+ if (!trimmed) {
30
+ searchResults.value = [];
31
+ return;
122
32
  }
123
- const getClassNames = (name) => classNames(`${props.className}${name ? `-${name}` : ""}`, props.hashId);
124
- return () => {
125
- const emptyTextRender = isArray(emptyText.value) ? emptyText.value : [emptyText.value];
126
- return createVNode(Fragment, null, [searchResults.value.length > 0 ? createVNode(Fragment, null, [searchHistory.value.length > 0 && !props.keyword && createVNode("div", { "class": getClassNames("panel-title") }, [createTextVNode("搜索历史")]), createVNode("div", { "class": getClassNames("panel-list") }, [uniqueByField(searchResults.value, "name").map((item, index) => createVNode("div", {
127
- "key": item.name,
128
- "class": getClassNames(classNames("panel-item", index === activeIndex.value && "active")),
129
- "data-search-item": index,
130
- "onClick": () => handleEnter(),
131
- "onMouseenter": () => handleMouseenter(index)
132
- }, [createVNode("div", { "class": getClassNames("panel-item-left") }, [item.meta?.title]), searchHistory.value.length > 0 && !props.keyword && createVNode(CloseOutlined, { "onClick": (e) => removeItem(e, item) }, null)]))])]) : emptyText.value ? emptyTextRender.map((node) => {
133
- return cloneVNode(node, {
134
- ...props.emptyProps,
135
- text: props.keyword ? `未找到搜索结果 "${props.keyword}"` : true
136
- });
137
- }) : createVNode(NoResult, {
138
- "className": getClassNames("result"),
139
- "value": props.keyword
140
- }, null)]);
141
- };
33
+ searchResults.value = searchMenuItems(props.dataSource ?? [], trimmed);
34
+ activeIndex.value = 0;
35
+ }, 200);
36
+ watch(() => props.keyword, (val) => {
37
+ if (val) handleSearch(val);
38
+ else searchResults.value = cloneDeep(unref(searchHistory));
39
+ });
40
+ function scrollIntoView() {
41
+ document.querySelector(`[data-search-item="${activeIndex.value}"]`)?.scrollIntoView({ block: "nearest" });
142
42
  }
43
+ async function handleEnter() {
44
+ if (searchResults.value.length === 0) return;
45
+ const index = activeIndex.value;
46
+ if (index < 0) return;
47
+ const row = searchResults.value[index];
48
+ if (!row) return;
49
+ const toPath = isString(row.redirect) ? row.redirect : row.path || "";
50
+ const target = row.meta?.link || "";
51
+ const hasUrl = isUrl(target);
52
+ if (searchHistory.value.every((item) => item.name !== row.name)) searchHistory.value.push(cloneDeep(row));
53
+ props.onClose?.(true);
54
+ await nextTick();
55
+ if (hasUrl && target && row.meta?.linkStatus === 1) window.open(target, "_blank");
56
+ else router.push({ path: toPath });
57
+ }
58
+ function handleUp() {
59
+ if (searchResults.value.length === 0) return;
60
+ props.onBlur?.();
61
+ activeIndex.value--;
62
+ if (activeIndex.value < 0) activeIndex.value = searchResults.value.length - 1;
63
+ scrollIntoView();
64
+ }
65
+ function handleDown() {
66
+ if (searchResults.value.length === 0) return;
67
+ props.onBlur?.();
68
+ activeIndex.value++;
69
+ if (activeIndex.value > searchResults.value.length - 1) activeIndex.value = 0;
70
+ scrollIntoView();
71
+ }
72
+ onMounted(() => {
73
+ onKeyStroke("Enter", handleEnter);
74
+ onKeyStroke("ArrowUp", handleUp);
75
+ onKeyStroke("ArrowDown", handleDown);
76
+ });
77
+ function handleMouseenter(index) {
78
+ activeIndex.value = index;
79
+ }
80
+ function removeItem(event, row) {
81
+ event.stopPropagation();
82
+ searchResults.value = searchResults.value.filter((item) => item.name !== row.name);
83
+ searchHistory.value = searchHistory.value.filter((item) => item.name !== row.name);
84
+ activeIndex.value = activeIndex.value - 1 >= 0 ? activeIndex.value - 1 : 0;
85
+ scrollIntoView();
86
+ }
87
+ const getClassNames = (name) => classNames(`${props.className}${name ? `-${name}` : ""}`, props.hashId);
88
+ return () => {
89
+ const emptyTextRender = isArray(emptyText.value) ? emptyText.value : [emptyText.value];
90
+ return createVNode(Fragment, null, [searchResults.value.length > 0 ? createVNode(Fragment, null, [searchHistory.value.length > 0 && !props.keyword && createVNode("div", { "class": getClassNames("panel-title") }, [props.locale.searchHistory]), createVNode("div", { "class": getClassNames("panel-list") }, [uniqueByField(searchResults.value, "name").map((item, index) => createVNode("div", {
91
+ "key": item.name,
92
+ "class": getClassNames(classNames("panel-item", index === activeIndex.value && "active")),
93
+ "data-search-item": index,
94
+ "onClick": () => handleEnter(),
95
+ "onMouseenter": () => handleMouseenter(index)
96
+ }, [createVNode("div", { "class": getClassNames("panel-item-left") }, [item.meta?.title]), searchHistory.value.length > 0 && !props.keyword && createVNode(CloseOutlined, { "onClick": (e) => removeItem(e, item) }, null)]))])]) : emptyText.value ? emptyTextRender.map((node) => {
97
+ return cloneVNode(node, {
98
+ ...props.emptyProps,
99
+ text: props.keyword ? props.locale.noResult?.(props.keyword) : true
100
+ });
101
+ }) : createVNode(NoResult, {
102
+ "className": getClassNames("result"),
103
+ "value": props.keyword,
104
+ "locale": props.locale
105
+ }, null)]);
106
+ };
107
+ }, {
108
+ props: {
109
+ className: {
110
+ type: String,
111
+ required: false
112
+ },
113
+ hashId: {
114
+ type: String,
115
+ required: false
116
+ },
117
+ keyword: {
118
+ type: String,
119
+ required: false
120
+ },
121
+ dataSource: {
122
+ type: Array,
123
+ required: false
124
+ },
125
+ historyKey: {
126
+ type: String,
127
+ required: false
128
+ },
129
+ emptyProps: {
130
+ type: Object,
131
+ required: false
132
+ },
133
+ locale: {
134
+ type: Object,
135
+ required: true
136
+ },
137
+ onBlur: {
138
+ type: Function,
139
+ required: false
140
+ },
141
+ onClose: {
142
+ type: Function,
143
+ required: false
144
+ }
145
+ },
146
+ name: "GSearchPanel",
147
+ inheritAttrs: false
143
148
  });
144
-
145
149
  //#endregion
146
- export { Panel_default as default };
150
+ export { GSearchPanel as default };
@@ -1,50 +1,14 @@
1
- import * as vue202 from "vue";
2
- import { PropType } from "vue";
3
- import * as _gx_design_vue_pro_layout3 from "@gx-design-vue/pro-layout";
4
- import * as ant_design_vue_es__util_type21 from "ant-design-vue/es/_util/type";
1
+ import { RightContentLocale } from "../interface.js";
2
+ import * as _$vue from "vue";
5
3
 
6
4
  //#region src/RightContent/Search/index.d.ts
7
- declare const _default: vue202.DefineComponent<vue202.ExtractPropTypes<{
8
- dark: {
9
- type: PropType<boolean>;
10
- default: any;
11
- };
12
- disabledShortKey: {
13
- type: PropType<boolean>;
14
- default: boolean;
15
- };
16
- dataSource: {
17
- type: PropType<_gx_design_vue_pro_layout3.AppRouteModule[]>;
18
- default: () => any[];
19
- };
20
- historyKey: PropType<string>;
21
- emptyProps: {
22
- type: PropType<any>;
23
- default: () => {};
24
- };
25
- }>, () => ant_design_vue_es__util_type21.VueNode, {}, {}, {}, vue202.ComponentOptionsMixin, vue202.ComponentOptionsMixin, {}, string, vue202.PublicProps, Readonly<vue202.ExtractPropTypes<{
26
- dark: {
27
- type: PropType<boolean>;
28
- default: any;
29
- };
30
- disabledShortKey: {
31
- type: PropType<boolean>;
32
- default: boolean;
33
- };
34
- dataSource: {
35
- type: PropType<_gx_design_vue_pro_layout3.AppRouteModule[]>;
36
- default: () => any[];
37
- };
38
- historyKey: PropType<string>;
39
- emptyProps: {
40
- type: PropType<any>;
41
- default: () => {};
42
- };
43
- }>> & Readonly<{}>, {
44
- dataSource: _gx_design_vue_pro_layout3.AppRouteModule[];
45
- dark: boolean;
46
- emptyProps: any;
47
- disabledShortKey: boolean;
48
- }, {}, {}, {}, string, vue202.ComponentProvideOptions, true, {}, any>;
5
+ interface SearchInputProps {
6
+ dataSource?: any[];
7
+ disabledShortKey?: boolean;
8
+ locale: RightContentLocale;
9
+ searchHistoryKey?: string;
10
+ emptyProps?: Record<string, unknown>;
11
+ }
12
+ declare const GSearchInput: _$vue.DefineSetupFnComponent<SearchInputProps, {}, {}, SearchInputProps & {}, _$vue.PublicProps>;
49
13
  //#endregion
50
- export { _default as default };
14
+ export { SearchInputProps, GSearchInput as default };
@@ -1,118 +1,132 @@
1
- import { commonProps } from "./props.js";
2
- import Panel_default from "./Panel.js";
3
- import { useStyle } from "./style.js";
1
+ import GSearchPanel from "./Panel.js";
2
+ import style_default from "./style.js";
4
3
  import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, ref } from "vue";
5
- import { useState } from "@gx-design-vue/pro-hooks";
6
- import { classNames, getLevelData, getPrefixCls, isWindowsOs } from "@gx-design-vue/pro-utils";
7
- import { Input } from "ant-design-vue";
8
- import { useProLayoutContext } from "@gx-design-vue/pro-layout";
9
- import { ArrowUpOutlined, EnterOutlined, SearchOutlined } from "@ant-design/icons-vue";
4
+ import { ArrowUpOutlined, EnterOutlined, SearchOutlined } from "@antdv-next/icons";
5
+ import { useInjectLayoutContext } from "@gx-design-vue/pro-layout";
6
+ import { classNames, getLevelData, isWindowsOs } from "@gx-design-vue/pro-utils";
10
7
  import { useMagicKeys, whenever } from "@vueuse/core";
8
+ import { Input } from "antdv-next";
9
+ import { useBaseConfig } from "antdv-next/config-provider/context";
10
+ import useCSSVarCls from "antdv-next/config-provider/hooks/useCSSVarCls";
11
11
  import { GProModal } from "@gx-design-vue/pro-modal";
12
-
13
12
  //#region src/RightContent/Search/index.tsx
14
- const ModalFooter = ({ className, hashId }) => createVNode("div", { "class": classNames(`${className}-footer`, hashId) }, [createVNode("div", { "class": classNames(`${className}-footer-icon`, hashId) }, [createVNode(EnterOutlined, null, null), createTextVNode("选择")]), createVNode("div", { "class": classNames(`${className}-footer-icon`, hashId) }, [
13
+ const ModalFooter = ({ className, hashId, locale }) => createVNode("div", { "class": classNames(`${className}-footer`, hashId) }, [createVNode("div", { "class": classNames(`${className}-footer-icon`, hashId) }, [createVNode(EnterOutlined, null, null), locale.selectLabel]), createVNode("div", { "class": classNames(`${className}-footer-icon`, hashId) }, [
15
14
  createVNode(ArrowUpOutlined, null, null),
16
15
  createVNode(ArrowUpOutlined, { "rotate": 180 }, null),
17
- createTextVNode("导航")
16
+ locale.navigateLabel
18
17
  ])]);
19
- var Search_default = /* @__PURE__ */ defineComponent({
20
- name: "SearchPageInput",
18
+ const GSearchInput = /* @__PURE__ */ defineComponent((props) => {
19
+ const layoutContext = useInjectLayoutContext();
20
+ const { prefixCls } = useBaseConfig("pro-right-search");
21
+ const rootCls = useCSSVarCls(prefixCls);
22
+ const [hashId, cssVarCls] = style_default(prefixCls, rootCls);
23
+ const keyword = ref("");
24
+ const open = ref(false);
25
+ const keys = useMagicKeys();
26
+ const shortcutKey = isWindowsOs() ? keys["ctrl+k"] : keys["cmd+k"];
27
+ const inputRef = ref();
28
+ const dataSource = computed(() => {
29
+ if (props.dataSource?.length) return getLevelData(props.dataSource);
30
+ if (layoutContext?.menuState?.flatMenus) return layoutContext.menuState.flatMenus.value;
31
+ return [];
32
+ });
33
+ whenever(shortcutKey, () => {
34
+ if (props.disabledShortKey) return;
35
+ open.value = true;
36
+ });
37
+ whenever(() => open.value, () => {
38
+ nextTick(() => {
39
+ inputRef.value?.focus?.();
40
+ });
41
+ });
42
+ function handleClose(clear) {
43
+ open.value = false;
44
+ if (clear) keyword.value = "";
45
+ }
46
+ return () => {
47
+ const classNameProps = {
48
+ className: prefixCls.value,
49
+ hashId: hashId.value
50
+ };
51
+ const modalClass = `${prefixCls.value}-modal`;
52
+ return createVNode(Fragment, null, [createVNode("div", {
53
+ "class": classNames(prefixCls.value, hashId.value, cssVarCls.value, rootCls.value),
54
+ "onClick": () => {
55
+ open.value = true;
56
+ }
57
+ }, [
58
+ createVNode(SearchOutlined, null, null),
59
+ createVNode("span", { "class": classNames(`${prefixCls.value}-word`, hashId.value) }, [props.locale.searchLabel]),
60
+ createVNode("span", { "class": classNames(`${prefixCls.value}-word-icon`, hashId.value) }, [
61
+ createTextVNode("⌘"),
62
+ " ",
63
+ createVNode("kbd", null, [createTextVNode("K")])
64
+ ])
65
+ ]), createVNode(GProModal, {
66
+ "wrapClassName": classNames(modalClass, hashId.value),
67
+ "width": 600,
68
+ "scrollProps": {
69
+ maxHeight: 400,
70
+ minHeight: 200
71
+ },
72
+ "centered": false,
73
+ "destroyOnHidden": false,
74
+ "title": createVNode(Input, {
75
+ "style": {
76
+ width: `${600 * .8}px`,
77
+ padding: 0
78
+ },
79
+ "ref": inputRef,
80
+ "bordered": false,
81
+ "size": "large",
82
+ "placeholder": props.locale.searchPlaceholder,
83
+ "value": keyword.value,
84
+ "onUpdate:value": (val) => {
85
+ keyword.value = val;
86
+ }
87
+ }, { prefix: () => createVNode(SearchOutlined, null, null) }),
88
+ "open": open.value,
89
+ "footer": createVNode(ModalFooter, {
90
+ "className": modalClass,
91
+ "hashId": hashId.value,
92
+ "locale": props.locale
93
+ }, null),
94
+ "onCancel": () => handleClose()
95
+ }, { default: () => [createVNode(GSearchPanel, mergeProps(classNameProps, {
96
+ "emptyProps": props.emptyProps,
97
+ "keyword": keyword.value,
98
+ "dataSource": dataSource.value,
99
+ "historyKey": props.searchHistoryKey,
100
+ "locale": props.locale,
101
+ "onClose": handleClose
102
+ }), null)] })]);
103
+ };
104
+ }, {
21
105
  props: {
22
- ...commonProps,
23
- dark: {
24
- type: Boolean,
25
- default: void 0
106
+ dataSource: {
107
+ type: Array,
108
+ required: false
26
109
  },
27
110
  disabledShortKey: {
28
111
  type: Boolean,
29
- default: false
112
+ required: false,
113
+ default: void 0
114
+ },
115
+ locale: {
116
+ type: Object,
117
+ required: true
118
+ },
119
+ searchHistoryKey: {
120
+ type: String,
121
+ required: false
122
+ },
123
+ emptyProps: {
124
+ type: Object,
125
+ required: false
30
126
  }
31
127
  },
32
- setup(props) {
33
- const baseClass = getPrefixCls({
34
- suffixCls: "page-search",
35
- isPor: true
36
- });
37
- const { wrapSSR, hashId } = useStyle(baseClass);
38
- const [keyword, changeKeyword] = useState("");
39
- const [open, setOpen] = useState(false);
40
- const layoutContext = useProLayoutContext();
41
- const keys = useMagicKeys();
42
- const cmd = isWindowsOs() ? keys["ctrl+k"] : keys["cmd+k"];
43
- const inputRef = ref();
44
- const dataSource = computed(() => {
45
- if (props.dataSource.length) return getLevelData(props.dataSource);
46
- if (layoutContext) return layoutContext.menu.value.flatMenus;
47
- return [];
48
- });
49
- whenever(cmd, () => {
50
- if (props.disabledShortKey) return;
51
- setOpen(true);
52
- });
53
- whenever(open, () => {
54
- nextTick(() => {
55
- inputRef.value?.focus();
56
- });
57
- });
58
- const handleClose = (clear) => {
59
- setOpen(false);
60
- if (clear) changeKeyword("");
61
- };
62
- return () => {
63
- const classNameProps = {
64
- className: `${baseClass}`,
65
- hashId: hashId.value
66
- };
67
- const modalClass = `${baseClass}-modal`;
68
- return wrapSSR(createVNode(Fragment, null, [createVNode("div", {
69
- "class": classNames(baseClass, hashId.value),
70
- "onClick": () => setOpen(true)
71
- }, [
72
- createVNode(SearchOutlined, null, null),
73
- createVNode("span", { "class": classNames(`${baseClass}-word`, hashId.value) }, [createTextVNode("搜索")]),
74
- createVNode("span", { "class": classNames(`${baseClass}-word-icon`, hashId.value) }, [
75
- createTextVNode("⌘"),
76
- " ",
77
- createVNode("kbd", null, [createTextVNode("K")])
78
- ])
79
- ]), createVNode(GProModal, {
80
- "class": classNames(`${modalClass}`, hashId.value),
81
- "width": 600,
82
- "scrollProps": {
83
- maxHeight: 400,
84
- minHeight: 200
85
- },
86
- "centered": false,
87
- "destroyOnClose": false,
88
- "title": createVNode(Input, {
89
- "style": {
90
- width: `${600 * .8}px`,
91
- padding: 0
92
- },
93
- "ref": inputRef,
94
- "bordered": false,
95
- "size": "large",
96
- "placeholder": "搜索导航菜单",
97
- "value": keyword.value,
98
- "prefix": createVNode(SearchOutlined, null, null),
99
- "onChange": (e) => changeKeyword(e.target.value)
100
- }, null),
101
- "open": open.value,
102
- "footer": createVNode(ModalFooter, {
103
- "className": modalClass,
104
- "hashId": hashId.value
105
- }, null),
106
- "onCancel": () => handleClose()
107
- }, { default: () => [createVNode(Panel_default, mergeProps(classNameProps, {
108
- "emptyProps": props.emptyProps,
109
- "keyword": keyword.value,
110
- "dataSource": dataSource.value,
111
- "onClose": handleClose
112
- }), null)] })]));
113
- };
114
- }
128
+ name: "GSearchInput",
129
+ inheritAttrs: false
115
130
  });
116
-
117
131
  //#endregion
118
- export { Search_default as default };
132
+ export { GSearchInput as default };
@@ -1,10 +1,7 @@
1
- import * as vue248 from "vue";
2
- import * as ant_design_vue_es__util_type25 from "ant-design-vue/es/_util/type";
1
+ import * as _$vue from "vue";
3
2
 
4
3
  //#region src/RightContent/Search/style.d.ts
5
- declare function useStyle(componentCls: string): {
6
- wrapSSR: (node: ant_design_vue_es__util_type25.VueNode) => ant_design_vue_es__util_type25.VueNode;
7
- hashId: vue248.ComputedRef<string>;
8
- };
4
+ type ComponentToken = Record<string, any>;
5
+ declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
9
6
  //#endregion
10
- export { useStyle };
7
+ export { ComponentToken, _default as default };