@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.
Files changed (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/es/components/ConfirmAction/withConfirmAction.js +23 -1
  3. package/es/components/ConfirmAction/withConfirmAction.js.map +1 -1
  4. package/es/components/Lexical/helpers/index.d.ts +58 -0
  5. package/es/components/Lexical/helpers/index.js +249 -0
  6. package/es/components/Lexical/helpers/index.js.map +1 -0
  7. package/es/components/Lexical/index.d.ts +5 -0
  8. package/es/components/Lexical/index.js +6 -0
  9. package/es/components/Lexical/index.js.map +1 -0
  10. package/es/components/Lexical/nodes/DivNode.d.ts +25 -0
  11. package/es/components/Lexical/nodes/DivNode.js +163 -0
  12. package/es/components/Lexical/nodes/DivNode.js.map +1 -0
  13. package/es/components/Lexical/nodes/ExtendTextNode.d.ts +24 -0
  14. package/es/components/Lexical/nodes/ExtendTextNode.js +102 -0
  15. package/es/components/Lexical/nodes/ExtendTextNode.js.map +1 -0
  16. package/es/components/Lexical/nodes/SelectNode.d.ts +44 -0
  17. package/es/components/Lexical/nodes/SelectNode.js +204 -0
  18. package/es/components/Lexical/nodes/SelectNode.js.map +1 -0
  19. package/es/components/Lexical/nodes/base.d.ts +51 -0
  20. package/es/components/Lexical/nodes/base.js +168 -0
  21. package/es/components/Lexical/nodes/base.js.map +1 -0
  22. package/es/hooks/useRefValue.d.ts +2 -2
  23. package/es/hooks/useRefValue.js.map +1 -1
  24. package/lib/components/ConfirmAction/withConfirmAction.js +5 -1
  25. package/lib/components/ConfirmAction/withConfirmAction.js.map +2 -2
  26. package/lib/components/Lexical/helpers/index.d.ts +58 -0
  27. package/lib/components/Lexical/helpers/index.js +198 -0
  28. package/lib/components/Lexical/helpers/index.js.map +7 -0
  29. package/lib/components/Lexical/index.d.ts +5 -0
  30. package/lib/components/Lexical/index.js +32 -0
  31. package/lib/components/Lexical/index.js.map +7 -0
  32. package/lib/components/Lexical/nodes/DivNode.d.ts +25 -0
  33. package/lib/components/Lexical/nodes/DivNode.js +139 -0
  34. package/lib/components/Lexical/nodes/DivNode.js.map +7 -0
  35. package/lib/components/Lexical/nodes/ExtendTextNode.d.ts +24 -0
  36. package/lib/components/Lexical/nodes/ExtendTextNode.js +87 -0
  37. package/lib/components/Lexical/nodes/ExtendTextNode.js.map +7 -0
  38. package/lib/components/Lexical/nodes/SelectNode.d.ts +44 -0
  39. package/lib/components/Lexical/nodes/SelectNode.js +157 -0
  40. package/lib/components/Lexical/nodes/SelectNode.js.map +7 -0
  41. package/lib/components/Lexical/nodes/base.d.ts +51 -0
  42. package/lib/components/Lexical/nodes/base.js +116 -0
  43. package/lib/components/Lexical/nodes/base.js.map +7 -0
  44. package/lib/hooks/useRefValue.d.ts +2 -2
  45. package/lib/hooks/useRefValue.js.map +2 -2
  46. package/package.json +20 -1
@@ -0,0 +1,163 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
11
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
12
+ 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); }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ 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); }; }
15
+ 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); }
16
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17
+ 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; } }
18
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
19
+ import { updateDomProps } from "../helpers";
20
+ import { BaseElementNode } from "./base";
21
+ export var DivNode = /*#__PURE__*/function (_BaseElementNode) {
22
+ _inherits(DivNode, _BaseElementNode);
23
+ var _super = _createSuper(DivNode);
24
+ function DivNode() {
25
+ _classCallCheck(this, DivNode);
26
+ return _super.apply(this, arguments);
27
+ }
28
+ _createClass(DivNode, [{
29
+ key: "getForceDisplay",
30
+ value: function getForceDisplay() {
31
+ return undefined;
32
+ }
33
+ }, {
34
+ key: "createDOM",
35
+ value: function createDOM() {
36
+ var div = document.createElement('div');
37
+ var domProps = this.getUnderlyingProps(this.__props);
38
+ if (domProps) {
39
+ updateDomProps(div, domProps);
40
+ }
41
+ return div;
42
+ }
43
+ }, {
44
+ key: "updateDOM",
45
+ value: function updateDOM(prevNode, dom) {
46
+ var prevProps = prevNode.__props;
47
+ var currentProps = this.__props;
48
+ var propsChanged = !this.shallowEqual(prevProps, currentProps);
49
+ if (propsChanged) {
50
+ updateDomProps(dom, this.getUnderlyingProps(currentProps));
51
+ }
52
+ // 不重新创建
53
+ return false;
54
+ }
55
+ }, {
56
+ key: "exportJSON",
57
+ value: function exportJSON() {
58
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(DivNode.prototype), "exportJSON", this).call(this)), {}, {
59
+ props: this.__props,
60
+ type: this.getType()
61
+ });
62
+ }
63
+ }, {
64
+ key: "exportDOM",
65
+ value: function exportDOM() {
66
+ var element = this.createDOM();
67
+ return {
68
+ element: element
69
+ };
70
+ }
71
+ }, {
72
+ key: "isInline",
73
+ value: function isInline() {
74
+ var _this$__props;
75
+ var display = (_this$__props = this.__props) === null || _this$__props === void 0 || (_this$__props = _this$__props.style) === null || _this$__props === void 0 ? void 0 : _this$__props.display;
76
+ return display === 'inline' || display === 'inline-flex' || display === 'inline-block' || display === 'inline-grid' || display === 'inline-table' || display === 'inline-list-item';
77
+ }
78
+ }, {
79
+ key: "getPropValue",
80
+ value: function getPropValue(key) {
81
+ var _this$__props2;
82
+ return (_this$__props2 = this.__props) === null || _this$__props2 === void 0 ? void 0 : _this$__props2[key];
83
+ }
84
+ }, {
85
+ key: "setProps",
86
+ value: function setProps(props) {
87
+ var _writable$__props;
88
+ var writable = this.getWritable();
89
+ writable.__props = _objectSpread(_objectSpread(_objectSpread({}, writable.__props), props), {}, {
90
+ style: _objectSpread(_objectSpread({}, (_writable$__props = writable.__props) === null || _writable$__props === void 0 ? void 0 : _writable$__props.style), props.style)
91
+ });
92
+ }
93
+
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
+ }, {
96
+ key: "shallowEqual",
97
+ value: function shallowEqual(obj1, obj2) {
98
+ if (obj1 === obj2) return true;
99
+ if (!obj1 || !obj2) return false;
100
+ var keys1 = Object.keys(obj1);
101
+ var keys2 = Object.keys(obj2);
102
+ if (keys1.length !== keys2.length) return false;
103
+ for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {
104
+ var key = _keys[_i];
105
+ if (key === 'style') {
106
+ // 特殊处理 style 对象
107
+ if (!this.shallowEqual(obj1[key], obj2[key])) return false;
108
+ } else if (obj1[key] !== obj2[key]) {
109
+ return false;
110
+ }
111
+ }
112
+ return true;
113
+ }
114
+ }], [{
115
+ key: "getType",
116
+ value: function getType() {
117
+ return 'html.div';
118
+ }
119
+ }, {
120
+ key: "clone",
121
+ value: function clone(node) {
122
+ return new DivNode(_objectSpread(_objectSpread({}, node.__props), {}, {
123
+ key: node.getKey()
124
+ }));
125
+ }
126
+ }, {
127
+ key: "importDOM",
128
+ value: function importDOM() {
129
+ return {
130
+ div: function div(node) {
131
+ return {
132
+ conversion: convertDivElement,
133
+ priority: 1
134
+ };
135
+ }
136
+ };
137
+ }
138
+ }, {
139
+ key: "importJSON",
140
+ value: function importJSON(serializedNode) {
141
+ return $createDivNode(serializedNode.props);
142
+ }
143
+ }]);
144
+ return DivNode;
145
+ }(BaseElementNode);
146
+ function convertDivElement(domNode) {
147
+ var element = domNode;
148
+ if (element.nodeName === 'DIV') {
149
+ return {
150
+ node: $createDivNode()
151
+ };
152
+ }
153
+ return {
154
+ node: null
155
+ };
156
+ }
157
+ export function $createDivNode(props) {
158
+ return new DivNode(props);
159
+ }
160
+ export function $isDivNode(node) {
161
+ return node instanceof DivNode;
162
+ }
163
+ //# sourceMappingURL=DivNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["updateDomProps","BaseElementNode","DivNode","_BaseElementNode","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getForceDisplay","undefined","createDOM","div","document","createElement","domProps","getUnderlyingProps","__props","updateDOM","prevNode","dom","prevProps","currentProps","propsChanged","shallowEqual","exportJSON","_objectSpread","_get","_getPrototypeOf","prototype","call","props","type","getType","exportDOM","element","isInline","_this$__props","display","style","getPropValue","_this$__props2","setProps","_writable$__props","writable","getWritable","obj1","obj2","keys1","Object","keys","keys2","length","_i","_keys","clone","node","getKey","importDOM","conversion","convertDivElement","priority","importJSON","serializedNode","$createDivNode","domNode","nodeName","$isDivNode"],"sources":["../../../../src/components/Lexical/nodes/DivNode.tsx"],"sourcesContent":["import type { CSSProperties, HtmlHTMLAttributes } from 'react';\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n LexicalNode,\n SerializedElementNode,\n Spread,\n} from 'lexical';\nimport { updateDomProps } from '../helpers';\nimport { BaseElementNode, type BaseElementProps } from './base';\n\nexport interface DivNodeProps extends HtmlHTMLAttributes<HTMLDivElement>, BaseElementProps {}\n\nexport type SerializedDivNode = Spread<\n {\n props?: DivNodeProps;\n },\n SerializedElementNode\n>;\n\nexport class DivNode extends BaseElementNode<DivNodeProps> {\n static getType(): string {\n return 'html.div';\n }\n\n static clone(node: DivNode): DivNode {\n return new DivNode({ ...node.__props, key: node.getKey() });\n }\n\n protected getForceDisplay(): CSSProperties['display'] {\n return undefined;\n }\n\n createDOM(): HTMLElement {\n const div = document.createElement('div');\n const domProps = this.getUnderlyingProps(this.__props);\n if (domProps) {\n updateDomProps(div, domProps);\n }\n return div;\n }\n\n updateDOM(prevNode: DivNode, dom: HTMLElement): boolean {\n const prevProps = prevNode.__props;\n const currentProps = this.__props;\n const propsChanged = !this.shallowEqual(prevProps, currentProps);\n if (propsChanged) {\n updateDomProps(dom, this.getUnderlyingProps(currentProps));\n }\n // 不重新创建\n return false;\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n div: (node: Node) => ({\n conversion: convertDivElement,\n priority: 1,\n }),\n };\n }\n\n static importJSON(serializedNode: SerializedDivNode): DivNode {\n return $createDivNode(serializedNode.props);\n }\n\n exportJSON(): SerializedDivNode {\n return {\n ...super.exportJSON(),\n props: this.__props,\n type: this.getType(),\n };\n }\n\n exportDOM(): DOMExportOutput {\n const element = this.createDOM();\n return { element };\n }\n\n isInline(): boolean {\n const display = this.__props?.style?.display;\n return (\n display === 'inline' ||\n display === 'inline-flex' ||\n display === 'inline-block' ||\n display === 'inline-grid' ||\n display === 'inline-table' ||\n display === 'inline-list-item'\n );\n }\n\n getPropValue<K extends keyof DivNodeProps>(key: K): DivNodeProps[K] | undefined {\n return this.__props?.[key];\n }\n setProps(props: DivNodeProps): void {\n const writable = this.getWritable();\n writable.__props = {\n ...writable.__props,\n ...props,\n style: {\n ...writable.__props?.style,\n ...props.style,\n },\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private shallowEqual(obj1: any, obj2: any): boolean {\n if (obj1 === obj2) return true;\n if (!obj1 || !obj2) return false;\n\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n\n if (keys1.length !== keys2.length) return false;\n\n for (const key of keys1) {\n if (key === 'style') {\n // 特殊处理 style 对象\n if (!this.shallowEqual(obj1[key], obj2[key])) return false;\n } else if (obj1[key] !== obj2[key]) {\n return false;\n }\n }\n\n return true;\n }\n}\n\nfunction convertDivElement(domNode: Node): DOMConversionOutput {\n const element = domNode as HTMLElement;\n if (element.nodeName === 'DIV') {\n return { node: $createDivNode() };\n }\n return { node: null };\n}\n\nexport function $createDivNode(props?: DivNodeProps): DivNode {\n return new DivNode(props);\n}\n\nexport function $isDivNode(node: LexicalNode | null | undefined): node is DivNode {\n return node instanceof DivNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AASA,SAASA,cAAc;AACvB,SAASC,eAAe;AAWxB,WAAaC,OAAO,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,OAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,OAAA;EAAA,SAAAA,QAAA;IAAAK,eAAA,OAAAL,OAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,OAAA;IAAAS,GAAA;IAAAC,KAAA,EASlB,SAAAC,gBAAA,EAA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AA,OAAAjC,OAAA;AAAA,EA5C0BD,eAAe;AA6G5C,SAAS+D,iBAAiBA,CAACK,OAAa,EAAuB;EAC7D,IAAM9B,OAAO,GAAG8B,OAAsB;EACtC,IAAI9B,OAAO,CAAC+B,QAAQ,KAAK,KAAK,EAAE;IAC9B,OAAO;MAAEV,IAAI,EAAEQ,cAAc,CAAC;IAAE,CAAC;EACnC;EACA,OAAO;IAAER,IAAI,EAAE;EAAK,CAAC;AACvB;AAEA,OAAO,SAASQ,cAAcA,CAACjC,KAAoB,EAAW;EAC5D,OAAO,IAAIjC,OAAO,CAACiC,KAAK,CAAC;AAC3B;AAEA,OAAO,SAASoC,UAAUA,CAACX,IAAoC,EAAmB;EAChF,OAAOA,IAAI,YAAY1D,OAAO;AAChC"}
@@ -0,0 +1,24 @@
1
+ import type { LexicalNode, NodeKey, SerializedTextNode, Spread } from 'lexical';
2
+ import { TextNode } from 'lexical';
3
+ import type { BaseNodeProps } from './base';
4
+ import { BaseNodeHelper } from './base';
5
+ export interface ExtendTextNodeProps extends BaseNodeProps {
6
+ text?: string;
7
+ }
8
+ export declare class ExtendTextNode extends TextNode {
9
+ __props: ExtendTextNodeProps | undefined;
10
+ __base: BaseNodeHelper<ExtendTextNodeProps>;
11
+ constructor(props?: ExtendTextNodeProps & {
12
+ key?: NodeKey;
13
+ });
14
+ static getType(): string;
15
+ static clone(node: ExtendTextNode): ExtendTextNode;
16
+ static importJSON(serializedNode: SerializedExtendTextNode): ExtendTextNode;
17
+ exportJSON(): SerializedExtendTextNode;
18
+ }
19
+ export type SerializedExtendTextNode = Spread<{
20
+ props?: ExtendTextNodeProps;
21
+ text: string;
22
+ }, SerializedTextNode>;
23
+ export declare function $createExtendTextNode(props?: ExtendTextNodeProps): ExtendTextNode;
24
+ export declare function $isExtendTextNode(node: LexicalNode | null | undefined): node is ExtendTextNode;
@@ -0,0 +1,102 @@
1
+ var _excluded = ["key"];
2
+ 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); }
3
+ 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; }
4
+ 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; }
5
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ 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); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ 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); }; }
13
+ 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); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ 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; } }
16
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
17
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
18
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
19
+ 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; }
20
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
21
+ 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); }
22
+ import { TextNode } from 'lexical';
23
+ import { BaseNodeHelper } from "./base";
24
+ export var ExtendTextNode = /*#__PURE__*/function (_TextNode) {
25
+ _inherits(ExtendTextNode, _TextNode);
26
+ var _super = _createSuper(ExtendTextNode);
27
+ function ExtendTextNode(props) {
28
+ var _thisSuper, _thisSuper2, _thisSuper3, _this;
29
+ _classCallCheck(this, ExtendTextNode);
30
+ var _ref = props || {},
31
+ key = _ref.key,
32
+ restProps = _objectWithoutProperties(_ref, _excluded);
33
+ _this = _super.call(this, props === null || props === void 0 ? void 0 : props.text, key);
34
+ _defineProperty(_assertThisInitialized(_this), "__props", void 0);
35
+ _defineProperty(_assertThisInitialized(_this), "__base", void 0);
36
+ _this.__props = restProps;
37
+ _this.__base = new BaseNodeHelper(_this.__props, {
38
+ remove: function remove() {
39
+ return _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(ExtendTextNode.prototype)), "remove", _thisSuper).call(_thisSuper);
40
+ },
41
+ replace: function replace(replaceWith, includeChildren) {
42
+ return _get((_thisSuper2 = _assertThisInitialized(_this), _getPrototypeOf(ExtendTextNode.prototype)), "replace", _thisSuper2).call(_thisSuper2, replaceWith, includeChildren);
43
+ }
44
+ });
45
+ Object.keys(_this.__base.hooks).forEach(function (key) {
46
+ var method = _this.__base.hooks[key];
47
+ if (typeof method === 'function') {
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ _this[key] = method.bind(_this.__base);
50
+ }
51
+ });
52
+ _this.replace = function (replaceWith, includeChildren) {
53
+ var _this$__props;
54
+ if (((_this$__props = _this.__props) === null || _this$__props === void 0 ? void 0 : _this$__props.canBeReplaced) === false) {
55
+ var _this$__props2;
56
+ _this.setTextContent(((_this$__props2 = _this.__props) === null || _this$__props2 === void 0 ? void 0 : _this$__props2.text) || '');
57
+ _this.selectNext();
58
+ return _assertThisInitialized(_this);
59
+ }
60
+ return _get((_thisSuper3 = _assertThisInitialized(_this), _getPrototypeOf(ExtendTextNode.prototype)), "replace", _thisSuper3).call(_thisSuper3, replaceWith, includeChildren);
61
+ };
62
+ return _this;
63
+ }
64
+ _createClass(ExtendTextNode, [{
65
+ key: "exportJSON",
66
+ value: function exportJSON() {
67
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(ExtendTextNode.prototype), "exportJSON", this).call(this)), {}, {
68
+ props: this.__props,
69
+ text: this.__text,
70
+ type: this.getType()
71
+ });
72
+ }
73
+ }], [{
74
+ key: "getType",
75
+ value: function getType() {
76
+ return 'html.TextNode';
77
+ }
78
+ }, {
79
+ key: "clone",
80
+ value: function clone(node) {
81
+ return new ExtendTextNode(_objectSpread(_objectSpread({}, node.__props), {}, {
82
+ text: node.__text,
83
+ key: node.getKey()
84
+ }));
85
+ }
86
+ }, {
87
+ key: "importJSON",
88
+ value: function importJSON(serializedNode) {
89
+ return $createExtendTextNode(_objectSpread(_objectSpread({}, serializedNode.props), {}, {
90
+ text: serializedNode.text
91
+ }));
92
+ }
93
+ }]);
94
+ return ExtendTextNode;
95
+ }(TextNode);
96
+ export function $createExtendTextNode(props) {
97
+ return new ExtendTextNode(props);
98
+ }
99
+ export function $isExtendTextNode(node) {
100
+ return node instanceof ExtendTextNode;
101
+ }
102
+ //# sourceMappingURL=ExtendTextNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TextNode","BaseNodeHelper","ExtendTextNode","_TextNode","_inherits","_super","_createSuper","props","_thisSuper","_thisSuper2","_thisSuper3","_this","_classCallCheck","_ref","key","restProps","_objectWithoutProperties","_excluded","call","text","_defineProperty","_assertThisInitialized","__props","__base","remove","_get","_getPrototypeOf","prototype","replace","replaceWith","includeChildren","Object","keys","hooks","forEach","method","bind","_this$__props","canBeReplaced","_this$__props2","setTextContent","selectNext","_createClass","value","exportJSON","_objectSpread","__text","type","getType","clone","node","getKey","importJSON","serializedNode","$createExtendTextNode","$isExtendTextNode"],"sources":["../../../../src/components/Lexical/nodes/ExtendTextNode.tsx"],"sourcesContent":["import type { LexicalNode, NodeKey, SerializedTextNode, Spread } from 'lexical';\nimport { TextNode } from 'lexical';\nimport type { BaseNodeProps } from './base';\nimport { BaseNodeHelper } from './base';\n\nexport interface ExtendTextNodeProps extends BaseNodeProps {\n text?: string;\n}\n\nexport class ExtendTextNode extends TextNode {\n __props: ExtendTextNodeProps | undefined;\n __base: BaseNodeHelper<ExtendTextNodeProps>;\n\n constructor(props?: ExtendTextNodeProps & { key?: NodeKey }) {\n const { key, ...restProps } = props || {};\n super(props?.text, key);\n this.__props = restProps;\n this.__base = new BaseNodeHelper<ExtendTextNodeProps>(this.__props, {\n remove: () => super.remove(),\n replace: (replaceWith, includeChildren) => super.replace(replaceWith, includeChildren),\n });\n Object.keys(this.__base.hooks).forEach((key) => {\n const method = this.__base.hooks[key as keyof typeof this.__base.hooks];\n if (typeof method === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this[key as keyof this] = method.bind(this.__base) as any;\n }\n });\n this.replace = <N extends LexicalNode>(replaceWith: N, includeChildren?: boolean): N => {\n if (this.__props?.canBeReplaced === false) {\n this.setTextContent(this.__props?.text || '');\n this.selectNext();\n return this as unknown as N;\n }\n return super.replace(replaceWith, includeChildren);\n };\n }\n\n static getType(): string {\n return 'html.TextNode';\n }\n\n static clone(node: ExtendTextNode): ExtendTextNode {\n return new ExtendTextNode({ ...node.__props, text: node.__text, key: node.getKey() });\n }\n\n static importJSON(serializedNode: SerializedExtendTextNode): ExtendTextNode {\n return $createExtendTextNode({\n ...serializedNode.props,\n text: serializedNode.text,\n });\n }\n\n exportJSON(): SerializedExtendTextNode {\n return {\n ...super.exportJSON(),\n props: this.__props,\n text: this.__text,\n type: this.getType(),\n };\n }\n}\n\nexport type SerializedExtendTextNode = Spread<\n {\n props?: ExtendTextNodeProps;\n text: string;\n },\n SerializedTextNode\n>;\n\nexport function $createExtendTextNode(props?: ExtendTextNodeProps): ExtendTextNode {\n return new ExtendTextNode(props);\n}\n\nexport function $isExtendTextNode(node: LexicalNode | null | undefined): node is ExtendTextNode {\n return node instanceof ExtendTextNode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,SAASA,QAAQ,QAAQ,SAAS;AAElC,SAASC,cAAc;AAMvB,WAAaC,cAAc,0BAAAC,SAAA;EAAAC,SAAA,CAAAF,cAAA,EAAAC,SAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,cAAA;EAIzB,SAAAA,eAAYK,KAA+C,EAAE;IAAA,IAAAC,UAAA,EAAAC,WAAA,EAAAC,WAAA,EAAAC,KAAA;IAAAC,eAAA,OAAAV,cAAA;IAC3D,IAAAW,IAAA,GAA8BN,KAAK,IAAI,CAAC,CAAC;MAAjCO,GAAG,GAAAD,IAAA,CAAHC,GAAG;MAAKC,SAAS,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;IACzBN,KAAA,GAAAN,MAAA,CAAAa,IAAA,OAAMX,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEY,IAAI,EAAEL,GAAG;IAAEM,eAAA,CAAAC,sBAAA,CAAAV,KAAA;IAAAS,eAAA,CAAAC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C;EAAA,OAAAjB,cAAA;AAAA,EA1CiCF,QAAQ;AA8D5C,OAAO,SAASsD,qBAAqBA,CAAC/C,KAA2B,EAAkB;EACjF,OAAO,IAAIL,cAAc,CAACK,KAAK,CAAC;AAClC;AAEA,OAAO,SAASgD,iBAAiBA,CAACL,IAAoC,EAA0B;EAC9F,OAAOA,IAAI,YAAYhD,cAAc;AACvC"}
@@ -0,0 +1,44 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ import type { SelectProps } from 'antd';
3
+ import type { BaseOptionType, DefaultOptionType } from 'antd/es/select';
4
+ import type { LexicalEditor, LexicalNode, SerializedLexicalNode, Spread } from 'lexical';
5
+ import type { BaseDecoratorNodeProps } from './base';
6
+ import { BaseDecoratorNode } from './base';
7
+ export interface SelectNodeProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends SelectProps<ValueType, OptionType>, BaseDecoratorNodeProps {
8
+ /**
9
+ * 在获取editor的textContent时,是否将选项的label作为文本内容插入到编辑器中,默认 `value`
10
+ *
11
+ * - `label` - 将选项的label作为文本内容
12
+ * - `value` - 将选项的value作为文本内容
13
+ */
14
+ textContentMode?: 'label' | 'value';
15
+ /** 是否在`textContext`两边添加一个空格,默认`true` */
16
+ spaceAround?: boolean;
17
+ /** 容器样式 */
18
+ containerStyle?: CSSProperties;
19
+ }
20
+ export declare class SelectNode<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends BaseDecoratorNode<ReactNode, SelectNodeProps<ValueType, OptionType>> {
21
+ __value: ValueType | undefined;
22
+ constructor(props?: SelectNodeProps<ValueType, OptionType> & {
23
+ key?: string;
24
+ });
25
+ static getType(): string;
26
+ static clone<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(node: SelectNode<ValueType, OptionType>): SelectNode<ValueType, OptionType>;
27
+ static importJSON<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(serializedNode: SerializedSelectNode<ValueType, OptionType>): SelectNode<ValueType, OptionType>;
28
+ exportJSON(): SerializedSelectNode<ValueType, OptionType>;
29
+ createDOM(): HTMLElement;
30
+ updateDOM(): false;
31
+ decorate(): ReactNode;
32
+ isInline(): boolean;
33
+ getTextContent(): string;
34
+ getValue(): ValueType | undefined;
35
+ setValue(value: ValueType | undefined): void;
36
+ getPropValue(propName: keyof SelectNodeProps<ValueType, OptionType>): any;
37
+ setProps(props: SelectNodeProps<ValueType, OptionType>): void;
38
+ }
39
+ export declare function $createSelectNode<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props?: SelectNodeProps<ValueType, OptionType>): SelectNode<ValueType, OptionType>;
40
+ export declare function $isSelectNode(node: LexicalNode | null | undefined): node is SelectNode<any, any>;
41
+ export declare function $insertSelectNode<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(editor: LexicalEditor, props: SelectNodeProps<ValueType, OptionType>): void;
42
+ export type SerializedSelectNode<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> = Spread<{
43
+ props?: SelectNodeProps<ValueType, OptionType>;
44
+ }, SerializedLexicalNode>;
@@ -0,0 +1,204 @@
1
+ var _excluded = ["textContentMode", "spaceAround", "containerStyle"];
2
+ 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); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ 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; }
12
+ 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; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ 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); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
17
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
18
+ 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); }
19
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20
+ 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); }; }
21
+ 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); }
22
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
23
+ 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; } }
24
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
25
+ 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; }
26
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
27
+ 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); }
28
+ import { useCallback } from 'react';
29
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
30
+ import { Select } from 'antd';
31
+ import { insertNodeAtCursor, updateDomStyle } from "../helpers";
32
+ import { BaseDecoratorNode } from "./base";
33
+ import { jsx as _jsx } from "react/jsx-runtime";
34
+ export var SelectNode = /*#__PURE__*/function (_BaseDecoratorNode) {
35
+ _inherits(SelectNode, _BaseDecoratorNode);
36
+ var _super = _createSuper(SelectNode);
37
+ function SelectNode(props) {
38
+ var _props$defaultValue;
39
+ var _this;
40
+ _classCallCheck(this, SelectNode);
41
+ _this = _super.call(this, props);
42
+ _defineProperty(_assertThisInitialized(_this), "__value", void 0);
43
+ _this.__value = (_props$defaultValue = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _props$defaultValue !== void 0 ? _props$defaultValue : undefined;
44
+ return _this;
45
+ }
46
+ _createClass(SelectNode, [{
47
+ key: "exportJSON",
48
+ value: function exportJSON() {
49
+ return _objectSpread(_objectSpread({}, _get(_getPrototypeOf(SelectNode.prototype), "exportJSON", this).call(this)), {}, {
50
+ props: this.__props,
51
+ type: this.getType(),
52
+ version: 1
53
+ });
54
+ }
55
+ }, {
56
+ key: "createDOM",
57
+ value: function createDOM() {
58
+ var _this$__props;
59
+ var span = document.createElement('span');
60
+ updateDomStyle(span, (_this$__props = this.__props) === null || _this$__props === void 0 ? void 0 : _this$__props.containerStyle);
61
+ return span;
62
+ }
63
+ }, {
64
+ key: "updateDOM",
65
+ value: function updateDOM() {
66
+ return false;
67
+ }
68
+ }, {
69
+ key: "decorate",
70
+ value: function decorate() {
71
+ return /*#__PURE__*/_jsx(SelectComponent, {
72
+ node: this
73
+ });
74
+ }
75
+ }, {
76
+ key: "isInline",
77
+ value: function isInline() {
78
+ return true;
79
+ }
80
+ }, {
81
+ key: "getTextContent",
82
+ value: function getTextContent() {
83
+ var _this$__props2,
84
+ _this2 = this,
85
+ _this$__props4;
86
+ var content;
87
+ var valueContent = this.__value ? String(this.__value) : '';
88
+ if (((_this$__props2 = this.__props) === null || _this$__props2 === void 0 ? void 0 : _this$__props2.textContentMode) === 'label') {
89
+ var _this$__props3;
90
+ var option = (_this$__props3 = this.__props) === null || _this$__props3 === void 0 || (_this$__props3 = _this$__props3.options) === null || _this$__props3 === void 0 ? void 0 : _this$__props3.find(function (opt) {
91
+ return opt.value === _this2.__value;
92
+ });
93
+ content = option !== null && option !== void 0 && option.label ? String(option.label) : valueContent;
94
+ } else {
95
+ content = valueContent;
96
+ }
97
+ if (((_this$__props4 = this.__props) === null || _this$__props4 === void 0 ? void 0 : _this$__props4.spaceAround) !== false) {
98
+ return " ".concat(content, " ");
99
+ }
100
+ return content;
101
+ }
102
+ }, {
103
+ key: "getValue",
104
+ value: function getValue() {
105
+ return this.__value;
106
+ }
107
+ }, {
108
+ key: "setValue",
109
+ value: function setValue(value) {
110
+ var writable = this.getWritable();
111
+ writable.__value = value;
112
+ }
113
+
114
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
+ }, {
116
+ key: "getPropValue",
117
+ value: function getPropValue(propName) {
118
+ var _this$__props5;
119
+ return (_this$__props5 = this.__props) === null || _this$__props5 === void 0 ? void 0 : _this$__props5[propName];
120
+ }
121
+ }, {
122
+ key: "setProps",
123
+ value: function setProps(props) {
124
+ var writable = this.getWritable();
125
+ writable.__props = _objectSpread(_objectSpread({}, writable.__props), props);
126
+ }
127
+ }], [{
128
+ key: "getType",
129
+ value: function getType() {
130
+ return 'antd.Select';
131
+ }
132
+
133
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
134
+ }, {
135
+ key: "clone",
136
+ value: function clone(node) {
137
+ return new SelectNode(_objectSpread(_objectSpread({}, node.__props), {}, {
138
+ key: node.getKey()
139
+ }));
140
+ }
141
+
142
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
+ }, {
144
+ key: "importJSON",
145
+ value: function importJSON(serializedNode) {
146
+ return $createSelectNode(serializedNode.props);
147
+ }
148
+ }]);
149
+ return SelectNode;
150
+ }(BaseDecoratorNode);
151
+
152
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
+ function SelectComponent(_ref) {
154
+ var node = _ref.node;
155
+ /* eslint-disable @typescript-eslint/no-unused-vars */
156
+ var _ref2 = node.__props || {},
157
+ textContentMode = _ref2.textContentMode,
158
+ spaceAround = _ref2.spaceAround,
159
+ containerStyle = _ref2.containerStyle,
160
+ selectProps = _objectWithoutProperties(_ref2, _excluded);
161
+ /* eslint-enable @typescript-eslint/no-unused-vars */
162
+ var _useLexicalComposerCo = useLexicalComposerContext(),
163
+ _useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
164
+ editor = _useLexicalComposerCo2[0];
165
+ var handleChange = useCallback(function (value, options) {
166
+ editor.update(function () {
167
+ var _node$__props, _node$__props$onChang;
168
+ node.setValue(value);
169
+ (_node$__props = node.__props) === null || _node$__props === void 0 || (_node$__props$onChang = _node$__props.onChange) === null || _node$__props$onChang === void 0 || _node$__props$onChang.call(_node$__props, value, options);
170
+ });
171
+ }, [editor, node]);
172
+ var handleClear = useCallback(function () {
173
+ editor.update(function () {
174
+ var _node$__props2, _node$__props2$onClea;
175
+ node.setValue(undefined);
176
+ (_node$__props2 = node.__props) === null || _node$__props2 === void 0 || (_node$__props2$onClea = _node$__props2.onClear) === null || _node$__props2$onClea === void 0 || _node$__props2$onClea.call(_node$__props2);
177
+ });
178
+ }, [editor, node]);
179
+ return /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({}, selectProps), {}, {
180
+ value: node.getValue(),
181
+ onChange: handleChange,
182
+ onClear: handleClear
183
+ }));
184
+ }
185
+ export function $createSelectNode(props) {
186
+ return new SelectNode(props);
187
+ }
188
+
189
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
190
+ export function $isSelectNode(node) {
191
+ return node instanceof SelectNode;
192
+ }
193
+ export function $insertSelectNode(editor, props) {
194
+ editor.update(function () {
195
+ var selectNode = $createSelectNode(_objectSpread(_objectSpread({}, props), {}, {
196
+ containerStyle: _objectSpread({
197
+ paddingLeft: '8px',
198
+ paddingRight: '8px'
199
+ }, props.containerStyle)
200
+ }));
201
+ insertNodeAtCursor(editor, selectNode);
202
+ });
203
+ }
204
+ //# sourceMappingURL=SelectNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useLexicalComposerContext","Select","insertNodeAtCursor","updateDomStyle","BaseDecoratorNode","jsx","_jsx","SelectNode","_BaseDecoratorNode","_inherits","_super","_createSuper","props","_props$defaultValue","_this","_classCallCheck","call","_defineProperty","_assertThisInitialized","__value","defaultValue","undefined","_createClass","key","value","exportJSON","_objectSpread","_get","_getPrototypeOf","prototype","__props","type","getType","version","createDOM","_this$__props","span","document","createElement","containerStyle","updateDOM","decorate","SelectComponent","node","isInline","getTextContent","_this$__props2","_this2","_this$__props4","content","valueContent","String","textContentMode","_this$__props3","option","options","find","opt","label","spaceAround","concat","getValue","setValue","writable","getWritable","getPropValue","propName","_this$__props5","setProps","clone","getKey","importJSON","serializedNode","$createSelectNode","_ref","_ref2","selectProps","_objectWithoutProperties","_excluded","_useLexicalComposerCo","_useLexicalComposerCo2","_slicedToArray","editor","handleChange","update","_node$__props","_node$__props$onChang","onChange","handleClear","_node$__props2","_node$__props2$onClea","onClear","$isSelectNode","$insertSelectNode","selectNode","paddingLeft","paddingRight"],"sources":["../../../../src/components/Lexical/nodes/SelectNode.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useCallback } from 'react';\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { Select } from 'antd';\nimport type { SelectProps } from 'antd';\nimport type { BaseOptionType, DefaultOptionType } from 'antd/es/select';\nimport type { LexicalEditor, LexicalNode, SerializedLexicalNode, Spread } from 'lexical';\nimport { insertNodeAtCursor, updateDomStyle } from '../helpers';\nimport type { BaseDecoratorNodeProps } from './base';\nimport { BaseDecoratorNode } from './base';\n\nexport interface SelectNodeProps<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n> extends SelectProps<ValueType, OptionType>,\n BaseDecoratorNodeProps {\n /**\n * 在获取editor的textContent时,是否将选项的label作为文本内容插入到编辑器中,默认 `value`\n *\n * - `label` - 将选项的label作为文本内容\n * - `value` - 将选项的value作为文本内容\n */\n textContentMode?: 'label' | 'value';\n /** 是否在`textContext`两边添加一个空格,默认`true` */\n spaceAround?: boolean;\n /** 容器样式 */\n containerStyle?: CSSProperties;\n}\n\nexport class SelectNode<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n> extends BaseDecoratorNode<ReactNode, SelectNodeProps<ValueType, OptionType>> {\n __value: ValueType | undefined;\n\n constructor(props?: SelectNodeProps<ValueType, OptionType> & { key?: string }) {\n super(props);\n this.__value = props?.defaultValue ?? undefined;\n }\n static getType(): string {\n return 'antd.Select';\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static clone<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(\n node: SelectNode<ValueType, OptionType>\n ): SelectNode<ValueType, OptionType> {\n return new SelectNode<ValueType, OptionType>({ ...node.__props, key: node.getKey() });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static importJSON<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(\n serializedNode: SerializedSelectNode<ValueType, OptionType>\n ): SelectNode<ValueType, OptionType> {\n return $createSelectNode(serializedNode.props);\n }\n\n exportJSON(): SerializedSelectNode<ValueType, OptionType> {\n return {\n ...super.exportJSON(),\n props: this.__props,\n type: this.getType(),\n version: 1,\n };\n }\n\n createDOM(): HTMLElement {\n const span = document.createElement('span');\n updateDomStyle(span, this.__props?.containerStyle);\n return span;\n }\n\n updateDOM(): false {\n return false;\n }\n\n decorate(): ReactNode {\n return <SelectComponent node={this} />;\n }\n\n isInline(): boolean {\n return true;\n }\n\n getTextContent(): string {\n let content: string;\n const valueContent = this.__value ? String(this.__value) : '';\n if (this.__props?.textContentMode === 'label') {\n const option = this.__props?.options?.find((opt) => opt.value === this.__value);\n content = option?.label ? String(option.label) : valueContent;\n } else {\n content = valueContent;\n }\n if (this.__props?.spaceAround !== false) {\n return ` ${content} `;\n }\n return content;\n }\n\n getValue(): ValueType | undefined {\n return this.__value;\n }\n\n setValue(value: ValueType | undefined): void {\n const writable = this.getWritable();\n writable.__value = value;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getPropValue(propName: keyof SelectNodeProps<ValueType, OptionType>): any {\n return this.__props?.[propName];\n }\n\n setProps(props: SelectNodeProps<ValueType, OptionType>): void {\n const writable = this.getWritable();\n writable.__props = {\n ...writable.__props,\n ...props,\n };\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction SelectComponent<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>({\n node,\n}: SelectComponentProps<ValueType, OptionType>): ReactNode {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n const { textContentMode, spaceAround, containerStyle, ...selectProps } = node.__props || {};\n /* eslint-enable @typescript-eslint/no-unused-vars */\n const [editor] = useLexicalComposerContext();\n\n const handleChange = useCallback<NonNullable<SelectNodeProps<ValueType, OptionType>['onChange']>>(\n (value, options) => {\n editor.update(() => {\n node.setValue(value);\n node.__props?.onChange?.(value, options);\n });\n },\n [editor, node]\n );\n\n const handleClear = useCallback(() => {\n editor.update(() => {\n node.setValue(undefined);\n node.__props?.onClear?.();\n });\n }, [editor, node]);\n\n return <Select {...selectProps} value={node.getValue()} onChange={handleChange} onClear={handleClear} />;\n}\n\nexport function $createSelectNode<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n>(props?: SelectNodeProps<ValueType, OptionType>): SelectNode<ValueType, OptionType> {\n return new SelectNode<ValueType, OptionType>(props);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function $isSelectNode(node: LexicalNode | null | undefined): node is SelectNode<any, any> {\n return node instanceof SelectNode;\n}\n\nexport function $insertSelectNode<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n>(editor: LexicalEditor, props: SelectNodeProps<ValueType, OptionType>): void {\n editor.update(() => {\n const selectNode = $createSelectNode<ValueType, OptionType>({\n ...props,\n containerStyle: {\n paddingLeft: '8px',\n paddingRight: '8px',\n ...props.containerStyle,\n },\n });\n insertNodeAtCursor(editor, selectNode);\n });\n}\n\ninterface SelectComponentProps<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n> {\n node: SelectNode<ValueType, OptionType>;\n}\nexport type SerializedSelectNode<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ValueType = any,\n OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,\n> = Spread<\n {\n props?: SelectNodeProps<ValueType, OptionType>;\n },\n SerializedLexicalNode\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAA6CA,WAAW,QAAQ,OAAO;AACvE,SAASC,yBAAyB,QAAQ,uCAAuC;AACjF,SAASC,MAAM,QAAQ,MAAM;AAI7B,SAASC,kBAAkB,EAAEC,cAAc;AAE3C,SAASC,iBAAiB;AAAiB,SAAAC,GAAA,IAAAC,IAAA;AAqB3C,WAAaC,UAAU,0BAAAC,kBAAA;EAAAC,SAAA,CAAAF,UAAA,EAAAC,kBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,UAAA;EAOrB,SAAAA,WAAYK,KAAiE,EAAE;IAAA,IAAAC,mBAAA;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAR,UAAA;IAC7EO,KAAA,GAAAJ,MAAA,CAAAM,IAAA,OAAMJ,KAAK;IAAEK,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IACbA,KAAA,CAAKK,OAAO,IAAAN,mBAAA,GAAGD,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEQ,YAAY,cAAAP,mBAAA,cAAAA,mBAAA,GAAIQ,S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