@cgboiler/biz-mobile 1.11.0 → 1.13.0
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/index.d.ts +4 -2
- package/es/index.js +5 -1
- package/es/md-preview/MdPreview.d.ts +49 -0
- package/es/md-preview/MdPreview.js +59 -0
- package/es/md-preview/_atomic.css +32 -0
- package/es/md-preview/index.css +1 -0
- package/es/md-preview/index.d.ts +3 -0
- package/es/md-preview/index.js +5 -0
- package/es/md-preview/index.less +102 -0
- package/es/md-preview/style/index.d.ts +1 -0
- package/es/md-preview/style/index.js +1 -0
- package/es/md-preview/style/less.d.ts +1 -0
- package/es/md-preview/style/less.js +1 -0
- package/es/md-preview/types.d.ts +23 -0
- package/es/md-preview/types.js +24 -0
- package/es/md-preview/utils/customRules.d.ts +12 -0
- package/es/md-preview/utils/customRules.js +31 -0
- package/es/md-preview/utils/diffRenderer.d.ts +8 -0
- package/es/md-preview/utils/diffRenderer.js +24 -0
- package/es/md-preview/utils/index.d.ts +4 -0
- package/es/md-preview/utils/index.js +4 -0
- package/es/md-preview/utils/markdownRenderer.d.ts +7 -0
- package/es/md-preview/utils/markdownRenderer.js +24 -0
- package/es/md-preview/utils/typewriterEffect.d.ts +34 -0
- package/es/md-preview/utils/typewriterEffect.js +61 -0
- package/es/org-picker/OrgPicker.d.ts +4 -4
- package/es/org-picker/OrgPicker.js +16 -42
- package/es/org-picker/types.d.ts +3 -2
- package/es/org-picker/useApi.d.ts +15 -1
- package/es/org-picker/useApi.js +20 -25
- package/es/vue-sfc-shim.d.ts +3 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.js +5 -1
- package/lib/md-preview/MdPreview.d.ts +49 -0
- package/lib/md-preview/MdPreview.js +76 -0
- package/lib/md-preview/_atomic.css +32 -0
- package/lib/md-preview/index.css +1 -0
- package/lib/md-preview/index.d.ts +3 -0
- package/lib/md-preview/index.js +34 -0
- package/lib/md-preview/index.less +102 -0
- package/lib/md-preview/style/index.d.ts +1 -0
- package/lib/md-preview/style/index.js +1 -0
- package/lib/md-preview/style/less.d.ts +1 -0
- package/lib/md-preview/style/less.js +1 -0
- package/lib/md-preview/types.d.ts +23 -0
- package/lib/md-preview/types.js +43 -0
- package/lib/md-preview/utils/customRules.d.ts +12 -0
- package/lib/md-preview/utils/customRules.js +50 -0
- package/lib/md-preview/utils/diffRenderer.d.ts +8 -0
- package/lib/md-preview/utils/diffRenderer.js +53 -0
- package/lib/md-preview/utils/index.d.ts +4 -0
- package/lib/md-preview/utils/index.js +20 -0
- package/lib/md-preview/utils/markdownRenderer.d.ts +7 -0
- package/lib/md-preview/utils/markdownRenderer.js +53 -0
- package/lib/md-preview/utils/typewriterEffect.d.ts +34 -0
- package/lib/md-preview/utils/typewriterEffect.js +79 -0
- package/lib/org-picker/OrgPicker.d.ts +4 -4
- package/lib/org-picker/OrgPicker.js +17 -43
- package/lib/org-picker/types.d.ts +3 -2
- package/lib/org-picker/useApi.d.ts +15 -1
- package/lib/org-picker/useApi.js +19 -24
- package/lib/vue-sfc-shim.d.ts +3 -0
- package/package.json +3 -2
- /package/es/org-picker/components/{deptImg.d.ts → DeptImg.d.ts} +0 -0
- /package/es/org-picker/components/{deptImg.js → DeptImg.js} +0 -0
- /package/lib/org-picker/components/{deptImg.d.ts → DeptImg.d.ts} +0 -0
- /package/lib/org-picker/components/{deptImg.js → DeptImg.js} +0 -0
|
@@ -22,7 +22,7 @@ import { createVNode as _createVNode, createTextVNode as _createTextVNode } from
|
|
|
22
22
|
import "./_atomic.css";
|
|
23
23
|
import { defineComponent, ref, computed, watch, nextTick } from "vue";
|
|
24
24
|
import { ActionSheet, Search, List, Image, Empty } from "vant";
|
|
25
|
-
import DeptImg from "./components/
|
|
25
|
+
import DeptImg from "./components/DeptImg";
|
|
26
26
|
import { orgPickerProps } from "./types";
|
|
27
27
|
import { useApi } from "./useApi";
|
|
28
28
|
import "./index.css";
|
|
@@ -44,18 +44,16 @@ var stdin_default = defineComponent({
|
|
|
44
44
|
getOrgList();
|
|
45
45
|
const selectedItems = ref([]);
|
|
46
46
|
watch(() => props.modelValue, (newValue) => {
|
|
47
|
+
var _a;
|
|
47
48
|
if (!newValue) {
|
|
48
49
|
selectedItems.value = [];
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}, 500);
|
|
52
|
+
if ((_a = userList.value) == null ? void 0 : _a.length) {
|
|
53
|
+
selectedItems.value = newValue.map((id) => {
|
|
54
|
+
return userList.value.find((item) => item.id === id);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
59
57
|
}, {
|
|
60
58
|
immediate: true
|
|
61
59
|
});
|
|
@@ -65,13 +63,10 @@ var stdin_default = defineComponent({
|
|
|
65
63
|
return;
|
|
66
64
|
}
|
|
67
65
|
if (props.multiple) {
|
|
68
|
-
const
|
|
69
|
-
const index = currentValue.findIndex((s) => s.id === item.id);
|
|
66
|
+
const index = selectedItems.value.findIndex((s) => s.id === item.id);
|
|
70
67
|
if (index > -1) {
|
|
71
|
-
|
|
72
|
-
selectedItems.value = selectedItems.value.filter((selected) => selected.id !== item.id);
|
|
68
|
+
selectedItems.value.splice(index, 1);
|
|
73
69
|
} else {
|
|
74
|
-
currentValue.push(item.id);
|
|
75
70
|
selectedItems.value.push(item);
|
|
76
71
|
}
|
|
77
72
|
} else {
|
|
@@ -89,12 +84,10 @@ var stdin_default = defineComponent({
|
|
|
89
84
|
const finished = ref(true);
|
|
90
85
|
const searchRef = ref();
|
|
91
86
|
watch(() => props.show, (newVal) => __async(this, null, function* () {
|
|
87
|
+
var _a;
|
|
92
88
|
if (newVal && props.autoFocus) {
|
|
93
89
|
yield nextTick();
|
|
94
|
-
|
|
95
|
-
var _a;
|
|
96
|
-
(_a = searchRef.value) == null ? void 0 : _a.focus();
|
|
97
|
-
}, 300);
|
|
90
|
+
(_a = searchRef.value) == null ? void 0 : _a.focus();
|
|
98
91
|
}
|
|
99
92
|
}));
|
|
100
93
|
watch(keyword, (newKeyword) => {
|
|
@@ -113,9 +106,7 @@ var stdin_default = defineComponent({
|
|
|
113
106
|
return [...personnel, ...departments];
|
|
114
107
|
});
|
|
115
108
|
const isSelected = (item) => {
|
|
116
|
-
|
|
117
|
-
return false;
|
|
118
|
-
return selectedItems.value.find((s) => s.id === item.id);
|
|
109
|
+
return selectedItems.value.some((s) => s.id === item.id);
|
|
119
110
|
};
|
|
120
111
|
const onLoad = () => {
|
|
121
112
|
finished.value = true;
|
|
@@ -148,8 +139,8 @@ var stdin_default = defineComponent({
|
|
|
148
139
|
"class": "separator"
|
|
149
140
|
}, [_createTextVNode(" / ")])]))]), _createVNode("div", {
|
|
150
141
|
"class": "feed-list-wrap"
|
|
151
|
-
}, [
|
|
152
|
-
"description": "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
|
|
142
|
+
}, [filteredOrgList.value.length === 0 ? _createVNode(Empty, {
|
|
143
|
+
"description": keyword.value ? "\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458" : "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
|
|
153
144
|
}, null) : _createVNode(List, {
|
|
154
145
|
"loading": loading.value,
|
|
155
146
|
"finished": finished.value,
|
|
@@ -158,7 +149,7 @@ var stdin_default = defineComponent({
|
|
|
158
149
|
default: () => [filteredOrgList.value.map((item) => _createVNode("div", {
|
|
159
150
|
"class": ["org-item", isSelected(item) ? "selected" : ""],
|
|
160
151
|
"onClick": () => handleSelect(item)
|
|
161
|
-
}, [item.type === "dept" ? _createVNode("div", {
|
|
152
|
+
}, [item.type === "dept" && !keyword.value ? _createVNode("div", {
|
|
162
153
|
"class": "org-avatar"
|
|
163
154
|
}, [_createVNode(DeptImg, null, null)]) : _createVNode(Image, {
|
|
164
155
|
"class": "org-avatar",
|
|
@@ -166,24 +157,7 @@ var stdin_default = defineComponent({
|
|
|
166
157
|
}, null), _createVNode("div", {
|
|
167
158
|
"class": "org-name"
|
|
168
159
|
}, [item.name])]))]
|
|
169
|
-
}),
|
|
170
|
-
"loading": loading.value,
|
|
171
|
-
"finished": finished.value,
|
|
172
|
-
"onLoad": onLoad,
|
|
173
|
-
"class": "search-result-list"
|
|
174
|
-
}, {
|
|
175
|
-
default: () => [filteredOrgList.value.filter((item) => item.type !== "dept").map((item) => _createVNode("div", {
|
|
176
|
-
"class": ["org-item", isSelected(item) ? "selected" : ""],
|
|
177
|
-
"onClick": () => handleSelect(item)
|
|
178
|
-
}, [_createVNode(Image, {
|
|
179
|
-
"class": "org-avatar",
|
|
180
|
-
"src": item.avatar
|
|
181
|
-
}, null), _createVNode("div", {
|
|
182
|
-
"class": "org-name"
|
|
183
|
-
}, [item.name])]))]
|
|
184
|
-
}), keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 && _createVNode("div", {
|
|
185
|
-
"class": "empty-search-result"
|
|
186
|
-
}, [_createTextVNode("\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458")])]), props.multiple && _createVNode("div", {
|
|
160
|
+
})]), props.multiple && _createVNode("div", {
|
|
187
161
|
"class": "bottom-section"
|
|
188
162
|
}, [selectedItems.value.length > 0 && _createVNode("div", {
|
|
189
163
|
"class": "selected-items"
|
package/es/org-picker/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface OrgItem {
|
|
|
4
4
|
name: string;
|
|
5
5
|
type: string;
|
|
6
6
|
avatar?: string;
|
|
7
|
+
[x: string]: any;
|
|
7
8
|
}
|
|
8
9
|
export declare const orgPickerProps: {
|
|
9
10
|
modelValue: {
|
|
@@ -23,10 +24,10 @@ export declare const orgPickerProps: {
|
|
|
23
24
|
default: boolean;
|
|
24
25
|
};
|
|
25
26
|
'onUpdate:modelValue': {
|
|
26
|
-
type:
|
|
27
|
+
type: FunctionConstructor;
|
|
27
28
|
};
|
|
28
29
|
'onUpdate:show': {
|
|
29
|
-
type:
|
|
30
|
+
type: FunctionConstructor;
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
33
|
export type OrgPickerProps = ExtractPropTypes<typeof orgPickerProps>;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { type OrgItem } from './types';
|
|
2
2
|
export declare const useApi: () => {
|
|
3
|
-
userList: import("vue").Ref<
|
|
3
|
+
userList: import("vue").Ref<{
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
id: string | number;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
avatar?: string | undefined;
|
|
9
|
+
}[], OrgItem[] | {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
id: string | number;
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
avatar?: string | undefined;
|
|
15
|
+
}[]>;
|
|
4
16
|
orgList: import("vue").Ref<{
|
|
17
|
+
[x: string]: any;
|
|
5
18
|
id: string | number;
|
|
6
19
|
name: string;
|
|
7
20
|
type: string;
|
|
8
21
|
avatar?: string | undefined;
|
|
9
22
|
}[], OrgItem[] | {
|
|
23
|
+
[x: string]: any;
|
|
10
24
|
id: string | number;
|
|
11
25
|
name: string;
|
|
12
26
|
type: string;
|
package/es/org-picker/useApi.js
CHANGED
|
@@ -19,30 +19,30 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
import { ref } from "vue";
|
|
22
|
-
import { useFetch } from "@cgboiler/core";
|
|
22
|
+
import { useFetch, getUserList } from "@cgboiler/core";
|
|
23
23
|
import { debounce } from "lodash-es";
|
|
24
24
|
const orgListCache = /* @__PURE__ */ new Map();
|
|
25
|
-
const
|
|
26
|
-
if (orgListCache.has(
|
|
27
|
-
return orgListCache.get(
|
|
25
|
+
const fetchData = (url, cacheKey) => __async(void 0, null, function* () {
|
|
26
|
+
if (cacheKey && orgListCache.has(cacheKey)) {
|
|
27
|
+
return orgListCache.get(cacheKey);
|
|
28
|
+
}
|
|
29
|
+
const res = (yield useFetch(url, { method: "GET" })) || [];
|
|
30
|
+
if (cacheKey) {
|
|
31
|
+
orgListCache.set(cacheKey, res);
|
|
28
32
|
}
|
|
29
|
-
const res = (yield useFetch(
|
|
30
|
-
`https://wflow.cgboiler.com/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`,
|
|
31
|
-
{
|
|
32
|
-
method: "GET"
|
|
33
|
-
}
|
|
34
|
-
)) || [];
|
|
35
|
-
orgListCache.set(deptId || "", res);
|
|
36
33
|
return res;
|
|
37
34
|
});
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
method: "GET"
|
|
42
|
-
})) || [];
|
|
43
|
-
userList.value = res;
|
|
35
|
+
const fetchOrgList = (deptId) => __async(void 0, null, function* () {
|
|
36
|
+
const url = `https://wflow.cgboiler.com/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`;
|
|
37
|
+
return fetchData(url, deptId || "");
|
|
44
38
|
});
|
|
45
|
-
|
|
39
|
+
const userList = ref([]);
|
|
40
|
+
function initUserList() {
|
|
41
|
+
return __async(this, null, function* () {
|
|
42
|
+
userList.value = yield getUserList();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
initUserList();
|
|
46
46
|
const useApi = () => {
|
|
47
47
|
const orgList = ref([]);
|
|
48
48
|
const currentDeptId = ref("1");
|
|
@@ -68,13 +68,8 @@ const useApi = () => {
|
|
|
68
68
|
orgList.value = [];
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
method: "GET"
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
orgList.value = res || [];
|
|
71
|
+
const url = `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`;
|
|
72
|
+
orgList.value = yield fetchData(url);
|
|
78
73
|
}), 300);
|
|
79
74
|
return {
|
|
80
75
|
userList,
|
package/es/vue-sfc-shim.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./md-preview";
|
|
1
2
|
export * from "./org-picker";
|
|
2
3
|
export * from "./project-select";
|
|
3
4
|
declare namespace _default {
|
|
@@ -6,7 +7,8 @@ declare namespace _default {
|
|
|
6
7
|
}
|
|
7
8
|
export default _default;
|
|
8
9
|
export function install(app: any): void;
|
|
9
|
-
export const version: "1.
|
|
10
|
+
export const version: "1.12.0";
|
|
11
|
+
import MdPreview from './md-preview';
|
|
10
12
|
import OrgPicker from './org-picker';
|
|
11
13
|
import ProjectSelect from './project-select';
|
|
12
|
-
export { OrgPicker, ProjectSelect };
|
|
14
|
+
export { MdPreview, OrgPicker, ProjectSelect };
|
package/lib/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var stdin_exports = {};
|
|
30
30
|
__export(stdin_exports, {
|
|
31
|
+
MdPreview: () => import_md_preview.default,
|
|
31
32
|
OrgPicker: () => import_org_picker.default,
|
|
32
33
|
ProjectSelect: () => import_project_select.default,
|
|
33
34
|
default: () => stdin_default,
|
|
@@ -35,13 +36,16 @@ __export(stdin_exports, {
|
|
|
35
36
|
version: () => version
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(stdin_exports);
|
|
39
|
+
var import_md_preview = __toESM(require("./md-preview"));
|
|
38
40
|
var import_org_picker = __toESM(require("./org-picker"));
|
|
39
41
|
var import_project_select = __toESM(require("./project-select"));
|
|
42
|
+
__reExport(stdin_exports, require("./md-preview"), module.exports);
|
|
40
43
|
__reExport(stdin_exports, require("./org-picker"), module.exports);
|
|
41
44
|
__reExport(stdin_exports, require("./project-select"), module.exports);
|
|
42
|
-
const version = "1.
|
|
45
|
+
const version = "1.12.0";
|
|
43
46
|
function install(app) {
|
|
44
47
|
const components = [
|
|
48
|
+
import_md_preview.default,
|
|
45
49
|
import_org_picker.default,
|
|
46
50
|
import_project_select.default
|
|
47
51
|
];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
text: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
required: boolean;
|
|
6
|
+
};
|
|
7
|
+
typewriter: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
typewriterKey: {
|
|
12
|
+
type: NumberConstructor;
|
|
13
|
+
};
|
|
14
|
+
showDiff: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
previousText: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "typewriterComplete"[], "typewriterComplete", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
text: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
required: boolean;
|
|
26
|
+
};
|
|
27
|
+
typewriter: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
typewriterKey: {
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
};
|
|
34
|
+
showDiff: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
previousText: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
}>> & Readonly<{
|
|
43
|
+
onTypewriterComplete?: ((...args: any[]) => any) | undefined;
|
|
44
|
+
}>, {
|
|
45
|
+
typewriter: boolean;
|
|
46
|
+
showDiff: boolean;
|
|
47
|
+
previousText: string;
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
var stdin_exports = {};
|
|
33
|
+
__export(stdin_exports, {
|
|
34
|
+
default: () => stdin_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
37
|
+
var import_vue = require("vue");
|
|
38
|
+
var import_atomic = require("./_atomic.css");
|
|
39
|
+
var import_vue2 = require("vue");
|
|
40
|
+
var import_types = require("./types");
|
|
41
|
+
var import_utils = require("./utils");
|
|
42
|
+
var import_index = require("./index.css");
|
|
43
|
+
var stdin_default = (0, import_vue2.defineComponent)({
|
|
44
|
+
name: "MdPreview",
|
|
45
|
+
props: __spreadValues({}, import_types.mdPreviewProps),
|
|
46
|
+
emits: ["typewriterComplete"],
|
|
47
|
+
setup(props, {
|
|
48
|
+
emit
|
|
49
|
+
}) {
|
|
50
|
+
(0, import_utils.initMarked)();
|
|
51
|
+
const {
|
|
52
|
+
currentText,
|
|
53
|
+
controller: typewriterController
|
|
54
|
+
} = (0, import_utils.useTypewriter)(() => {
|
|
55
|
+
emit("typewriterComplete");
|
|
56
|
+
});
|
|
57
|
+
const htmlContent = (0, import_vue2.computed)(() => (0, import_utils.renderMarkdown)(props.text || ""));
|
|
58
|
+
const displayContent = (0, import_vue2.computed)(() => {
|
|
59
|
+
if (props.showDiff) {
|
|
60
|
+
return (0, import_utils.generateDiffHtml)(props.previousText, props.text || "", htmlContent.value);
|
|
61
|
+
}
|
|
62
|
+
return props.typewriter ? currentText.value : htmlContent.value;
|
|
63
|
+
});
|
|
64
|
+
(0, import_vue2.watch)([() => props.text, () => props.typewriterKey], () => {
|
|
65
|
+
if (props.typewriter) {
|
|
66
|
+
typewriterController.start(htmlContent.value);
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
immediate: true
|
|
70
|
+
});
|
|
71
|
+
return () => (0, import_vue.createVNode)("div", {
|
|
72
|
+
"class": "cgx-markdown-preview",
|
|
73
|
+
"innerHTML": displayContent.value
|
|
74
|
+
}, null);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
.cgx-atm .flex {
|
|
3
|
+
align-items: initial;
|
|
4
|
+
flex-direction: initial;
|
|
5
|
+
justify-content: initial;
|
|
6
|
+
flex-wrap: initial;
|
|
7
|
+
}
|
|
8
|
+
.cgx-atm .flex-row {
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
}
|
|
11
|
+
.cgx-atm .flex-col {
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
.cgx-atm .justify-center {
|
|
15
|
+
justify-content: center;
|
|
16
|
+
}
|
|
17
|
+
.cgx-atm .justify-between {
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
}
|
|
20
|
+
.cgx-atm .justify-around {
|
|
21
|
+
justify-content: space-around;
|
|
22
|
+
}
|
|
23
|
+
.cgx-atm .justify-end {
|
|
24
|
+
justify-content: flex-end;
|
|
25
|
+
}
|
|
26
|
+
.cgx-atm .items-center {
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
.cgx-atm .flex-wrap {
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.katex-block{display:block;margin:1em 0;text-align:center;overflow-x:auto;overflow-y:hidden}.cgx-markdown-preview{overflow-x:auto}.cgx-markdown-preview .diff-container{border:1px solid #ebeef5;border-radius:4px;overflow:auto}.cgx-markdown-preview .diff-equal{color:#606266}.cgx-markdown-preview .diff-delete{background-color:#ffeef0;color:#f56c6c;text-decoration:line-through}.cgx-markdown-preview .diff-insert{background-color:#e6ffec;color:#67c23a}.cgx-markdown-preview .diff-unified-view pre{margin:0;padding:8px;white-space:pre-wrap;word-break:break-word}.cgx-markdown-preview{line-height:1.6;font-size:var(--font-base)}.cgx-markdown-preview ol{list-style:auto}.cgx-markdown-preview ul{list-style:disc}.cgx-markdown-preview ol,.cgx-markdown-preview ul{padding-left:2em;margin:0 0 12px}.cgx-markdown-preview li::marker{text-align:start!important}.cgx-markdown-preview h1{font-size:2em;font-weight:700;margin:16px 0}.cgx-markdown-preview h2{font-size:1.5em;font-weight:700;margin:14px 0}.cgx-markdown-preview p{margin:12px 0}.cgx-markdown-preview blockquote{margin:0;padding-left:1em;border-left:4px solid #ddd;color:#666}.cgx-markdown-preview table{border-collapse:collapse;width:100%;margin-bottom:16px}.cgx-markdown-preview th,.cgx-markdown-preview td{border:1px solid #ddd;padding:8px;text-align:left}.cgx-markdown-preview th{background-color:#f6f8fa}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var stdin_exports = {};
|
|
29
|
+
__export(stdin_exports, {
|
|
30
|
+
default: () => stdin_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
33
|
+
var import_MdPreview = __toESM(require("./MdPreview"));
|
|
34
|
+
var stdin_default = import_MdPreview.default;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.katex-block {
|
|
2
|
+
display: block;
|
|
3
|
+
margin: 1em 0;
|
|
4
|
+
text-align: center;
|
|
5
|
+
overflow-x: auto;
|
|
6
|
+
overflow-y: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cgx-markdown-preview {
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
|
|
12
|
+
/* 差异对比样式 */
|
|
13
|
+
.diff-container {
|
|
14
|
+
border: 1px solid #ebeef5;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.diff-equal {
|
|
20
|
+
color: #606266;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.diff-delete {
|
|
24
|
+
background-color: #ffeef0;
|
|
25
|
+
color: #f56c6c;
|
|
26
|
+
text-decoration: line-through;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.diff-insert {
|
|
30
|
+
background-color: #e6ffec;
|
|
31
|
+
color: #67c23a;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.diff-unified-view pre {
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 8px;
|
|
37
|
+
white-space: pre-wrap;
|
|
38
|
+
word-break: break-word;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.cgx-markdown-preview {
|
|
43
|
+
line-height: 1.6;
|
|
44
|
+
font-size: var(--font-base);
|
|
45
|
+
ol {
|
|
46
|
+
list-style: auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ul {
|
|
50
|
+
list-style: disc;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ol,
|
|
54
|
+
ul {
|
|
55
|
+
padding-left: 2em;
|
|
56
|
+
margin: 0 0 12px 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
li::marker {
|
|
60
|
+
text-align: start !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
h1 {
|
|
64
|
+
font-size: 2em;
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
margin: 16px 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
h2 {
|
|
70
|
+
font-size: 1.5em;
|
|
71
|
+
font-weight: bold;
|
|
72
|
+
margin: 14px 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
p {
|
|
76
|
+
margin: 12px 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
blockquote {
|
|
80
|
+
margin: 0;
|
|
81
|
+
padding-left: 1em;
|
|
82
|
+
border-left: 4px solid #ddd;
|
|
83
|
+
color: #666;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
table {
|
|
87
|
+
border-collapse: collapse;
|
|
88
|
+
width: 100%;
|
|
89
|
+
margin-bottom: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
th,
|
|
93
|
+
td {
|
|
94
|
+
border: 1px solid #ddd;
|
|
95
|
+
padding: 8px;
|
|
96
|
+
text-align: left;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
th {
|
|
100
|
+
background-color: #f6f8fa;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("../index.css");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("../index.less");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
|
2
|
+
export declare const mdPreviewProps: {
|
|
3
|
+
text: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
required: boolean;
|
|
6
|
+
};
|
|
7
|
+
typewriter: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
typewriterKey: {
|
|
12
|
+
type: NumberConstructor;
|
|
13
|
+
};
|
|
14
|
+
showDiff: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
previousText: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type MdPreviewProps = ExtractPropTypes<typeof mdPreviewProps>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var stdin_exports = {};
|
|
19
|
+
__export(stdin_exports, {
|
|
20
|
+
mdPreviewProps: () => mdPreviewProps
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
23
|
+
const mdPreviewProps = {
|
|
24
|
+
text: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
typewriter: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
typewriterKey: {
|
|
33
|
+
type: Number
|
|
34
|
+
},
|
|
35
|
+
showDiff: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
previousText: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
}
|
|
43
|
+
};
|