@yoka-ui/ui 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/@Docs-yoka/exports.generated.md +6 -9
  2. package/README.md +39 -12
  3. package/dist/es/business/YkLoginModule/SmsLoginForm.d.ts +25 -0
  4. package/dist/es/business/YkLoginModule/SmsLoginForm.js +178 -0
  5. package/dist/es/business/YkLoginModule/SmsLoginForm.js.map +7 -0
  6. package/dist/es/business/YkLoginModule/index.d.ts +48 -0
  7. package/dist/es/business/YkLoginModule/index.js +198 -0
  8. package/dist/es/business/YkLoginModule/index.js.map +7 -0
  9. package/dist/es/business/YkLoginModule/styles.module.less +169 -0
  10. package/dist/es/business/YkSqlEdit/code-mirror-custom.module.less +154 -0
  11. package/dist/es/business/YkSqlEdit/index.d.ts +20 -0
  12. package/dist/es/business/YkSqlEdit/index.js +180 -0
  13. package/dist/es/business/YkSqlEdit/index.js.map +7 -0
  14. package/dist/es/business/YkSqlEdit/sql-language.d.ts +11 -0
  15. package/dist/es/business/YkSqlEdit/sql-language.js +1460 -0
  16. package/dist/es/business/YkSqlEdit/sql-language.js.map +7 -0
  17. package/dist/es/creative/GlassSegmentedRadio/index.d.ts +1 -1
  18. package/dist/es/index.d.ts +4 -2
  19. package/dist/es/index.js +80 -76
  20. package/dist/es/index.js.map +2 -2
  21. package/dist/es/index.less +2 -0
  22. package/dist/lib/business/YkLoginModule/SmsLoginForm.d.ts +25 -0
  23. package/dist/lib/business/YkLoginModule/SmsLoginForm.js +171 -0
  24. package/dist/lib/business/YkLoginModule/SmsLoginForm.js.map +7 -0
  25. package/dist/lib/business/YkLoginModule/index.d.ts +48 -0
  26. package/dist/lib/business/YkLoginModule/index.js +206 -0
  27. package/dist/lib/business/YkLoginModule/index.js.map +7 -0
  28. package/dist/lib/business/YkLoginModule/styles.module.less +169 -0
  29. package/dist/lib/business/YkSqlEdit/code-mirror-custom.module.less +154 -0
  30. package/dist/lib/business/YkSqlEdit/index.d.ts +20 -0
  31. package/dist/lib/business/YkSqlEdit/index.js +202 -0
  32. package/dist/lib/business/YkSqlEdit/index.js.map +7 -0
  33. package/dist/lib/business/YkSqlEdit/sql-language.d.ts +11 -0
  34. package/dist/lib/business/YkSqlEdit/sql-language.js +1493 -0
  35. package/dist/lib/business/YkSqlEdit/sql-language.js.map +7 -0
  36. package/dist/lib/creative/GlassSegmentedRadio/index.d.ts +1 -1
  37. package/dist/lib/index.d.ts +4 -2
  38. package/dist/lib/index.js +6 -0
  39. package/dist/lib/index.js.map +2 -2
  40. package/dist/lib/index.less +2 -0
  41. package/package.json +143 -138
