@jetlinks-web/components 2.0.2-2 → 2.0.2-4
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/AMap/Map.js +124 -0
- package/es/AMap/index.js +2 -0
- package/es/AMap/util.js +56 -0
- package/es/BadgeStatus/Badge.js +54 -0
- package/es/BadgeStatus/color.js +21 -0
- package/es/BadgeStatus/index.js +3 -0
- package/es/CardSelect/CardSelect.js +123 -0
- package/es/CardSelect/index.js +2 -0
- package/es/CheckButton/CheckButton.js +121 -0
- package/es/CheckButton/index.js +2 -0
- package/es/ConfigProvider/context.js +12 -0
- package/es/ConfigProvider/index.js +31 -0
- package/es/Echarts/Echarts.js +47 -0
- package/es/Echarts/index.js +2 -0
- package/es/Ellipsis/Ellipsis.js +189 -0
- package/es/Ellipsis/index.js +2 -0
- package/es/Empty/Empty.js +56 -0
- package/es/Empty/image.js +2 -0
- package/es/Empty/index.js +2 -0
- package/es/FullPage/FullPage.js +31 -0
- package/es/FullPage/index.js +2 -0
- package/es/Icon/icon.js +43 -0
- package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
- package/es/MonacoEditor/Monaco.js +238 -0
- package/es/MonacoEditor/index.js +2 -0
- package/es/PermissionButton/index.js +117 -0
- package/es/ProLayout/Basic/BasicLayout.js +255 -0
- package/es/ProLayout/Basic/Header.js +93 -0
- package/es/ProLayout/PageContainer/index.js +318 -0
- package/es/ProLayout/PageContainer/typings.js +1 -0
- package/es/ProLayout/RouteContext.js +22 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +262 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +258 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/typings.js +1 -0
- package/es/ProLayout/TopHeader/index.js +155 -0
- package/es/ProLayout/defaultSettings.js +66 -0
- package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
- package/{src → es}/ProLayout/style/default.less +4 -4
- package/es/ProLayout/style/index.js +1 -0
- package/es/ProLayout/typings.js +1 -0
- package/es/ProLayout/util.js +61 -0
- package/es/ProTable/index.js +406 -0
- package/es/ProTable/proTableTypes.js +11 -0
- package/es/ProTable/style/index.css +65 -0
- package/es/ProTable/style/index.js +1 -0
- package/es/Scrollbar/Bar.js +114 -0
- package/es/Scrollbar/Scrollbar.js +100 -0
- package/es/Scrollbar/Thumb.js +10 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +2 -0
- package/es/Scrollbar/util.js +30 -0
- package/es/Search/Advanced/History.js +183 -0
- package/es/Search/Advanced/SaveHistory.js +153 -0
- package/es/Search/Advanced/index.js +520 -0
- package/es/Search/Item.js +497 -0
- package/es/Search/Search.js +249 -0
- package/es/Search/hooks/index.js +1 -0
- package/es/Search/hooks/useSearchItems.js +40 -0
- package/es/Search/index.js +4 -0
- package/es/Search/setting.js +91 -0
- package/es/Search/typing.js +1 -0
- package/es/Search/util.js +234 -0
- package/es/ValueItem/ValueItem.js +233 -0
- package/es/ValueItem/index.js +2 -0
- package/es/ValueItem/util.js +16 -0
- package/es/index.js +24 -0
- package/es/style/index.js +3 -0
- package/es/style/variable.css +0 -0
- package/{src → es}/style/variable.less +0 -2
- package/lib/AMap/Map.js +124 -0
- package/lib/AMap/index.js +9 -0
- package/lib/AMap/util.js +62 -0
- package/lib/BadgeStatus/Badge.js +54 -0
- package/lib/BadgeStatus/color.js +27 -0
- package/lib/BadgeStatus/index.js +22 -0
- package/lib/CardSelect/CardSelect.js +123 -0
- package/lib/CardSelect/index.js +9 -0
- package/lib/CheckButton/CheckButton.js +121 -0
- package/lib/CheckButton/index.js +9 -0
- package/lib/ConfigProvider/context.js +19 -0
- package/lib/ConfigProvider/index.js +37 -0
- package/lib/Echarts/Echarts.js +47 -0
- package/lib/Echarts/index.js +9 -0
- package/lib/Ellipsis/Ellipsis.js +189 -0
- package/lib/Ellipsis/index.js +9 -0
- package/lib/Empty/Empty.js +56 -0
- package/lib/Empty/image.js +8 -0
- package/lib/Empty/index.js +9 -0
- package/lib/FullPage/FullPage.js +31 -0
- package/lib/FullPage/index.js +9 -0
- package/lib/Icon/icon.js +52 -0
- package/lib/Icon/index.js +9 -0
- package/lib/MonacoEditor/Monaco.js +238 -0
- package/lib/MonacoEditor/index.js +9 -0
- package/lib/PermissionButton/index.js +124 -0
- package/lib/ProLayout/Basic/BasicLayout.js +264 -0
- package/lib/ProLayout/Basic/BasicLayout.less +66 -0
- package/lib/ProLayout/Basic/Header.js +99 -0
- package/lib/ProLayout/Basic/Header.less +8 -0
- package/lib/ProLayout/PageContainer/index.js +323 -0
- package/lib/ProLayout/PageContainer/index.less +103 -0
- package/lib/ProLayout/PageContainer/typings.js +5 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +268 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +267 -0
- package/lib/ProLayout/SiderMenu/index.js +20 -0
- package/lib/ProLayout/SiderMenu/index.less +212 -0
- package/lib/ProLayout/SiderMenu/typings.js +5 -0
- package/lib/ProLayout/TopHeader/index.js +161 -0
- package/lib/ProLayout/TopHeader/index.less +174 -0
- package/lib/ProLayout/defaultSettings.js +72 -0
- package/lib/ProLayout/index.js +16 -0
- package/lib/ProLayout/style/default.less +4 -0
- package/lib/ProLayout/style/index.js +3 -0
- package/lib/ProLayout/style/style.less +7 -0
- package/lib/ProLayout/typings.js +5 -0
- package/lib/ProLayout/util.js +72 -0
- package/lib/ProTable/index.js +412 -0
- package/lib/ProTable/proTableTypes.js +17 -0
- package/lib/ProTable/style/index.css +65 -0
- package/lib/ProTable/style/index.js +3 -0
- package/lib/ProTable/style/index.less +92 -0
- package/lib/Scrollbar/Bar.js +114 -0
- package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/Scrollbar.js} +106 -108
- package/lib/Scrollbar/Thumb.js +16 -0
- package/lib/Scrollbar/constants.js +7 -0
- package/lib/Scrollbar/index.js +9 -0
- package/lib/Scrollbar/util.js +37 -0
- package/lib/Search/Advanced/History.js +183 -0
- package/lib/Search/Advanced/SaveHistory.js +153 -0
- package/lib/Search/Advanced/index.js +520 -0
- package/lib/Search/Item.js +497 -0
- package/lib/Search/Search.js +249 -0
- package/lib/Search/hooks/index.js +16 -0
- package/lib/Search/hooks/useSearchItems.js +47 -0
- package/lib/Search/index.js +16 -0
- package/lib/Search/setting.js +97 -0
- package/lib/Search/typing.js +5 -0
- package/lib/Search/util.js +241 -0
- package/lib/ValueItem/ValueItem.js +233 -0
- package/lib/ValueItem/index.js +9 -0
- package/lib/ValueItem/util.js +22 -0
- package/lib/index.js +158 -0
- package/lib/style/components.less +1 -0
- package/lib/style/index.js +4 -0
- package/lib/style/variable.css +0 -0
- package/lib/style/variable.less +2 -0
- package/package.json +121 -12
- package/index.ts +0 -64
- package/src/AMap/Map.vue +0 -110
- package/src/AMap/index.ts +0 -1
- package/src/AMap/util.ts +0 -56
- package/src/BadgeStatus/Badge.vue +0 -41
- package/src/BadgeStatus/color.ts +0 -25
- package/src/BadgeStatus/index.ts +0 -4
- package/src/CardSelect/CardSelect.vue +0 -136
- package/src/CardSelect/index.ts +0 -3
- package/src/CheckButton/CheckButton.vue +0 -146
- package/src/CheckButton/index.md +0 -27
- package/src/CheckButton/index.ts +0 -3
- package/src/ConfigProvider/context.ts +0 -17
- package/src/ConfigProvider/index.tsx +0 -40
- package/src/Echarts/Echarts.vue +0 -43
- package/src/Echarts/index.ts +0 -3
- package/src/Ellipsis/Ellipsis.vue +0 -182
- package/src/Ellipsis/index.ts +0 -3
- package/src/Empty/Empty.vue +0 -43
- package/src/Empty/image.ts +0 -3
- package/src/Empty/index.ts +0 -2
- package/src/FullPage/FullPage.vue +0 -30
- package/src/FullPage/index.ts +0 -3
- package/src/Icon/icon.tsx +0 -40
- package/src/MonacoEditor/Monaco.vue +0 -242
- package/src/MonacoEditor/index.md +0 -26
- package/src/MonacoEditor/index.ts +0 -2
- package/src/PermissionButton/index.tsx +0 -110
- package/src/ProLayout/Basic/BasicLayout.tsx +0 -395
- package/src/ProLayout/Basic/Header.tsx +0 -115
- package/src/ProLayout/PageContainer/index.tsx +0 -441
- package/src/ProLayout/PageContainer/typings.ts +0 -56
- package/src/ProLayout/RouteContext.ts +0 -87
- package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
- package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
- package/src/ProLayout/SiderMenu/index.ts +0 -2
- package/src/ProLayout/SiderMenu/typings.ts +0 -49
- package/src/ProLayout/TopHeader/index.tsx +0 -210
- package/src/ProLayout/defaultSettings.ts +0 -106
- package/src/ProLayout/style/index.ts +0 -1
- package/src/ProLayout/typings.ts +0 -87
- package/src/ProLayout/util.ts +0 -64
- package/src/ProTable/index.md +0 -53
- package/src/ProTable/index.tsx +0 -551
- package/src/ProTable/proTableTypes.ts +0 -70
- package/src/ProTable/style/index.ts +0 -1
- package/src/Scrollbar/Bar.vue +0 -75
- package/src/Scrollbar/Scrollbar.vue +0 -260
- package/src/Scrollbar/Thumb.vue +0 -163
- package/src/Scrollbar/constants.ts +0 -10
- package/src/Scrollbar/index.ts +0 -4
- package/src/Scrollbar/thumb.ts +0 -16
- package/src/Scrollbar/util.ts +0 -38
- package/src/Search/Advanced/History.vue +0 -140
- package/src/Search/Advanced/SaveHistory.vue +0 -108
- package/src/Search/Advanced/index.vue +0 -435
- package/src/Search/Item.vue +0 -525
- package/src/Search/Search.vue +0 -398
- package/src/Search/hooks/index.ts +0 -1
- package/src/Search/hooks/useSearchItems.ts +0 -68
- package/src/Search/index.md +0 -57
- package/src/Search/index.ts +0 -5
- package/src/Search/setting.ts +0 -55
- package/src/Search/typing.ts +0 -76
- package/src/Search/util.ts +0 -263
- package/src/ValueItem/ValueItem.vue +0 -192
- package/src/ValueItem/index.ts +0 -3
- package/src/ValueItem/util.ts +0 -16
- package/src/style/index.ts +0 -3
- /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
- /package/{src → es}/ProLayout/Basic/Header.less +0 -0
- /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
- /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
- /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
- /package/{src → es}/ProLayout/style/style.less +0 -0
- /package/{src → es}/ProTable/style/index.less +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Analyzed bindings: {
|
|
2
|
+
"ref": "setup-const",
|
|
3
|
+
"useElementBounding": "setup-maybe-ref",
|
|
4
|
+
"fullPage": "setup-ref",
|
|
5
|
+
"y": "setup-maybe-ref"
|
|
6
|
+
} */
|
|
7
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
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-1712538745502"), n = n(), _popScopeId(), n);
|
|
10
|
+
const _hoisted_1 = { class: "full-page-warp-content" };
|
|
11
|
+
import { ref } from 'vue';
|
|
12
|
+
import { useElementBounding } from '@vueuse/core';
|
|
13
|
+
const __sfc_main__ = _defineComponent({
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const fullPage = ref(null);
|
|
16
|
+
const { y } = useElementBounding(fullPage);
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
return (_openBlock(), _createElementBlock("div", {
|
|
19
|
+
class: "full-page-warp",
|
|
20
|
+
ref_key: "fullPage",
|
|
21
|
+
ref: fullPage,
|
|
22
|
+
style: _normalizeStyle({ minHeight: `calc(100vh - ${_unref(y) + 24}px)` })
|
|
23
|
+
}, [
|
|
24
|
+
_createElementVNode("div", _hoisted_1, [
|
|
25
|
+
_renderSlot(_ctx.$slots, "default")
|
|
26
|
+
])
|
|
27
|
+
], 4 /* STYLE */));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 _FullPage = _interopRequireDefault(require("./FullPage.js"));
|
|
9
|
+
var _default = exports.default = _FullPage.default;
|
package/lib/Icon/icon.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _vue = require("vue");
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _iconsVue = _interopRequireWildcard(require("@ant-design/icons-vue/lib/icons"));
|
|
12
|
+
var aIcon = _iconsVue;
|
|
13
|
+
var _hooks = require("@jetlinks-web/hooks");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
var MyIcon = (0, _iconsVue.createFromIconfontCN)({
|
|
17
|
+
scriptUrl: '//at.alicdn.com/t/c/font_3183515_i7oma42he.js' // 在 iconfont.cn 上生成
|
|
18
|
+
});
|
|
19
|
+
var AntdIcon = function AntdIcon(props) {
|
|
20
|
+
return (0, _vue.createVNode)(aIcon[props.type]);
|
|
21
|
+
};
|
|
22
|
+
var Icon = function Icon(props) {
|
|
23
|
+
return Object.keys(aIcon).includes(props.type) ? (0, _vue.createVNode)(AntdIcon, props, null) : (0, _vue.createVNode)(MyIcon, props, null);
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = (0, _vue.defineComponent)({
|
|
26
|
+
name: 'AIcon',
|
|
27
|
+
// 传入组件配置
|
|
28
|
+
props: ['type', 'scriptUrl', 'class'],
|
|
29
|
+
emits: ['click'],
|
|
30
|
+
setup: function setup(props, _ref) {
|
|
31
|
+
var emit = _ref.emit,
|
|
32
|
+
attrs = _ref.attrs;
|
|
33
|
+
var config = (0, _hooks.useIcon)();
|
|
34
|
+
(0, _vue.watchEffect)(function () {
|
|
35
|
+
var url = props.scriptUrl || config.scriptUrl;
|
|
36
|
+
if (url) {
|
|
37
|
+
MyIcon = (0, _iconsVue.createFromIconfontCN)({
|
|
38
|
+
scriptUrl: url
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var click = function click() {
|
|
43
|
+
emit('click');
|
|
44
|
+
};
|
|
45
|
+
return function () {
|
|
46
|
+
return (0, _vue.createVNode)(Icon, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
47
|
+
"style": attrs.style,
|
|
48
|
+
"onClick": click
|
|
49
|
+
}), null);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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 _icon = _interopRequireDefault(require("./icon"));
|
|
9
|
+
var _default = exports.default = _icon.default;
|
|
@@ -0,0 +1,238 @@
|
|
|
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-ref",
|
|
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, toRaw, nextTick } from 'vue';
|
|
52
|
+
import * as monaco from 'monaco-editor';
|
|
53
|
+
import { omit } from 'lodash-es';
|
|
54
|
+
const __sfc_main__ = {
|
|
55
|
+
props: {
|
|
56
|
+
modelValue: [String, Number],
|
|
57
|
+
theme: { type: String, default: 'vs-dark' },
|
|
58
|
+
language: { type: String, default: 'json' },
|
|
59
|
+
codeTips: { type: Array, default: () => [] },
|
|
60
|
+
init: { type: Function, default: undefined },
|
|
61
|
+
registrationTips: { type: Object, default: () => ({}) },
|
|
62
|
+
registrationTypescript: { type: Object, default: () => ({}) },
|
|
63
|
+
blurFormat: { type: Boolean, default: true },
|
|
64
|
+
readOnly: { type: Boolean, default: false },
|
|
65
|
+
options: { type: Object, default: () => ({}) },
|
|
66
|
+
},
|
|
67
|
+
emits: [
|
|
68
|
+
'update:modelValue',
|
|
69
|
+
'blur',
|
|
70
|
+
'focus',
|
|
71
|
+
'change',
|
|
72
|
+
'errorChange',
|
|
73
|
+
],
|
|
74
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
75
|
+
const props = __props;
|
|
76
|
+
const emit = __emit;
|
|
77
|
+
const dom = ref();
|
|
78
|
+
const instance = ref();
|
|
79
|
+
const monacoProviderRef = ref();
|
|
80
|
+
const monacoTypescriptProviderRef = ref();
|
|
81
|
+
// codeTipItem.dispose() // 销毁自定义提示
|
|
82
|
+
const handleSuggestions = (suggestions, range) => {
|
|
83
|
+
return Array.isArray(suggestions)
|
|
84
|
+
? suggestions.map((item) => ({ ...item, range }))
|
|
85
|
+
: [];
|
|
86
|
+
};
|
|
87
|
+
const disposeRegister = () => {
|
|
88
|
+
_optionalChain([monacoProviderRef, 'access', _ => _.value, 'optionalAccess', _2 => _2.dispose, 'call', _3 => _3()]);
|
|
89
|
+
monacoProviderRef.value = null;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* 代码提示注册
|
|
93
|
+
*/
|
|
94
|
+
const registerCompletionItemProvider = () => {
|
|
95
|
+
disposeRegister();
|
|
96
|
+
if (monaco.languages && _optionalChain([props, 'access', _4 => _4.registrationTips, 'optionalAccess', _5 => _5.suggestions])) {
|
|
97
|
+
const { name, suggestions } = props.registrationTips;
|
|
98
|
+
monacoProviderRef.value =
|
|
99
|
+
monaco.languages.registerCompletionItemProvider(name || 'json', {
|
|
100
|
+
provideCompletionItems: function (model, position) {
|
|
101
|
+
const word = model.getWordUntilPosition(position); // 获取提示代码范围位置
|
|
102
|
+
const range = {
|
|
103
|
+
startLineNumber: position.lineNumber,
|
|
104
|
+
endLineNumber: position.lineNumber,
|
|
105
|
+
startColumn: word.startColumn,
|
|
106
|
+
endColumn: word.endColumn,
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
suggestions: handleSuggestions(suggestions, range),
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const disposeTypescript = () => {
|
|
116
|
+
_optionalChain([monacoTypescriptProviderRef, 'access', _6 => _6.value, 'optionalAccess', _7 => _7.dispose, 'call', _8 => _8()]);
|
|
117
|
+
monacoTypescriptProviderRef.value = null;
|
|
118
|
+
};
|
|
119
|
+
const registerTypescript = () => {
|
|
120
|
+
disposeTypescript();
|
|
121
|
+
if (monaco.languages && _optionalChain([props, 'access', _9 => _9.registrationTypescript, 'optionalAccess', _10 => _10.typescript])) {
|
|
122
|
+
const { name, typescript } = props.registrationTypescript;
|
|
123
|
+
monacoTypescriptProviderRef.value =
|
|
124
|
+
monaco.languages.typescript.javascriptDefaults.addExtraLib(typescript);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* 代码格式化
|
|
129
|
+
*/
|
|
130
|
+
const editorFormat = () => {
|
|
131
|
+
if (!instance.value)
|
|
132
|
+
return;
|
|
133
|
+
_optionalChain([toRaw, 'call', _11 => _11(instance.value), 'access', _12 => _12.getAction, 'call', _13 => _13('editor.action.formatDocument'), 'optionalAccess', _14 => _14.run, 'call', _15 => _15()]);
|
|
134
|
+
if (props.hasOwnProperty('readOnly')) {
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
toRaw(instance.value).updateOptions({
|
|
137
|
+
readOnly: props.readOnly !== false,
|
|
138
|
+
});
|
|
139
|
+
}, 100);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
monaco.editor.onDidChangeMarkers(([uri]) => {
|
|
143
|
+
const markers = monaco.editor.getModelMarkers({ resource: uri });
|
|
144
|
+
emit('errorChange', markers);
|
|
145
|
+
});
|
|
146
|
+
onMounted(async () => {
|
|
147
|
+
const _model = monaco.editor.createModel(props.modelValue, props.language);
|
|
148
|
+
instance.value = monaco.editor.create(dom.value, {
|
|
149
|
+
model: _model,
|
|
150
|
+
tabSize: 2,
|
|
151
|
+
automaticLayout: true,
|
|
152
|
+
scrollBeyondLastLine: false,
|
|
153
|
+
theme: props.theme,
|
|
154
|
+
formatOnPaste: true,
|
|
155
|
+
...(omit(props.options, ['readOnly']) || {}),
|
|
156
|
+
});
|
|
157
|
+
instance.value.onDidChangeModelContent(() => {
|
|
158
|
+
//
|
|
159
|
+
const value = toRaw(instance.value).getValue();
|
|
160
|
+
nextTick(() => {
|
|
161
|
+
emit('update:modelValue', value);
|
|
162
|
+
emit('change', value);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
instance.value.onDidBlurEditorText(() => {
|
|
166
|
+
emit('blur');
|
|
167
|
+
if (props.blurFormat) {
|
|
168
|
+
editorFormat();
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
instance.value.onDidFocusEditorText(() => {
|
|
172
|
+
emit('focus');
|
|
173
|
+
});
|
|
174
|
+
if (props.modelValue) {
|
|
175
|
+
setTimeout(() => {
|
|
176
|
+
editorFormat();
|
|
177
|
+
}, 200);
|
|
178
|
+
}
|
|
179
|
+
_optionalChain([props, 'access', _16 => _16.init, 'optionalCall', _17 => _17(instance.value, monaco)]);
|
|
180
|
+
});
|
|
181
|
+
/**
|
|
182
|
+
* 光标位置插入内容
|
|
183
|
+
* @param {String} val
|
|
184
|
+
* @param position
|
|
185
|
+
*/
|
|
186
|
+
const insert = (val, position) => {
|
|
187
|
+
if (!instance.value)
|
|
188
|
+
return;
|
|
189
|
+
const _position = position || toRaw(instance.value).getPosition();
|
|
190
|
+
const value = toRaw(instance.value).getValue();
|
|
191
|
+
if (position && position.lineNumber) {
|
|
192
|
+
toRaw(instance.value).setPosition(position);
|
|
193
|
+
}
|
|
194
|
+
toRaw(instance.value).executeEdits(value, [
|
|
195
|
+
{
|
|
196
|
+
range: new monaco.Range(_optionalChain([_position, 'optionalAccess', _18 => _18.lineNumber]), _optionalChain([_position, 'optionalAccess', _19 => _19.column]), _optionalChain([_position, 'optionalAccess', _20 => _20.lineNumber]), _optionalChain([_position, 'optionalAccess', _21 => _21.column])),
|
|
197
|
+
text: val,
|
|
198
|
+
},
|
|
199
|
+
]);
|
|
200
|
+
};
|
|
201
|
+
watch(() => props.modelValue, (val) => {
|
|
202
|
+
if (!instance.value ||
|
|
203
|
+
(instance.value &&
|
|
204
|
+
props.modelValue === toRaw(instance.value).getValue()))
|
|
205
|
+
return;
|
|
206
|
+
// setValue之前获取光标位置
|
|
207
|
+
const position = toRaw(instance.value).getPosition();
|
|
208
|
+
// setValue之后光标位置改变
|
|
209
|
+
toRaw(instance.value).setValue(val);
|
|
210
|
+
// 设置光标位置为setValue之前的位置
|
|
211
|
+
toRaw(instance.value).setPosition(position);
|
|
212
|
+
editorFormat();
|
|
213
|
+
});
|
|
214
|
+
watch(() => JSON.stringify(props.registrationTips), () => {
|
|
215
|
+
registerCompletionItemProvider();
|
|
216
|
+
}, { immediate: true });
|
|
217
|
+
watch(() => JSON.stringify(props.registrationTypescript), () => {
|
|
218
|
+
registerTypescript();
|
|
219
|
+
}, { immediate: true });
|
|
220
|
+
onUnmounted(() => {
|
|
221
|
+
disposeRegister();
|
|
222
|
+
disposeTypescript();
|
|
223
|
+
_optionalChain([toRaw, 'call', _22 => _22(instance.value), 'access', _23 => _23.editor, 'optionalAccess', _24 => _24.dispose, 'optionalCall', _25 => _25()]);
|
|
224
|
+
});
|
|
225
|
+
__expose({
|
|
226
|
+
editorFormat,
|
|
227
|
+
insert,
|
|
228
|
+
});
|
|
229
|
+
return (_ctx, _cache) => {
|
|
230
|
+
return (_openBlock(), _createElementBlock("div", {
|
|
231
|
+
ref_key: "dom",
|
|
232
|
+
ref: dom,
|
|
233
|
+
class: "j-monaco-editor"
|
|
234
|
+
}, null, 512 /* NEED_PATCH */));
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
var _default = exports.default = _Monaco.default;
|
|
@@ -0,0 +1,124 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _vue = require("vue");
|
|
12
|
+
var _antDesignVue = require("ant-design-vue");
|
|
13
|
+
require("ant-design-vue/es");
|
|
14
|
+
var _lodashEs = require("lodash");
|
|
15
|
+
var _button = require("ant-design-vue/es/button/button");
|
|
16
|
+
var _hooks = require("@jetlinks-web/hooks");
|
|
17
|
+
var _excluded = ["popConfirm", "tooltip", "hasPermission", "noPermissionTitle"];
|
|
18
|
+
var definedProps = (0, _objectSpread2.default)({
|
|
19
|
+
tooltip: {
|
|
20
|
+
type: Object
|
|
21
|
+
},
|
|
22
|
+
popConfirm: {
|
|
23
|
+
type: Object
|
|
24
|
+
},
|
|
25
|
+
hasPermission: {
|
|
26
|
+
type: [String, Array, Boolean],
|
|
27
|
+
default: undefined
|
|
28
|
+
},
|
|
29
|
+
style: {
|
|
30
|
+
type: Object
|
|
31
|
+
},
|
|
32
|
+
noPermissionTitle: {
|
|
33
|
+
type: String
|
|
34
|
+
}
|
|
35
|
+
}, (0, _lodashEs.omit)((0, _button.buttonProps)(), 'icon'));
|
|
36
|
+
var PermissionButton = (0, _vue.defineComponent)({
|
|
37
|
+
name: 'PermissionButton',
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
slots: ['button', 'icon'],
|
|
40
|
+
props: definedProps,
|
|
41
|
+
setup: function setup(props, _ref) {
|
|
42
|
+
var slots = _ref.slots;
|
|
43
|
+
var popConfirm = props.popConfirm,
|
|
44
|
+
tooltip = props.tooltip;
|
|
45
|
+
var _usePermission = (0, _hooks.usePermission)(props.hasPermission),
|
|
46
|
+
hasPerm = _usePermission.hasPerm;
|
|
47
|
+
var permission = (0, _vue.computed)(function () {
|
|
48
|
+
if (!props.hasPermission || props.hasPermission === true) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return hasPerm.value;
|
|
52
|
+
});
|
|
53
|
+
var isPermission = (0, _vue.computed)(function () {
|
|
54
|
+
if ('hasPermission' in props && permission.value) {
|
|
55
|
+
return 'disabled' in props ? props.disabled : false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
var hasPopConfirm = (0, _vue.computed)(function () {
|
|
60
|
+
return !!popConfirm;
|
|
61
|
+
}); // 是否包含确认弹窗
|
|
62
|
+
var hasTooltip = (0, _vue.computed)(function () {
|
|
63
|
+
return !!tooltip;
|
|
64
|
+
}); // 是否包含文字提示
|
|
65
|
+
return function () {
|
|
66
|
+
var popConfirm = props.popConfirm,
|
|
67
|
+
tooltip = props.tooltip,
|
|
68
|
+
hasPermission = props.hasPermission,
|
|
69
|
+
noPermissionTitle = props.noPermissionTitle,
|
|
70
|
+
buttonProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
71
|
+
var button = !slots.button ? (0, _vue.h)(_antDesignVue.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, buttonProps), {}, {
|
|
72
|
+
disabled: isPermission.value
|
|
73
|
+
}), {
|
|
74
|
+
default: function _default() {
|
|
75
|
+
var _slots$default;
|
|
76
|
+
return slots === null || slots === void 0 ? void 0 : (_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
|
|
77
|
+
},
|
|
78
|
+
icon: function icon() {
|
|
79
|
+
var _slots$icon;
|
|
80
|
+
return slots === null || slots === void 0 ? void 0 : (_slots$icon = slots.icon) === null || _slots$icon === void 0 ? void 0 : _slots$icon.call(slots);
|
|
81
|
+
}
|
|
82
|
+
}) : slots.button();
|
|
83
|
+
// 文字提示
|
|
84
|
+
var _tooltip = tooltip ? (0, _vue.h)(_antDesignVue.Tooltip, (0, _extends2.default)(tooltip, {
|
|
85
|
+
disabled: isPermission.value
|
|
86
|
+
}), {
|
|
87
|
+
default: function _default() {
|
|
88
|
+
return button;
|
|
89
|
+
}
|
|
90
|
+
}) : undefined;
|
|
91
|
+
// 无权限
|
|
92
|
+
var noPermissionButton = !permission.value ? (0, _vue.h)(_antDesignVue.Tooltip, {
|
|
93
|
+
title: noPermissionTitle || '暂无权限,请联系管理员'
|
|
94
|
+
}, {
|
|
95
|
+
default: function _default() {
|
|
96
|
+
return button;
|
|
97
|
+
}
|
|
98
|
+
}) : undefined;
|
|
99
|
+
// 二次确认
|
|
100
|
+
var _popConfirm = popConfirm ? (0, _vue.h)(_antDesignVue.Popconfirm, (0, _extends2.default)({
|
|
101
|
+
overlayStyle: {
|
|
102
|
+
width: '220px'
|
|
103
|
+
}
|
|
104
|
+
}, popConfirm, {
|
|
105
|
+
disabled: !permission.value || buttonProps.disabled
|
|
106
|
+
}), {
|
|
107
|
+
default: function _default() {
|
|
108
|
+
return tooltip ? _tooltip : button;
|
|
109
|
+
}
|
|
110
|
+
}) : undefined;
|
|
111
|
+
if (permission.value) {
|
|
112
|
+
if (hasPopConfirm.value) {
|
|
113
|
+
return _popConfirm;
|
|
114
|
+
}
|
|
115
|
+
if (hasTooltip.value) {
|
|
116
|
+
return _tooltip;
|
|
117
|
+
}
|
|
118
|
+
return button;
|
|
119
|
+
}
|
|
120
|
+
return noPermissionButton;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
var _default2 = exports.default = PermissionButton;
|