@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,216 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { VtxUpload } from "@vtx/components";
|
|
14
|
+
import htmr from "htmr";
|
|
15
|
+
import React, { useState } from "react";
|
|
16
|
+
import { useSetState } from 'ahooks';
|
|
17
|
+
import "./widgets/style.less";
|
|
18
|
+
import classNames from "classnames";
|
|
19
|
+
import { DeleteOutlined, EyeOutlined } from '@ant-design/icons';
|
|
20
|
+
import { useEffect } from "react";
|
|
21
|
+
import Viewer from 'viewerjs';
|
|
22
|
+
import { getVtxToken } from '@vtx/utils';
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
export default function viewRichText(_ref) {
|
|
25
|
+
var content = _ref.content,
|
|
26
|
+
configJson = _ref.configJson,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
values = _ref.values,
|
|
29
|
+
_ref$viewMode = _ref.viewMode,
|
|
30
|
+
viewMode = _ref$viewMode === void 0 ? false : _ref$viewMode,
|
|
31
|
+
_ref$configDisabled = _ref.configDisabled,
|
|
32
|
+
configDisabled = _ref$configDisabled === void 0 ? {} : _ref$configDisabled;
|
|
33
|
+
var _useSetState = useSetState({}),
|
|
34
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
35
|
+
state = _useSetState2[0],
|
|
36
|
+
setState = _useSetState2[1];
|
|
37
|
+
var _useState = useState(null),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
imageList = _useState2[0],
|
|
40
|
+
setImageList = _useState2[1];
|
|
41
|
+
var _useState3 = useState(null),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
imageViewer = _useState4[0],
|
|
44
|
+
setImageViewer = _useState4[1];
|
|
45
|
+
function changeValue(obj) {
|
|
46
|
+
if (onChange instanceof Function) {
|
|
47
|
+
onChange(obj);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
if (imageList) {
|
|
52
|
+
setImageViewer(new Viewer(imageList, {}));
|
|
53
|
+
}
|
|
54
|
+
}, [imageList]);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
if (values) {
|
|
57
|
+
var configs = JSON.parse(configJson);
|
|
58
|
+
for (var key in values) {
|
|
59
|
+
var config = configs[key],
|
|
60
|
+
node = null;
|
|
61
|
+
if (config.type == 'sign') {
|
|
62
|
+
setState(_defineProperty({}, key, values[key]));
|
|
63
|
+
} else if (['input', 'date', 'textarea'].includes(config.type)) {
|
|
64
|
+
document.getElementById(key).value = values[key];
|
|
65
|
+
} else if (['editable-div'].includes(config.type)) {
|
|
66
|
+
document.getElementById(key).innerHTML = values[key];
|
|
67
|
+
} else if (['radio'].includes(config.type)) {
|
|
68
|
+
node = document.getElementsByName(config.name);
|
|
69
|
+
if (node) for (var i = 0; i < node.length; i++) {
|
|
70
|
+
if (node[i].value == values[key]) {
|
|
71
|
+
node[i].checked = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} else if (['checkbox'].includes(config.type)) {
|
|
75
|
+
node = document.getElementsByName(config.name);
|
|
76
|
+
if (node) for (var _i = 0; _i < node.length; _i++) {
|
|
77
|
+
if (values[key].split(";").includes(node[_i].value)) {
|
|
78
|
+
node[_i].checked = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [values]);
|
|
85
|
+
if (!content) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return htmr(content.replaceAll(' vtx_ck_widgets', ''), {
|
|
89
|
+
transform: {
|
|
90
|
+
_: function _(node, props, children) {
|
|
91
|
+
var obj = {},
|
|
92
|
+
style = {},
|
|
93
|
+
isDisabled = false;
|
|
94
|
+
if (props !== null && props !== void 0 && props.configid) {
|
|
95
|
+
props.id = props.configid;
|
|
96
|
+
var components = JSON.parse(configJson);
|
|
97
|
+
var config = components[props === null || props === void 0 ? void 0 : props.configid] || {};
|
|
98
|
+
for (var key in config) {
|
|
99
|
+
if (key == 'width') {
|
|
100
|
+
style[key] = config[key];
|
|
101
|
+
} else {
|
|
102
|
+
if (key == 'label') {
|
|
103
|
+
obj.placeholder = "\u8BF7\u8F93\u5165".concat(config[key] || '');
|
|
104
|
+
}
|
|
105
|
+
obj[key] = config[key];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (obj.type == 'editable-div') {
|
|
109
|
+
obj.contentEditable = true;
|
|
110
|
+
delete props.contentEditable;
|
|
111
|
+
} else if (obj.type == 'date') {
|
|
112
|
+
style.width = style.width || '100px';
|
|
113
|
+
}
|
|
114
|
+
obj.style = style;
|
|
115
|
+
obj.id = props === null || props === void 0 ? void 0 : props.configid;
|
|
116
|
+
var temp = configDisabled[props.configid];
|
|
117
|
+
if (temp !== null && temp !== void 0 && temp.useOtherField && !(temp !== null && temp !== void 0 && temp.editAble)) {
|
|
118
|
+
isDisabled = true;
|
|
119
|
+
}
|
|
120
|
+
if (viewMode || isDisabled) {
|
|
121
|
+
obj.disabled = true;
|
|
122
|
+
delete obj.contentEditable;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (node == 'label' && ["radio", 'checkbox'].includes(props.type)) {
|
|
126
|
+
var data = [];
|
|
127
|
+
if (obj.url) $.ajax({
|
|
128
|
+
url: "".concat(obj.url).concat(obj.url.indexOf("?") > -1 ? '&' : '?', "token=").concat(getVtxToken("token")),
|
|
129
|
+
async: false,
|
|
130
|
+
success: function success(res) {
|
|
131
|
+
if (res.result == 0) {
|
|
132
|
+
data = res.data || [];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
137
|
+
children: data.map(function (item) {
|
|
138
|
+
return /*#__PURE__*/_jsxs("label", {
|
|
139
|
+
children: [/*#__PURE__*/_jsx("input", {
|
|
140
|
+
type: props.type,
|
|
141
|
+
name: obj.name,
|
|
142
|
+
value: item.parmName,
|
|
143
|
+
disabled: viewMode || isDisabled
|
|
144
|
+
}), item.parmName]
|
|
145
|
+
}, item.id);
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (node == 'span' && ['sign'].includes(obj.type)) {
|
|
150
|
+
var arr = JSON.parse(state[props.configid] || '[]');
|
|
151
|
+
if (arr.length > 0) {
|
|
152
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
153
|
+
className: classNames('sign_pic_box'),
|
|
154
|
+
ref: function ref(ins) {
|
|
155
|
+
if (ins) setImageList(ins);
|
|
156
|
+
},
|
|
157
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
158
|
+
className: classNames('sign_pic'),
|
|
159
|
+
src: "/cloudFile/common/downloadFile?id=".concat(arr[0].id)
|
|
160
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
161
|
+
className: classNames('sign_opera'),
|
|
162
|
+
children: [/*#__PURE__*/_jsx(EyeOutlined, {
|
|
163
|
+
className: classNames('sign_del'),
|
|
164
|
+
onClick: function onClick() {
|
|
165
|
+
if (imageViewer) {
|
|
166
|
+
imageViewer.view(0);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}), !viewMode && !isDisabled && /*#__PURE__*/_jsx(DeleteOutlined, {
|
|
170
|
+
className: classNames('sign_del'),
|
|
171
|
+
onClick: function onClick() {
|
|
172
|
+
setState(_defineProperty({}, props.configid, ''));
|
|
173
|
+
changeValue(_defineProperty({}, props.configid, ''));
|
|
174
|
+
}
|
|
175
|
+
})]
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (viewMode || isDisabled) {
|
|
180
|
+
return /*#__PURE__*/React.createElement(node, _objectSpread(_objectSpread({}, obj), props), children);
|
|
181
|
+
}
|
|
182
|
+
return /*#__PURE__*/_jsx(VtxUpload, {
|
|
183
|
+
accept: ".jpg,.png,.jepg",
|
|
184
|
+
customizedButton: /*#__PURE__*/React.createElement(node, _objectSpread(_objectSpread({}, obj), props), children),
|
|
185
|
+
maxNum: 1,
|
|
186
|
+
onSuccess: function onSuccess(file) {
|
|
187
|
+
var obj = _defineProperty({}, props.configid, JSON.stringify([{
|
|
188
|
+
id: file.id,
|
|
189
|
+
name: file.name,
|
|
190
|
+
type: file.type
|
|
191
|
+
}]));
|
|
192
|
+
setState(obj);
|
|
193
|
+
changeValue(obj);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
if (!props && !children) {
|
|
198
|
+
return node;
|
|
199
|
+
}
|
|
200
|
+
if (node == 'table') {
|
|
201
|
+
return /*#__PURE__*/React.createElement(node, _objectSpread(_objectSpread(_objectSpread({}, obj), props), {}, {
|
|
202
|
+
border: 'true'
|
|
203
|
+
}), children);
|
|
204
|
+
}
|
|
205
|
+
if (node === 'input' && obj.type === 'date') {
|
|
206
|
+
if (viewMode && !(values !== null && values !== void 0 && values[obj.id])) {
|
|
207
|
+
return /*#__PURE__*/_jsx("span", {
|
|
208
|
+
id: obj.id
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return /*#__PURE__*/React.createElement(node, _objectSpread(_objectSpread({}, obj), props), children);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { Input, Modal, Form } from "antd";
|
|
14
|
+
import React, { useEffect } from "react";
|
|
15
|
+
import Config from "./config";
|
|
16
|
+
import classNames from "classnames";
|
|
17
|
+
import { VtxFormLayout } from '@vtx/components';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
export default function CKModal(props) {
|
|
20
|
+
var _props$defaultData = props.defaultData,
|
|
21
|
+
defaultData = _props$defaultData === void 0 ? {} : _props$defaultData;
|
|
22
|
+
var _Form$useForm = Form.useForm(),
|
|
23
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
24
|
+
form = _Form$useForm2[0];
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
if (defaultData.id) {
|
|
27
|
+
form.setFieldsValue(defaultData);
|
|
28
|
+
}
|
|
29
|
+
}, [JSON.stringify(defaultData)]);
|
|
30
|
+
var onFinish = function onFinish(values) {
|
|
31
|
+
props.onOk(_objectSpread(_objectSpread({}, values), {}, {
|
|
32
|
+
type: props.type,
|
|
33
|
+
id: defaultData.id || ''
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
37
|
+
title: "".concat(props.title),
|
|
38
|
+
visible: props.visible,
|
|
39
|
+
maskClosable: false,
|
|
40
|
+
onCancel: props.onClose,
|
|
41
|
+
onOk: function onOk() {
|
|
42
|
+
return form.submit();
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
45
|
+
form: form,
|
|
46
|
+
name: "add",
|
|
47
|
+
onFinish: onFinish,
|
|
48
|
+
children: /*#__PURE__*/_jsx(VtxFormLayout, {
|
|
49
|
+
cols: 1,
|
|
50
|
+
children: (Config[props.type] || []).map(function (item) {
|
|
51
|
+
if (item.type == 'label') {
|
|
52
|
+
return /*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: classNames("label"),
|
|
54
|
+
children: item.name
|
|
55
|
+
}, item.key);
|
|
56
|
+
} else {
|
|
57
|
+
return /*#__PURE__*/_jsx(VtxFormLayout.FormItem, {
|
|
58
|
+
label: item.name,
|
|
59
|
+
name: item.key,
|
|
60
|
+
weights: 1,
|
|
61
|
+
rules: [{
|
|
62
|
+
required: item.require,
|
|
63
|
+
message: '必填'
|
|
64
|
+
}],
|
|
65
|
+
getValueFromEvent: function getValueFromEvent(e) {
|
|
66
|
+
return (e.target.value || '').trim();
|
|
67
|
+
},
|
|
68
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
69
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
import { Command } from "../ckeditor/ckeditor";
|
|
15
|
+
var OpenPanelCommand = /*#__PURE__*/function (_Command) {
|
|
16
|
+
_inherits(OpenPanelCommand, _Command);
|
|
17
|
+
var _super = _createSuper(OpenPanelCommand);
|
|
18
|
+
function OpenPanelCommand() {
|
|
19
|
+
_classCallCheck(this, OpenPanelCommand);
|
|
20
|
+
return _super.apply(this, arguments);
|
|
21
|
+
}
|
|
22
|
+
_createClass(OpenPanelCommand, [{
|
|
23
|
+
key: "execute",
|
|
24
|
+
value: function execute() {
|
|
25
|
+
var _this$uiPanel;
|
|
26
|
+
if (this !== null && this !== void 0 && (_this$uiPanel = this.uiPanel) !== null && _this$uiPanel !== void 0 && _this$uiPanel._showUI) this.uiPanel._showUI();
|
|
27
|
+
}
|
|
28
|
+
}]);
|
|
29
|
+
return OpenPanelCommand;
|
|
30
|
+
}(Command);
|
|
31
|
+
export { OpenPanelCommand as default };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
var Config = {
|
|
2
|
+
input: [{
|
|
3
|
+
type: 'field',
|
|
4
|
+
name: '字段名',
|
|
5
|
+
key: 'label',
|
|
6
|
+
require: true
|
|
7
|
+
}, {
|
|
8
|
+
type: 'field',
|
|
9
|
+
name: '字段',
|
|
10
|
+
key: 'name',
|
|
11
|
+
require: true
|
|
12
|
+
}, {
|
|
13
|
+
type: 'field',
|
|
14
|
+
name: '排序号',
|
|
15
|
+
key: 'order',
|
|
16
|
+
require: true
|
|
17
|
+
}, {
|
|
18
|
+
type: 'field',
|
|
19
|
+
name: '宽度',
|
|
20
|
+
key: 'width'
|
|
21
|
+
}],
|
|
22
|
+
date: [{
|
|
23
|
+
type: 'field',
|
|
24
|
+
name: '字段名',
|
|
25
|
+
key: 'label',
|
|
26
|
+
require: true
|
|
27
|
+
}, {
|
|
28
|
+
type: 'field',
|
|
29
|
+
name: '字段',
|
|
30
|
+
key: 'name',
|
|
31
|
+
require: true
|
|
32
|
+
}, {
|
|
33
|
+
type: 'field',
|
|
34
|
+
name: '排序号',
|
|
35
|
+
key: 'order',
|
|
36
|
+
require: true
|
|
37
|
+
}, {
|
|
38
|
+
type: 'field',
|
|
39
|
+
name: '宽度',
|
|
40
|
+
key: 'width'
|
|
41
|
+
}],
|
|
42
|
+
radio: [{
|
|
43
|
+
type: 'field',
|
|
44
|
+
name: '字段名',
|
|
45
|
+
key: 'label',
|
|
46
|
+
require: true
|
|
47
|
+
}, {
|
|
48
|
+
type: 'field',
|
|
49
|
+
name: '字段',
|
|
50
|
+
key: 'name',
|
|
51
|
+
require: true
|
|
52
|
+
}, {
|
|
53
|
+
type: 'field',
|
|
54
|
+
name: '排序号',
|
|
55
|
+
key: 'order',
|
|
56
|
+
require: true
|
|
57
|
+
}, {
|
|
58
|
+
type: 'field',
|
|
59
|
+
name: '数据源',
|
|
60
|
+
key: 'url',
|
|
61
|
+
require: true
|
|
62
|
+
}],
|
|
63
|
+
checkbox: [{
|
|
64
|
+
type: 'field',
|
|
65
|
+
name: '字段名',
|
|
66
|
+
key: 'label',
|
|
67
|
+
require: true
|
|
68
|
+
}, {
|
|
69
|
+
type: 'field',
|
|
70
|
+
name: '字段',
|
|
71
|
+
key: 'name',
|
|
72
|
+
require: true
|
|
73
|
+
}, {
|
|
74
|
+
type: 'field',
|
|
75
|
+
name: '排序号',
|
|
76
|
+
key: 'order',
|
|
77
|
+
require: true
|
|
78
|
+
}, {
|
|
79
|
+
type: 'field',
|
|
80
|
+
name: '数据源',
|
|
81
|
+
key: 'url',
|
|
82
|
+
require: true
|
|
83
|
+
}],
|
|
84
|
+
textarea: [{
|
|
85
|
+
type: 'field',
|
|
86
|
+
name: '字段名',
|
|
87
|
+
key: 'label',
|
|
88
|
+
require: true
|
|
89
|
+
}, {
|
|
90
|
+
type: 'field',
|
|
91
|
+
name: '字段',
|
|
92
|
+
key: 'name',
|
|
93
|
+
require: true
|
|
94
|
+
}, {
|
|
95
|
+
type: 'field',
|
|
96
|
+
name: '排序号',
|
|
97
|
+
key: 'order',
|
|
98
|
+
require: true
|
|
99
|
+
}, {
|
|
100
|
+
type: 'field',
|
|
101
|
+
name: 'Rows',
|
|
102
|
+
key: 'rows'
|
|
103
|
+
}],
|
|
104
|
+
sign: [{
|
|
105
|
+
type: 'field',
|
|
106
|
+
name: '字段名',
|
|
107
|
+
key: 'label',
|
|
108
|
+
require: true
|
|
109
|
+
}, {
|
|
110
|
+
type: 'field',
|
|
111
|
+
name: '字段',
|
|
112
|
+
key: 'name',
|
|
113
|
+
require: true
|
|
114
|
+
}, {
|
|
115
|
+
type: 'field',
|
|
116
|
+
name: '排序号',
|
|
117
|
+
key: 'order',
|
|
118
|
+
require: true
|
|
119
|
+
}, {
|
|
120
|
+
type: 'field',
|
|
121
|
+
name: '文字',
|
|
122
|
+
key: 'text'
|
|
123
|
+
}],
|
|
124
|
+
'editable-div': [{
|
|
125
|
+
type: 'field',
|
|
126
|
+
name: '字段名',
|
|
127
|
+
key: 'label',
|
|
128
|
+
require: true
|
|
129
|
+
}, {
|
|
130
|
+
type: 'field',
|
|
131
|
+
name: '字段',
|
|
132
|
+
key: 'name',
|
|
133
|
+
require: true
|
|
134
|
+
}, {
|
|
135
|
+
type: 'field',
|
|
136
|
+
name: '排序号',
|
|
137
|
+
key: 'order',
|
|
138
|
+
require: true
|
|
139
|
+
}, {
|
|
140
|
+
type: 'field',
|
|
141
|
+
name: '填充字符数',
|
|
142
|
+
key: 'fill',
|
|
143
|
+
require: false
|
|
144
|
+
}]
|
|
145
|
+
};
|
|
146
|
+
export default Config;
|
|
@@ -0,0 +1,92 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
8
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
13
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
|
+
import { View, LabeledFieldView, createLabeledInputText, ButtonView, submitHandler, icons, LabelView } from "../../ckeditor/ckeditor";
|
|
17
|
+
var FormView = /*#__PURE__*/function (_View) {
|
|
18
|
+
_inherits(FormView, _View);
|
|
19
|
+
var _super = _createSuper(FormView);
|
|
20
|
+
function FormView(locale) {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, FormView);
|
|
23
|
+
_this = _super.call(this, locale);
|
|
24
|
+
_this.attrLabel = _this._createLabel("属性");
|
|
25
|
+
_this.labelInputView = _this._createInput('字段名');
|
|
26
|
+
_this.nameInputView = _this._createInput('字段');
|
|
27
|
+
_this.orderInputView = _this._createInput('排序号');
|
|
28
|
+
|
|
29
|
+
// Create the save and cancel buttons.
|
|
30
|
+
_this.saveButtonView = _this._createButton('Save', icons.check, 'ck-button-save');
|
|
31
|
+
// Set the type to 'submit', which will trigger
|
|
32
|
+
// the submit event on entire form when clicked.
|
|
33
|
+
_this.saveButtonView.type = 'submit';
|
|
34
|
+
_this.cancelButtonView = _this._createButton('Cancel', icons.cancel, 'ck-button-cancel');
|
|
35
|
+
// Delegate ButtonView#execute to FormView#cancel.
|
|
36
|
+
_this.cancelButtonView.delegate('execute').to(_assertThisInitialized(_this), 'cancel');
|
|
37
|
+
_this.childViews = _this.createCollection([_this.attrLabel, _this.labelInputView, _this.nameInputView, _this.orderInputView, _this.saveButtonView, _this.cancelButtonView]);
|
|
38
|
+
_this.setTemplate({
|
|
39
|
+
tag: 'form',
|
|
40
|
+
attributes: {
|
|
41
|
+
class: ['ck', 'ck-abbr-form'],
|
|
42
|
+
tabindex: '-1'
|
|
43
|
+
},
|
|
44
|
+
children: _this.childViews
|
|
45
|
+
});
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
_createClass(FormView, [{
|
|
49
|
+
key: "render",
|
|
50
|
+
value: function render() {
|
|
51
|
+
_get(_getPrototypeOf(FormView.prototype), "render", this).call(this);
|
|
52
|
+
submitHandler({
|
|
53
|
+
view: this
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "focus",
|
|
58
|
+
value: function focus() {
|
|
59
|
+
this.childViews.first.focus();
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "_createInput",
|
|
63
|
+
value: function _createInput(label) {
|
|
64
|
+
var labeledInput = new LabeledFieldView(this.locale, createLabeledInputText);
|
|
65
|
+
labeledInput.label = label;
|
|
66
|
+
return labeledInput;
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "_createButton",
|
|
70
|
+
value: function _createButton(label, icon, className) {
|
|
71
|
+
var button = new ButtonView();
|
|
72
|
+
button.set({
|
|
73
|
+
label: label,
|
|
74
|
+
icon: icon,
|
|
75
|
+
tooltip: true,
|
|
76
|
+
class: className
|
|
77
|
+
});
|
|
78
|
+
return button;
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "_createLabel",
|
|
82
|
+
value: function _createLabel(text) {
|
|
83
|
+
var label = new LabelView();
|
|
84
|
+
label.set({
|
|
85
|
+
text: text
|
|
86
|
+
});
|
|
87
|
+
return label;
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
return FormView;
|
|
91
|
+
}(View);
|
|
92
|
+
export { FormView as default };
|