@@ -0,0 +1,169 @@
1
+ .root {
2
+ display: flex;
3
+ flex: 1;
4
+ align-items: center;
5
+ justify-content: center;
6
+
7
+ :global {
8
+ @media (max-width: 768px) {
9
+ .ant-pro-form-login-container {
10
+ padding: 20px !important;
11
+ padding-inline: 0;
12
+ padding-block: 0;
13
+ }
14
+ }
15
+
16
+ .ant-pro-form-login-container {
17
+ border: 1px solid #ececec;
18
+ border-radius: 12px;
19
+ background: #ffffff;
20
+
21
+ .ant-pro-form-login-top {
22
+ margin-bottom: 54px;
23
+
24
+ .ant-pro-form-login-header {
25
+ justify-content: flex-start;
26
+ height: 33px;
27
+ line-height: 33px;
28
+ }
29
+ }
30
+
31
+ .ant-pro-form-login-main {
32
+ width: 100% !important;
33
+ max-width: 500px !important;
34
+ }
35
+
36
+ @media (max-width: 768px) {
37
+ .ant-pro-form-login-main {
38
+ width: 100% !important;
39
+ }
40
+
41
+ .ant-form-item-control-input {
42
+ .ant-input-affix-wrapper {
43
+ width: 100% !important;
44
+ }
45
+ }
46
+ }
47
+
48
+ .ant-pro-form-login-main-other {
49
+ margin-top: 0;
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ .title {
56
+ height: 33px;
57
+ color: #333333;
58
+ font-weight: 600;
59
+ font-size: 24px;
60
+ line-height: 33px;
61
+ }
62
+
63
+ .tabs {
64
+ :global {
65
+ .ant-tabs-nav {
66
+ margin: 0 0 30px 0;
67
+
68
+ .ant-tabs-nav-wrap {
69
+ justify-content: left;
70
+ border-bottom: 1px solid #eeeeee;
71
+
72
+ .ant-tabs-nav-list {
73
+ .ant-tabs-tab {
74
+ padding: 0 0 15px 0;
75
+
76
+ .ant-tabs-tab-btn {
77
+ color: #666666;
78
+ font-weight: 400;
79
+ font-size: 18px;
80
+ line-height: 25px;
81
+ }
82
+
83
+ &.ant-tabs-tab-active {
84
+ .ant-tabs-tab-btn {
85
+ color: #333333;
86
+ font-weight: 600;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ .form {
97
+ :global {
98
+ width: 100%;
99
+
100
+ .ant-form-item {
101
+ margin-bottom: 20px;
102
+
103
+ .ant-form-item-row {
104
+ .ant-form-item-explain-error {
105
+ font-size: 12px;
106
+ }
107
+
108
+ .ant-form-item-control-input {
109
+ .ant-input-affix-wrapper {
110
+ width: 100%;
111
+ height: 50px;
112
+ background: #fcfcfc;
113
+ border: 1px solid #ececec;
114
+ border-radius: 4px;
115
+
116
+ .ant-input-prefix {
117
+ margin-right: 15px;
118
+ color: #666;
119
+ font-size: 20px;
120
+ }
121
+
122
+ input {
123
+ background: #fcfcfc;
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
129
+
130
+ .ant-btn-primary {
131
+ width: 100%;
132
+ height: 50px;
133
+ margin-top: 37px;
134
+ margin-bottom: 46px;
135
+ padding: 0;
136
+ color: #ffffff;
137
+ font-weight: 600;
138
+ font-size: 18px;
139
+ line-height: 50px;
140
+ background: linear-gradient(131deg, #1d93ff 0%, #0a6bfd 100%);
141
+ border-radius: 4px;
142
+ }
143
+ }
144
+ }
145
+
146
+ .actions {
147
+ color: #666666;
148
+ font-weight: 400;
149
+ font-size: 14px;
150
+ line-height: 25px;
151
+ }
152
+
153
+ .qrcodeBox {
154
+ padding: 20px 24px;
155
+ border: 1px solid #ececec;
156
+ border-radius: 12px;
157
+ }
158
+
159
+ .qrcode {
160
+ :global {
161
+ border: none !important;
162
+ }
163
+ }
164
+
165
+ .captchaBtn {
166
+ padding: 0;
167
+ color: #0a6bfd;
168
+ }
169
+
@@ -0,0 +1,154 @@
1
+ .codeMirrorCustom {
2
+ width: 100%;
3
+ height: 100%;
4
+ border: 0.5px solid #ecedf1;
5
+
6
+ &.disabled {
7
+ :global {
8
+ .cm-activeLine,
9
+ .cm-activeLineGutter {
10
+ background-color: transparent !important;
11
+ }
12
+ }
13
+ }
14
+
15
+ // CodeMirror 语法高亮样式覆盖
16
+ :global {
17
+ color: #888d9d;
18
+ // 关键字 - 蓝色
19
+ .ͼb {
20
+ color: #997bbf !important;
21
+ font-weight: 400;
22
+ }
23
+
24
+ // 类型名 - 紫色
25
+ .ͼi {
26
+ color: #997bbf !important;
27
+ font-weight: 400;
28
+ }
29
+
30
+ // 字符串 - 绿色
31
+ .ͼc,
32
+ .ͼf,
33
+ .ͼe {
34
+ color: #9dbd93 !important;
35
+ }
36
+
37
+ // 数字 - 橙色
38
+ .ͼd {
39
+ color: #e57271 !important;
40
+ }
41
+
42
+ // 注释 - 灰色
43
+ .ͼm {
44
+ color: #999999 !important;
45
+ font-style: italic;
46
+ }
47
+
48
+ // 变量名 - 黑色
49
+ .ͼg {
50
+ color: #000000 !important;
51
+ }
52
+
53
+ // 表名、列名 - 深绿色
54
+ .ͼh {
55
+ color: #006633 !important;
56
+ }
57
+
58
+ .cm-dynamic-param {
59
+ color: #4484d2 !important;
60
+
61
+ .ͼi,
62
+ .ͼb,
63
+ .ͼc,
64
+ .ͼd,
65
+ .ͼe,
66
+ .ͼf,
67
+ .ͼg,
68
+ .ͼh {
69
+ color: #4484d2 !important;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ // 自定义关键词高亮样式
76
+ :global {
77
+ .cm-custom-keyword {
78
+ color: #997bbf !important;
79
+ }
80
+
81
+ .cm-editor {
82
+ outline: none !important;
83
+ }
84
+
85
+ .cm-activeLine {
86
+ background-color: rgb(204 238 255 / 60%) !important;
87
+ }
88
+
89
+ // 确保自定义关键词在语法高亮之上
90
+ .cm-editor .cm-line .cm-custom-keyword {
91
+ position: relative;
92
+ z-index: 10;
93
+ }
94
+ }
95
+
96
+ :global {
97
+ .cm-scroller {
98
+ font-size: 12px;
99
+ background-color: #f9fbfc;
100
+ }
101
+
102
+ .cm-gutters {
103
+ background-color: #f6f6f9 !important;
104
+ border: none !important;
105
+ }
106
+
107
+ .cm-gutterElement {
108
+ color: #999 !important;
109
+
110
+ span[title='Fold line'] {
111
+ display: inline-block;
112
+ transform: translateY(-5px);
113
+ }
114
+ }
115
+
116
+ .cm-tooltip {
117
+ padding: 10px !important;
118
+ background-color: #fff !important;
119
+ border: none !important;
120
+ border-radius: 4px !important;
121
+ box-shadow: 0 0 10px 0 rgba(154, 153, 153, 0.2);
122
+
123
+ .cm-completionLabel {
124
+ color: #666 !important;
125
+ }
126
+
127
+ .cm-completionMatchedText {
128
+ color: #ff9600 !important;
129
+ text-decoration: none !important;
130
+ }
131
+ }
132
+
133
+ .cm-tooltip-autocomplete ul li {
134
+ display: flex !important;
135
+ margin-bottom: 5px !important;
136
+ line-height: 30px !important;
137
+ border-radius: 4px !important;
138
+
139
+ .cm-completionDetail {
140
+ margin-left: auto !important;
141
+ padding-right: 10px !important;
142
+ color: #999 !important;
143
+ }
144
+ }
145
+
146
+ .cm-tooltip.cm-tooltip-autocomplete > ul {
147
+ max-height: 220px !important;
148
+ }
149
+
150
+ .cm-tooltip-autocomplete ul li[aria-selected] {
151
+ background-color: #f1f8ff !important;
152
+ }
153
+ }
154
+
@@ -0,0 +1,20 @@
1
+ import { type ReactCodeMirrorRef } from '@uiw/react-codemirror';
2
+ import React from 'react';
3
+ import { type SqlDialectType } from './sql-language';
4
+ export type YkSqlEditProps = {
5
+ value: string;
6
+ previewValue?: string;
7
+ preview?: boolean;
8
+ placeholder?: string;
9
+ height?: string;
10
+ width?: string;
11
+ onChange: (value: string) => void;
12
+ datasourceType?: SqlDialectType;
13
+ keywordOptions?: {
14
+ keywords: string[];
15
+ functions: string[];
16
+ };
17
+ dataTestId?: string;
18
+ };
19
+ declare const YkSqlEdit: React.ForwardRefExoticComponent<YkSqlEditProps & React.RefAttributes<ReactCodeMirrorRef>>;
20
+ export default YkSqlEdit;
@@ -0,0 +1,180 @@
1
+ // src/business/YkSqlEdit/index.tsx
2
+ import {
3
+ autocompletion
4
+ } from "@codemirror/autocomplete";
5
+ import { MySQL, sql } from "@codemirror/lang-sql";
6
+ import { Decoration, ViewPlugin } from "@codemirror/view";
7
+ import CodeMirror from "@uiw/react-codemirror";
8
+ import React from "react";
9
+ import customStyles from "./code-mirror-custom.module.less";
10
+ import { sqlFunctions, sqlKeywords } from "./sql-language";
11
+ function dynamicParamHighlighter() {
12
+ return ViewPlugin.fromClass(
13
+ class {
14
+ constructor(view) {
15
+ this.decorations = this.buildDecorations(view);
16
+ }
17
+ update(update) {
18
+ if (update.docChanged || update.viewportChanged) {
19
+ this.decorations = this.buildDecorations(update.view);
20
+ }
21
+ }
22
+ buildDecorations(view) {
23
+ const widgets = [];
24
+ const regex = /\{\{.*?\}\}/g;
25
+ for (const { from, to } of view.visibleRanges) {
26
+ const text = view.state.doc.sliceString(from, to);
27
+ let match;
28
+ while ((match = regex.exec(text)) !== null) {
29
+ const start = from + match.index;
30
+ const end = start + match[0].length;
31
+ widgets.push(Decoration.mark({ class: "cm-dynamic-param" }).range(start, end));
32
+ }
33
+ }
34
+ return Decoration.set(widgets, true);
35
+ }
36
+ },
37
+ {
38
+ decorations: (v) => v.decorations
39
+ }
40
+ );
41
+ }
42
+ function customKeywordHighlighter(allKeywords) {
43
+ return ViewPlugin.fromClass(
44
+ class {
45
+ constructor(view) {
46
+ this.decorations = this.buildDecorations(view);
47
+ }
48
+ update(update) {
49
+ if (update.docChanged || update.viewportChanged) {
50
+ this.decorations = this.buildDecorations(update.view);
51
+ }
52
+ }
53
+ buildDecorations(view) {
54
+ if (!allKeywords.length)
55
+ return Decoration.none;
56
+ const widgets = [];
57
+ const regex = new RegExp(`\\b(${allKeywords.join("|")})\\b`, "gi");
58
+ for (const { from, to } of view.visibleRanges) {
59
+ const text = view.state.doc.sliceString(from, to);
60
+ let match;
61
+ while ((match = regex.exec(text)) !== null) {
62
+ const start = from + match.index;
63
+ const end = start + match[0].length;
64
+ widgets.push(
65
+ Decoration.mark({
66
+ class: "cm-custom-keyword",
67
+ attributes: { "data-keyword": match[0] }
68
+ }).range(start, end)
69
+ );
70
+ }
71
+ }
72
+ return Decoration.set(widgets, true);
73
+ }
74
+ },
75
+ {
76
+ decorations: (v) => v.decorations
77
+ }
78
+ );
79
+ }
80
+ function buildCompletions(keywordOptions) {
81
+ var _a, _b;
82
+ const keywords = (_a = keywordOptions == null ? void 0 : keywordOptions.keywords) != null ? _a : [];
83
+ const functions = (_b = keywordOptions == null ? void 0 : keywordOptions.functions) != null ? _b : [];
84
+ const allKeywords = [.../* @__PURE__ */ new Set([...keywords, ...functions])];
85
+ return (context) => {
86
+ var _a2, _b2;
87
+ const word = context.matchBefore(/\w*/);
88
+ if ((word == null ? void 0 : word.from) === (word == null ? void 0 : word.to) && !context.explicit)
89
+ return null;
90
+ const search = ((_a2 = word == null ? void 0 : word.text) != null ? _a2 : "").toLowerCase();
91
+ const options = allKeywords.filter((kw) => kw.toLowerCase().includes(search)).map((kw) => ({
92
+ label: kw,
93
+ detail: keywords.includes(kw) ? "关键字" : functions.includes(kw) ? "函数" : "",
94
+ boost: kw.toLowerCase().startsWith(search) ? 10 : 1
95
+ })).sort((a, b) => {
96
+ var _a3, _b3;
97
+ return ((_a3 = b.boost) != null ? _a3 : 0) - ((_b3 = a.boost) != null ? _b3 : 0);
98
+ });
99
+ return {
100
+ from: (_b2 = word == null ? void 0 : word.from) != null ? _b2 : 0,
101
+ options: options.slice(0, 50)
102
+ };
103
+ };
104
+ }
105
+ var YkSqlEdit = React.forwardRef((props, ref) => {
106
+ const {
107
+ value,
108
+ previewValue,
109
+ preview,
110
+ placeholder = "请输入查询语句",
111
+ height = "100%",
112
+ width = "100%",
113
+ onChange,
114
+ datasourceType,
115
+ keywordOptions,
116
+ dataTestId = "native-query-editor"
117
+ } = props;
118
+ const resolvedKeywordOptions = React.useMemo(() => {
119
+ if (keywordOptions)
120
+ return keywordOptions;
121
+ if (!datasourceType)
122
+ return { keywords: [], functions: [] };
123
+ return {
124
+ keywords: sqlKeywords(datasourceType),
125
+ functions: sqlFunctions(datasourceType)
126
+ };
127
+ }, [datasourceType, keywordOptions]);
128
+ const allKeywords = React.useMemo(() => {
129
+ var _a, _b;
130
+ const keywords = (_a = resolvedKeywordOptions.keywords) != null ? _a : [];
131
+ const functions = (_b = resolvedKeywordOptions.functions) != null ? _b : [];
132
+ return [.../* @__PURE__ */ new Set([...keywords, ...functions])];
133
+ }, [resolvedKeywordOptions]);
134
+ const customCompletions = React.useMemo(() => buildCompletions(resolvedKeywordOptions), [resolvedKeywordOptions]);
135
+ return /* @__PURE__ */ React.createElement(
136
+ CodeMirror,
137
+ {
138
+ ref,
139
+ value: preview ? previewValue != null ? previewValue : value : value,
140
+ className: `${customStyles.codeMirrorCustom} ${preview ? customStyles.disabled : ""}`,
141
+ "data-testid": dataTestId,
142
+ placeholder,
143
+ height,
144
+ width,
145
+ editable: !preview,
146
+ autoCorrect: "off",
147
+ extensions: [
148
+ sql({ dialect: MySQL }),
149
+ dynamicParamHighlighter(),
150
+ customKeywordHighlighter(allKeywords),
151
+ autocompletion({
152
+ override: [customCompletions]
153
+ })
154
+ ],
155
+ onChange: (next) => onChange(next),
156
+ basicSetup: {
157
+ closeBrackets: true,
158
+ autocompletion: true,
159
+ bracketMatching: true,
160
+ highlightSpecialChars: true,
161
+ searchKeymap: true,
162
+ history: true,
163
+ historyKeymap: true,
164
+ drawSelection: true,
165
+ syntaxHighlighting: true,
166
+ defaultKeymap: true,
167
+ dropCursor: true,
168
+ highlightSelectionMatches: true,
169
+ completionKeymap: true,
170
+ highlightActiveLineGutter: true
171
+ }
172
+ }
173
+ );
174
+ });
175
+ YkSqlEdit.displayName = "YkSqlEdit";
176
+ var YkSqlEdit_default = YkSqlEdit;
177
+ export {
178
+ YkSqlEdit_default as default
179
+ };
180
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/business/YkSqlEdit/index.tsx"],
4
+ "sourcesContent": ["import {\n autocompletion,\n type Completion,\n type CompletionContext,\n type CompletionResult,\n} from '@codemirror/autocomplete';\nimport { MySQL, sql } from '@codemirror/lang-sql';\nimport { Decoration, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';\nimport CodeMirror, { type ReactCodeMirrorRef } from '@uiw/react-codemirror';\nimport React from 'react';\nimport customStyles from './code-mirror-custom.module.less';\nimport { type SqlDialectType, sqlFunctions, sqlKeywords } from './sql-language';\n\nexport type YkSqlEditProps = {\n value: string;\n previewValue?: string;\n preview?: boolean;\n placeholder?: string;\n height?: string;\n width?: string;\n onChange: (value: string) => void;\n\n datasourceType?: SqlDialectType;\n keywordOptions?: {\n keywords: string[];\n functions: string[];\n };\n dataTestId?: string;\n};\n\n// 动态参数高亮插件\nfunction dynamicParamHighlighter() {\n return ViewPlugin.fromClass(\n class {\n decorations;\n constructor(view: EditorView) {\n this.decorations = this.buildDecorations(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view);\n }\n }\n buildDecorations(view: EditorView) {\n const widgets = [];\n const regex = /\\{\\{.*?\\}\\}/g;\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to);\n let match;\n while ((match = regex.exec(text)) !== null) {\n const start = from + match.index;\n const end = start + match[0].length;\n widgets.push(Decoration.mark({ class: 'cm-dynamic-param' }).range(start, end));\n }\n }\n return Decoration.set(widgets, true);\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n );\n}\n\nfunction customKeywordHighlighter(allKeywords: string[]) {\n return ViewPlugin.fromClass(\n class {\n decorations;\n constructor(view: EditorView) {\n this.decorations = this.buildDecorations(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view);\n }\n }\n buildDecorations(view: EditorView) {\n if (!allKeywords.length) return Decoration.none;\n\n const widgets = [];\n const regex = new RegExp(`\\\\b(${allKeywords.join('|')})\\\\b`, 'gi');\n\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to);\n let match;\n while ((match = regex.exec(text)) !== null) {\n const start = from + match.index;\n const end = start + match[0].length;\n widgets.push(\n Decoration.mark({\n class: 'cm-custom-keyword',\n attributes: { 'data-keyword': match[0] },\n }).range(start, end),\n );\n }\n }\n return Decoration.set(widgets, true);\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n );\n}\n\nfunction buildCompletions(keywordOptions?: YkSqlEditProps['keywordOptions']) {\n const keywords = keywordOptions?.keywords ?? [];\n const functions = keywordOptions?.functions ?? [];\n const allKeywords = [...new Set([...keywords, ...functions])];\n\n return (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/\\w*/);\n if (word?.from === word?.to && !context.explicit) return null;\n\n const search = (word?.text ?? '').toLowerCase();\n const options: Completion[] = allKeywords\n .filter((kw) => kw.toLowerCase().includes(search))\n .map((kw) => ({\n label: kw,\n detail: keywords.includes(kw) ? '关键字' : functions.includes(kw) ? '函数' : '',\n boost: kw.toLowerCase().startsWith(search) ? 10 : 1,\n }))\n .sort((a, b) => (b.boost ?? 0) - (a.boost ?? 0));\n\n return {\n from: word?.from ?? 0,\n options: options.slice(0, 50),\n };\n };\n}\n\nconst YkSqlEdit = React.forwardRef<ReactCodeMirrorRef, YkSqlEditProps>((props, ref) => {\n const {\n value,\n previewValue,\n preview,\n placeholder = '请输入查询语句',\n height = '100%',\n width = '100%',\n onChange,\n datasourceType,\n keywordOptions,\n dataTestId = 'native-query-editor',\n } = props;\n\n const resolvedKeywordOptions = React.useMemo(() => {\n if (keywordOptions) return keywordOptions;\n if (!datasourceType) return { keywords: [], functions: [] };\n return {\n keywords: sqlKeywords(datasourceType),\n functions: sqlFunctions(datasourceType),\n };\n }, [datasourceType, keywordOptions]);\n\n const allKeywords = React.useMemo(() => {\n const keywords = resolvedKeywordOptions.keywords ?? [];\n const functions = resolvedKeywordOptions.functions ?? [];\n return [...new Set([...keywords, ...functions])];\n }, [resolvedKeywordOptions]);\n\n const customCompletions = React.useMemo(() => buildCompletions(resolvedKeywordOptions), [resolvedKeywordOptions]);\n\n return (\n <CodeMirror\n ref={ref}\n value={preview ? (previewValue ?? value) : value}\n className={`${customStyles.codeMirrorCustom} ${preview ? customStyles.disabled : ''}`}\n data-testid={dataTestId}\n placeholder={placeholder}\n height={height}\n width={width}\n editable={!preview}\n autoCorrect='off'\n extensions={[\n sql({ dialect: MySQL }),\n dynamicParamHighlighter(),\n customKeywordHighlighter(allKeywords),\n autocompletion({\n override: [customCompletions],\n }),\n ]}\n onChange={(next) => onChange(next)}\n basicSetup={{\n closeBrackets: true,\n autocompletion: true,\n bracketMatching: true,\n highlightSpecialChars: true,\n searchKeymap: true,\n history: true,\n historyKeymap: true,\n drawSelection: true,\n syntaxHighlighting: true,\n defaultKeymap: true,\n dropCursor: true,\n highlightSelectionMatches: true,\n completionKeymap: true,\n highlightActiveLineGutter: true,\n }}\n />\n );\n});\n\nYkSqlEdit.displayName = 'YkSqlEdit';\n\nexport default YkSqlEdit;\n"],
5
+ "mappings": ";AAAA;AAAA,EACE;AAAA,OAIK;AACP,SAAS,OAAO,WAAW;AAC3B,SAAS,YAA6B,kBAAmC;AACzE,OAAO,gBAA6C;AACpD,OAAO,WAAW;AAClB,OAAO,kBAAkB;AACzB,SAA8B,cAAc,mBAAmB;AAoB/D,SAAS,0BAA0B;AACjC,SAAO,WAAW;AAAA,IAChB,MAAM;AAAA,MAEJ,YAAY,MAAkB;AAC5B,aAAK,cAAc,KAAK,iBAAiB,IAAI;AAAA,MAC/C;AAA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A;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,MACX,aAAY;AAAA,MACZ,YAAY;AAAA,QACV,IAAI,EAAE,SAAS,MAAM,CAAC;AAAA,QACtB,wBAAwB;AAAA,QACxB,yBAAyB,WAAW;AAAA,QACpC,eAAe;AAAA,UACb,UAAU,CAAC,iBAAiB;AAAA,QAC9B,CAAC;AAAA,MACH;AAAA,MACA,UAAU,CAAC,SAAS,SAAS,IAAI;AAAA,MACjC,YAAY;AAAA,QACV,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,iBAAiB;AAAA,QACjB,uBAAuB;AAAA,QACvB,cAAc;AAAA,QACd,SAAS;AAAA,QACT,eAAe;AAAA,QACf,eAAe;AAAA,QACf,oBAAoB;AAAA,QACpB,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,2BAA2B;AAAA,QAC3B,kBAAkB;AAAA,QAClB,2BAA2B;AAAA,MAC7B;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,UAAU,cAAc;AAExB,IAAO,oBAAQ;",
6
+ "names": ["_a", "_b"]
7
+ }
@@ -0,0 +1,11 @@
1
+ export type SqlDialectType = 'starrocks' | 'impala' | 'hive' | string;
2
+ export declare const defaultKeywords: string[];
3
+ export declare const defaultFunctions: string[];
4
+ export declare const srKeywords: string[];
5
+ export declare const srFunctions: string[];
6
+ export declare const impalaKeywords: string[];
7
+ export declare const impalaFunctions: string[];
8
+ export declare const hiveKeywords: string[];
9
+ export declare const hiveFunctions: string[];
10
+ export declare const sqlKeywords: (type: SqlDialectType) => string[];
11
+ export declare const sqlFunctions: (type: SqlDialectType) => string[];