@jetlinks-web/components 2.6.12 → 3.0.1-rc

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 (68) hide show
  1. package/es/EditTable/components/Search/sort.js +1 -1
  2. package/es/FullPage/FullPage.js +1 -1
  3. package/es/ProTable/ProTable.js +8 -4
  4. package/es/Search/Advanced/SaveHistory.js +1 -1
  5. package/es/Search/Item.js +1 -1
  6. package/es/Skeleton/components/DashBoardCard.js +57 -0
  7. package/es/Skeleton/components/DashBoardChart.js +93 -0
  8. package/es/Skeleton/components/Detail.js +104 -0
  9. package/es/Skeleton/components/Drawer.js +82 -0
  10. package/es/Skeleton/components/Item.js +60 -0
  11. package/es/Skeleton/components/List.js +46 -0
  12. package/es/Skeleton/components/ListCard.js +56 -0
  13. package/es/Skeleton/components/ListCardItem.js +87 -0
  14. package/es/Skeleton/components/ListTable.js +67 -0
  15. package/es/Skeleton/components/Page.js +63 -0
  16. package/es/Skeleton/components/Search.js +54 -0
  17. package/es/Skeleton/components/Tree.js +65 -0
  18. package/es/Skeleton/index.js +15 -0
  19. package/es/Skeleton/skeleton.js +49 -0
  20. package/es/Skeleton/style/Skeleton.less +166 -0
  21. package/es/Skeleton/style/index.js +1 -0
  22. package/es/Title/style/index.css +4 -0
  23. package/es/Title/style/index.less +3 -1
  24. package/es/ValueItem/ValueItem.js +9 -57
  25. package/es/components.js +2 -2
  26. package/es/style/index.css +141 -4
  27. package/es/style/index.less +1 -1
  28. package/es/style.js +2 -2
  29. package/lib/EditTable/components/Search/sort.js +1 -1
  30. package/lib/FullPage/FullPage.js +1 -1
  31. package/lib/ProTable/ProTable.js +8 -4
  32. package/lib/Search/Advanced/SaveHistory.js +1 -1
  33. package/lib/Search/Item.js +1 -1
  34. package/lib/Skeleton/components/DashBoardCard.js +57 -0
  35. package/lib/Skeleton/components/DashBoardChart.js +93 -0
  36. package/lib/Skeleton/components/Detail.js +104 -0
  37. package/lib/Skeleton/components/Drawer.js +82 -0
  38. package/lib/Skeleton/components/Item.js +60 -0
  39. package/lib/Skeleton/components/List.js +46 -0
  40. package/lib/Skeleton/components/ListCard.js +56 -0
  41. package/lib/Skeleton/components/ListCardItem.js +87 -0
  42. package/lib/Skeleton/components/ListTable.js +67 -0
  43. package/lib/Skeleton/components/Page.js +63 -0
  44. package/lib/Skeleton/components/Search.js +54 -0
  45. package/lib/Skeleton/components/Tree.js +65 -0
  46. package/lib/Skeleton/index.js +75 -0
  47. package/lib/Skeleton/skeleton.js +49 -0
  48. package/lib/Skeleton/style/Skeleton.less +166 -0
  49. package/lib/Skeleton/style/index.js +3 -0
  50. package/lib/Title/style/index.css +4 -0
  51. package/lib/Title/style/index.less +3 -1
  52. package/lib/ValueItem/ValueItem.js +9 -57
  53. package/lib/components.js +7 -7
  54. package/lib/style/components.less +0 -1
  55. package/lib/style/index.css +141 -4
  56. package/lib/style/index.less +1 -1
  57. package/lib/style.js +2 -2
  58. package/package.json +173 -173
  59. package/es/MonacoEditor/Monaco.js +0 -242
  60. package/es/MonacoEditor/index.js +0 -5
  61. package/es/MonacoEditor/style/index.css +0 -4
  62. package/es/MonacoEditor/style/index.js +0 -1
  63. package/es/MonacoEditor/style/index.less +0 -4
  64. package/lib/MonacoEditor/Monaco.js +0 -242
  65. package/lib/MonacoEditor/index.js +0 -12
  66. package/lib/MonacoEditor/style/index.css +0 -4
  67. package/lib/MonacoEditor/style/index.js +0 -3
  68. package/lib/MonacoEditor/style/index.less +0 -4
