@tiny-codes/react-easy 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/es/components/ConfirmAction/withConfirmAction.js +23 -1
- package/es/components/ConfirmAction/withConfirmAction.js.map +1 -1
- package/es/components/Lexical/helpers/index.d.ts +58 -0
- package/es/components/Lexical/helpers/index.js +249 -0
- package/es/components/Lexical/helpers/index.js.map +1 -0
- package/es/components/Lexical/index.d.ts +5 -0
- package/es/components/Lexical/index.js +6 -0
- package/es/components/Lexical/index.js.map +1 -0
- package/es/components/Lexical/nodes/DivNode.d.ts +25 -0
- package/es/components/Lexical/nodes/DivNode.js +163 -0
- package/es/components/Lexical/nodes/DivNode.js.map +1 -0
- package/es/components/Lexical/nodes/ExtendTextNode.d.ts +24 -0
- package/es/components/Lexical/nodes/ExtendTextNode.js +102 -0
- package/es/components/Lexical/nodes/ExtendTextNode.js.map +1 -0
- package/es/components/Lexical/nodes/SelectNode.d.ts +44 -0
- package/es/components/Lexical/nodes/SelectNode.js +204 -0
- package/es/components/Lexical/nodes/SelectNode.js.map +1 -0
- package/es/components/Lexical/nodes/base.d.ts +51 -0
- package/es/components/Lexical/nodes/base.js +168 -0
- package/es/components/Lexical/nodes/base.js.map +1 -0
- package/es/hooks/useRefValue.d.ts +2 -2
- package/es/hooks/useRefValue.js.map +1 -1
- package/lib/components/ConfirmAction/withConfirmAction.js +5 -1
- package/lib/components/ConfirmAction/withConfirmAction.js.map +2 -2
- package/lib/components/Lexical/helpers/index.d.ts +58 -0
- package/lib/components/Lexical/helpers/index.js +198 -0
- package/lib/components/Lexical/helpers/index.js.map +7 -0
- package/lib/components/Lexical/index.d.ts +5 -0
- package/lib/components/Lexical/index.js +32 -0
- package/lib/components/Lexical/index.js.map +7 -0
- package/lib/components/Lexical/nodes/DivNode.d.ts +25 -0
- package/lib/components/Lexical/nodes/DivNode.js +139 -0
- package/lib/components/Lexical/nodes/DivNode.js.map +7 -0
- package/lib/components/Lexical/nodes/ExtendTextNode.d.ts +24 -0
- package/lib/components/Lexical/nodes/ExtendTextNode.js +87 -0
- package/lib/components/Lexical/nodes/ExtendTextNode.js.map +7 -0
- package/lib/components/Lexical/nodes/SelectNode.d.ts +44 -0
- package/lib/components/Lexical/nodes/SelectNode.js +157 -0
- package/lib/components/Lexical/nodes/SelectNode.js.map +7 -0
- package/lib/components/Lexical/nodes/base.d.ts +51 -0
- package/lib/components/Lexical/nodes/base.js +116 -0
- package/lib/components/Lexical/nodes/base.js.map +7 -0
- package/lib/hooks/useRefValue.d.ts +2 -2
- package/lib/hooks/useRefValue.js.map +2 -2
- package/package.json +20 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## 1.4.0
|
|
6
|
+
|
|
7
|
+
2025-8-7
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- 🔥 Add some custom nodes and helpers for `Lexical`.
|
|
12
|
+
|
|
13
|
+
## 1.3.1
|
|
14
|
+
|
|
15
|
+
2025-8-1
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
- 🐞 Fix `onOK` handler is not fired in `withConfirmAction` HOC.
|
|
20
|
+
|
|
5
21
|
## 1.3.0
|
|
6
22
|
|
|
7
23
|
2025-7-28
|
|
@@ -4,6 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
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
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
7
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
11
|
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
12
|
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); }
|
|
@@ -45,6 +48,25 @@ renderDefaultProps, defaultProps) {
|
|
|
45
48
|
var setOnOk = useCallback(function (handler) {
|
|
46
49
|
saveFuncRef.current = handler;
|
|
47
50
|
}, []);
|
|
51
|
+
var triggerOnOK = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
52
|
+
var _saveFuncRef$current;
|
|
53
|
+
var _len,
|
|
54
|
+
args,
|
|
55
|
+
_key,
|
|
56
|
+
_args = arguments;
|
|
57
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
58
|
+
while (1) switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = _args[_key];
|
|
62
|
+
}
|
|
63
|
+
return _context.abrupt("return", (_saveFuncRef$current = saveFuncRef.current) === null || _saveFuncRef$current === void 0 ? void 0 : _saveFuncRef$current.call.apply(_saveFuncRef$current, [saveFuncRef].concat(args)));
|
|
64
|
+
case 2:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context.stop();
|
|
67
|
+
}
|
|
68
|
+
}, _callee);
|
|
69
|
+
})), []);
|
|
48
70
|
|
|
49
71
|
// Merge the default ref and custom ref and output to the parent component
|
|
50
72
|
useImperativeHandle(ref, function () {
|
|
@@ -53,7 +75,7 @@ renderDefaultProps, defaultProps) {
|
|
|
53
75
|
|
|
54
76
|
// Render the default trigger DOM element, and pass it to the custom ActionComponent
|
|
55
77
|
var triggerDom = /*#__PURE__*/_jsx(ConfirmActionWithRef, _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
|
|
56
|
-
onOk:
|
|
78
|
+
onOk: triggerOnOK,
|
|
57
79
|
ref: actionRef
|
|
58
80
|
}));
|
|
59
81
|
return /*#__PURE__*/_jsx(ActionComponent, _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useCallback","useImperativeHandle","useRef","useState","genRenderer","withDefaultConfirmActionProps","Button","Switch","Typography","isForwardRef","jsx","_jsx","withConfirmAction","ActionComponent","defaultProps","withConfirmActionInternal","confirmType","renderDefaultProps","ConfirmActionWithRef","displayName","WrappedActionComponent","propsWithDefaults","ref","actionRef","_useState","_useState2","_slicedToArray","customRef","setCustomRef","saveFuncRef","undefined","setOnOk","handler","current","_objectSpread","triggerDom","onOk","setOK","withDefaults","addTriggers","comp","patchedComp","triggerComponent","triggerEvent","triggerProps","Link","style","whiteSpace"],"sources":["../../../src/components/ConfirmAction/withConfirmAction.tsx"],"sourcesContent":["import type { ComponentType, PropsWithoutRef, ReactNode, RefAttributes } from 'react';\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\nimport type { ActionCompConstraint, ConfirmActionProps, ConfirmActionRef } from '.';\nimport { genRenderer, withDefaultConfirmActionProps } from '.';\nimport { Button, type ButtonProps, Switch, type SwitchProps, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { isForwardRef } from 'react-is';\n\n/**\n * - **EN:** Generate a confirm box component with custom trigger and default props\n * - **CN:** 将一个组件包装成一个确认弹框组件,支持自定义触发器和默认属性\n *\n * @param actionComponent Custom trigger component | 自定义触发器组件\n * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性\n */\nexport default function withConfirmAction<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n return withConfirmActionInternal(\n ActionComponent,\n {\n confirmType: 'normal',\n },\n defaultProps\n );\n}\n\nexport function withConfirmActionInternal<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n renderDefaultProps: Partial<ConfirmActionProps<any, never>> & { confirmType: 'normal' | 'delete' },\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n const ConfirmActionWithRef = forwardRef(genRenderer(renderDefaultProps));\n ConfirmActionWithRef.displayName = 'ForwardRef(ConfirmAction)';\n\n const WrappedActionComponent = forwardRef<Ref, ConfirmActionProps<OuterTriggerProp, OuterEvent>>(\n (propsWithDefaults, ref) => {\n const actionRef = useRef<ConfirmActionRef>(null);\n const [customRef, setCustomRef] = useState<Ref | null>(null);\n const saveFuncRef = useRef<(...triggerEventArgs: any[]) => unknown | Promise<unknown>>(undefined);\n\n // Receive the onSave callback method passed by the form component\n const setOnOk: ActionCompConstraint['setOK'] = useCallback((handler) => {\n saveFuncRef.current = handler;\n }, []);\n\n // Merge the default ref and custom ref and output to the parent component\n useImperativeHandle(ref, () => {\n return {\n ...actionRef.current,\n ...customRef,\n } as ConfirmActionRef<Ref>;\n }, [customRef]);\n\n // Render the default trigger DOM element, and pass it to the custom ActionComponent\n const triggerDom = (\n <ConfirmActionWithRef\n {...(propsWithDefaults as ConfirmActionProps<object, never>)}\n onOk={saveFuncRef.current}\n ref={actionRef}\n />\n );\n\n return (\n <ActionComponent\n {...(propsWithDefaults as P)}\n ref={isForwardRef(ActionComponent) ? setCustomRef : undefined}\n setOK={setOnOk}\n triggerDom={triggerDom}\n />\n );\n }\n );\n WrappedActionComponent.displayName = 'ConfirmAction(ActionComponent)';\n\n const withDefaults = withDefaultConfirmActionProps(\n WrappedActionComponent,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any\n ) as unknown as ComponentType<\n Omit<ConfirmActionProps<OuterTriggerProp, OuterEvent>, 'triggerComponent'> & RefAttributes<ConfirmActionRef>\n >;\n // return withDefaults;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return addTriggers<P, OuterTriggerProp, OuterEvent, Ref>(withDefaults as any);\n}\n\n/**\n * - **EN:** Add trigger types to the ModalAction component\n * - **CN:** 给ModalAction组件添加子触发器类型\n */\nfunction addTriggers<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(comp: ComponentType<ConfirmActionProps<OuterTriggerProp, OuterEvent> & RefAttributes<ConfirmActionRef<Ref>>>) {\n const patchedComp = comp as unknown as WithGenericTriggers<P, Ref>;\n // Type of button trigger\n patchedComp.Button = withDefaultConfirmActionProps<P, ButtonProps, 'onClick', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // Type of switch trigger\n patchedComp.Switch = withDefaultConfirmActionProps<P, SwitchProps, 'onChange', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // Type of link trigger\n patchedComp.Link = withDefaultConfirmActionProps<P, LinkProps, 'onClick', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n return patchedComp;\n}\n\n/**\n * - **EN:** ModalAction component type\n * - **CN:** ModalAction组件的类型\n */\nexport type ActionComponentInterface<P extends ActionCompConstraint, Ref extends object> = ComponentType<\n P & RefAttributes<ConfirmActionRef<Ref>>\n>;\n\ntype WithGenericTriggers<P extends ActionCompConstraint, Ref extends object> = (<\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n>(\n props: PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> &\n ConfirmActionProps<TriggerProp, Event> &\n RefAttributes<ConfirmActionRef<Ref>>\n) => ReactNode) &\n TypedTriggers<P, Ref>;\n\n/**\n * - **EN:** Built-in trigger types (specified form components)\n * - **CN:** 内置的几种触发器类型(已指定表单组件)\n */\nexport interface TypedTriggers<P extends ActionCompConstraint, Ref extends object> {\n /**\n * - **EN:** Dialog with button type trigger\n * - **CN:** 按钮类型的弹窗\n */\n Button: ConfirmActionWithTrigger<P, ButtonProps, 'onClick', Ref>;\n /**\n * - **EN:** Dialog with switch type trigger\n * - **CN:** 开关类型的弹窗\n */\n Switch: ConfirmActionWithTrigger<P, SwitchProps, 'onChange', Ref>;\n /**\n * - **EN:** Dialog with link type trigger\n * - **CN:** 链接类型的弹窗\n */\n Link: ConfirmActionWithTrigger<P, LinkProps, 'onClick', Ref>;\n}\n\n/**\n * - **EN:** ModalAction with specified trigger type (specified form component)\n * - **CN:** 已指定Trigger类型的ModalAction(并且已指定表单组件)\n */\ntype ConfirmActionWithTrigger<\n P extends ActionCompConstraint,\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n Ref extends object,\n OMIT extends string = never,\n> = ComponentType<\n Omit<\n PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & ConfirmActionProps<TriggerProp, Event>,\n 'triggerComponent' | 'triggerEvent' | OMIT\n > &\n RefAttributes<ConfirmActionRef<Ref>>\n>;\n"],"mappings":";;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,WAAW,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEtF,SAASC,WAAW,EAAEC,6BAA6B,QAAQ,GAAG;AAC9D,SAASC,MAAM,EAAoBC,MAAM,EAAoBC,UAAU,QAAQ,MAAM;AAErF,SAASC,YAAY,QAAQ,UAAU;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,eAAe,SAASC,iBAAiBA,CAMvCC,eAAiD,EACjDC,YAIyG,EAC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e,YAAY,GAAGE,SAAU;MAC9DO,KAAK,EAAEN,OAAQ;MACfI,UAAU,EAAEA;IAAW,EACxB,CAAC;EAEN,CACF,CAAC;EACDf,sBAAsB,CAACD,WAAW,GAAG,gCAAgC;EAErE,IAAMmB,YAAY,GAAGjC,6BAA6B,CAChDe,sBAAsB;EACtB;EACAN,YACF,CAEC;EACD;EACA;EACA,OAAOyB,WAAW,CAAuCD,YAAmB,CAAC;AAC/E;;AAEA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CAKlBC,IAA4G,EAAE;EAC9G,IAAMC,WAAW,GAAGD,IAA8C;EAClE;EACAC,WAAW,CAACnC,MAAM,GAAGD,6BAA6B;EAChD;EACAmC,IAAI,EACJ;IACEE,gBAAgB,EAAEpC,MAAM;IACxBqC,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE,CAAC;EACjB;EACA;EACF,CAAQ;EACR;EACAH,WAAW,CAAClC,MAAM,GAAGF,6BAA6B;EAChD;EACAmC,IAAI,EACJ;IACEE,gBAAgB,EAAEnC,MAAM;IACxBoC,YAAY,EAAE,UAAU;IACxBC,YAAY,EAAE,CAAC;EACjB;EACA;EACF,CAAQ;EACR;EACAH,WAAW,CAACI,IAAI,GAAGxC,6BAA6B;EAC9C;EACAmC,IAAI,EACJ;IACEE,gBAAgB,EAAElC,UAAU,CAACqC,IAAI;IACjCF,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE;MACZE,KAAK,EAAE;QAAEC,UAAU,EAAE;MAAS;IAChC;EACF;EACA;EACF,CAAQ;EACR,OAAON,WAAW;AACpB;;AAEA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"names":["_regeneratorRuntime","e","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","call","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","return","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","catch","_catch","delegateYield","asyncGeneratorStep","gen","reject","_next","_throw","key","info","error","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","minLen","_arrayLikeToArray","toString","Array","from","test","len","arr2","isArray","forwardRef","useCallback","useImperativeHandle","useRef","useState","genRenderer","withDefaultConfirmActionProps","Button","Switch","Typography","isForwardRef","jsx","_jsx","withConfirmAction","ActionComponent","defaultProps","withConfirmActionInternal","confirmType","renderDefaultProps","ConfirmActionWithRef","WrappedActionComponent","propsWithDefaults","ref","actionRef","_useState","_useState2","customRef","setCustomRef","saveFuncRef","setOnOk","handler","current","triggerOnOK","_callee","_saveFuncRef$current","_len","_key","_args","_callee$","_context","concat","_objectSpread","triggerDom","onOk","setOK","withDefaults","addTriggers","comp","patchedComp","triggerComponent","triggerEvent","triggerProps","Link","style","whiteSpace"],"sources":["../../../src/components/ConfirmAction/withConfirmAction.tsx"],"sourcesContent":["import type { ComponentType, PropsWithoutRef, ReactNode, RefAttributes } from 'react';\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\nimport type { ActionCompConstraint, ConfirmActionProps, ConfirmActionRef } from '.';\nimport { genRenderer, withDefaultConfirmActionProps } from '.';\nimport { Button, type ButtonProps, Switch, type SwitchProps, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { isForwardRef } from 'react-is';\n\n/**\n * - **EN:** Generate a confirm box component with custom trigger and default props\n * - **CN:** 将一个组件包装成一个确认弹框组件,支持自定义触发器和默认属性\n *\n * @param actionComponent Custom trigger component | 自定义触发器组件\n * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性\n */\nexport default function withConfirmAction<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n return withConfirmActionInternal(\n ActionComponent,\n {\n confirmType: 'normal',\n },\n defaultProps\n );\n}\n\nexport function withConfirmActionInternal<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n renderDefaultProps: Partial<ConfirmActionProps<any, never>> & { confirmType: 'normal' | 'delete' },\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n const ConfirmActionWithRef = forwardRef(genRenderer(renderDefaultProps));\n ConfirmActionWithRef.displayName = 'ForwardRef(ConfirmAction)';\n\n const WrappedActionComponent = forwardRef<Ref, ConfirmActionProps<OuterTriggerProp, OuterEvent>>(\n (propsWithDefaults, ref) => {\n const actionRef = useRef<ConfirmActionRef>(null);\n const [customRef, setCustomRef] = useState<Ref | null>(null);\n const saveFuncRef = useRef<(...triggerEventArgs: any[]) => unknown | Promise<unknown>>(undefined);\n\n // Receive the onSave callback method passed by the form component\n const setOnOk: ActionCompConstraint['setOK'] = useCallback((handler) => {\n saveFuncRef.current = handler;\n }, []);\n const triggerOnOK = useCallback(async (...args: any[]) => {\n return saveFuncRef.current?.(...args);\n }, []);\n\n // Merge the default ref and custom ref and output to the parent component\n useImperativeHandle(ref, () => {\n return {\n ...actionRef.current,\n ...customRef,\n } as ConfirmActionRef<Ref>;\n }, [customRef]);\n\n // Render the default trigger DOM element, and pass it to the custom ActionComponent\n const triggerDom = (\n <ConfirmActionWithRef\n {...(propsWithDefaults as ConfirmActionProps<object, never>)}\n onOk={triggerOnOK}\n ref={actionRef}\n />\n );\n\n return (\n <ActionComponent\n {...(propsWithDefaults as P)}\n ref={isForwardRef(ActionComponent) ? setCustomRef : undefined}\n setOK={setOnOk}\n triggerDom={triggerDom}\n />\n );\n }\n );\n WrappedActionComponent.displayName = 'ConfirmAction(ActionComponent)';\n\n const withDefaults = withDefaultConfirmActionProps(\n WrappedActionComponent,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any\n ) as unknown as ComponentType<\n Omit<ConfirmActionProps<OuterTriggerProp, OuterEvent>, 'triggerComponent'> & RefAttributes<ConfirmActionRef>\n >;\n // return withDefaults;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return addTriggers<P, OuterTriggerProp, OuterEvent, Ref>(withDefaults as any);\n}\n\n/**\n * - **EN:** Add trigger types to the ModalAction component\n * - **CN:** 给ModalAction组件添加子触发器类型\n */\nfunction addTriggers<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(comp: ComponentType<ConfirmActionProps<OuterTriggerProp, OuterEvent> & RefAttributes<ConfirmActionRef<Ref>>>) {\n const patchedComp = comp as unknown as WithGenericTriggers<P, Ref>;\n // Type of button trigger\n patchedComp.Button = withDefaultConfirmActionProps<P, ButtonProps, 'onClick', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // Type of switch trigger\n patchedComp.Switch = withDefaultConfirmActionProps<P, SwitchProps, 'onChange', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // Type of link trigger\n patchedComp.Link = withDefaultConfirmActionProps<P, LinkProps, 'onClick', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n return patchedComp;\n}\n\n/**\n * - **EN:** ModalAction component type\n * - **CN:** ModalAction组件的类型\n */\nexport type ActionComponentInterface<P extends ActionCompConstraint, Ref extends object> = ComponentType<\n P & RefAttributes<ConfirmActionRef<Ref>>\n>;\n\ntype WithGenericTriggers<P extends ActionCompConstraint, Ref extends object> = (<\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n>(\n props: PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> &\n ConfirmActionProps<TriggerProp, Event> &\n RefAttributes<ConfirmActionRef<Ref>>\n) => ReactNode) &\n TypedTriggers<P, Ref>;\n\n/**\n * - **EN:** Built-in trigger types (specified form components)\n * - **CN:** 内置的几种触发器类型(已指定表单组件)\n */\nexport interface TypedTriggers<P extends ActionCompConstraint, Ref extends object> {\n /**\n * - **EN:** Dialog with button type trigger\n * - **CN:** 按钮类型的弹窗\n */\n Button: ConfirmActionWithTrigger<P, ButtonProps, 'onClick', Ref>;\n /**\n * - **EN:** Dialog with switch type trigger\n * - **CN:** 开关类型的弹窗\n */\n Switch: ConfirmActionWithTrigger<P, SwitchProps, 'onChange', Ref>;\n /**\n * - **EN:** Dialog with link type trigger\n * - **CN:** 链接类型的弹窗\n */\n Link: ConfirmActionWithTrigger<P, LinkProps, 'onClick', Ref>;\n}\n\n/**\n * - **EN:** ModalAction with specified trigger type (specified form component)\n * - **CN:** 已指定Trigger类型的ModalAction(并且已指定表单组件)\n */\ntype ConfirmActionWithTrigger<\n P extends ActionCompConstraint,\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n Ref extends object,\n OMIT extends string = never,\n> = ComponentType<\n Omit<\n PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & ConfirmActionProps<TriggerProp, Event>,\n 'triggerComponent' | 'triggerEvent' | OMIT\n > &\n RefAttributes<ConfirmActionRef<Ref>>\n>;\n"],"mappings":";;;;;;+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,CAAA,SAAAC,CAAA,EAAAD,CAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,CAAA,GAAAH,CAAA,CAAAI,cAAA,EAAAC,CAAA,GAAAJ,MAAA,CAAAK,cAAA,cAAAP,CAAA,EAAAD,CAAA,EAAAE,CAAA,IAAAD,CAAA,CAAAD,CAAA,IAAAE,CAAA,CAAAO,KAAA,KAAAC,CAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,CAAA,GAAAF,CAAA,CAAAG,QAAA,kBAAAC,CAAA,GAAAJ,CAAA,CAAAK,aAAA,uBAAAC,CAAA,GAAAN,CAAA,CAAAO,WAAA,8BAAAC,OAAAjB,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAC,MAAA,CAAAK,cAAA,CAAAP,CAAA,EAAAD,CAAA,IAAAS,KAAA,EAAAP,CAAA,EAAAiB,UAAA,MAAAC,YAAA,MAAAC,QAAA,SAAApB,C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SAAU;MAC9D4D,KAAK,EAAEf,OAAQ;MACfa,UAAU,EAAEA;IAAW,EACxB,CAAC;EAEN,CACF,CAAC;EACDtB,sBAAsB,CAAC3E,WAAW,GAAG,gCAAgC;EAErE,IAAMoG,YAAY,GAAGvC,6BAA6B,CAChDc,sBAAsB;EACtB;EACAL,YACF,CAEC;EACD;EACA;EACA,OAAO+B,WAAW,CAAuCD,YAAmB,CAAC;AAC/E;;AAEA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CAKlBC,IAA4G,EAAE;EAC9G,IAAMC,WAAW,GAAGD,IAA8C;EAClE;EACAC,WAAW,CAACzC,MAAM,GAAGD,6BAA6B;EAChD;EACAyC,IAAI,EACJ;IACEE,gBAAgB,EAAE1C,MAAM;IACxB2C,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE,CAAC;EACjB;EACA;EACF,CAAQ;EACR;EACAH,WAAW,CAACxC,MAAM,GAAGF,6BAA6B;EAChD;EACAyC,IAAI,EACJ;IACEE,gBAAgB,EAAEzC,MAAM;IACxB0C,YAAY,EAAE,UAAU;IACxBC,YAAY,EAAE,CAAC;EACjB;EACA;EACF,CAAQ;EACR;EACAH,WAAW,CAACI,IAAI,GAAG9C,6BAA6B;EAC9C;EACAyC,IAAI,EACJ;IACEE,gBAAgB,EAAExC,UAAU,CAAC2C,IAAI;IACjCF,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE;MACZE,KAAK,EAAE;QAAEC,UAAU,EAAE;MAAS;IAChC;EACF;EACA;EACF,CAAQ;EACR,OAAON,WAAW;AACpB;;AAEA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CSSProperties, HtmlHTMLAttributes } from 'react';
|
|
2
|
+
import type { LexicalEditor, LexicalNode } from 'lexical';
|
|
3
|
+
/**
|
|
4
|
+
* 将节点插入到当前光标位置
|
|
5
|
+
*
|
|
6
|
+
* @param editor LexicalEditor 实例
|
|
7
|
+
* @param node 要插入的节点
|
|
8
|
+
*/
|
|
9
|
+
export declare function insertNodeAtCursor(editor: LexicalEditor, node: LexicalNode): void;
|
|
10
|
+
/**
|
|
11
|
+
* 将文本插入到当前光标位置
|
|
12
|
+
*
|
|
13
|
+
* @param editor LexicalEditor 实例
|
|
14
|
+
* @param text 要插入的文本
|
|
15
|
+
*/
|
|
16
|
+
export declare function insertTextAtCursor(editor: LexicalEditor, text: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* 清空编辑器内容
|
|
19
|
+
*
|
|
20
|
+
* @param editor LexicalEditor 实例
|
|
21
|
+
*/
|
|
22
|
+
export declare function clearEditorContent(editor: LexicalEditor): void;
|
|
23
|
+
/**
|
|
24
|
+
* 查找符合条件的节点
|
|
25
|
+
*
|
|
26
|
+
* @param editor LexicalEditor 实例
|
|
27
|
+
* @param predicate 用于匹配节点的函数
|
|
28
|
+
* @param options 选项
|
|
29
|
+
*
|
|
30
|
+
* @returns 符合条件的节点数组
|
|
31
|
+
*/
|
|
32
|
+
export declare function findNode<T extends LexicalNode>(editor: LexicalEditor, predicate: (node: LexicalNode) => boolean): T | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* 查找所有符合条件的节点数组
|
|
35
|
+
*
|
|
36
|
+
* @param editor LexicalEditor 实例
|
|
37
|
+
* @param predicate 用于匹配节点的函数
|
|
38
|
+
* @param options 选项
|
|
39
|
+
*
|
|
40
|
+
* @returns 符合条件的节点数组
|
|
41
|
+
*/
|
|
42
|
+
export declare function findNodes<T extends LexicalNode>(editor: LexicalEditor, predicate: (node: LexicalNode) => boolean, options?: {
|
|
43
|
+
stopOnFirstMatch?: boolean;
|
|
44
|
+
}): T[];
|
|
45
|
+
/**
|
|
46
|
+
* 更新 DOM 元素的属性
|
|
47
|
+
*
|
|
48
|
+
* @param dom 要更新的 DOM 元素
|
|
49
|
+
* @param props 要设置的属性
|
|
50
|
+
*/
|
|
51
|
+
export declare function updateDomProps(dom: HTMLElement | undefined, props: HtmlHTMLAttributes<HTMLElement>): void;
|
|
52
|
+
/**
|
|
53
|
+
* 更新 DOM 元素的样式
|
|
54
|
+
*
|
|
55
|
+
* @param dom 要更新的 DOM 元素
|
|
56
|
+
* @param style 要设置的样式
|
|
57
|
+
*/
|
|
58
|
+
export declare function updateDomStyle(dom: HTMLElement | undefined, style: CSSProperties | undefined): void;
|
|
@@ -0,0 +1,249 @@
|
|
|
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
|
+
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); }
|
|
14
|
+
import { $createTextNode, $getRoot, $getSelection, $isDecoratorNode, $isElementNode, $isParagraphNode, $isRangeSelection, $isTextNode } from 'lexical';
|
|
15
|
+
import { $createDivNode, $isDivNode } from "../nodes/DivNode";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 将节点插入到当前光标位置
|
|
19
|
+
*
|
|
20
|
+
* @param editor LexicalEditor 实例
|
|
21
|
+
* @param node 要插入的节点
|
|
22
|
+
*/
|
|
23
|
+
export function insertNodeAtCursor(editor, node) {
|
|
24
|
+
editor.update(function () {
|
|
25
|
+
var selection = $getSelection();
|
|
26
|
+
if (selection) {
|
|
27
|
+
if ($isRangeSelection(selection)) {
|
|
28
|
+
// 如果没有选取,则直接在根节点末尾插入
|
|
29
|
+
var lastNode = selection.focus.getNode();
|
|
30
|
+
if (lastNode) {
|
|
31
|
+
if ($isParagraphNode(lastNode)) {
|
|
32
|
+
lastNode.append(node);
|
|
33
|
+
} else if ($isTextNode(lastNode)) {
|
|
34
|
+
// 如果最后一个节点是文本节点,则在其后插入 SelectNode
|
|
35
|
+
lastNode.insertAfter(node);
|
|
36
|
+
} else if ($isDivNode(lastNode)) {
|
|
37
|
+
lastNode.append(node);
|
|
38
|
+
} else {
|
|
39
|
+
selection.insertNodes([node]);
|
|
40
|
+
}
|
|
41
|
+
node.selectNext();
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
selection.insertNodes([node]);
|
|
45
|
+
node.selectNext();
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
var root = $getRoot();
|
|
49
|
+
var nodeToInsert = node;
|
|
50
|
+
if ($isElementNode(node) || $isDecoratorNode(node)) {
|
|
51
|
+
nodeToInsert = node;
|
|
52
|
+
} else {
|
|
53
|
+
var container = $createDivNode({
|
|
54
|
+
style: {
|
|
55
|
+
display: 'inline-block'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
container.append(node);
|
|
59
|
+
nodeToInsert = container;
|
|
60
|
+
}
|
|
61
|
+
root.append(nodeToInsert);
|
|
62
|
+
node.selectNext();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 将文本插入到当前光标位置
|
|
69
|
+
*
|
|
70
|
+
* @param editor LexicalEditor 实例
|
|
71
|
+
* @param text 要插入的文本
|
|
72
|
+
*/
|
|
73
|
+
export function insertTextAtCursor(editor, text) {
|
|
74
|
+
editor === null || editor === void 0 || editor.update(function () {
|
|
75
|
+
var textNode = $createTextNode(text);
|
|
76
|
+
var root = $getRoot();
|
|
77
|
+
var selection = $getSelection();
|
|
78
|
+
if (selection) {
|
|
79
|
+
// 插入光标位置
|
|
80
|
+
selection.insertText(text);
|
|
81
|
+
} else {
|
|
82
|
+
// 如果没有选取,则直接在根节点末尾插入
|
|
83
|
+
var lastNode = root.getLastChild();
|
|
84
|
+
if (lastNode && $isParagraphNode(lastNode)) {
|
|
85
|
+
lastNode.append(textNode);
|
|
86
|
+
} else {
|
|
87
|
+
var container = $createDivNode({
|
|
88
|
+
style: {
|
|
89
|
+
display: 'inline-block'
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
container.append(textNode);
|
|
93
|
+
root.append(container);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 清空编辑器内容
|
|
101
|
+
*
|
|
102
|
+
* @param editor LexicalEditor 实例
|
|
103
|
+
*/
|
|
104
|
+
export function clearEditorContent(editor) {
|
|
105
|
+
var state = editor.getEditorState();
|
|
106
|
+
var stateJson = state.toJSON();
|
|
107
|
+
// 默认创建一个ParagraphNode
|
|
108
|
+
var newJson = _objectSpread(_objectSpread({}, stateJson), {}, {
|
|
109
|
+
root: _objectSpread(_objectSpread({}, stateJson.root), {}, {
|
|
110
|
+
children: [{
|
|
111
|
+
children: [],
|
|
112
|
+
direction: null,
|
|
113
|
+
format: '',
|
|
114
|
+
indent: 0,
|
|
115
|
+
type: 'paragraph',
|
|
116
|
+
version: 1,
|
|
117
|
+
textFormat: 0,
|
|
118
|
+
textStyle: ''
|
|
119
|
+
}]
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
var emptyState = editor.parseEditorState(JSON.stringify(newJson));
|
|
123
|
+
editor.setEditorState(emptyState);
|
|
124
|
+
editor.update(function () {
|
|
125
|
+
var root = $getRoot();
|
|
126
|
+
root.clear();
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 查找符合条件的节点
|
|
132
|
+
*
|
|
133
|
+
* @param editor LexicalEditor 实例
|
|
134
|
+
* @param predicate 用于匹配节点的函数
|
|
135
|
+
* @param options 选项
|
|
136
|
+
*
|
|
137
|
+
* @returns 符合条件的节点数组
|
|
138
|
+
*/
|
|
139
|
+
export function findNode(editor, predicate) {
|
|
140
|
+
var matched = findNodes(editor, predicate, {
|
|
141
|
+
stopOnFirstMatch: true
|
|
142
|
+
});
|
|
143
|
+
return matched[0];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 查找所有符合条件的节点数组
|
|
147
|
+
*
|
|
148
|
+
* @param editor LexicalEditor 实例
|
|
149
|
+
* @param predicate 用于匹配节点的函数
|
|
150
|
+
* @param options 选项
|
|
151
|
+
*
|
|
152
|
+
* @returns 符合条件的节点数组
|
|
153
|
+
*/
|
|
154
|
+
export function findNodes(editor, predicate, options) {
|
|
155
|
+
var matched = [];
|
|
156
|
+
editor.getEditorState().read(function () {
|
|
157
|
+
var root = $getRoot();
|
|
158
|
+
var traverse = function traverse(node, result) {
|
|
159
|
+
if (predicate(node)) {
|
|
160
|
+
result.push(node);
|
|
161
|
+
if (options !== null && options !== void 0 && options.stopOnFirstMatch) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if ($isElementNode(node)) {
|
|
166
|
+
var children = node.getChildren();
|
|
167
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
168
|
+
_step;
|
|
169
|
+
try {
|
|
170
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
171
|
+
var child = _step.value;
|
|
172
|
+
traverse(child, result);
|
|
173
|
+
if (options !== null && options !== void 0 && options.stopOnFirstMatch && result.length > 0) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} catch (err) {
|
|
178
|
+
_iterator.e(err);
|
|
179
|
+
} finally {
|
|
180
|
+
_iterator.f();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
traverse(root, matched);
|
|
185
|
+
});
|
|
186
|
+
return matched;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 更新 DOM 元素的属性
|
|
191
|
+
*
|
|
192
|
+
* @param dom 要更新的 DOM 元素
|
|
193
|
+
* @param props 要设置的属性
|
|
194
|
+
*/
|
|
195
|
+
export function updateDomProps(dom, props) {
|
|
196
|
+
if (!dom) return;
|
|
197
|
+
Array.from(dom.attributes).forEach(function (attr) {
|
|
198
|
+
if (!attr.name.startsWith('data-lexical')) {
|
|
199
|
+
dom.removeAttribute(attr.name);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
dom.removeAttribute('style');
|
|
203
|
+
dom.removeAttribute('class');
|
|
204
|
+
if (props) {
|
|
205
|
+
Object.entries(props).forEach(function (_ref) {
|
|
206
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
207
|
+
key = _ref2[0],
|
|
208
|
+
value = _ref2[1];
|
|
209
|
+
if (key === 'style' && value) {
|
|
210
|
+
Object.entries(value).forEach(function (_ref3) {
|
|
211
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
212
|
+
styleKey = _ref4[0],
|
|
213
|
+
styleValue = _ref4[1];
|
|
214
|
+
if (styleValue !== undefined) {
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
|
+
dom.style[styleKey] = styleValue;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
} else if (key === 'className' && value) {
|
|
220
|
+
dom.className = value;
|
|
221
|
+
} else if (value !== undefined && value !== null) {
|
|
222
|
+
dom.setAttribute(key, value.toString());
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 更新 DOM 元素的样式
|
|
230
|
+
*
|
|
231
|
+
* @param dom 要更新的 DOM 元素
|
|
232
|
+
* @param style 要设置的样式
|
|
233
|
+
*/
|
|
234
|
+
export function updateDomStyle(dom, style) {
|
|
235
|
+
if (!dom) return;
|
|
236
|
+
dom.removeAttribute('style');
|
|
237
|
+
if (style) {
|
|
238
|
+
Object.entries(style).forEach(function (_ref5) {
|
|
239
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
240
|
+
styleKey = _ref6[0],
|
|
241
|
+
styleValue = _ref6[1];
|
|
242
|
+
if (styleValue !== undefined) {
|
|
243
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
244
|
+
dom.style[styleKey] = styleValue;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["$createTextNode","$getRoot","$getSelection","$isDecoratorNode","$isElementNode","$isParagraphNode","$isRangeSelection","$isTextNode","$createDivNode","$isDivNode","insertNodeAtCursor","editor","node","update","selection","lastNode","focus","getNode","append","insertAfter","insertNodes","selectNext","root","nodeToInsert","container","style","display","insertTextAtCursor","text","textNode","insertText","getLastChild","clearEditorContent","state","getEditorState","stateJson","toJSON","newJson","_objectSpread","children","direction","format","indent","type","version","textFormat","textStyle","emptyState","parseEditorState","JSON","stringify","setEditorState","clear","findNode","predicate","matched","findNodes","stopOnFirstMatch","options","read","traverse","result","push","getChildren","_iterator","_createForOfIteratorHelper","_step","s","n","done","child","value","length","err","e","f","updateDomProps","dom","props","Array","from","attributes","forEach","attr","name","startsWith","removeAttribute","Object","entries","_ref","_ref2","_slicedToArray","key","_ref3","_ref4","styleKey","styleValue","undefined","className","setAttribute","toString","updateDomStyle","_ref5","_ref6"],"sources":["../../../../src/components/Lexical/helpers/index.ts"],"sourcesContent":["import type { CSSProperties, HtmlHTMLAttributes } from 'react';\nimport type { LexicalEditor, LexicalNode } from 'lexical';\nimport {\n $createTextNode,\n $getRoot,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isParagraphNode,\n $isRangeSelection,\n $isTextNode,\n} from 'lexical';\nimport { $createDivNode, $isDivNode } from '../nodes/DivNode';\n\n/**\n * 将节点插入到当前光标位置\n *\n * @param editor LexicalEditor 实例\n * @param node 要插入的节点\n */\nexport function insertNodeAtCursor(editor: LexicalEditor, node: LexicalNode): void {\n editor.update(() => {\n const selection = $getSelection();\n if (selection) {\n if ($isRangeSelection(selection)) {\n // 如果没有选取,则直接在根节点末尾插入\n const lastNode = selection.focus.getNode();\n if (lastNode) {\n if ($isParagraphNode(lastNode)) {\n lastNode.append(node);\n } else if ($isTextNode(lastNode)) {\n // 如果最后一个节点是文本节点,则在其后插入 SelectNode\n lastNode.insertAfter(node);\n } else if ($isDivNode(lastNode)) {\n lastNode.append(node);\n } else {\n selection.insertNodes([node]);\n }\n node.selectNext();\n }\n } else {\n selection.insertNodes([node]);\n node.selectNext();\n }\n } else {\n const root = $getRoot();\n let nodeToInsert: LexicalNode = node;\n if ($isElementNode(node) || $isDecoratorNode(node)) {\n nodeToInsert = node;\n } else {\n const container = $createDivNode({\n style: { display: 'inline-block' },\n });\n container.append(node);\n nodeToInsert = container;\n }\n root.append(nodeToInsert);\n node.selectNext();\n }\n });\n}\n\n/**\n * 将文本插入到当前光标位置\n *\n * @param editor LexicalEditor 实例\n * @param text 要插入的文本\n */\nexport function insertTextAtCursor(editor: LexicalEditor, text: string): void {\n editor?.update(() => {\n const textNode = $createTextNode(text);\n const root = $getRoot();\n const selection = $getSelection();\n if (selection) {\n // 插入光标位置\n selection.insertText(text);\n } else {\n // 如果没有选取,则直接在根节点末尾插入\n const lastNode = root.getLastChild();\n if (lastNode && $isParagraphNode(lastNode)) {\n lastNode.append(textNode);\n } else {\n const container = $createDivNode({\n style: { display: 'inline-block' },\n });\n container.append(textNode);\n root.append(container);\n }\n }\n });\n}\n\n/**\n * 清空编辑器内容\n *\n * @param editor LexicalEditor 实例\n */\nexport function clearEditorContent(editor: LexicalEditor) {\n const state = editor.getEditorState();\n const stateJson = state.toJSON();\n // 默认创建一个ParagraphNode\n const newJson = {\n ...stateJson,\n root: {\n ...stateJson.root,\n children: [\n {\n children: [],\n direction: null,\n format: '',\n indent: 0,\n type: 'paragraph',\n version: 1,\n textFormat: 0,\n textStyle: '',\n },\n ],\n },\n };\n const emptyState = editor.parseEditorState(JSON.stringify(newJson));\n editor.setEditorState(emptyState);\n editor.update(() => {\n const root = $getRoot();\n root.clear();\n });\n}\n\n/**\n * 查找符合条件的节点\n *\n * @param editor LexicalEditor 实例\n * @param predicate 用于匹配节点的函数\n * @param options 选项\n *\n * @returns 符合条件的节点数组\n */\nexport function findNode<T extends LexicalNode>(\n editor: LexicalEditor,\n predicate: (node: LexicalNode) => boolean\n): T | undefined {\n const matched = findNodes<T>(editor, predicate, { stopOnFirstMatch: true });\n return matched[0];\n}\n/**\n * 查找所有符合条件的节点数组\n *\n * @param editor LexicalEditor 实例\n * @param predicate 用于匹配节点的函数\n * @param options 选项\n *\n * @returns 符合条件的节点数组\n */\nexport function findNodes<T extends LexicalNode>(\n editor: LexicalEditor,\n predicate: (node: LexicalNode) => boolean,\n options?: {\n stopOnFirstMatch?: boolean;\n }\n): T[] {\n const matched: T[] = [];\n editor.getEditorState().read(() => {\n const root = $getRoot();\n const traverse = (node: LexicalNode, result: T[]) => {\n if (predicate(node)) {\n result.push(node as unknown as T);\n if (options?.stopOnFirstMatch) {\n return;\n }\n }\n if ($isElementNode(node)) {\n const children = node.getChildren();\n for (const child of children) {\n traverse(child, result);\n if (options?.stopOnFirstMatch && result.length > 0) {\n return;\n }\n }\n }\n };\n traverse(root, matched);\n });\n return matched;\n}\n\n/**\n * 更新 DOM 元素的属性\n *\n * @param dom 要更新的 DOM 元素\n * @param props 要设置的属性\n */\nexport function updateDomProps(dom: HTMLElement | undefined, props: HtmlHTMLAttributes<HTMLElement>): void {\n if (!dom) return;\n Array.from(dom.attributes).forEach((attr) => {\n if (!attr.name.startsWith('data-lexical')) {\n dom.removeAttribute(attr.name);\n }\n });\n\n dom.removeAttribute('style');\n dom.removeAttribute('class');\n\n if (props) {\n Object.entries(props).forEach(([key, value]) => {\n if (key === 'style' && value) {\n Object.entries(value as CSSProperties).forEach(([styleKey, styleValue]) => {\n if (styleValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (dom.style as any)[styleKey] = styleValue;\n }\n });\n } else if (key === 'className' && value) {\n dom.className = value as string;\n } else if (value !== undefined && value !== null) {\n dom.setAttribute(key, value.toString());\n }\n });\n }\n}\n\n/**\n * 更新 DOM 元素的样式\n *\n * @param dom 要更新的 DOM 元素\n * @param style 要设置的样式\n */\nexport function updateDomStyle(dom: HTMLElement | undefined, style: CSSProperties | undefined): void {\n if (!dom) return;\n dom.removeAttribute('style');\n if (style) {\n Object.entries(style).forEach(([styleKey, styleValue]) => {\n if (styleValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (dom.style as any)[styleKey] = styleValue;\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA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OAAO,CAAC;EAC5B,IAAI7D,KAAK,EAAE;IACT8D,MAAM,CAACC,OAAO,CAAC/D,KAAK,CAAC,CAACyD,OAAO,CAAC,UAAAoB,KAAA,EAA4B;MAAA,IAAAC,KAAA,GAAAZ,cAAA,CAAAW,KAAA;QAA1BP,QAAQ,GAAAQ,KAAA;QAAEP,UAAU,GAAAO,KAAA;MAClD,IAAIP,UAAU,KAAKC,SAAS,EAAE;QAC5B;QACCpB,GAAG,CAACpD,KAAK,CAASsE,QAAQ,CAAC,GAAGC,UAAU;MAC3C;IACF,CAAC,CAAC;EACJ;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/Lexical/index.ts"],"sourcesContent":["export * from './helpers';\nexport * from './nodes/base';\nexport * from './nodes/DivNode';\nexport * from './nodes/SelectNode';\nexport * from './nodes/ExtendTextNode';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CSSProperties, HtmlHTMLAttributes } from 'react';
|
|
2
|
+
import type { DOMConversionMap, DOMExportOutput, LexicalNode, SerializedElementNode, Spread } from 'lexical';
|
|
3
|
+
import { BaseElementNode, type BaseElementProps } from './base';
|
|
4
|
+
export interface DivNodeProps extends HtmlHTMLAttributes<HTMLDivElement>, BaseElementProps {
|
|
5
|
+
}
|
|
6
|
+
export type SerializedDivNode = Spread<{
|
|
7
|
+
props?: DivNodeProps;
|
|
8
|
+
}, SerializedElementNode>;
|
|
9
|
+
export declare class DivNode extends BaseElementNode<DivNodeProps> {
|
|
10
|
+
static getType(): string;
|
|
11
|
+
static clone(node: DivNode): DivNode;
|
|
12
|
+
protected getForceDisplay(): CSSProperties['display'];
|
|
13
|
+
createDOM(): HTMLElement;
|
|
14
|
+
updateDOM(prevNode: DivNode, dom: HTMLElement): boolean;
|
|
15
|
+
static importDOM(): DOMConversionMap | null;
|
|
16
|
+
static importJSON(serializedNode: SerializedDivNode): DivNode;
|
|
17
|
+
exportJSON(): SerializedDivNode;
|
|
18
|
+
exportDOM(): DOMExportOutput;
|
|
19
|
+
isInline(): boolean;
|
|
20
|
+
getPropValue<K extends keyof DivNodeProps>(key: K): DivNodeProps[K] | undefined;
|
|
21
|
+
setProps(props: DivNodeProps): void;
|
|
22
|
+
private shallowEqual;
|
|
23
|
+
}
|
|
24
|
+
export declare function $createDivNode(props?: DivNodeProps): DivNode;
|
|
25
|
+
export declare function $isDivNode(node: LexicalNode | null | undefined): node is DivNode;
|