@jetlinks-web/components 2.1.0 → 2.1.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.
- package/es/EditTable/Body.js +2 -1
- package/es/EditTable/EditTable.js +12 -9
- package/es/EditTable/FormItem.js +214 -0
- package/es/EditTable/Header.js +3 -2
- package/es/EditTable/components/Search/Search.js +7 -13
- package/es/EditTable/index.js +2 -0
- package/es/EditTable/props.js +12 -0
- package/es/FullPage/FullPage.js +1 -1
- package/es/MonacoEditor/Monaco.js +9 -1
- package/es/MonacoEditor/grammars.js +125 -0
- package/es/MonacoEditor/style/index.js +0 -0
- package/es/MonacoEditor/tips.js +1056 -0
- package/es/Search/Advanced/SaveHistory.js +1 -1
- package/es/Search/Item.js +1 -1
- package/es/Search/Search.js +1 -1
- package/lib/EditTable/Body.js +2 -1
- package/lib/EditTable/EditTable.js +12 -9
- package/lib/EditTable/FormItem.js +214 -0
- package/lib/EditTable/Header.js +3 -2
- package/lib/EditTable/components/Search/Search.js +7 -13
- package/lib/EditTable/index.js +2 -0
- package/lib/EditTable/props.js +12 -0
- package/lib/FullPage/FullPage.js +1 -1
- package/lib/MonacoEditor/Monaco.js +9 -1
- package/lib/MonacoEditor/grammars.js +137 -0
- package/lib/MonacoEditor/style/index.js +1 -0
- package/lib/MonacoEditor/tips.js +1062 -0
- package/lib/Search/Advanced/SaveHistory.js +1 -1
- package/lib/Search/Item.js +1 -1
- package/lib/Search/Search.js +1 -1
- package/package.json +5 -2
package/es/EditTable/Body.js
CHANGED
|
@@ -28,6 +28,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
28
28
|
"watch": "setup-const",
|
|
29
29
|
"onMounted": "setup-const",
|
|
30
30
|
"onBeforeUnmount": "setup-const",
|
|
31
|
+
"nextTick": "setup-const",
|
|
31
32
|
"handleColumnFixed": "setup-maybe-ref",
|
|
32
33
|
"props": "setup-reactive-const",
|
|
33
34
|
"emit": "setup-const",
|
|
@@ -66,7 +67,7 @@ import ContextMenu from './components/ContextMenu';
|
|
|
66
67
|
import { useRightMenuContext, useTableTool } from "./hooks";
|
|
67
68
|
import { randomString } from "@jetlinks-web/utils";
|
|
68
69
|
import { bodyProps, defaultProps } from "./props";
|
|
69
|
-
import { ref, reactive, computed, watch, onMounted, onBeforeUnmount } from 'vue';
|
|
70
|
+
import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
|
70
71
|
import { handleColumnFixed } from "./utils";
|
|
71
72
|
const __sfc_main__ = Object.assign({
|
|
72
73
|
name: 'JEditTableBody'
|
|
@@ -37,6 +37,8 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
37
37
|
"ref": "setup-const",
|
|
38
38
|
"reactive": "setup-const",
|
|
39
39
|
"defineOptions": "setup-const",
|
|
40
|
+
"computed": "setup-const",
|
|
41
|
+
"watch": "setup-const",
|
|
40
42
|
"bodyProps": "setup-maybe-ref",
|
|
41
43
|
"defaultProps": "setup-maybe-ref",
|
|
42
44
|
"findIndex": "setup-maybe-ref",
|
|
@@ -55,7 +57,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
55
57
|
"fields": "setup-const",
|
|
56
58
|
"fieldsErrMap": "setup-ref",
|
|
57
59
|
"sortData": "setup-reactive-const",
|
|
58
|
-
"_dataSource": "setup-
|
|
60
|
+
"_dataSource": "setup-ref",
|
|
59
61
|
"isFullscreen": "setup-maybe-ref",
|
|
60
62
|
"toggle": "setup-maybe-ref",
|
|
61
63
|
"rules": "setup-maybe-ref",
|
|
@@ -67,7 +69,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
67
69
|
"findField": "setup-const",
|
|
68
70
|
"removeFieldError": "setup-const",
|
|
69
71
|
"addFieldError": "setup-const",
|
|
70
|
-
"scrollWidth": "setup-
|
|
72
|
+
"scrollWidth": "setup-ref",
|
|
71
73
|
"onHorizontalScroll": "setup-const",
|
|
72
74
|
"onResize": "setup-const",
|
|
73
75
|
"onScrollDown": "setup-const",
|
|
@@ -90,7 +92,7 @@ import { tableProps } from 'ant-design-vue/lib/table';
|
|
|
90
92
|
import Header from './header.js';
|
|
91
93
|
import Body from './body.js';
|
|
92
94
|
import { useFullscreen } from '@vueuse/core';
|
|
93
|
-
import { provide, useAttrs, useSlots, ref, reactive, } from 'vue';
|
|
95
|
+
import { provide, useAttrs, useSlots, ref, reactive, computed, watch } from 'vue';
|
|
94
96
|
import { bodyProps, defaultProps } from "./props";
|
|
95
97
|
import { findIndex, get, sortBy } from 'lodash-es';
|
|
96
98
|
const __sfc_main__ = Object.assign({
|
|
@@ -343,16 +345,17 @@ const __sfc_main__ = Object.assign({
|
|
|
343
345
|
_createElementVNode("div", _hoisted_2, [
|
|
344
346
|
_createElementVNode("div", {
|
|
345
347
|
class: "jetlinks-edit-table-header",
|
|
346
|
-
style: _normalizeStyle([{ "height": "50px" }, { paddingRight:
|
|
348
|
+
style: _normalizeStyle([{ "height": "50px" }, { paddingRight: scrollWidth.value + 'px' }])
|
|
347
349
|
}, [
|
|
348
350
|
_createVNode(Header, {
|
|
349
351
|
columns: myColumns.value,
|
|
350
352
|
style: _normalizeStyle({ width: tableStyle.width }),
|
|
351
|
-
rowKey: _ctx.rowKey
|
|
352
|
-
|
|
353
|
+
rowKey: _ctx.rowKey,
|
|
354
|
+
searchColumns: _ctx.searchColumns
|
|
355
|
+
}, null, 8 /* PROPS */, ["columns", "style", "rowKey", "searchColumns"]),
|
|
353
356
|
_createElementVNode("div", {
|
|
354
357
|
class: "jetlinks-edit-table-header-scroll-hidden",
|
|
355
|
-
style: _normalizeStyle({ width:
|
|
358
|
+
style: _normalizeStyle({ width: scrollWidth.value + 'px' })
|
|
356
359
|
}, null, 4 /* STYLE */)
|
|
357
360
|
], 4 /* STYLE */),
|
|
358
361
|
_createElementVNode("div", {
|
|
@@ -362,7 +365,7 @@ const __sfc_main__ = Object.assign({
|
|
|
362
365
|
_createVNode(Body, {
|
|
363
366
|
ref_key: "tableBody",
|
|
364
367
|
ref: tableBody,
|
|
365
|
-
dataSource:
|
|
368
|
+
dataSource: _dataSource.value,
|
|
366
369
|
columns: myColumns.value,
|
|
367
370
|
cellHeight: _ctx.cellHeight,
|
|
368
371
|
height: _ctx.height,
|
|
@@ -400,7 +403,7 @@ const __sfc_main__ = Object.assign({
|
|
|
400
403
|
], 544 /* NEED_HYDRATION, NEED_PATCH */),
|
|
401
404
|
_createElementVNode("div", {
|
|
402
405
|
class: "jetlinks-edit-table-horizontal-scroll-hidden",
|
|
403
|
-
style: _normalizeStyle({ width:
|
|
406
|
+
style: _normalizeStyle({ width: scrollWidth.value + 'px' })
|
|
404
407
|
}, null, 4 /* STYLE */)
|
|
405
408
|
]))
|
|
406
409
|
: _createCommentVNode("v-if", true)
|
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
"name": "props",
|
|
19
|
+
"required": "props",
|
|
20
|
+
"onBeforeUnmount": "setup-const",
|
|
21
|
+
"computed": "setup-const",
|
|
22
|
+
"reactive": "setup-const",
|
|
23
|
+
"watch": "setup-const",
|
|
24
|
+
"defineOptions": "setup-const",
|
|
25
|
+
"provide": "setup-const",
|
|
26
|
+
"get": "setup-maybe-ref",
|
|
27
|
+
"isArray": "setup-maybe-ref",
|
|
28
|
+
"useProvideFormItemContext": "setup-maybe-ref",
|
|
29
|
+
"useInjectError": "setup-maybe-ref",
|
|
30
|
+
"useInjectForm": "setup-maybe-ref",
|
|
31
|
+
"TABLE_FORM_ITEM_ERROR": "setup-maybe-ref",
|
|
32
|
+
"props": "setup-reactive-const",
|
|
33
|
+
"emit": "setup-const",
|
|
34
|
+
"context": "setup-maybe-ref",
|
|
35
|
+
"globalErrorMessage": "setup-maybe-ref",
|
|
36
|
+
"hideTimer": "setup-let",
|
|
37
|
+
"eventKey": "setup-ref",
|
|
38
|
+
"errorMap": "setup-reactive-const",
|
|
39
|
+
"filedId": "setup-ref",
|
|
40
|
+
"filedName": "setup-ref",
|
|
41
|
+
"filedValue": "setup-ref",
|
|
42
|
+
"popContainer": "setup-const",
|
|
43
|
+
"removeTimer": "setup-const",
|
|
44
|
+
"showErrorTip": "setup-const",
|
|
45
|
+
"hideErrorTip": "setup-const",
|
|
46
|
+
"validateRules": "setup-const",
|
|
47
|
+
"onFieldBlur": "setup-const",
|
|
48
|
+
"onFieldChange": "setup-const"
|
|
49
|
+
} */
|
|
50
|
+
import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
51
|
+
const _withScopeId = n => (_pushScopeId("data-v-1723098069285"), n = n(), _popScopeId(), n);
|
|
52
|
+
const _hoisted_1 = { style: { "color": "#1d2129" } };
|
|
53
|
+
const _hoisted_2 = {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "table-form-error-target"
|
|
56
|
+
};
|
|
57
|
+
const _hoisted_3 = ["id"];
|
|
58
|
+
import { onBeforeUnmount, computed, reactive, watch, provide } from "vue";
|
|
59
|
+
import { get, isArray } from 'lodash-es';
|
|
60
|
+
import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext';
|
|
61
|
+
import { useInjectError, useInjectForm } from "./hooks";
|
|
62
|
+
import { TABLE_FORM_ITEM_ERROR } from "./consts";
|
|
63
|
+
const __sfc_main__ = Object.assign({
|
|
64
|
+
name: 'JEditTableFormItem'
|
|
65
|
+
}, {
|
|
66
|
+
props: {
|
|
67
|
+
name: {
|
|
68
|
+
type: [String, Array],
|
|
69
|
+
default: undefined
|
|
70
|
+
},
|
|
71
|
+
required: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
emits: ['change'],
|
|
77
|
+
setup(__props, { emit: __emit }) {
|
|
78
|
+
const props = __props;
|
|
79
|
+
const emit = __emit;
|
|
80
|
+
const context = useInjectForm();
|
|
81
|
+
const globalErrorMessage = useInjectError();
|
|
82
|
+
let hideTimer;
|
|
83
|
+
const eventKey = computed(() => {
|
|
84
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
85
|
+
return names.join('-');
|
|
86
|
+
});
|
|
87
|
+
const errorMap = reactive({
|
|
88
|
+
message: '',
|
|
89
|
+
visible: false
|
|
90
|
+
});
|
|
91
|
+
const filedId = computed(() => {
|
|
92
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
93
|
+
return names.join('_');
|
|
94
|
+
});
|
|
95
|
+
const filedName = computed(() => {
|
|
96
|
+
const names = isArray(props.name) ? props.name : [props.name];
|
|
97
|
+
const _rules = context.rules.value;
|
|
98
|
+
let tempKey = undefined;
|
|
99
|
+
for (const key of names) {
|
|
100
|
+
if (key in _rules) {
|
|
101
|
+
tempKey = key;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return tempKey;
|
|
105
|
+
});
|
|
106
|
+
const filedValue = computed(() => {
|
|
107
|
+
return get(context.dataSource.value, props.name);
|
|
108
|
+
});
|
|
109
|
+
provide(TABLE_FORM_ITEM_ERROR, errorMap);
|
|
110
|
+
const popContainer = (e) => {
|
|
111
|
+
return e;
|
|
112
|
+
};
|
|
113
|
+
const removeTimer = () => {
|
|
114
|
+
if (hideTimer) {
|
|
115
|
+
window.clearTimeout(hideTimer);
|
|
116
|
+
hideTimer = null;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const showErrorTip = (msg) => {
|
|
120
|
+
removeTimer();
|
|
121
|
+
errorMap.message = msg;
|
|
122
|
+
errorMap.visible = true;
|
|
123
|
+
};
|
|
124
|
+
const hideErrorTip = () => {
|
|
125
|
+
errorMap.visible = false;
|
|
126
|
+
removeTimer();
|
|
127
|
+
hideTimer = setTimeout(() => {
|
|
128
|
+
errorMap.message = '';
|
|
129
|
+
}, 300);
|
|
130
|
+
};
|
|
131
|
+
const validateRules = () => {
|
|
132
|
+
let index = 0;
|
|
133
|
+
if (isArray(props.name)) {
|
|
134
|
+
index = props.name[0];
|
|
135
|
+
}
|
|
136
|
+
const promise = context.validateItem({ [filedName.value]: get(context.dataSource.value, props.name) }, index);
|
|
137
|
+
promise.catch(res => {
|
|
138
|
+
const error = _optionalChain([res, 'optionalAccess', _2 => _2.filter, 'call', _3 => _3(item => item.field === filedName.value)]) || [];
|
|
139
|
+
if (error.length === 0) {
|
|
140
|
+
hideErrorTip();
|
|
141
|
+
context.removeFieldError(eventKey.value);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
removeTimer();
|
|
145
|
+
errorMap.message = _optionalChain([error, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.message]) || errorMap.message;
|
|
146
|
+
errorMap.visible = !!error.length;
|
|
147
|
+
context.addFieldError(eventKey.value, errorMap.message);
|
|
148
|
+
}
|
|
149
|
+
return errorMap.message;
|
|
150
|
+
});
|
|
151
|
+
return promise;
|
|
152
|
+
};
|
|
153
|
+
const onFieldBlur = () => {
|
|
154
|
+
// validateRules()
|
|
155
|
+
};
|
|
156
|
+
const onFieldChange = () => {
|
|
157
|
+
validateRules();
|
|
158
|
+
emit('change');
|
|
159
|
+
};
|
|
160
|
+
watch(() => globalErrorMessage.value, (val) => {
|
|
161
|
+
if (val[eventKey.value]) {
|
|
162
|
+
showErrorTip(val[eventKey.value]);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
hideErrorTip();
|
|
166
|
+
}
|
|
167
|
+
}, { immediate: true, deep: true });
|
|
168
|
+
useProvideFormItemContext({
|
|
169
|
+
id: filedId,
|
|
170
|
+
onFieldChange,
|
|
171
|
+
onFieldBlur,
|
|
172
|
+
}, computed(() => get(context.dataSource.value, props.name)));
|
|
173
|
+
onBeforeUnmount(() => {
|
|
174
|
+
hideErrorTip();
|
|
175
|
+
});
|
|
176
|
+
watch(() => [filedName.value, props.name], () => {
|
|
177
|
+
context.addField(eventKey.value, {
|
|
178
|
+
filedName: filedName.value,
|
|
179
|
+
eventKey: eventKey.value,
|
|
180
|
+
names: props.name,
|
|
181
|
+
validateRules,
|
|
182
|
+
showErrorTip
|
|
183
|
+
});
|
|
184
|
+
}, { immediate: true });
|
|
185
|
+
return (_ctx, _cache) => {
|
|
186
|
+
const _component_a_tooltip = _resolveComponent("a-tooltip");
|
|
187
|
+
return (_openBlock(), _createElementBlock(_Fragment, null, [
|
|
188
|
+
_createVNode(_component_a_tooltip, {
|
|
189
|
+
color: "#ffffff",
|
|
190
|
+
"get-popup-container": popContainer,
|
|
191
|
+
arrowPointAtCenter: true
|
|
192
|
+
}, {
|
|
193
|
+
title: _withCtx(() => [
|
|
194
|
+
_createElementVNode("span", _hoisted_1, _toDisplayString(errorMap.message), 1 /* TEXT */)
|
|
195
|
+
]),
|
|
196
|
+
default: _withCtx(() => [
|
|
197
|
+
(errorMap.visible)
|
|
198
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_2))
|
|
199
|
+
: _createCommentVNode("v-if", true)
|
|
200
|
+
]),
|
|
201
|
+
_: 1 /* STABLE */
|
|
202
|
+
}),
|
|
203
|
+
_createElementVNode("div", {
|
|
204
|
+
id: eventKey.value,
|
|
205
|
+
style: { "position": "relative" },
|
|
206
|
+
class: _normalizeClass({ 'edit-table-form-has-error': errorMap.message })
|
|
207
|
+
}, [
|
|
208
|
+
_renderSlot(_ctx.$slots, "default")
|
|
209
|
+
], 10 /* CLASS, PROPS */, _hoisted_3)
|
|
210
|
+
], 64 /* STABLE_FRAGMENT */));
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
export default __sfc_main__;
|
package/es/EditTable/Header.js
CHANGED
|
@@ -78,7 +78,7 @@ const __sfc_main__ = Object.assign({
|
|
|
78
78
|
style: {
|
|
79
79
|
type: Object,
|
|
80
80
|
default: undefined
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
82
|
},
|
|
83
83
|
setup(__props) {
|
|
84
84
|
const props = __props;
|
|
@@ -232,8 +232,9 @@ const __sfc_main__ = Object.assign({
|
|
|
232
232
|
key: 0,
|
|
233
233
|
searchKey: searchData.key,
|
|
234
234
|
rowKey: _ctx.rowKey,
|
|
235
|
+
columns: _ctx.searchColumns,
|
|
235
236
|
onClose: _cache[0] || (_cache[0] = $event => (searchData.visible = false))
|
|
236
|
-
}, null, 8 /* PROPS */, ["searchKey", "rowKey"]))
|
|
237
|
+
}, null, 8 /* PROPS */, ["searchKey", "rowKey", "columns"]))
|
|
237
238
|
: _createCommentVNode("v-if", true)
|
|
238
239
|
], 64 /* STABLE_FRAGMENT */));
|
|
239
240
|
};
|
|
@@ -17,6 +17,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
17
17
|
/* Analyzed bindings: {
|
|
18
18
|
"searchKey": "props",
|
|
19
19
|
"rowKey": "props",
|
|
20
|
+
"columns": "props",
|
|
20
21
|
"Table": "setup-const",
|
|
21
22
|
"useTableDataSource": "setup-maybe-ref",
|
|
22
23
|
"useTableTool": "setup-maybe-ref",
|
|
@@ -39,7 +40,6 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
39
40
|
"tableHeight": "setup-ref",
|
|
40
41
|
"selectedRowKeys": "setup-ref",
|
|
41
42
|
"tableRef": "setup-ref",
|
|
42
|
-
"columns": "setup-const",
|
|
43
43
|
"selectedTableRow": "setup-const",
|
|
44
44
|
"handleFilterArray": "setup-const",
|
|
45
45
|
"search": "setup-const",
|
|
@@ -73,6 +73,10 @@ const __sfc_main__ = Object.assign({
|
|
|
73
73
|
rowKey: {
|
|
74
74
|
type: String,
|
|
75
75
|
default: 'id'
|
|
76
|
+
},
|
|
77
|
+
columns: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default: () => []
|
|
76
80
|
}
|
|
77
81
|
},
|
|
78
82
|
emits: ['close'],
|
|
@@ -89,16 +93,6 @@ const __sfc_main__ = Object.assign({
|
|
|
89
93
|
const tableHeight = ref(230);
|
|
90
94
|
const selectedRowKeys = ref([]);
|
|
91
95
|
const tableRef = ref();
|
|
92
|
-
const columns = [
|
|
93
|
-
{
|
|
94
|
-
title: '标识',
|
|
95
|
-
dataIndex: 'id',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
title: '名称',
|
|
99
|
-
dataIndex: 'name',
|
|
100
|
-
}
|
|
101
|
-
];
|
|
102
96
|
const selectedTableRow = (record) => {
|
|
103
97
|
tableTool.scrollTo({
|
|
104
98
|
...record,
|
|
@@ -238,7 +232,7 @@ const __sfc_main__ = Object.assign({
|
|
|
238
232
|
ref_key: "tableRef",
|
|
239
233
|
ref: tableRef,
|
|
240
234
|
"data-source": filterArray.value,
|
|
241
|
-
columns: columns,
|
|
235
|
+
columns: __props.columns,
|
|
242
236
|
height: tableHeight.value,
|
|
243
237
|
disableMenu: false,
|
|
244
238
|
cellHeight: 36,
|
|
@@ -270,7 +264,7 @@ const __sfc_main__ = Object.assign({
|
|
|
270
264
|
}, 1024 /* DYNAMIC_SLOTS */)
|
|
271
265
|
]),
|
|
272
266
|
_: 1 /* STABLE */
|
|
273
|
-
}, 8 /* PROPS */, ["data-source", "height", "rowSelection"])
|
|
267
|
+
}, 8 /* PROPS */, ["data-source", "columns", "height", "rowSelection"])
|
|
274
268
|
]))
|
|
275
269
|
: _createCommentVNode("v-if", true),
|
|
276
270
|
(visible.value)
|
package/es/EditTable/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import EditTable from './EditTable.js';
|
|
2
2
|
import EditTableBody from './Body.js';
|
|
3
3
|
import EditTableHeader from './Header.js';
|
|
4
|
+
import FormItem from './FormItem.js';
|
|
4
5
|
EditTable.install = function (app) {
|
|
5
6
|
app.component(EditTable.name, EditTable);
|
|
6
7
|
app.component(EditTableBody.name, EditTableBody);
|
|
7
8
|
app.component(EditTableHeader.name, EditTableHeader);
|
|
9
|
+
app.component(FormItem.name, FormItem);
|
|
8
10
|
};
|
|
9
11
|
export default EditTable;
|
package/es/EditTable/props.js
CHANGED
|
@@ -9,6 +9,18 @@ export var defaultProps = function defaultProps() {
|
|
|
9
9
|
default: function _default() {
|
|
10
10
|
return [];
|
|
11
11
|
}
|
|
12
|
+
},
|
|
13
|
+
searchColumns: {
|
|
14
|
+
type: Array,
|
|
15
|
+
default: function _default() {
|
|
16
|
+
return [{
|
|
17
|
+
title: '标识',
|
|
18
|
+
dataIndex: 'id'
|
|
19
|
+
}, {
|
|
20
|
+
title: '名称',
|
|
21
|
+
dataIndex: 'name'
|
|
22
|
+
}];
|
|
23
|
+
}
|
|
12
24
|
}
|
|
13
25
|
};
|
|
14
26
|
};
|
package/es/FullPage/FullPage.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
} */
|
|
7
7
|
import { defineComponent as _defineComponent } from 'vue';
|
|
8
8
|
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
9
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
9
|
+
const _withScopeId = n => (_pushScopeId("data-v-1723098070863"), n = n(), _popScopeId(), n);
|
|
10
10
|
const _hoisted_1 = { class: "full-page-warp-content" };
|
|
11
11
|
import { ref } from 'vue';
|
|
12
12
|
import { useElementBounding } from '@vueuse/core';
|
|
@@ -33,6 +33,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
33
33
|
"nextTick": "setup-const",
|
|
34
34
|
"monaco": "setup-const",
|
|
35
35
|
"omit": "setup-maybe-ref",
|
|
36
|
+
"loadGrammars": "setup-maybe-ref",
|
|
36
37
|
"props": "setup-reactive-const",
|
|
37
38
|
"emit": "setup-const",
|
|
38
39
|
"dom": "setup-ref",
|
|
@@ -51,6 +52,7 @@ import { openBlock as _openBlock, createElementBlock as _createElementBlock } fr
|
|
|
51
52
|
import { ref, onMounted, watch, onUnmounted, toRaw, nextTick } from 'vue';
|
|
52
53
|
import * as monaco from 'monaco-editor';
|
|
53
54
|
import { omit } from 'lodash-es';
|
|
55
|
+
import { loadGrammars } from './grammars';
|
|
54
56
|
const __sfc_main__ = Object.assign({
|
|
55
57
|
name: 'JMonacoEditor'
|
|
56
58
|
}, {
|
|
@@ -147,6 +149,11 @@ const __sfc_main__ = Object.assign({
|
|
|
147
149
|
});
|
|
148
150
|
onMounted(async () => {
|
|
149
151
|
const _model = monaco.editor.createModel(props.modelValue, props.language);
|
|
152
|
+
const defaultOptions = Object.assign({
|
|
153
|
+
suggest: {
|
|
154
|
+
preview: true,
|
|
155
|
+
},
|
|
156
|
+
}, omit(props.options, ['readOnly']));
|
|
150
157
|
instance.value = monaco.editor.create(dom.value, {
|
|
151
158
|
model: _model,
|
|
152
159
|
tabSize: 2,
|
|
@@ -154,8 +161,9 @@ const __sfc_main__ = Object.assign({
|
|
|
154
161
|
scrollBeyondLastLine: false,
|
|
155
162
|
theme: props.theme,
|
|
156
163
|
formatOnPaste: true,
|
|
157
|
-
...
|
|
164
|
+
...defaultOptions
|
|
158
165
|
});
|
|
166
|
+
loadGrammars(monaco, instance.value);
|
|
159
167
|
instance.value.onDidChangeModelContent(() => {
|
|
160
168
|
//
|
|
161
169
|
const value = toRaw(instance.value).getValue();
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
5
|
+
import { wireTmGrammars } from "monaco-editor-textmate";
|
|
6
|
+
import { Registry } from "monaco-textmate";
|
|
7
|
+
import tsJson from 'shiki/languages/typescript.tmLanguage.json';
|
|
8
|
+
import jsJson from 'shiki/languages/javascript.tmLanguage.json';
|
|
9
|
+
import htmlJson from 'shiki/languages/html.tmLanguage.json';
|
|
10
|
+
import cssJson from 'shiki/languages/css.tmLanguage.json';
|
|
11
|
+
function dispatchGrammars(_x) {
|
|
12
|
+
return _dispatchGrammars.apply(this, arguments);
|
|
13
|
+
}
|
|
14
|
+
function _dispatchGrammars() {
|
|
15
|
+
_dispatchGrammars = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(scopeName) {
|
|
16
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
_context.t0 = scopeName;
|
|
20
|
+
_context.next = _context.t0 === "source.js" ? 3 : _context.t0 === "source.ts" ? 4 : _context.t0 === "source.js" ? 5 : _context.t0 === "text.html.basic" ? 6 : _context.t0 === "source.css" ? 7 : 8;
|
|
21
|
+
break;
|
|
22
|
+
case 3:
|
|
23
|
+
return _context.abrupt("return", {
|
|
24
|
+
format: "json",
|
|
25
|
+
content: import('shiki/languages/vue.tmLanguage.json')
|
|
26
|
+
});
|
|
27
|
+
case 4:
|
|
28
|
+
return _context.abrupt("return", {
|
|
29
|
+
format: "json",
|
|
30
|
+
content: tsJson
|
|
31
|
+
});
|
|
32
|
+
case 5:
|
|
33
|
+
return _context.abrupt("return", {
|
|
34
|
+
format: "json",
|
|
35
|
+
content: jsJson
|
|
36
|
+
});
|
|
37
|
+
case 6:
|
|
38
|
+
return _context.abrupt("return", {
|
|
39
|
+
format: "json",
|
|
40
|
+
content: htmlJson
|
|
41
|
+
});
|
|
42
|
+
case 7:
|
|
43
|
+
return _context.abrupt("return", {
|
|
44
|
+
format: "json",
|
|
45
|
+
content: cssJson
|
|
46
|
+
});
|
|
47
|
+
case 8:
|
|
48
|
+
return _context.abrupt("return", {
|
|
49
|
+
format: "json",
|
|
50
|
+
content: {
|
|
51
|
+
scopeName: "source",
|
|
52
|
+
patterns: []
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
case 9:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context.stop();
|
|
58
|
+
}
|
|
59
|
+
}, _callee);
|
|
60
|
+
}));
|
|
61
|
+
return _dispatchGrammars.apply(this, arguments);
|
|
62
|
+
}
|
|
63
|
+
export function loadGrammars(_x2, _x3) {
|
|
64
|
+
return _loadGrammars.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
function _loadGrammars() {
|
|
67
|
+
_loadGrammars = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(monaco, editor) {
|
|
68
|
+
var registry, grammars, _iterator, _step, lang;
|
|
69
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
70
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
registry = new Registry({
|
|
73
|
+
getGrammarDefinition: function () {
|
|
74
|
+
var _getGrammarDefinition = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(scopeName) {
|
|
75
|
+
var dispatch;
|
|
76
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
77
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
_context2.next = 2;
|
|
80
|
+
return dispatchGrammars(scopeName);
|
|
81
|
+
case 2:
|
|
82
|
+
dispatch = _context2.sent;
|
|
83
|
+
console.log('scopeName', scopeName, dispatch);
|
|
84
|
+
return _context2.abrupt("return", JSON.parse(JSON.stringify(dispatch)));
|
|
85
|
+
case 5:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context2.stop();
|
|
88
|
+
}
|
|
89
|
+
}, _callee2);
|
|
90
|
+
}));
|
|
91
|
+
function getGrammarDefinition(_x4) {
|
|
92
|
+
return _getGrammarDefinition.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
return getGrammarDefinition;
|
|
95
|
+
}()
|
|
96
|
+
});
|
|
97
|
+
grammars = new Map();
|
|
98
|
+
grammars.set("vue", "source.js");
|
|
99
|
+
grammars.set("javascript", "source.js");
|
|
100
|
+
grammars.set("typescript", "source.ts");
|
|
101
|
+
grammars.set("css", "source.css");
|
|
102
|
+
grammars.set("html", "text.html.basic");
|
|
103
|
+
_iterator = _createForOfIteratorHelper(grammars.keys());
|
|
104
|
+
try {
|
|
105
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
106
|
+
lang = _step.value;
|
|
107
|
+
monaco.languages.register({
|
|
108
|
+
id: lang
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
} catch (err) {
|
|
112
|
+
_iterator.e(err);
|
|
113
|
+
} finally {
|
|
114
|
+
_iterator.f();
|
|
115
|
+
}
|
|
116
|
+
_context3.next = 11;
|
|
117
|
+
return wireTmGrammars(monaco, registry, grammars, editor);
|
|
118
|
+
case 11:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context3.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee3);
|
|
123
|
+
}));
|
|
124
|
+
return _loadGrammars.apply(this, arguments);
|
|
125
|
+
}
|
|
File without changes
|