@@ -1,242 +0,0 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
- const op = ops[i];
3
- const fn = ops[i + 1];
4
- i += 2;
5
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
- return undefined;
7
- }
8
- if (op === 'access' || op === 'optionalAccess') {
9
- lastAccessLHS = value;
10
- value = fn(value);
11
- }
12
- else if (op === 'call' || op === 'optionalCall') {
13
- value = fn((...args) => value.call(lastAccessLHS, ...args));
14
- lastAccessLHS = undefined;
15
- }
16
- } return value; }
17
- /* Analyzed bindings: {
18
- "modelValue": "props",
19
- "theme": "props",
20
- "language": "props",
21
- "codeTips": "props",
22
- "init": "props",
23
- "registrationTips": "props",
24
- "registrationTypescript": "props",
25
- "blurFormat": "props",
26
- "readOnly": "props",
27
- "options": "props",
28
- "ref": "setup-const",
29
- "onMounted": "setup-const",
30
- "watch": "setup-const",
31
- "onUnmounted": "setup-const",
32
- "toRaw": "setup-const",
33
- "nextTick": "setup-const",
34
- "monaco": "setup-const",
35
- "omit": "setup-maybe-ref",
36
- "props": "setup-reactive-const",
37
- "emit": "setup-const",
38
- "dom": "setup-ref",
39
- "instance": "setup-let",
40
- "monacoProviderRef": "setup-ref",
41
- "monacoTypescriptProviderRef": "setup-ref",
42
- "handleSuggestions": "setup-const",
43
- "disposeRegister": "setup-const",
44
- "registerCompletionItemProvider": "setup-const",
45
- "disposeTypescript": "setup-const",
46
- "registerTypescript": "setup-const",
47
- "editorFormat": "setup-const",
48
- "insert": "setup-const"
49
- } */
50
- import { openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
51
- import { ref, onMounted, watch, onUnmounted, nextTick } from 'vue';
52
- import * as monaco from 'monaco-editor';
53
- import { omit } from 'lodash-es';
54
- const __sfc_main__ = Object.assign({
55
- name: 'JMonacoEditor'
56
- }, {
57
- props: {
58
- modelValue: [String, Number],
59
- theme: { type: String, default: 'vs-dark' },
60
- language: { type: String, default: 'json' },
61
- codeTips: { type: Array, default: () => [] },
62
- init: { type: Function, default: undefined },
63
- registrationTips: { type: Object, default: () => ({}) },
64
- registrationTypescript: { type: Object, default: () => ({}) },
65
- blurFormat: { type: Boolean, default: true },
66
- readOnly: { type: Boolean, default: false },
67
- options: { type: Object, default: () => ({}) },
68
- },
69
- emits: [
70
- 'update:modelValue',
71
- 'blur',
72
- 'focus',
73
- 'change',
74
- 'errorChange',
75
- ],
76
- setup(__props, { expose: __expose, emit: __emit }) {
77
- const props = __props;
78
- const emit = __emit;
79
- const dom = ref();
80
- let instance;
81
- const monacoProviderRef = ref();
82
- const monacoTypescriptProviderRef = ref();
83
- // codeTipItem.dispose() // 销毁自定义提示
84
- const handleSuggestions = (suggestions, range) => {
85
- return Array.isArray(suggestions)
86
- ? suggestions.map((item) => ({ ...item, range }))
87
- : [];
88
- };
89
- const disposeRegister = () => {
90
- _optionalChain([monacoProviderRef, 'access', _ => _.value, 'optionalAccess', _2 => _2.dispose, 'call', _3 => _3()]);
91
- monacoProviderRef.value = null;
92
- };
93
- /**
94
- * 代码提示注册
95
- */
96
- const registerCompletionItemProvider = () => {
97
- disposeRegister();
98
- if (monaco.languages && _optionalChain([props, 'access', _4 => _4.registrationTips, 'optionalAccess', _5 => _5.suggestions])) {
99
- const { name, suggestions } = props.registrationTips;
100
- monacoProviderRef.value =
101
- monaco.languages.registerCompletionItemProvider(name || 'json', {
102
- provideCompletionItems: function (model, position) {
103
- const word = model.getWordUntilPosition(position); // 获取提示代码范围位置
104
- const range = {
105
- startLineNumber: position.lineNumber,
106
- endLineNumber: position.lineNumber,
107
- startColumn: word.startColumn,
108
- endColumn: word.endColumn,
109
- };
110
- return {
111
- suggestions: handleSuggestions(suggestions, range),
112
- };
113
- },
114
- });
115
- }
116
- };
117
- const disposeTypescript = () => {
118
- _optionalChain([monacoTypescriptProviderRef, 'access', _6 => _6.value, 'optionalAccess', _7 => _7.dispose, 'call', _8 => _8()]);
119
- monacoTypescriptProviderRef.value = null;
120
- };
121
- const registerTypescript = () => {
122
- disposeTypescript();
123
- if (monaco.languages && _optionalChain([props, 'access', _9 => _9.registrationTypescript, 'optionalAccess', _10 => _10.typescript])) {
124
- const { name, typescript } = props.registrationTypescript;
125
- monacoTypescriptProviderRef.value =
126
- monaco.languages.typescript.javascriptDefaults.addExtraLib(typescript);
127
- }
128
- };
129
- /**
130
- * 代码格式化
131
- */
132
- const editorFormat = () => {
133
- if (!instance)
134
- return;
135
- setTimeout(() => {
136
- _optionalChain([instance, 'access', _11 => _11.getAction, 'call', _12 => _12('editor.action.formatDocument'), 'optionalAccess', _13 => _13.run, 'call', _14 => _14()]);
137
- }, 300);
138
- if (props.hasOwnProperty('readOnly')) {
139
- setTimeout(() => {
140
- instance.updateOptions({
141
- readOnly: props.readOnly !== false,
142
- });
143
- }, 400);
144
- }
145
- };
146
- monaco.editor.onDidChangeMarkers(([uri]) => {
147
- const markers = monaco.editor.getModelMarkers({ resource: uri });
148
- emit('errorChange', markers);
149
- });
150
- onMounted(async () => {
151
- const _model = monaco.editor.createModel(props.modelValue, props.language);
152
- instance = monaco.editor.create(dom.value, {
153
- model: _model,
154
- tabSize: 2,
155
- automaticLayout: true,
156
- scrollBeyondLastLine: false,
157
- theme: props.theme,
158
- formatOnPaste: true,
159
- ...(omit(props.options, ['readOnly']) || {}),
160
- });
161
- instance.onDidChangeModelContent(() => {
162
- //
163
- const value = instance.getValue();
164
- nextTick(() => {
165
- emit('update:modelValue', value);
166
- emit('change', value);
167
- });
168
- });
169
- instance.onDidBlurEditorText(() => {
170
- emit('blur');
171
- if (props.blurFormat) {
172
- editorFormat();
173
- }
174
- });
175
- instance.onDidFocusEditorText(() => {
176
- emit('focus');
177
- });
178
- if (props.modelValue) {
179
- setTimeout(() => {
180
- editorFormat();
181
- }, 200);
182
- }
183
- _optionalChain([props, 'access', _15 => _15.init, 'optionalCall', _16 => _16(instance, monaco)]);
184
- });
185
- /**
186
- * 光标位置插入内容
187
- * @param {String} val
188
- * @param position
189
- */
190
- const insert = (val, position) => {
191
- if (!instance)
192
- return;
193
- const _position = position || instance.getPosition();
194
- const value = instance.getValue();
195
- if (position && position.lineNumber) {
196
- instance.setPosition(position);
197
- }
198
- instance.executeEdits(value, [
199
- {
200
- range: new monaco.Range(_optionalChain([_position, 'optionalAccess', _17 => _17.lineNumber]), _optionalChain([_position, 'optionalAccess', _18 => _18.column]), _optionalChain([_position, 'optionalAccess', _19 => _19.lineNumber]), _optionalChain([_position, 'optionalAccess', _20 => _20.column])),
201
- text: val,
202
- },
203
- ]);
204
- };
205
- watch(() => props.modelValue, (val) => {
206
- if (!instance ||
207
- (instance &&
208
- props.modelValue === instance.getValue()))
209
- return;
210
- // setValue之前获取光标位置
211
- const position = instance.getPosition();
212
- // setValue之后光标位置改变
213
- instance.setValue(val);
214
- // 设置光标位置为setValue之前的位置
215
- instance.setPosition(position);
216
- editorFormat();
217
- });
218
- watch(() => JSON.stringify(props.registrationTips), () => {
219
- registerCompletionItemProvider();
220
- }, { immediate: true });
221
- watch(() => JSON.stringify(props.registrationTypescript), () => {
222
- registerTypescript();
223
- }, { immediate: true });
224
- onUnmounted(() => {
225
- disposeRegister();
226
- disposeTypescript();
227
- _optionalChain([instance, 'access', _21 => _21.editor, 'optionalAccess', _22 => _22.dispose, 'optionalCall', _23 => _23()]);
228
- });
229
- __expose({
230
- editorFormat,
231
- insert,
232
- });
233
- return (_ctx, _cache) => {
234
- return (_openBlock(), _createElementBlock("div", {
235
- ref_key: "dom",
236
- ref: dom,
237
- class: "j-monaco-editor"
238
- }, null, 512 /* NEED_PATCH */));
239
- };
240
- }
241
- });
242
- export default __sfc_main__;
@@ -1,5 +0,0 @@
1
- import Monaco from './Monaco.js';
2
- Monaco.install = function (app) {
3
- app.component(Monaco.name, Monaco);
4
- };
5
- export default Monaco;
@@ -1,4 +0,0 @@
1
- .j-monaco-editor {
2
- min-height: 50px;
3
- height: 100%;
4
- }
@@ -1 +0,0 @@
1
- import './index.less';
@@ -1,4 +0,0 @@
1
- .j-monaco-editor {
2
- min-height: 50px;
3
- height: 100%;
4
- }
@@ -1,242 +0,0 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
- const op = ops[i];
3
- const fn = ops[i + 1];
4
- i += 2;
5
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
- return undefined;
7
- }
8
- if (op === 'access' || op === 'optionalAccess') {
9
- lastAccessLHS = value;
10
- value = fn(value);
11
- }
12
- else if (op === 'call' || op === 'optionalCall') {
13
- value = fn((...args) => value.call(lastAccessLHS, ...args));
14
- lastAccessLHS = undefined;
15
- }
16
- } return value; }
17
- /* Analyzed bindings: {
18
- "modelValue": "props",
19
- "theme": "props",
20
- "language": "props",
21
- "codeTips": "props",
22
- "init": "props",
23
- "registrationTips": "props",
24
- "registrationTypescript": "props",
25
- "blurFormat": "props",
26
- "readOnly": "props",
27
- "options": "props",
28
- "ref": "setup-const",
29
- "onMounted": "setup-const",
30
- "watch": "setup-const",
31
- "onUnmounted": "setup-const",
32
- "toRaw": "setup-const",
33
- "nextTick": "setup-const",
34
- "monaco": "setup-const",
35
- "omit": "setup-maybe-ref",
36
- "props": "setup-reactive-const",
37
- "emit": "setup-const",
38
- "dom": "setup-ref",
39
- "instance": "setup-let",
40
- "monacoProviderRef": "setup-ref",
41
- "monacoTypescriptProviderRef": "setup-ref",
42
- "handleSuggestions": "setup-const",
43
- "disposeRegister": "setup-const",
44
- "registerCompletionItemProvider": "setup-const",
45
- "disposeTypescript": "setup-const",
46
- "registerTypescript": "setup-const",
47
- "editorFormat": "setup-const",
48
- "insert": "setup-const"
49
- } */
50
- import { openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
51
- import { ref, onMounted, watch, onUnmounted, nextTick } from 'vue';
52
- import * as monaco from 'monaco-editor';
53
- import { omit } from 'lodash-es';
54
- const __sfc_main__ = Object.assign({
55
- name: 'JMonacoEditor'
56
- }, {
57
- props: {
58
- modelValue: [String, Number],
59
- theme: { type: String, default: 'vs-dark' },
60
- language: { type: String, default: 'json' },
61
- codeTips: { type: Array, default: () => [] },
62
- init: { type: Function, default: undefined },
63
- registrationTips: { type: Object, default: () => ({}) },
64
- registrationTypescript: { type: Object, default: () => ({}) },
65
- blurFormat: { type: Boolean, default: true },
66
- readOnly: { type: Boolean, default: false },
67
- options: { type: Object, default: () => ({}) },
68
- },
69
- emits: [
70
- 'update:modelValue',
71
- 'blur',
72
- 'focus',
73
- 'change',
74
- 'errorChange',
75
- ],
76
- setup(__props, { expose: __expose, emit: __emit }) {
77
- const props = __props;
78
- const emit = __emit;
79
- const dom = ref();
80
- let instance;
81
- const monacoProviderRef = ref();
82
- const monacoTypescriptProviderRef = ref();
83
- // codeTipItem.dispose() // 销毁自定义提示
84
- const handleSuggestions = (suggestions, range) => {
85
- return Array.isArray(suggestions)
86
- ? suggestions.map((item) => ({ ...item, range }))
87
- : [];
88
- };
89
- const disposeRegister = () => {
90
- _optionalChain([monacoProviderRef, 'access', _ => _.value, 'optionalAccess', _2 => _2.dispose, 'call', _3 => _3()]);
91
- monacoProviderRef.value = null;
92
- };
93
- /**
94
- * 代码提示注册
95
- */
96
- const registerCompletionItemProvider = () => {
97
- disposeRegister();
98
- if (monaco.languages && _optionalChain([props, 'access', _4 => _4.registrationTips, 'optionalAccess', _5 => _5.suggestions])) {
99
- const { name, suggestions } = props.registrationTips;
100
- monacoProviderRef.value =
101
- monaco.languages.registerCompletionItemProvider(name || 'json', {
102
- provideCompletionItems: function (model, position) {
103
- const word = model.getWordUntilPosition(position); // 获取提示代码范围位置
104
- const range = {
105
- startLineNumber: position.lineNumber,
106
- endLineNumber: position.lineNumber,
107
- startColumn: word.startColumn,
108
- endColumn: word.endColumn,
109
- };
110
- return {
111
- suggestions: handleSuggestions(suggestions, range),
112
- };
113
- },
114
- });
115
- }
116
- };
117
- const disposeTypescript = () => {
118
- _optionalChain([monacoTypescriptProviderRef, 'access', _6 => _6.value, 'optionalAccess', _7 => _7.dispose, 'call', _8 => _8()]);
119
- monacoTypescriptProviderRef.value = null;
120
- };
121
- const registerTypescript = () => {
122
- disposeTypescript();
123
- if (monaco.languages && _optionalChain([props, 'access', _9 => _9.registrationTypescript, 'optionalAccess', _10 => _10.typescript])) {
124
- const { name, typescript } = props.registrationTypescript;
125
- monacoTypescriptProviderRef.value =
126
- monaco.languages.typescript.javascriptDefaults.addExtraLib(typescript);
127
- }
128
- };
129
- /**
130
- * 代码格式化
131
- */
132
- const editorFormat = () => {
133
- if (!instance)
134
- return;
135
- setTimeout(() => {
136
- _optionalChain([instance, 'access', _11 => _11.getAction, 'call', _12 => _12('editor.action.formatDocument'), 'optionalAccess', _13 => _13.run, 'call', _14 => _14()]);
137
- }, 300);
138
- if (props.hasOwnProperty('readOnly')) {
139
- setTimeout(() => {
140
- instance.updateOptions({
141
- readOnly: props.readOnly !== false,
142
- });
143
- }, 400);
144
- }
145
- };
146
- monaco.editor.onDidChangeMarkers(([uri]) => {
147
- const markers = monaco.editor.getModelMarkers({ resource: uri });
148
- emit('errorChange', markers);
149
- });
150
- onMounted(async () => {
151
- const _model = monaco.editor.createModel(props.modelValue, props.language);
152
- instance = monaco.editor.create(dom.value, {
153
- model: _model,
154
- tabSize: 2,
155
- automaticLayout: true,
156
- scrollBeyondLastLine: false,
157
- theme: props.theme,
158
- formatOnPaste: true,
159
- ...(omit(props.options, ['readOnly']) || {}),
160
- });
161
- instance.onDidChangeModelContent(() => {
162
- //
163
- const value = instance.getValue();
164
- nextTick(() => {
165
- emit('update:modelValue', value);
166
- emit('change', value);
167
- });
168
- });
169
- instance.onDidBlurEditorText(() => {
170
- emit('blur');
171
- if (props.blurFormat) {
172
- editorFormat();
173
- }
174
- });
175
- instance.onDidFocusEditorText(() => {
176
- emit('focus');
177
- });
178
- if (props.modelValue) {
179
- setTimeout(() => {
180
- editorFormat();
181
- }, 200);
182
- }
183
- _optionalChain([props, 'access', _15 => _15.init, 'optionalCall', _16 => _16(instance, monaco)]);
184
- });
185
- /**
186
- * 光标位置插入内容
187
- * @param {String} val
188
- * @param position
189
- */
190
- const insert = (val, position) => {
191
- if (!instance)
192
- return;
193
- const _position = position || instance.getPosition();
194
- const value = instance.getValue();
195
- if (position && position.lineNumber) {
196
- instance.setPosition(position);
197
- }
198
- instance.executeEdits(value, [
199
- {
200
- range: new monaco.Range(_optionalChain([_position, 'optionalAccess', _17 => _17.lineNumber]), _optionalChain([_position, 'optionalAccess', _18 => _18.column]), _optionalChain([_position, 'optionalAccess', _19 => _19.lineNumber]), _optionalChain([_position, 'optionalAccess', _20 => _20.column])),
201
- text: val,
202
- },
203
- ]);
204
- };
205
- watch(() => props.modelValue, (val) => {
206
- if (!instance ||
207
- (instance &&
208
- props.modelValue === instance.getValue()))
209
- return;
210
- // setValue之前获取光标位置
211
- const position = instance.getPosition();
212
- // setValue之后光标位置改变
213
- instance.setValue(val);
214
- // 设置光标位置为setValue之前的位置
215
- instance.setPosition(position);
216
- editorFormat();
217
- });
218
- watch(() => JSON.stringify(props.registrationTips), () => {
219
- registerCompletionItemProvider();
220
- }, { immediate: true });
221
- watch(() => JSON.stringify(props.registrationTypescript), () => {
222
- registerTypescript();
223
- }, { immediate: true });
224
- onUnmounted(() => {
225
- disposeRegister();
226
- disposeTypescript();
227
- _optionalChain([instance, 'access', _21 => _21.editor, 'optionalAccess', _22 => _22.dispose, 'optionalCall', _23 => _23()]);
228
- });
229
- __expose({
230
- editorFormat,
231
- insert,
232
- });
233
- return (_ctx, _cache) => {
234
- return (_openBlock(), _createElementBlock("div", {
235
- ref_key: "dom",
236
- ref: dom,
237
- class: "j-monaco-editor"
238
- }, null, 512 /* NEED_PATCH */));
239
- };
240
- }
241
- });
242
- export default __sfc_main__;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _Monaco = _interopRequireDefault(require("./Monaco.js"));
9
- _Monaco.default.install = function (app) {
10
- app.component(_Monaco.default.name, _Monaco.default);
11
- };
12
- var _default = exports.default = _Monaco.default;
@@ -1,4 +0,0 @@
1
- .j-monaco-editor {
2
- min-height: 50px;
3
- height: 100%;
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
-
3
- require("./index.less");
@@ -1,4 +0,0 @@
1
- .j-monaco-editor {
2
- min-height: 50px;
3
- height: 100%;
4
- }