@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,334 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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; } }
|
|
5
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
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); } }
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
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); }
|
|
17
|
+
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); }
|
|
18
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
|
+
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); }; }
|
|
20
|
+
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); }
|
|
21
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
|
+
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; } }
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
import { Plugin, Widget, ButtonView, ContextualBalloon, Command, clickOutsideHandler, toWidget } from "../../ckeditor/ckeditor";
|
|
25
|
+
import OpenPanelCommand from "../OpenPanelCommand";
|
|
26
|
+
import FormView from "./FormView";
|
|
27
|
+
import "./index.less";
|
|
28
|
+
var Date = /*#__PURE__*/function (_Plugin) {
|
|
29
|
+
_inherits(Date, _Plugin);
|
|
30
|
+
var _super = _createSuper(Date);
|
|
31
|
+
function Date() {
|
|
32
|
+
_classCallCheck(this, Date);
|
|
33
|
+
return _super.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
_createClass(Date, null, [{
|
|
36
|
+
key: "requires",
|
|
37
|
+
get: function get() {
|
|
38
|
+
return [DateEditing, DateUI];
|
|
39
|
+
}
|
|
40
|
+
}]);
|
|
41
|
+
return Date;
|
|
42
|
+
}(Plugin);
|
|
43
|
+
export { Date as default };
|
|
44
|
+
var DateEditing = /*#__PURE__*/function (_Plugin2) {
|
|
45
|
+
_inherits(DateEditing, _Plugin2);
|
|
46
|
+
var _super2 = _createSuper(DateEditing);
|
|
47
|
+
function DateEditing() {
|
|
48
|
+
_classCallCheck(this, DateEditing);
|
|
49
|
+
return _super2.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
_createClass(DateEditing, [{
|
|
52
|
+
key: "init",
|
|
53
|
+
value: function init() {
|
|
54
|
+
console.log('自定义输入框内容被调用');
|
|
55
|
+
this._defineSchema();
|
|
56
|
+
this._defineConverters();
|
|
57
|
+
this.editor.commands.add('insertCustomDate', new InsertCustomDateCommand(this.editor));
|
|
58
|
+
this.editor.commands.add('openDatePanel', new OpenPanelCommand(this.editor));
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "_defineSchema",
|
|
62
|
+
value: function _defineSchema() {
|
|
63
|
+
var schema = this.editor.model.schema;
|
|
64
|
+
schema.register('customDate', {
|
|
65
|
+
// 定义类型
|
|
66
|
+
inheritAllFrom: '$inlineObject',
|
|
67
|
+
// 定义属性
|
|
68
|
+
allowAttributes: ['configid']
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "_defineConverters",
|
|
73
|
+
value: function _defineConverters() {
|
|
74
|
+
var conversion = this.editor.conversion;
|
|
75
|
+
|
|
76
|
+
// conversion.for('upcast').elementToElement({
|
|
77
|
+
// model: 'customDate',
|
|
78
|
+
// view: this._renderView
|
|
79
|
+
// });
|
|
80
|
+
conversion.for('upcast').elementToElement({
|
|
81
|
+
view: {
|
|
82
|
+
name: 'input',
|
|
83
|
+
classes: 'custom-input-date'
|
|
84
|
+
},
|
|
85
|
+
model: function model(modelElement, props) {
|
|
86
|
+
var writer = props === null || props === void 0 ? void 0 : props.writer;
|
|
87
|
+
var configid = modelElement._attrs.get('configid');
|
|
88
|
+
var element = null;
|
|
89
|
+
if (writer) {
|
|
90
|
+
element = writer.createElement('customDate', {
|
|
91
|
+
configid: configid
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return element;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
conversion.for('dataDowncast').elementToElement({
|
|
98
|
+
model: 'customDate',
|
|
99
|
+
view: this._renderView
|
|
100
|
+
});
|
|
101
|
+
conversion.for('editingDowncast').elementToElement({
|
|
102
|
+
model: 'customDate',
|
|
103
|
+
view: this._renderView
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "_renderView",
|
|
108
|
+
value: function _renderView(modelElement, props) {
|
|
109
|
+
var writer = props === null || props === void 0 ? void 0 : props.writer;
|
|
110
|
+
var components = JSON.parse(sessionStorage.getItem('ckComponents') || '{}');
|
|
111
|
+
var config = components[modelElement._attrs.get('configid')] || {};
|
|
112
|
+
var obj = {
|
|
113
|
+
configid: modelElement._attrs.get('configid')
|
|
114
|
+
},
|
|
115
|
+
style = '';
|
|
116
|
+
for (var key in config) {
|
|
117
|
+
if (key == 'width') {
|
|
118
|
+
style += "width: ".concat(config[key], "px;");
|
|
119
|
+
} else {
|
|
120
|
+
if (key == 'label') {
|
|
121
|
+
obj.placeholder = "\u8BF7\u8F93\u5165".concat(config[key] || '');
|
|
122
|
+
}
|
|
123
|
+
obj[key] = config[key];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (style.indexOf('width') == -1) {
|
|
127
|
+
style += "width: 100px;";
|
|
128
|
+
}
|
|
129
|
+
obj.style = style;
|
|
130
|
+
var input = '';
|
|
131
|
+
if (writer) {
|
|
132
|
+
// input = writer.createEmptyElement('input', { ...obj, class: 'custom-input-date has-border', });
|
|
133
|
+
input = writer.createContainerElement('input', _objectSpread(_objectSpread({}, obj), {}, {
|
|
134
|
+
class: 'custom-input-date has-border vtx_ck_widgets'
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
return toWidget(input, writer);
|
|
138
|
+
// return input;
|
|
139
|
+
}
|
|
140
|
+
}], [{
|
|
141
|
+
key: "requires",
|
|
142
|
+
get: function get() {
|
|
143
|
+
// ADDED
|
|
144
|
+
return [Widget];
|
|
145
|
+
}
|
|
146
|
+
}]);
|
|
147
|
+
return DateEditing;
|
|
148
|
+
}(Plugin);
|
|
149
|
+
function renderView(modelElement, props) {
|
|
150
|
+
var writer = props === null || props === void 0 ? void 0 : props.writer;
|
|
151
|
+
var attr = modelElement.getAttributes();
|
|
152
|
+
var obj = {},
|
|
153
|
+
style = '';
|
|
154
|
+
var _iterator = _createForOfIteratorHelper(attr),
|
|
155
|
+
_step;
|
|
156
|
+
try {
|
|
157
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
158
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
159
|
+
key = _step$value[0],
|
|
160
|
+
value = _step$value[1];
|
|
161
|
+
if (key == 'width') {
|
|
162
|
+
style += "width: ".concat(value, ";");
|
|
163
|
+
} else {
|
|
164
|
+
if (key == 'label') {
|
|
165
|
+
obj.placeholder = "\u8BF7\u8F93\u5165".concat(value || '');
|
|
166
|
+
}
|
|
167
|
+
obj[key] = value;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} catch (err) {
|
|
171
|
+
_iterator.e(err);
|
|
172
|
+
} finally {
|
|
173
|
+
_iterator.f();
|
|
174
|
+
}
|
|
175
|
+
if (style.indexOf('width') == -1) {
|
|
176
|
+
style += "width: 100px;";
|
|
177
|
+
}
|
|
178
|
+
obj.style = style;
|
|
179
|
+
var input = '';
|
|
180
|
+
if (writer) {
|
|
181
|
+
input = writer.createEmptyElement('input', _objectSpread(_objectSpread({}, obj), {}, {
|
|
182
|
+
class: 'custom-input-date has-border'
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
return input;
|
|
186
|
+
}
|
|
187
|
+
var DateUI = /*#__PURE__*/function (_Plugin3) {
|
|
188
|
+
_inherits(DateUI, _Plugin3);
|
|
189
|
+
var _super3 = _createSuper(DateUI);
|
|
190
|
+
function DateUI() {
|
|
191
|
+
_classCallCheck(this, DateUI);
|
|
192
|
+
return _super3.apply(this, arguments);
|
|
193
|
+
}
|
|
194
|
+
_createClass(DateUI, [{
|
|
195
|
+
key: "init",
|
|
196
|
+
value: function init() {
|
|
197
|
+
var _this = this;
|
|
198
|
+
console.log('自定义输入框UI被调用');
|
|
199
|
+
var editor = this.editor;
|
|
200
|
+
var t = editor.t;
|
|
201
|
+
this._balloon = this.editor.plugins.get(ContextualBalloon);
|
|
202
|
+
this.formView = this._createFormView();
|
|
203
|
+
editor.commands.get('openDatePanel').set('uiPanel', this);
|
|
204
|
+
editor.ui.componentFactory.add('customDate', function (locale) {
|
|
205
|
+
var buttonView = new ButtonView(locale);
|
|
206
|
+
buttonView.set({
|
|
207
|
+
label: t('日期'),
|
|
208
|
+
withText: true,
|
|
209
|
+
tooltip: false
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// this.listenTo(buttonView, 'execute', () => {
|
|
213
|
+
// editor.execute('insertCustomDate')
|
|
214
|
+
// });
|
|
215
|
+
_this.listenTo(buttonView, 'execute', function () {
|
|
216
|
+
_this._showUI();
|
|
217
|
+
});
|
|
218
|
+
return buttonView;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "_createFormView",
|
|
223
|
+
value: function _createFormView() {
|
|
224
|
+
var _this2 = this;
|
|
225
|
+
var editor = this.editor;
|
|
226
|
+
var formView = new FormView(editor.locale);
|
|
227
|
+
var _editor$config$get = editor.config.get('globalConfig'),
|
|
228
|
+
emit = _editor$config$get.emit;
|
|
229
|
+
this.listenTo(formView, 'submit', function () {
|
|
230
|
+
var name = formView.nameInputView.fieldView.element.value;
|
|
231
|
+
var label = formView.labelInputView.fieldView.element.value;
|
|
232
|
+
var width = formView.widthInputView.fieldView.element.value;
|
|
233
|
+
var order = formView.orderInputView.fieldView.element.value;
|
|
234
|
+
emit('plugingChange', {
|
|
235
|
+
config: {
|
|
236
|
+
name: name,
|
|
237
|
+
width: width,
|
|
238
|
+
label: label,
|
|
239
|
+
order: order,
|
|
240
|
+
type: 'date'
|
|
241
|
+
},
|
|
242
|
+
callback: function callback(id) {
|
|
243
|
+
editor.model.change(function (writer) {
|
|
244
|
+
editor.execute('insertCustomDate', {
|
|
245
|
+
configid: id
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
_this2._hideUI();
|
|
251
|
+
});
|
|
252
|
+
this.listenTo(formView, 'cancel', function () {
|
|
253
|
+
_this2._hideUI();
|
|
254
|
+
});
|
|
255
|
+
clickOutsideHandler({
|
|
256
|
+
emitter: formView,
|
|
257
|
+
activator: function activator() {
|
|
258
|
+
return _this2._balloon.visibleView === formView;
|
|
259
|
+
},
|
|
260
|
+
contextElements: [this._balloon.view.element],
|
|
261
|
+
callback: function callback() {
|
|
262
|
+
return _this2._hideUI();
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
return formView;
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
key: "_getBalloonPositionData",
|
|
269
|
+
value: function _getBalloonPositionData() {
|
|
270
|
+
var view = this.editor.editing.view;
|
|
271
|
+
var viewDocument = view.document;
|
|
272
|
+
var target = null;
|
|
273
|
+
|
|
274
|
+
// Set a target position by converting view selection range to DOM.
|
|
275
|
+
target = function target() {
|
|
276
|
+
return view.domConverter.viewRangeToDom(viewDocument.selection.getFirstRange());
|
|
277
|
+
};
|
|
278
|
+
return {
|
|
279
|
+
target: target
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "_showUI",
|
|
284
|
+
value: function _showUI() {
|
|
285
|
+
this._balloon.add({
|
|
286
|
+
view: this.formView,
|
|
287
|
+
position: this._getBalloonPositionData()
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// this.formView.focus();
|
|
291
|
+
}
|
|
292
|
+
}, {
|
|
293
|
+
key: "_hideUI",
|
|
294
|
+
value: function _hideUI() {
|
|
295
|
+
this.formView.widthInputView.fieldView.value = '';
|
|
296
|
+
this.formView.nameInputView.fieldView.value = '';
|
|
297
|
+
this.formView.labelInputView.fieldView.value = '';
|
|
298
|
+
this.formView.orderInputView.fieldView.value = '';
|
|
299
|
+
this.formView.element.reset();
|
|
300
|
+
this._balloon.remove(this.formView);
|
|
301
|
+
|
|
302
|
+
// Focus the editing view after closing the form view.
|
|
303
|
+
this.editor.editing.view.focus();
|
|
304
|
+
}
|
|
305
|
+
}], [{
|
|
306
|
+
key: "requires",
|
|
307
|
+
get: function get() {
|
|
308
|
+
return [ContextualBalloon];
|
|
309
|
+
}
|
|
310
|
+
}]);
|
|
311
|
+
return DateUI;
|
|
312
|
+
}(Plugin);
|
|
313
|
+
var InsertCustomDateCommand = /*#__PURE__*/function (_Command) {
|
|
314
|
+
_inherits(InsertCustomDateCommand, _Command);
|
|
315
|
+
var _super4 = _createSuper(InsertCustomDateCommand);
|
|
316
|
+
function InsertCustomDateCommand() {
|
|
317
|
+
_classCallCheck(this, InsertCustomDateCommand);
|
|
318
|
+
return _super4.apply(this, arguments);
|
|
319
|
+
}
|
|
320
|
+
_createClass(InsertCustomDateCommand, [{
|
|
321
|
+
key: "execute",
|
|
322
|
+
value: function execute(param) {
|
|
323
|
+
var _this3 = this;
|
|
324
|
+
this.editor.model.change(function (writer) {
|
|
325
|
+
_this3.editor.model.insertObject(createCustomDateElement(writer, param));
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}]);
|
|
329
|
+
return InsertCustomDateCommand;
|
|
330
|
+
}(Command);
|
|
331
|
+
function createCustomDateElement(writer, param) {
|
|
332
|
+
var element = writer.createElement('customDate', param);
|
|
333
|
+
return element;
|
|
334
|
+
}
|
|
@@ -0,0 +1,330 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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; } }
|
|
5
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
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); } }
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
+
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); }
|
|
17
|
+
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); }
|
|
18
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
|
+
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); }; }
|
|
20
|
+
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); }
|
|
21
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
|
+
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; } }
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
import { Plugin, Widget, ButtonView, ContextualBalloon, Command, clickOutsideHandler, toWidget } from "../../ckeditor/ckeditor";
|
|
25
|
+
import OpenPanelCommand from "../OpenPanelCommand";
|
|
26
|
+
import FormView from "./FormView";
|
|
27
|
+
import "./index.less";
|
|
28
|
+
var Input = /*#__PURE__*/function (_Plugin) {
|
|
29
|
+
_inherits(Input, _Plugin);
|
|
30
|
+
var _super = _createSuper(Input);
|
|
31
|
+
function Input() {
|
|
32
|
+
_classCallCheck(this, Input);
|
|
33
|
+
return _super.apply(this, arguments);
|
|
34
|
+
}
|
|
35
|
+
_createClass(Input, null, [{
|
|
36
|
+
key: "requires",
|
|
37
|
+
get: function get() {
|
|
38
|
+
return [InputEditing, InputUI];
|
|
39
|
+
}
|
|
40
|
+
}]);
|
|
41
|
+
return Input;
|
|
42
|
+
}(Plugin);
|
|
43
|
+
export { Input as default };
|
|
44
|
+
var InputEditing = /*#__PURE__*/function (_Plugin2) {
|
|
45
|
+
_inherits(InputEditing, _Plugin2);
|
|
46
|
+
var _super2 = _createSuper(InputEditing);
|
|
47
|
+
function InputEditing() {
|
|
48
|
+
_classCallCheck(this, InputEditing);
|
|
49
|
+
return _super2.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
_createClass(InputEditing, [{
|
|
52
|
+
key: "init",
|
|
53
|
+
value: function init() {
|
|
54
|
+
console.log('自定义文本框内容被调用');
|
|
55
|
+
this._defineSchema();
|
|
56
|
+
this._defineConverters();
|
|
57
|
+
this.editor.commands.add('insertCustomInput', new InsertCustomInputCommand(this.editor));
|
|
58
|
+
this.editor.commands.add('openInputPanel', new OpenPanelCommand(this.editor));
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "_defineSchema",
|
|
62
|
+
value: function _defineSchema() {
|
|
63
|
+
var schema = this.editor.model.schema;
|
|
64
|
+
schema.register('customInput', {
|
|
65
|
+
// 定义类型
|
|
66
|
+
inheritAllFrom: '$inlineObject',
|
|
67
|
+
// 定义属性
|
|
68
|
+
allowAttributes: ['configid']
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "_defineConverters",
|
|
73
|
+
value: function _defineConverters() {
|
|
74
|
+
var conversion = this.editor.conversion;
|
|
75
|
+
|
|
76
|
+
// conversion.for('upcast').elementToElement({
|
|
77
|
+
// model: 'customInput',
|
|
78
|
+
// view: this._renderView
|
|
79
|
+
// });
|
|
80
|
+
conversion.for('upcast').elementToElement({
|
|
81
|
+
view: {
|
|
82
|
+
name: 'input',
|
|
83
|
+
classes: 'custom-input'
|
|
84
|
+
},
|
|
85
|
+
model: function model(modelElement, props) {
|
|
86
|
+
var writer = props === null || props === void 0 ? void 0 : props.writer;
|
|
87
|
+
var configid = modelElement._attrs.get('configid');
|
|
88
|
+
var element = null;
|
|
89
|
+
if (writer) {
|
|
90
|
+
element = writer.createElement('customInput', {
|
|
91
|
+
configid: configid
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return element;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
conversion.for('dataDowncast').elementToElement({
|
|
98
|
+
model: 'customInput',
|
|
99
|
+
view: this._renderView
|
|
100
|
+
});
|
|
101
|
+
conversion.for('editingDowncast').elementToElement({
|
|
102
|
+
model: 'customInput',
|
|
103
|
+
view: this._renderView
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "_renderView",
|
|
108
|
+
value: function _renderView(modelElement, props) {
|
|
109
|
+
var writer = props === null || props === void 0 ? void 0 : props.writer;
|
|
110
|
+
var components = JSON.parse(sessionStorage.getItem('ckComponents') || '{}');
|
|
111
|
+
var config = components[modelElement._attrs.get('configid')] || {};
|
|
112
|
+
var obj = {
|
|
113
|
+
configid: modelElement._attrs.get('configid')
|
|
114
|
+
},
|
|
115
|
+
style = '';
|
|
116
|
+
for (var key in config) {
|
|
117
|
+
if (key == 'width') {
|
|
118
|
+
style += "width: ".concat(config[key], "px;");
|
|
119
|
+
} else {
|
|
120
|
+
if (key == 'label') {
|
|
121
|
+
obj.placeholder = "\u8BF7\u8F93\u5165".concat(config[key] || '');
|
|
122
|
+
}
|
|
123
|
+
obj[key] = config[key];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
obj.style = style;
|
|
127
|
+
var input = '';
|
|
128
|
+
if (writer) {
|
|
129
|
+
input = writer.createContainerElement('input', _objectSpread(_objectSpread({}, obj), {}, {
|
|
130
|
+
class: 'custom-input has-border vtx_ck_widgets'
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
return toWidget(input, writer);
|
|
134
|
+
// return input;
|
|
135
|
+
}
|
|
136
|
+
}], [{
|
|
137
|
+
key: "requires",
|
|
138
|
+
get: function get() {
|
|
139
|
+
// ADDED
|
|
140
|
+
return [Widget];
|
|
141
|
+
}
|
|
142
|
+
}]);
|
|
143
|
+
return InputEditing;
|
|
144
|
+
}(Plugin);
|
|
145
|
+
function renderView(modelElement, props) {
|
|
146
|
+
console.log('renderView');
|
|
147
|
+
var writer = props === null || props === void 0 ? void 0 : props.writer;
|
|
148
|
+
var attr = modelElement.getAttributes();
|
|
149
|
+
console.log(attr);
|
|
150
|
+
var obj = {},
|
|
151
|
+
style = '';
|
|
152
|
+
var _iterator = _createForOfIteratorHelper(attr),
|
|
153
|
+
_step;
|
|
154
|
+
try {
|
|
155
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
156
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
157
|
+
key = _step$value[0],
|
|
158
|
+
value = _step$value[1];
|
|
159
|
+
if (key == 'width') {
|
|
160
|
+
style += "width: ".concat(value, ";");
|
|
161
|
+
} else {
|
|
162
|
+
if (key == 'label') {
|
|
163
|
+
obj.placeholder = "\u8BF7\u8F93\u5165".concat(value || '');
|
|
164
|
+
}
|
|
165
|
+
obj[key] = value;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
} catch (err) {
|
|
169
|
+
_iterator.e(err);
|
|
170
|
+
} finally {
|
|
171
|
+
_iterator.f();
|
|
172
|
+
}
|
|
173
|
+
obj.style = style;
|
|
174
|
+
var input = '';
|
|
175
|
+
if (writer) {
|
|
176
|
+
input = writer.createEmptyElement('input', _objectSpread(_objectSpread({}, obj), {}, {
|
|
177
|
+
class: 'custom-input has-border'
|
|
178
|
+
}));
|
|
179
|
+
console.log(input);
|
|
180
|
+
}
|
|
181
|
+
return input;
|
|
182
|
+
}
|
|
183
|
+
var InputUI = /*#__PURE__*/function (_Plugin3) {
|
|
184
|
+
_inherits(InputUI, _Plugin3);
|
|
185
|
+
var _super3 = _createSuper(InputUI);
|
|
186
|
+
function InputUI() {
|
|
187
|
+
_classCallCheck(this, InputUI);
|
|
188
|
+
return _super3.apply(this, arguments);
|
|
189
|
+
}
|
|
190
|
+
_createClass(InputUI, [{
|
|
191
|
+
key: "init",
|
|
192
|
+
value: function init() {
|
|
193
|
+
var _this = this;
|
|
194
|
+
console.log('自定义文本框UI被调用');
|
|
195
|
+
var editor = this.editor;
|
|
196
|
+
var t = editor.t;
|
|
197
|
+
this._balloon = this.editor.plugins.get(ContextualBalloon);
|
|
198
|
+
this.formView = this._createFormView();
|
|
199
|
+
editor.commands.get('openInputPanel').set('uiPanel', this);
|
|
200
|
+
editor.ui.componentFactory.add('customInput', function (locale) {
|
|
201
|
+
var buttonView = new ButtonView(locale);
|
|
202
|
+
buttonView.set({
|
|
203
|
+
label: t('文本框'),
|
|
204
|
+
withText: true,
|
|
205
|
+
tooltip: false
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// this.listenTo(buttonView, 'execute', () => {
|
|
209
|
+
// editor.execute('insertCustomInput')
|
|
210
|
+
// });
|
|
211
|
+
_this.listenTo(buttonView, 'execute', function () {
|
|
212
|
+
_this._showUI();
|
|
213
|
+
});
|
|
214
|
+
return buttonView;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
key: "_createFormView",
|
|
219
|
+
value: function _createFormView() {
|
|
220
|
+
var _this2 = this;
|
|
221
|
+
var editor = this.editor;
|
|
222
|
+
var formView = new FormView(editor.locale);
|
|
223
|
+
var _editor$config$get = editor.config.get('globalConfig'),
|
|
224
|
+
emit = _editor$config$get.emit;
|
|
225
|
+
this.listenTo(formView, 'submit', function () {
|
|
226
|
+
var name = formView.nameInputView.fieldView.element.value;
|
|
227
|
+
var label = formView.labelInputView.fieldView.element.value;
|
|
228
|
+
var width = formView.widthInputView.fieldView.element.value;
|
|
229
|
+
var order = formView.orderInputView.fieldView.element.value;
|
|
230
|
+
emit('plugingChange', {
|
|
231
|
+
config: {
|
|
232
|
+
name: name,
|
|
233
|
+
width: width,
|
|
234
|
+
label: label,
|
|
235
|
+
order: order,
|
|
236
|
+
type: 'input'
|
|
237
|
+
},
|
|
238
|
+
callback: function callback(id) {
|
|
239
|
+
editor.model.change(function (writer) {
|
|
240
|
+
editor.execute('insertCustomInput', {
|
|
241
|
+
configid: id
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
_this2._hideUI();
|
|
247
|
+
});
|
|
248
|
+
this.listenTo(formView, 'cancel', function () {
|
|
249
|
+
_this2._hideUI();
|
|
250
|
+
});
|
|
251
|
+
clickOutsideHandler({
|
|
252
|
+
emitter: formView,
|
|
253
|
+
activator: function activator() {
|
|
254
|
+
return _this2._balloon.visibleView === formView;
|
|
255
|
+
},
|
|
256
|
+
contextElements: [this._balloon.view.element],
|
|
257
|
+
callback: function callback() {
|
|
258
|
+
return _this2._hideUI();
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
return formView;
|
|
262
|
+
}
|
|
263
|
+
}, {
|
|
264
|
+
key: "_getBalloonPositionData",
|
|
265
|
+
value: function _getBalloonPositionData() {
|
|
266
|
+
var view = this.editor.editing.view;
|
|
267
|
+
var viewDocument = view.document;
|
|
268
|
+
var target = null;
|
|
269
|
+
|
|
270
|
+
// Set a target position by converting view selection range to DOM.
|
|
271
|
+
target = function target() {
|
|
272
|
+
return view.domConverter.viewRangeToDom(viewDocument.selection.getFirstRange());
|
|
273
|
+
};
|
|
274
|
+
return {
|
|
275
|
+
target: target
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}, {
|
|
279
|
+
key: "_showUI",
|
|
280
|
+
value: function _showUI() {
|
|
281
|
+
this._balloon.add({
|
|
282
|
+
view: this.formView,
|
|
283
|
+
position: this._getBalloonPositionData()
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// this.formView.focus();
|
|
287
|
+
}
|
|
288
|
+
}, {
|
|
289
|
+
key: "_hideUI",
|
|
290
|
+
value: function _hideUI() {
|
|
291
|
+
this.formView.widthInputView.fieldView.value = '';
|
|
292
|
+
this.formView.nameInputView.fieldView.value = '';
|
|
293
|
+
this.formView.labelInputView.fieldView.value = '';
|
|
294
|
+
this.formView.orderInputView.fieldView.value = '';
|
|
295
|
+
this.formView.element.reset();
|
|
296
|
+
this._balloon.remove(this.formView);
|
|
297
|
+
|
|
298
|
+
// Focus the editing view after closing the form view.
|
|
299
|
+
this.editor.editing.view.focus();
|
|
300
|
+
}
|
|
301
|
+
}], [{
|
|
302
|
+
key: "requires",
|
|
303
|
+
get: function get() {
|
|
304
|
+
return [ContextualBalloon];
|
|
305
|
+
}
|
|
306
|
+
}]);
|
|
307
|
+
return InputUI;
|
|
308
|
+
}(Plugin);
|
|
309
|
+
var InsertCustomInputCommand = /*#__PURE__*/function (_Command) {
|
|
310
|
+
_inherits(InsertCustomInputCommand, _Command);
|
|
311
|
+
var _super4 = _createSuper(InsertCustomInputCommand);
|
|
312
|
+
function InsertCustomInputCommand() {
|
|
313
|
+
_classCallCheck(this, InsertCustomInputCommand);
|
|
314
|
+
return _super4.apply(this, arguments);
|
|
315
|
+
}
|
|
316
|
+
_createClass(InsertCustomInputCommand, [{
|
|
317
|
+
key: "execute",
|
|
318
|
+
value: function execute(param) {
|
|
319
|
+
var _this3 = this;
|
|
320
|
+
this.editor.model.change(function (writer) {
|
|
321
|
+
_this3.editor.model.insertObject(createCustomInputElement(writer, param));
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}]);
|
|
325
|
+
return InsertCustomInputCommand;
|
|
326
|
+
}(Command);
|
|
327
|
+
function createCustomInputElement(writer, param) {
|
|
328
|
+
var element = writer.createElement('customInput', param);
|
|
329
|
+
return element;
|
|
330
|
+
}
|