@vtx/modals2 5.0.12 → 5.0.14
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/lib/_components/vm-card-statistics/index.less +27 -27
- package/lib/_components/vm-extra-tab/index.js +8 -0
- package/lib/_components/vm-extra-tab/style/index.less +1 -0
- package/lib/_components/vm-factor-list/index.less +11 -11
- package/lib/_components/vm-table/index.js +4 -4
- package/lib/_util/http.js +6 -0
- package/lib/index.js +2 -1
- package/lib/vtx-base-modal/Header/index.less +98 -98
- package/lib/vtx-base-modal/Tabs/index.less +31 -31
- package/lib/vtx-car-modal/components/Info/index.less +6 -6
- package/lib/vtx-car-modal/content/Common/OilConsumption/index.less +6 -6
- package/lib/vtx-car-modal/content/Common/WaterConsumption/index.less +6 -6
- package/lib/vtx-cc-unit-modal/components/BaseInfo/index.less +6 -6
- package/lib/vtx-cp-modal/components/ExeceptionInfo/AlarmRecord.js +5 -5
- package/lib/vtx-cp-modal/components/SyInfo/index.js +3 -0
- package/lib/vtx-device-modal/components/DataAnalysis/index.less +66 -66
- package/lib/vtx-restaurant-modal/components/Basic/index.less +16 -16
- package/lib/vtx-restaurant-modal/config.js +52 -52
- package/lib/vtx-road-modal/components/BaseInfo/index.less +34 -31
- package/lib/vtx-road-modal/components/Statistical/index.less +32 -32
- package/lib/vtx-wr-modal/components/Base/Ptss.js +0 -6
- package/lib/vtx-wr-modal/components/Base/Sjjg.js +2 -5
- package/lib/vtx-wr-modal/components/Base/index.less +5 -10
- package/lib/vtx-wr-modal/components/Build/index.js +3 -2
- package/lib/vtx-wr-modal/components/Score/index.js +4 -4
- package/lib/vtx-wr-modal/index.js +15 -2
- package/lib/vtx-zf-modal/components/Base/index.js +244 -0
- package/lib/vtx-zf-modal/components/Base/index.less +105 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/ckeditor.d.ts +109 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/ckeditor.js +5 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/ckeditor.js.map +1 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/af.js +33 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ar.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ast.js +109 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/az.js +221 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/bg.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/bn.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/bs.js +80 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ca.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/cs.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/da.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/de-ch.js +220 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/de.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/el.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/en-au.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/en-gb.js +215 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/en.js +92 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/eo.js +120 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/es-co.js +36 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/es.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/et.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/eu.js +121 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/fa.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/fi.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/fr.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/gl.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/gu.js +22 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/he.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/hi.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/hr.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/hu.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/id.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/it.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ja.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/jv.js +106 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/kk.js +13 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/km.js +127 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/kn.js +121 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ko.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ku.js +219 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/lt.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/lv.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ms.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/nb.js +199 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ne.js +215 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/nl.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/no.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/oc.js +21 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/pl.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/pt-br.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/pt.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ro.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ru.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/si.js +76 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/sk.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/sl.js +78 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/sq.js +208 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/sr-latn.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/sr.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/sv.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/th.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/tk.js +220 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/tr.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/tt.js +170 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ug.js +205 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/uk.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/ur.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/uz.js +220 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/vi.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/zh-cn.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/ckeditor/translations/zh.js +222 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/context/Event.js +42 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/context/context.js +98 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/context/index.js +3 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/context/useContextComponent.js +16 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/index.js +294 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/index.less +133 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/utils/util.js +67 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/view.js +216 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/CKModal.js +77 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/OpenPanelCommand.js +31 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/config.js +146 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/editableDiv/FormView.js +92 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/editableDiv/index.js +341 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/editableDiv/index.less +1 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/FormView.js +94 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/date.js +334 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/index.js +330 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/input/index.less +36 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/FormView.js +93 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/checkbox.js +335 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/index.js +335 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/radio/index.less +35 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/sign/FormView.js +94 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/sign/index.js +338 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/sign/index.less +1 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/style.less +92 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/textarea/FormView.js +94 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/textarea/index.js +328 -0
- package/lib/vtx-zf-modal/components/CkEditorCustom/widgets/textarea/index.less +1 -0
- package/lib/vtx-zf-modal/components/Document/index.js +84 -0
- package/lib/vtx-zf-modal/components/Document/index.less +47 -0
- package/lib/vtx-zf-modal/components/File/index.js +192 -0
- package/lib/vtx-zf-modal/components/File/index.less +43 -0
- package/lib/vtx-zf-modal/components/Process/index.js +196 -0
- package/lib/vtx-zf-modal/components/Process/index.less +107 -0
- package/lib/vtx-zf-modal/components/Record/index.js +108 -0
- package/lib/vtx-zf-modal/components/Record/index.less +34 -0
- package/lib/vtx-zf-modal/components/Right/index.js +45 -0
- package/lib/vtx-zf-modal/components/index.js +6 -0
- package/lib/vtx-zf-modal/index.js +125 -0
- package/lib/vtx-zf-modal/style/index.js +7 -0
- package/lib/vtx-zf-modal/style/index.less +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import React, { useEffect, forwardRef } from 'react';
|
|
18
|
+
import { useSetState } from 'ahooks';
|
|
19
|
+
import { createEditor, useContextComponent } from "./context";
|
|
20
|
+
import classNames from 'classnames';
|
|
21
|
+
import { ClassicEditor } from "./ckeditor/ckeditor";
|
|
22
|
+
import Radio from "./widgets/radio";
|
|
23
|
+
import Input from "./widgets/input";
|
|
24
|
+
import Checkbox from "./widgets/radio/checkbox";
|
|
25
|
+
import CustomDate from "./widgets/input/date";
|
|
26
|
+
import Textarea from "./widgets/textarea";
|
|
27
|
+
import Sign from "./widgets/sign";
|
|
28
|
+
import EditableDiv from "./widgets/editableDiv";
|
|
29
|
+
import { getUUID } from "./utils/util";
|
|
30
|
+
import { UnorderedListOutlined } from '@ant-design/icons';
|
|
31
|
+
import "./index.less";
|
|
32
|
+
import viewRichText from "./view";
|
|
33
|
+
import CKModal from "./widgets/CKModal";
|
|
34
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
|
+
var defaultPlugins = ClassicEditor.builtinPlugins;
|
|
36
|
+
function CkEditorCustom(_ref, ref) {
|
|
37
|
+
var _state$editor;
|
|
38
|
+
var content = _ref.content,
|
|
39
|
+
config = _ref.config,
|
|
40
|
+
customStyles = _ref.customStyles;
|
|
41
|
+
var _useContextComponent = useContextComponent(),
|
|
42
|
+
emit = _useContextComponent.emit,
|
|
43
|
+
bind = _useContextComponent.bind;
|
|
44
|
+
var _useSetState = useSetState({
|
|
45
|
+
editor: null,
|
|
46
|
+
html: '',
|
|
47
|
+
active: 'design',
|
|
48
|
+
modalVisible: false,
|
|
49
|
+
modalType: '',
|
|
50
|
+
modalTitle: '',
|
|
51
|
+
executeFunc: '',
|
|
52
|
+
defaultData: {}
|
|
53
|
+
}),
|
|
54
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
55
|
+
state = _useSetState2[0],
|
|
56
|
+
setState = _useSetState2[1];
|
|
57
|
+
var ckcontent = (state === null || state === void 0 || (_state$editor = state.editor) === null || _state$editor === void 0 ? void 0 : _state$editor.getData) && state.editor.getData();
|
|
58
|
+
bind('plugingChange', function (params) {
|
|
59
|
+
var uuid = params.id || getUUID();
|
|
60
|
+
sessionStorage.setItem('ckComponents', JSON.stringify(_objectSpread(_objectSpread({}, JSON.parse(sessionStorage.getItem('ckComponents') || '{}')), {}, _defineProperty({}, uuid, params.config))));
|
|
61
|
+
params.callback(uuid);
|
|
62
|
+
});
|
|
63
|
+
useEffect(function () {
|
|
64
|
+
sessionStorage.setItem('ckComponents', '');
|
|
65
|
+
ClassicEditor.create(document.querySelector('#editor'), {
|
|
66
|
+
language: 'zh-cn',
|
|
67
|
+
plugins: [].concat(_toConsumableArray(defaultPlugins), [Radio, Input, Checkbox, CustomDate, Textarea, Sign, EditableDiv]),
|
|
68
|
+
toolbar: {
|
|
69
|
+
items: ['undo', 'redo', '|', 'heading', 'underline', 'bold', 'italic', '|', 'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', '|', 'alignment', '|', 'insertTable', 'indent', 'outdent', 'numberedList', 'bulletedList', '|'
|
|
70
|
+
// 'customInput', 'customRadio', 'customCheckbox', 'customDate', 'customTextarea', 'customSign', 'editableDiv'
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
globalConfig: {
|
|
74
|
+
emit: emit,
|
|
75
|
+
bind: bind
|
|
76
|
+
},
|
|
77
|
+
heading: {
|
|
78
|
+
options: [{
|
|
79
|
+
model: 'paragraph',
|
|
80
|
+
title: '正文',
|
|
81
|
+
class: 'ck-heading_paragraph'
|
|
82
|
+
}, {
|
|
83
|
+
model: 'heading1',
|
|
84
|
+
view: 'h1',
|
|
85
|
+
title: '标题1',
|
|
86
|
+
class: 'ck-heading_heading1'
|
|
87
|
+
}, {
|
|
88
|
+
model: 'heading2',
|
|
89
|
+
view: 'h2',
|
|
90
|
+
title: '标题2',
|
|
91
|
+
class: 'ck-heading_heading2'
|
|
92
|
+
}, {
|
|
93
|
+
model: 'heading3',
|
|
94
|
+
view: 'h3',
|
|
95
|
+
title: '标题3',
|
|
96
|
+
class: 'ck-heading_heading3'
|
|
97
|
+
}]
|
|
98
|
+
},
|
|
99
|
+
table: {
|
|
100
|
+
contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties']
|
|
101
|
+
},
|
|
102
|
+
fontSize: {
|
|
103
|
+
options: [12, 14, 16, 18, 20, 22, 25, 30]
|
|
104
|
+
},
|
|
105
|
+
fontFamily: {
|
|
106
|
+
options: ['宋体', '仿宋', '楷体']
|
|
107
|
+
}
|
|
108
|
+
}).then(function (editor) {
|
|
109
|
+
window.editor = editor;
|
|
110
|
+
setState({
|
|
111
|
+
editor: editor
|
|
112
|
+
});
|
|
113
|
+
}).catch(function (error) {
|
|
114
|
+
console.error(error);
|
|
115
|
+
});
|
|
116
|
+
}, []);
|
|
117
|
+
useEffect(function () {
|
|
118
|
+
if (content && state.editor) {
|
|
119
|
+
sessionStorage.setItem('ckComponents', config);
|
|
120
|
+
state.editor.setData(content);
|
|
121
|
+
ckcontent = state.editor.getData();
|
|
122
|
+
}
|
|
123
|
+
}, [content, config, state.editor]);
|
|
124
|
+
var modalprops = {
|
|
125
|
+
visible: state.modalVisible,
|
|
126
|
+
type: state.modalType,
|
|
127
|
+
title: state.modalTitle,
|
|
128
|
+
defaultData: state.defaultData,
|
|
129
|
+
onClose: function onClose() {
|
|
130
|
+
setState({
|
|
131
|
+
modalVisible: false,
|
|
132
|
+
modalTitle: '',
|
|
133
|
+
modalType: '',
|
|
134
|
+
defaultData: {}
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
onOk: function onOk(params) {
|
|
138
|
+
var uuid = params.id || getUUID();
|
|
139
|
+
sessionStorage.setItem('ckComponents', JSON.stringify(_objectSpread(_objectSpread({}, JSON.parse(sessionStorage.getItem('ckComponents') || '{}')), {}, _defineProperty({}, uuid, params))));
|
|
140
|
+
if (!params.id) {
|
|
141
|
+
editor.execute(state.executeFunc, {
|
|
142
|
+
configid: uuid
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
editor.setData(editor.getData());
|
|
146
|
+
}
|
|
147
|
+
setState({
|
|
148
|
+
modalVisible: false,
|
|
149
|
+
modalTitle: '',
|
|
150
|
+
modalType: '',
|
|
151
|
+
defaultData: {}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
useEffect(function () {
|
|
156
|
+
if (ckcontent) {
|
|
157
|
+
(document.querySelectorAll('.vtx_ck_widgets') || []).forEach(function (item) {
|
|
158
|
+
if (!item.onclick) {
|
|
159
|
+
item.onclick = function () {
|
|
160
|
+
var configid = item.getAttribute('configid');
|
|
161
|
+
var components = JSON.parse(sessionStorage.getItem('ckComponents') || '{}');
|
|
162
|
+
var defaultData = components[configid] || {};
|
|
163
|
+
setState({
|
|
164
|
+
modalVisible: true,
|
|
165
|
+
modalType: defaultData.type,
|
|
166
|
+
modalTitle: '编辑',
|
|
167
|
+
defaultData: _objectSpread(_objectSpread({}, defaultData), {}, {
|
|
168
|
+
id: configid
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}, [ckcontent]);
|
|
176
|
+
console.log(customStyles, 'customStyles');
|
|
177
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
178
|
+
className: classNames('custom-ck'),
|
|
179
|
+
style: _objectSpread({}, customStyles),
|
|
180
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
181
|
+
className: classNames('content'),
|
|
182
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
183
|
+
className: classNames("tab1"),
|
|
184
|
+
style: {
|
|
185
|
+
display: state.active == 'source' ? 'block' : 'none'
|
|
186
|
+
},
|
|
187
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
188
|
+
className: classNames("block"),
|
|
189
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
190
|
+
children: /*#__PURE__*/_jsx("code", {
|
|
191
|
+
children: state.html
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
196
|
+
className: classNames("tab2"),
|
|
197
|
+
style: {
|
|
198
|
+
display: state.active == 'design' ? 'flex' : 'none'
|
|
199
|
+
},
|
|
200
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
201
|
+
className: classNames("editor"),
|
|
202
|
+
id: "editor",
|
|
203
|
+
ref: ref
|
|
204
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
205
|
+
className: classNames('right_bar'),
|
|
206
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
207
|
+
className: classNames('right_bar_title'),
|
|
208
|
+
children: [/*#__PURE__*/_jsx(UnorderedListOutlined, {
|
|
209
|
+
className: classNames('right_bar_title_icon')
|
|
210
|
+
}), "\u8868\u5355\u7EC4\u4EF6"]
|
|
211
|
+
}), [{
|
|
212
|
+
name: '文本框',
|
|
213
|
+
type: 'input',
|
|
214
|
+
func: 'insertCustomInput'
|
|
215
|
+
}, {
|
|
216
|
+
name: '日期',
|
|
217
|
+
type: 'date',
|
|
218
|
+
func: 'insertCustomDate'
|
|
219
|
+
}, {
|
|
220
|
+
name: '文本域',
|
|
221
|
+
type: 'textarea',
|
|
222
|
+
func: 'insertCustomTextarea'
|
|
223
|
+
}, {
|
|
224
|
+
name: '签名图片',
|
|
225
|
+
type: 'sign',
|
|
226
|
+
func: 'insertCustomSign'
|
|
227
|
+
}, {
|
|
228
|
+
name: '可编辑文本',
|
|
229
|
+
type: 'editable-div',
|
|
230
|
+
func: 'insertEditableDiv'
|
|
231
|
+
}, {
|
|
232
|
+
name: '单选框',
|
|
233
|
+
type: 'radio',
|
|
234
|
+
func: 'insertCustomRadio'
|
|
235
|
+
}, {
|
|
236
|
+
name: '复选框',
|
|
237
|
+
type: 'checkbox',
|
|
238
|
+
func: 'insertCustomCheckbox'
|
|
239
|
+
}].map(function (item) {
|
|
240
|
+
return /*#__PURE__*/_jsx("div", {
|
|
241
|
+
className: classNames('right_bar_button'),
|
|
242
|
+
onClick: function onClick() {
|
|
243
|
+
// state.editor.execute(item.func)
|
|
244
|
+
setState({
|
|
245
|
+
modalVisible: true,
|
|
246
|
+
modalType: item.type,
|
|
247
|
+
modalTitle: "".concat(item.name, " > \u914D\u7F6E"),
|
|
248
|
+
executeFunc: item.func
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
children: item.name
|
|
252
|
+
}, item.func);
|
|
253
|
+
})]
|
|
254
|
+
})]
|
|
255
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
256
|
+
className: classNames("tab3"),
|
|
257
|
+
style: {
|
|
258
|
+
display: state.active == 'preview' ? 'block' : 'none'
|
|
259
|
+
},
|
|
260
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
261
|
+
className: classNames("block"),
|
|
262
|
+
children: viewRichText({
|
|
263
|
+
content: state.html,
|
|
264
|
+
configJson: sessionStorage.getItem('ckComponents') || '{}'
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
})]
|
|
268
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
269
|
+
className: classNames("footer"),
|
|
270
|
+
children: [{
|
|
271
|
+
name: '源码',
|
|
272
|
+
key: 'source'
|
|
273
|
+
}, {
|
|
274
|
+
name: '设计',
|
|
275
|
+
key: 'design'
|
|
276
|
+
}, {
|
|
277
|
+
name: '预览',
|
|
278
|
+
key: 'preview'
|
|
279
|
+
}].map(function (item) {
|
|
280
|
+
return /*#__PURE__*/_jsx("span", {
|
|
281
|
+
className: classNames(state.active == item.key ? 'checked' : ''),
|
|
282
|
+
onClick: function onClick() {
|
|
283
|
+
setState({
|
|
284
|
+
active: item.key,
|
|
285
|
+
html: window.editor.getData()
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
children: item.name
|
|
289
|
+
}, item.key);
|
|
290
|
+
})
|
|
291
|
+
}), state.modalVisible && /*#__PURE__*/_jsx(CKModal, _objectSpread({}, modalprops))]
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
export default createEditor({})( /*#__PURE__*/forwardRef(CkEditorCustom));
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
.custom-ck {
|
|
2
|
+
height: 100%;
|
|
3
|
+
// width: 100%;
|
|
4
|
+
width: 924px;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border: 1px solid rgb(204, 206, 209);
|
|
9
|
+
margin: auto;
|
|
10
|
+
|
|
11
|
+
.content {
|
|
12
|
+
flex: 1;
|
|
13
|
+
|
|
14
|
+
.tab1 pre {
|
|
15
|
+
width: 100%;
|
|
16
|
+
word-wrap: break-word;
|
|
17
|
+
word-break: break-all;
|
|
18
|
+
white-space: normal;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tab2 {
|
|
22
|
+
position: relative;
|
|
23
|
+
// height: 100%;
|
|
24
|
+
width: fit-content;
|
|
25
|
+
height: 100%;
|
|
26
|
+
|
|
27
|
+
.editor,
|
|
28
|
+
.ck-editor {
|
|
29
|
+
height: 100%;
|
|
30
|
+
// width: 100%;
|
|
31
|
+
width: 794px;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
|
|
35
|
+
.ck-editor__main {
|
|
36
|
+
flex: 1;
|
|
37
|
+
|
|
38
|
+
.ck-content {
|
|
39
|
+
height: 100%;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.right_bar {
|
|
46
|
+
.right_bar_title {
|
|
47
|
+
height: 40px;
|
|
48
|
+
line-height: 40px;
|
|
49
|
+
border-bottom: 1px solid #ccced1;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
text-align: center;
|
|
52
|
+
|
|
53
|
+
.right_bar_title_icon {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
margin-right: 5px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
width: 130px;
|
|
60
|
+
// position: absolute;
|
|
61
|
+
// right: 0;
|
|
62
|
+
// top: 40px;
|
|
63
|
+
// bottom: 0px;
|
|
64
|
+
// width: fit-content;
|
|
65
|
+
border-left: 1px solid #ccced1;
|
|
66
|
+
line-height: 40px;
|
|
67
|
+
|
|
68
|
+
.right_bar_button {
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
padding: 0 20px;
|
|
71
|
+
border-bottom: 1px solid #ccced1;
|
|
72
|
+
text-align: center;
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
color: #189ff1;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.tab3 {
|
|
82
|
+
width: 794px;
|
|
83
|
+
margin: auto;
|
|
84
|
+
padding: 20px 40px;
|
|
85
|
+
height: 100%;
|
|
86
|
+
border: 1px dashed #ccced1;
|
|
87
|
+
|
|
88
|
+
table {
|
|
89
|
+
width: 100%;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.footer {
|
|
95
|
+
height: 40px;
|
|
96
|
+
border-top: 1px solid #ccced1;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
|
|
100
|
+
span {
|
|
101
|
+
height: 100%;
|
|
102
|
+
line-height: 40px;
|
|
103
|
+
text-align: center;
|
|
104
|
+
display: inline-block;
|
|
105
|
+
vertical-align: middle;
|
|
106
|
+
padding: 0 25px;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
border-right: 1px solid #ccced1;
|
|
109
|
+
|
|
110
|
+
&:hover {
|
|
111
|
+
color: #189ff1;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.checked {
|
|
116
|
+
color: #189ff1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ck.ck-balloon-panel:not([class*='ck-tooltip']),
|
|
123
|
+
.ck.ck-balloon-panel:not([class*='ck-toolbar-container']) {
|
|
124
|
+
top: 50% !important;
|
|
125
|
+
left: 50% !important;
|
|
126
|
+
right: inherit !important;
|
|
127
|
+
bottom: inherit !important;
|
|
128
|
+
transform: translate(-50%, -50%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before {
|
|
132
|
+
display: none;
|
|
133
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// 生成临时UUID
|
|
2
|
+
export function getUUID() {
|
|
3
|
+
var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16;
|
|
4
|
+
var radix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
|
|
5
|
+
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
|
6
|
+
var uuid = [],
|
|
7
|
+
i;
|
|
8
|
+
radix = radix || chars.length;
|
|
9
|
+
if (len) {
|
|
10
|
+
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
|
|
11
|
+
} else {
|
|
12
|
+
var r;
|
|
13
|
+
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
|
|
14
|
+
uuid[14] = '4';
|
|
15
|
+
for (i = 0; i < 36; i++) {
|
|
16
|
+
if (!uuid[i]) {
|
|
17
|
+
r = 0 | Math.random() * 16;
|
|
18
|
+
uuid[i] = chars[i == 19 ? r & 0x3 | 0x8 : r];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return uuid.join('');
|
|
23
|
+
}
|
|
24
|
+
export function getRichFormData(config) {
|
|
25
|
+
var obj = {},
|
|
26
|
+
node = null,
|
|
27
|
+
specl = {};
|
|
28
|
+
for (var key in config) {
|
|
29
|
+
if (['input', 'date', 'textarea', 'radio', 'checkbox', 'editable-div'].includes(config[key].type)) {
|
|
30
|
+
obj[key] = '';
|
|
31
|
+
}
|
|
32
|
+
if (['input', 'date', 'textarea'].includes(config[key].type)) {
|
|
33
|
+
node = document.getElementById(key);
|
|
34
|
+
if (node) {
|
|
35
|
+
obj[key] = node.value;
|
|
36
|
+
if (config[key].name == 'caseCauseManageName' || config[key].label == '案由') {
|
|
37
|
+
specl['caseCauseManageName'] = node.value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} else if (['radio'].includes(config[key].type)) {
|
|
41
|
+
node = document.getElementsByName(config[key].name);
|
|
42
|
+
if (node) for (var i = 0; i < node.length; i++) {
|
|
43
|
+
if (node[i].checked) {
|
|
44
|
+
obj[key] = node[i].value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} else if (['checkbox'].includes(config[key].type)) {
|
|
48
|
+
obj[key] = [];
|
|
49
|
+
node = document.getElementsByName(config[key].name);
|
|
50
|
+
if (node) for (var _i = 0; _i < node.length; _i++) {
|
|
51
|
+
if (node[_i].checked) {
|
|
52
|
+
obj[key].push(node[_i].value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
obj[key] = obj[key].join(";");
|
|
56
|
+
} else if (['editable-div'].includes(config[key].type)) {
|
|
57
|
+
node = document.getElementById(key);
|
|
58
|
+
if (node) {
|
|
59
|
+
obj[key] = node.innerHTML;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
data: obj,
|
|
65
|
+
specl: specl
|
|
66
|
+
};
|
|
67
|
+
}
|