easy-email-extensions 4.15.0 → 4.16.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/index.d.ts +2 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/tableCellBgSelector.d.ts +6 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/tableMenuConfig.d.ts +44 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/tableOperationMenu.d.ts +65 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/tableTool.d.ts +45 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/type.d.ts +21 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/Operation/util.d.ts +23 -0
- package/lib/AttributePanel/components/blocks/AdvancedTable/index.d.ts +2 -0
- package/lib/AttributePanel/components/blocks/index.d.ts +2 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index2.js +1040 -152
- package/lib/index2.js.map +1 -1
- package/lib/utils/getIconNameByBlockType.d.ts +1 -0
- package/package.json +3 -2
- package/readme.md +0 -233
package/lib/index2.js
CHANGED
@@ -56,9 +56,9 @@ var __async = (__this, __arguments, generator) => {
|
|
56
56
|
};
|
57
57
|
import * as React from "react";
|
58
58
|
import React__default, { Children, isValidElement, cloneElement, createContext, useContext, Component, useMemo, memo, forwardRef, useEffect, useRef, useLayoutEffect, useState, useImperativeHandle, PureComponent, useCallback, useReducer, createRef, Fragment, createElement, Suspense } from "react";
|
59
|
-
import { IconFont, useEditorProps, Stack as Stack$4, useRefState, getShadowRoot, DATA_CONTENT_EDITABLE_TYPE, ContentEditableType, TextStyle, useEditorContext, useBlock, useFocusIdx, useFocusBlockLayout, MergeTagBadge, FIXED_CONTAINER_ID, getPluginElement, RICH_TEXT_BAR_ID, CONTENT_EDITABLE_CLASS_NAME, getEditorRoot,
|
59
|
+
import { IconFont, useEditorProps, Stack as Stack$4, useRefState, getShadowRoot, DATA_CONTENT_EDITABLE_TYPE, ContentEditableType, TextStyle, useEditorContext, useBlock, useFocusIdx, DATA_CONTENT_EDITABLE_IDX, useFocusBlockLayout, MergeTagBadge, FIXED_CONTAINER_ID, getPluginElement, RICH_TEXT_BAR_ID, CONTENT_EDITABLE_CLASS_NAME, getEditorRoot, scrollBlockEleIntoView, useHoverIdx, useDataTransfer, getBlockNodeByChildEle, getDirectionPosition, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, isTextBlock, getBlockNodeByIdx, useLazyState, useActiveTab, ActiveTabKeys } from "easy-email-editor";
|
60
60
|
import { BasicType, ImageManager, EMAIL_BLOCK_CLASS_NAME, BlockManager, createBlockDataByType, AdvancedType, Operator, OperatorSymbol, isAdvancedBlock, getParentByIdx, getParentIdx, getIndexByIdx, getSiblingIdx, getNodeIdxFromClassName, getNodeIdxClassName, getPageIdx, getChildIdx, JsonToMjml, getNodeTypeFromClassName } from "easy-email-core";
|
61
|
-
import ReactDOM, { findDOMNode, createPortal } from "react-dom";
|
61
|
+
import ReactDOM, { findDOMNode, render, createPortal } from "react-dom";
|
62
62
|
import { Field, useForm as useForm$1, useField, Form as Form$3, version as version$2, useFormState } from "react-final-form";
|
63
63
|
import { v4 } from "uuid";
|
64
64
|
import mjml from "mjml-browser";
|
@@ -5814,7 +5814,7 @@ var Transition = /* @__PURE__ */ function(_React$Component) {
|
|
5814
5814
|
setTimeout(this.nextCallback, timeout);
|
5815
5815
|
}
|
5816
5816
|
};
|
5817
|
-
_proto.render = function
|
5817
|
+
_proto.render = function render2() {
|
5818
5818
|
var status = this.state.status;
|
5819
5819
|
if (status === UNMOUNTED) {
|
5820
5820
|
return null;
|
@@ -5984,7 +5984,7 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
5984
5984
|
removeClass(node, doneClassName);
|
5985
5985
|
}
|
5986
5986
|
};
|
5987
|
-
_proto.render = function
|
5987
|
+
_proto.render = function render2() {
|
5988
5988
|
var _this$props = this.props;
|
5989
5989
|
_this$props.classNames;
|
5990
5990
|
var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
|
@@ -6166,7 +6166,7 @@ var TransitionGroup = /* @__PURE__ */ function(_React$Component) {
|
|
6166
6166
|
});
|
6167
6167
|
}
|
6168
6168
|
};
|
6169
|
-
_proto.render = function
|
6169
|
+
_proto.render = function render2() {
|
6170
6170
|
var _this$props = this.props, Component2 = _this$props.component, childFactory2 = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
6171
6171
|
var contextValue = this.state.contextValue;
|
6172
6172
|
var children = values(this.state.children).map(childFactory2);
|
@@ -6297,7 +6297,7 @@ var SwitchTransition = /* @__PURE__ */ function(_React$Component) {
|
|
6297
6297
|
})
|
6298
6298
|
};
|
6299
6299
|
};
|
6300
|
-
_proto.render = function
|
6300
|
+
_proto.render = function render2() {
|
6301
6301
|
var _this$props = this.props, children = _this$props.children, mode = _this$props.mode, _this$state = this.state, status = _this$state.status, current = _this$state.current;
|
6302
6302
|
var data = {
|
6303
6303
|
children,
|
@@ -9152,7 +9152,7 @@ var ResizeObserverSPI = function() {
|
|
9152
9152
|
return ResizeObserverSPI2;
|
9153
9153
|
}();
|
9154
9154
|
var observers = typeof WeakMap !== "undefined" ? new WeakMap() : new MapShim();
|
9155
|
-
var ResizeObserver$
|
9155
|
+
var ResizeObserver$2 = function() {
|
9156
9156
|
function ResizeObserver2(callback) {
|
9157
9157
|
if (!(this instanceof ResizeObserver2)) {
|
9158
9158
|
throw new TypeError("Cannot call a class as a function.");
|
@@ -9171,7 +9171,7 @@ var ResizeObserver$1 = function() {
|
|
9171
9171
|
"unobserve",
|
9172
9172
|
"disconnect"
|
9173
9173
|
].forEach(function(method) {
|
9174
|
-
ResizeObserver$
|
9174
|
+
ResizeObserver$2.prototype[method] = function() {
|
9175
9175
|
var _a;
|
9176
9176
|
return (_a = observers.get(this))[method].apply(_a, arguments);
|
9177
9177
|
};
|
@@ -9180,7 +9180,7 @@ var index$1 = function() {
|
|
9180
9180
|
if (typeof global$1.ResizeObserver !== "undefined") {
|
9181
9181
|
return global$1.ResizeObserver;
|
9182
9182
|
}
|
9183
|
-
return ResizeObserver$
|
9183
|
+
return ResizeObserver$2;
|
9184
9184
|
}();
|
9185
9185
|
var __extends$6 = globalThis && globalThis.__extends || function() {
|
9186
9186
|
var extendStatics = function(d, b) {
|
@@ -9242,7 +9242,7 @@ var ResizeObserverComponent = function(_super) {
|
|
9242
9242
|
};
|
9243
9243
|
return ResizeObserverComponent2;
|
9244
9244
|
}(React__default.Component);
|
9245
|
-
var ResizeObserver = ResizeObserverComponent;
|
9245
|
+
var ResizeObserver$1 = ResizeObserverComponent;
|
9246
9246
|
var useIsomorphicLayoutEffect = isServerRendering ? useEffect : useLayoutEffect;
|
9247
9247
|
var useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
|
9248
9248
|
var __read$1d = globalThis && globalThis.__read || function(o, n) {
|
@@ -10190,7 +10190,7 @@ var InputComponent = React__default.forwardRef(function(props, ref) {
|
|
10190
10190
|
onMouseDown: function(e) {
|
10191
10191
|
e.preventDefault();
|
10192
10192
|
}
|
10193
|
-
})) : null) : React__default.createElement("input", __assign$1n({ ref: refInput }, inputProps, { style: hasParent ? {} : __assign$1n(__assign$1n({}, style), "height" in props ? { height } : {}) })), autoFitWidth && React__default.createElement(ResizeObserver, { onResize: function() {
|
10193
|
+
})) : null) : React__default.createElement("input", __assign$1n({ ref: refInput }, inputProps, { style: hasParent ? {} : __assign$1n(__assign$1n({}, style), "height" in props ? { height } : {}) })), autoFitWidth && React__default.createElement(ResizeObserver$1, { onResize: function() {
|
10194
10194
|
var inputWidth = refInputMirror.current.offsetWidth;
|
10195
10195
|
if (typeof autoFitWidth === "object") {
|
10196
10196
|
var delay = typeof autoFitWidth.delay === "function" ? autoFitWidth.delay(inputWidth, refPrevInputWidth.current) : autoFitWidth.delay;
|
@@ -11389,7 +11389,7 @@ var Trigger = function(_super) {
|
|
11389
11389
|
}
|
11390
11390
|
var prefixCls2 = getPrefixCls("trigger");
|
11391
11391
|
var popupClassName = cs$1(prefixCls2, childrenPrefix, prefixCls2 + "-position-" + position, className);
|
11392
|
-
var childrenComponent = isExistChildren && React__default.createElement(ResizeObserver, { onResize: this.onResize }, React__default.cloneElement(child, __assign$1i({}, mergeProps2)));
|
11392
|
+
var childrenComponent = isExistChildren && React__default.createElement(ResizeObserver$1, { onResize: this.onResize }, React__default.cloneElement(child, __assign$1i({}, mergeProps2)));
|
11393
11393
|
var portalContent = React__default.createElement(CSSTransition$1, { in: !!popupVisible, timeout: duration2, classNames, unmountOnExit, appear: true, mountOnEnter: true, onEnter: function(e) {
|
11394
11394
|
e.style.display = "initial";
|
11395
11395
|
e.style.pointerEvents = "none";
|
@@ -11411,7 +11411,7 @@ var Trigger = function(_super) {
|
|
11411
11411
|
_this.triggerRef = null;
|
11412
11412
|
}
|
11413
11413
|
_this.setState({ popupStyle: {} });
|
11414
|
-
} }, React__default.createElement(ResizeObserver, { onResize: this.onResize }, React__default.createElement("span", __assign$1i({ ref: function(node) {
|
11414
|
+
} }, React__default.createElement(ResizeObserver$1, { onResize: this.onResize }, React__default.createElement("span", __assign$1i({ ref: function(node) {
|
11415
11415
|
return _this.triggerRef = node;
|
11416
11416
|
}, "trigger-placement": this.realPosition, style: __assign$1i(__assign$1i(__assign$1i({ width: autoAlignPopupWidth && (style === null || style === void 0 ? void 0 : style.width) === void 0 ? (_c = this.childrenDomSize) === null || _c === void 0 ? void 0 : _c.width : "" }, popupStyle), { position: "absolute", zIndex: zIndex || "" }), style) }, popupEventProps, { className: popupClassName }), React__default.createElement(popupChildren.type, __assign$1i({ ref: popupChildren.ref }, popupChildren.props, { style: __assign$1i(__assign$1i({}, popupChildren.props.style), dropdownPopupStyle) })), (showArrow || arrowProps) && React__default.createElement("div", { className: cs$1(prefixCls2 + "-arrow-container", (_a = {}, _a[childrenPrefix + "-arrow-container"] = childrenPrefix, _a)) }, React__default.createElement("div", __assign$1i({}, arrowProps, { className: cs$1(prefixCls2 + "-arrow", (_b = {}, _b[childrenPrefix + "-arrow"] = childrenPrefix, _b), arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.className), style: __assign$1i(__assign$1i({}, this.arrowStyle), arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.style) }))))));
|
11417
11417
|
var portal = popupVisible || this.triggerRef ? React__default.createElement(Portal$4, { getContainer: this.getContainer }, portalContent) : null;
|
@@ -13472,7 +13472,7 @@ var VirtualList = React__default.forwardRef(function(props, ref) {
|
|
13472
13472
|
}
|
13473
13473
|
return null;
|
13474
13474
|
};
|
13475
|
-
return React__default.createElement(ResizeObserver, { onResize: function() {
|
13475
|
+
return React__default.createElement(ResizeObserver$1, { onResize: function() {
|
13476
13476
|
if (refList.current && !isNumber$2(styleListMaxHeight)) {
|
13477
13477
|
var clientHeight = refList.current.clientHeight;
|
13478
13478
|
setStateHeight(clientHeight);
|
@@ -14540,7 +14540,7 @@ function Select$1(baseProps, ref) {
|
|
14540
14540
|
}
|
14541
14541
|
};
|
14542
14542
|
}, [hotkeyHandler, optionInfoMap, valueActive]);
|
14543
|
-
return React__default.createElement(ResizeObserver, { onResize: function() {
|
14543
|
+
return React__default.createElement(ResizeObserver$1, { onResize: function() {
|
14544
14544
|
return refTrigger.current.updatePopupPosition();
|
14545
14545
|
} }, React__default.createElement(Trigger$1, __assign$18({ ref: function(ref2) {
|
14546
14546
|
return refTrigger.current = ref2;
|
@@ -16442,7 +16442,7 @@ function ResizeTrigger(props) {
|
|
16442
16442
|
if (!resizable) {
|
16443
16443
|
return React__default.createElement("div", { className: classNames }, isFunction$5(renderChildren) ? renderChildren(prev, trigger, next) : children || renderIcon());
|
16444
16444
|
}
|
16445
|
-
return React__default.createElement(ResizeObserver, { onResize }, React__default.createElement("div", { className: classNames, onMouseDown }, isFunction$5(renderChildren) ? renderChildren(prev, trigger, next) : children || renderIcon()));
|
16445
|
+
return React__default.createElement(ResizeObserver$1, { onResize }, React__default.createElement("div", { className: classNames, onMouseDown }, isFunction$5(renderChildren) ? renderChildren(prev, trigger, next) : children || renderIcon()));
|
16446
16446
|
}
|
16447
16447
|
var __read$O = globalThis && globalThis.__read || function(o, n) {
|
16448
16448
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
@@ -19687,7 +19687,7 @@ function withSideEffect(reducePropsToState2, handleStateChangeOnClient2) {
|
|
19687
19687
|
mountedInstances.splice(index2, 1);
|
19688
19688
|
emitChange();
|
19689
19689
|
};
|
19690
|
-
_proto.render = function
|
19690
|
+
_proto.render = function render2() {
|
19691
19691
|
return /* @__PURE__ */ React__default.createElement(WrappedComponent, this.props);
|
19692
19692
|
};
|
19693
19693
|
return SideEffect2;
|
@@ -24419,7 +24419,7 @@ var defaultProps$7 = {
|
|
24419
24419
|
function List(baseProps, ref) {
|
24420
24420
|
var _a = useContext(ConfigContext), getPrefixCls = _a.getPrefixCls, loadingElement = _a.loadingElement, ctxSize = _a.size, renderEmpty2 = _a.renderEmpty, componentConfig2 = _a.componentConfig;
|
24421
24421
|
var props = useMergeProps(baseProps, defaultProps$7, componentConfig2 === null || componentConfig2 === void 0 ? void 0 : componentConfig2.List);
|
24422
|
-
var style = props.style, wrapperStyle = props.wrapperStyle, className = props.className, wrapperClassName = props.wrapperClassName, _b = props.children, children = _b === void 0 ? [] : _b, _c = props.dataSource, dataSource = _c === void 0 ? [] : _c, propSize = props.size, footer = props.footer, header = props.header, pagination = props.pagination, bordered = props.bordered, split = props.split,
|
24422
|
+
var style = props.style, wrapperStyle = props.wrapperStyle, className = props.className, wrapperClassName = props.wrapperClassName, _b = props.children, children = _b === void 0 ? [] : _b, _c = props.dataSource, dataSource = _c === void 0 ? [] : _c, propSize = props.size, footer = props.footer, header = props.header, pagination = props.pagination, bordered = props.bordered, split = props.split, render2 = props.render, grid = props.grid, loading = props.loading, hoverable = props.hoverable, scrollLoading = props.scrollLoading, paginationInFooter = props.paginationInFooter, offsetBottom = props.offsetBottom, throttleDelay = props.throttleDelay, defaultCurrent = props.defaultCurrent, noDataElement = props.noDataElement, listRef = props.listRef, onReachBottom = props.onReachBottom, onListScroll = props.onListScroll;
|
24423
24423
|
var size = propSize || (SizeList.indexOf(ctxSize) > -1 ? ctxSize : "default");
|
24424
24424
|
var prefixCls2 = getPrefixCls("list");
|
24425
24425
|
var refDom = useRef(null);
|
@@ -24477,11 +24477,11 @@ function List(baseProps, ref) {
|
|
24477
24477
|
var startIndex = (current - 1) * pageSize2;
|
24478
24478
|
return pagination && items.length > startIndex ? items.slice(startIndex, startIndex + pageSize2) : items;
|
24479
24479
|
};
|
24480
|
-
var getItems = function(originItems,
|
24480
|
+
var getItems = function(originItems, render3) {
|
24481
24481
|
var currentPageItems = getCurrentPageItems(originItems);
|
24482
|
-
return
|
24482
|
+
return render3 ? currentPageItems.map(render3) : currentPageItems;
|
24483
24483
|
};
|
24484
|
-
var getGrid = function(originItems,
|
24484
|
+
var getGrid = function(originItems, render3) {
|
24485
24485
|
var currentPageItems = getCurrentPageItems(originItems);
|
24486
24486
|
if (grid.column || grid.span) {
|
24487
24487
|
var items = [];
|
@@ -24493,7 +24493,7 @@ function List(baseProps, ref) {
|
|
24493
24493
|
var nextStartNum = startNum_1 + rowSize;
|
24494
24494
|
var currentRow = ~~(startNum_1 / rowSize);
|
24495
24495
|
items.push(React__default.createElement(Row$2, { key: currentRow, className: prefixCls2 + "-row", gutter, justify, align }, currentPageItems.slice(startNum_1, nextStartNum).map(function(item2, index2) {
|
24496
|
-
return React__default.createElement(Col$2, __assign$r({ key: currentRow + "_" + index2, className: prefixCls2 + "-row-col" }, colProps_1, { span: span_1 }),
|
24496
|
+
return React__default.createElement(Col$2, __assign$r({ key: currentRow + "_" + index2, className: prefixCls2 + "-row-col" }, colProps_1, { span: span_1 }), render3 ? render3(item2, startNum_1 + index2) : item2);
|
24497
24497
|
})));
|
24498
24498
|
startNum_1 = nextStartNum;
|
24499
24499
|
};
|
@@ -24503,11 +24503,11 @@ function List(baseProps, ref) {
|
|
24503
24503
|
return items;
|
24504
24504
|
}
|
24505
24505
|
return React__default.createElement(Row$2, { className: prefixCls2 + "-row", gutter: grid.gutter }, currentPageItems.map(function(item2, index2) {
|
24506
|
-
return React__default.createElement(Col$2, __assign$r({ className: prefixCls2 + "-row-col" }, omit$1(grid, ["gutter"]), { key: index2 }),
|
24506
|
+
return React__default.createElement(Col$2, __assign$r({ className: prefixCls2 + "-row-col" }, omit$1(grid, ["gutter"]), { key: index2 }), render3 ? render3(item2, index2) : item2);
|
24507
24507
|
}));
|
24508
24508
|
};
|
24509
|
-
if (dataSource.length > 0 &&
|
24510
|
-
return grid ? getGrid(dataSource,
|
24509
|
+
if (dataSource.length > 0 && render2) {
|
24510
|
+
return grid ? getGrid(dataSource, render2) : getItems(dataSource, render2);
|
24511
24511
|
}
|
24512
24512
|
if (childrenCount > 0) {
|
24513
24513
|
return grid ? getGrid(children) : getItems(children);
|
@@ -24593,10 +24593,10 @@ function confirm(config2, renderFunc) {
|
|
24593
24593
|
var div = document.createElement("div");
|
24594
24594
|
document.body.appendChild(div);
|
24595
24595
|
var configProviderProps = getConfigProviderProps();
|
24596
|
-
function
|
24596
|
+
function render2(props) {
|
24597
24597
|
ReactDOM.render(React__default.createElement(ConfigProvider, __assign$q({}, configProviderProps), React__default.createElement(ConfirmModal, __assign$q({}, props, { onCancel }))), div);
|
24598
24598
|
}
|
24599
|
-
var renderFunction = renderFunc ||
|
24599
|
+
var renderFunction = renderFunc || render2;
|
24600
24600
|
var modalConfig2 = __assign$q(__assign$q({}, config2), { visible: false });
|
24601
24601
|
var onOk = function() {
|
24602
24602
|
var ret;
|
@@ -26287,7 +26287,7 @@ var __assign$g = globalThis && globalThis.__assign || function() {
|
|
26287
26287
|
var TabHeaderTitle = function(_a, ref) {
|
26288
26288
|
var _b;
|
26289
26289
|
var prefixCls2 = _a.prefixCls, onDeleteTab = _a.onDeleteTab, tabKey = _a.tabKey, isActive = _a.isActive, onClickTab = _a.onClickTab, _c = _a.disabled, disabled = _c === void 0 ? false : _c, title2 = _a.title, editable = _a.editable, renderTitle = _a.renderTitle, deleteIcon = _a.deleteIcon, deleteButton = _a.deleteButton, getIdPrefix = _a.getIdPrefix, index2 = _a.index;
|
26290
|
-
var
|
26290
|
+
var render2 = isFunction$5(renderTitle) ? renderTitle : function(node) {
|
26291
26291
|
return node;
|
26292
26292
|
};
|
26293
26293
|
var handleDeleteTab = function(e) {
|
@@ -26301,7 +26301,7 @@ var TabHeaderTitle = function(_a, ref) {
|
|
26301
26301
|
return;
|
26302
26302
|
onClickTab(e);
|
26303
26303
|
};
|
26304
|
-
return
|
26304
|
+
return render2(React__default.createElement("div", { ref, key: tabKey, className: cs$1(prefixCls2 + "-header-title", (_b = {}, _b[prefixCls2 + "-header-title-active"] = isActive, _b[prefixCls2 + "-header-title-editable"] = editable, _b[prefixCls2 + "-header-title-disabled"] = disabled, _b)), role: "tab", "aria-selected": isActive, tabIndex: disabled ? -1 : 0, "aria-disabled": disabled || void 0, id: getIdPrefix(index2).tab, "aria-controls": getIdPrefix(index2).tabpane, onClick: handleTabClick, onKeyDown: function(event2) {
|
26305
26305
|
var keyCode = event2.keyCode || event2.which;
|
26306
26306
|
if (keyCode === Enter.code) {
|
26307
26307
|
handleTabClick(event2);
|
@@ -26716,7 +26716,7 @@ var TabHeader = React__default.forwardRef(function(props, ref) {
|
|
26716
26716
|
direction,
|
26717
26717
|
align,
|
26718
26718
|
onChange: updateHeaderOffset
|
26719
|
-
}), React__default.createElement(ResizeObserver, { onResize: onWrapperResize }, React__default.createElement("div", { className: prefixCls2 + "-header-wrapper", ref: headerWrapperRef }, React__default.createElement(ResizeObserver, { onResize: onHeaderResize }, React__default.createElement("div", { className: cs$1(prefixCls2 + "-header", (_b = {}, _b[prefixCls2 + "-header-no-padding"] = !props.headerPadding && direction === "horizontal" && ["line", "text"].indexOf(type) > -1, _b)), ref: headerRef, style: headerStyle }, paneChildren.map(function(child, index2) {
|
26719
|
+
}), React__default.createElement(ResizeObserver$1, { onResize: onWrapperResize }, React__default.createElement("div", { className: prefixCls2 + "-header-wrapper", ref: headerWrapperRef }, React__default.createElement(ResizeObserver$1, { onResize: onHeaderResize }, React__default.createElement("div", { className: cs$1(prefixCls2 + "-header", (_b = {}, _b[prefixCls2 + "-header-no-padding"] = !props.headerPadding && direction === "horizontal" && ["line", "text"].indexOf(type) > -1, _b)), ref: headerRef, style: headerStyle }, paneChildren.map(function(child, index2) {
|
26720
26720
|
return React__default.createElement(TabHeaderTitle$1, __assign$f({ key: index2, ref: function(node) {
|
26721
26721
|
titleRef.current[child.key] = node;
|
26722
26722
|
}, tabKey: child.key }, child.props, { prefixCls: prefixCls2, onDeleteTab: function() {
|
@@ -30056,7 +30056,7 @@ function Base(props) {
|
|
30056
30056
|
} else if (componentType === "Text") {
|
30057
30057
|
TextComponent = ellipsis ? "div" : "span";
|
30058
30058
|
}
|
30059
|
-
var node = React__default.createElement(ResizeObserver, { onResize: handleResize }, React__default.createElement(TextComponent, __assign$3({ className: cs$1(prefixCls2, componentClassName, className) }, baseProps, omit$1(rest, [
|
30059
|
+
var node = React__default.createElement(ResizeObserver$1, { onResize: handleResize }, React__default.createElement(TextComponent, __assign$3({ className: cs$1(prefixCls2, componentClassName, className) }, baseProps, omit$1(rest, [
|
30060
30060
|
"spacing",
|
30061
30061
|
"type",
|
30062
30062
|
"close",
|
@@ -33258,7 +33258,7 @@ function useFontFamily() {
|
|
33258
33258
|
fontList: fontList2
|
33259
33259
|
};
|
33260
33260
|
}
|
33261
|
-
var styleText$
|
33261
|
+
var styleText$2 = ".easy-email-extensions-Tools-Popover .arco-popover-content{padding:0}.easy-email-extensions-Tools-Popover .arco-popover-content-inner *::-webkit-scrollbar{-webkit-appearance:none;width:5px}.easy-email-extensions-Tools-Popover .arco-popover-content-inner *::-webkit-scrollbar-thumb{border-radius:5px;background-color:#00000080;box-shadow:0 0 1px #ffffff80;-webkit-box-shadow:0 0 1px rgba(255,255,255,.5)}\n";
|
33262
33262
|
function FontFamily$1(props) {
|
33263
33263
|
const { fontList: fontList2 } = useFontFamily();
|
33264
33264
|
const { execCommand } = props;
|
@@ -33277,7 +33277,7 @@ function FontFamily$1(props) {
|
|
33277
33277
|
className: "easy-email-extensions-Tools-Popover",
|
33278
33278
|
popupVisible: visible,
|
33279
33279
|
onVisibleChange,
|
33280
|
-
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$
|
33280
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$2), /* @__PURE__ */ React__default.createElement("div", {
|
33281
33281
|
style: {
|
33282
33282
|
maxWidth: 150,
|
33283
33283
|
maxHeight: 350,
|
@@ -33304,15 +33304,15 @@ var ARRAY_ERROR = "FINAL_FORM/array-error";
|
|
33304
33304
|
var fieldSubscriptionItems = ["active", "data", "dirty", "dirtySinceLastSubmit", "error", "initial", "invalid", "length", "modified", "modifiedSinceLastSubmit", "pristine", "submitError", "submitFailed", "submitSucceeded", "submitting", "touched", "valid", "value", "visited", "validating"];
|
33305
33305
|
var version$1 = "4.20.4";
|
33306
33306
|
function renderComponent(props, name2) {
|
33307
|
-
var
|
33307
|
+
var render2 = props.render, children = props.children, component = props.component, rest = _objectWithoutPropertiesLoose(props, ["render", "children", "component"]);
|
33308
33308
|
if (component) {
|
33309
33309
|
return /* @__PURE__ */ createElement(component, _extends({}, rest, {
|
33310
33310
|
children,
|
33311
|
-
render
|
33311
|
+
render: render2
|
33312
33312
|
}));
|
33313
33313
|
}
|
33314
|
-
if (
|
33315
|
-
return
|
33314
|
+
if (render2) {
|
33315
|
+
return render2(children === void 0 ? rest : _extends({}, rest, {
|
33316
33316
|
children
|
33317
33317
|
}));
|
33318
33318
|
}
|
@@ -34518,14 +34518,135 @@ function Direction() {
|
|
34518
34518
|
}));
|
34519
34519
|
}, [focusIdx2]);
|
34520
34520
|
}
|
34521
|
+
function getContextMergeTags(mergeTags2, context, idx) {
|
34522
|
+
const loop = (currentIdx, combineMergeTags) => {
|
34523
|
+
var _a, _b;
|
34524
|
+
const parentBlockData = lodash.exports.get(context, currentIdx);
|
34525
|
+
if (!parentBlockData)
|
34526
|
+
return combineMergeTags;
|
34527
|
+
const dataSource = (_b = (_a = parentBlockData.data) == null ? void 0 : _a.value) == null ? void 0 : _b.dataSource;
|
34528
|
+
if (!dataSource)
|
34529
|
+
return combineMergeTags;
|
34530
|
+
Object.keys(dataSource).forEach((key) => {
|
34531
|
+
let formatKey = dataSource[key];
|
34532
|
+
const loopFormatKey = (currentLoopKeyIdx) => {
|
34533
|
+
const currentParentIdx = getParentIdx(currentLoopKeyIdx);
|
34534
|
+
if (currentParentIdx) {
|
34535
|
+
const currentBlockData = lodash.exports.get(context, currentParentIdx);
|
34536
|
+
if (!currentBlockData)
|
34537
|
+
return formatKey;
|
34538
|
+
currentBlockData.data.value.dataSource && Object.keys(currentBlockData.data.value.dataSource).forEach((item2) => {
|
34539
|
+
formatKey = formatKey.replace(item2, currentBlockData.data.value.dataSource[item2].replace(/{{([^}}]+)}}/g, "$1"));
|
34540
|
+
});
|
34541
|
+
loopFormatKey(currentParentIdx);
|
34542
|
+
}
|
34543
|
+
};
|
34544
|
+
loopFormatKey(currentIdx);
|
34545
|
+
const dataSourcePath = formatKey.replace(/{{([^}}]+)}}/g, "$1");
|
34546
|
+
combineMergeTags = __spreadValues({
|
34547
|
+
[key]: lodash.exports.get(combineMergeTags, dataSourcePath)
|
34548
|
+
}, combineMergeTags);
|
34549
|
+
});
|
34550
|
+
const parentIdx = getParentIdx(currentIdx);
|
34551
|
+
if (!parentIdx)
|
34552
|
+
return combineMergeTags;
|
34553
|
+
return loop(parentIdx, combineMergeTags);
|
34554
|
+
};
|
34555
|
+
return loop(idx, lodash.exports.cloneDeep(mergeTags2));
|
34556
|
+
}
|
34557
|
+
const MergeTags$1 = React__default.memo((props) => {
|
34558
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
34559
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
34560
|
+
const {
|
34561
|
+
mergeTags: mergeTags2 = {},
|
34562
|
+
mergeTagGenerate,
|
34563
|
+
renderMergeTagContent
|
34564
|
+
} = useEditorProps();
|
34565
|
+
const { values: values2 } = useBlock();
|
34566
|
+
const contextMergeTags = useMemo(() => getContextMergeTags(mergeTags2, values2, focusIdx2), [mergeTags2, values2, focusIdx2]);
|
34567
|
+
const treeOptions = useMemo(() => {
|
34568
|
+
const treeData = [];
|
34569
|
+
const deep = (key, title2, parent2, mapData = []) => {
|
34570
|
+
const currentMapData = {
|
34571
|
+
key,
|
34572
|
+
value: key,
|
34573
|
+
title: title2,
|
34574
|
+
children: []
|
34575
|
+
};
|
34576
|
+
mapData.push(currentMapData);
|
34577
|
+
const current = parent2[title2];
|
34578
|
+
if (current && typeof current === "object") {
|
34579
|
+
Object.keys(current).map((childKey) => deep(key + "." + childKey, childKey, current, currentMapData.children));
|
34580
|
+
}
|
34581
|
+
};
|
34582
|
+
Object.keys(contextMergeTags).map((key) => deep(key, key, contextMergeTags, treeData));
|
34583
|
+
return treeData;
|
34584
|
+
}, [contextMergeTags]);
|
34585
|
+
const onSelect = useCallback((key) => {
|
34586
|
+
const value = lodash.exports.get(contextMergeTags, key);
|
34587
|
+
if (lodash.exports.isObject(value)) {
|
34588
|
+
setExpandedKeys((keys2) => {
|
34589
|
+
if (keys2.includes(key)) {
|
34590
|
+
return keys2.filter((k) => k !== key);
|
34591
|
+
} else {
|
34592
|
+
return [...keys2, key];
|
34593
|
+
}
|
34594
|
+
});
|
34595
|
+
return;
|
34596
|
+
}
|
34597
|
+
return props.onChange(mergeTagGenerate(key));
|
34598
|
+
}, [contextMergeTags, props, mergeTagGenerate]);
|
34599
|
+
const mergeTagContent = useMemo(() => renderMergeTagContent ? renderMergeTagContent({
|
34600
|
+
onChange: props.onChange,
|
34601
|
+
isSelect: Boolean(props.isSelect),
|
34602
|
+
value: props.value
|
34603
|
+
}) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null), [renderMergeTagContent, props.onChange, props.isSelect, props.value]);
|
34604
|
+
if (renderMergeTagContent) {
|
34605
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, mergeTagContent);
|
34606
|
+
}
|
34607
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
34608
|
+
style: { color: "#333" }
|
34609
|
+
}, props.isSelect ? /* @__PURE__ */ React__default.createElement(TreeSelect$1, {
|
34610
|
+
value: props.value,
|
34611
|
+
size: "small",
|
34612
|
+
dropdownMenuStyle: { maxHeight: 400, overflow: "auto" },
|
34613
|
+
placeholder: t("Please select"),
|
34614
|
+
treeData: treeOptions,
|
34615
|
+
onChange: (val) => onSelect(val)
|
34616
|
+
}) : /* @__PURE__ */ React__default.createElement(Tree$1, {
|
34617
|
+
expandedKeys,
|
34618
|
+
onExpand: setExpandedKeys,
|
34619
|
+
selectedKeys: [],
|
34620
|
+
treeData: treeOptions,
|
34621
|
+
onSelect: (vals) => onSelect(vals[0]),
|
34622
|
+
style: {
|
34623
|
+
maxHeight: 400,
|
34624
|
+
overflow: "auto"
|
34625
|
+
}
|
34626
|
+
}));
|
34627
|
+
});
|
34521
34628
|
function Link() {
|
34522
34629
|
const { focusIdx: focusIdx2 } = useFocusIdx();
|
34630
|
+
const { input } = useField(`${focusIdx2}.attributes.href`, {
|
34631
|
+
parse: (v) => v
|
34632
|
+
});
|
34523
34633
|
return useMemo(() => {
|
34524
34634
|
return /* @__PURE__ */ React__default.createElement(Grid.Row, null, /* @__PURE__ */ React__default.createElement(Grid.Col, {
|
34525
34635
|
span: 11
|
34526
34636
|
}, /* @__PURE__ */ React__default.createElement(TextField, {
|
34527
34637
|
prefix: /* @__PURE__ */ React__default.createElement(IconLink$1, null),
|
34528
|
-
label: /* @__PURE__ */ React__default.createElement("span", null, t("Href"), "\xA0\xA0\xA0"),
|
34638
|
+
label: /* @__PURE__ */ React__default.createElement(Space$1, null, /* @__PURE__ */ React__default.createElement("span", null, t("Href"), "\xA0\xA0\xA0"), /* @__PURE__ */ React__default.createElement(Popover$1, {
|
34639
|
+
trigger: "click",
|
34640
|
+
content: /* @__PURE__ */ React__default.createElement(MergeTags$1, {
|
34641
|
+
value: input.value,
|
34642
|
+
onChange: input.onChange
|
34643
|
+
})
|
34644
|
+
}, /* @__PURE__ */ React__default.createElement(Button$4, {
|
34645
|
+
type: "text",
|
34646
|
+
icon: /* @__PURE__ */ React__default.createElement(IconFont, {
|
34647
|
+
iconName: "icon-merge-tags"
|
34648
|
+
})
|
34649
|
+
}))),
|
34529
34650
|
name: `${focusIdx2}.attributes.href`
|
34530
34651
|
})), /* @__PURE__ */ React__default.createElement(Grid.Col, {
|
34531
34652
|
offset: 1,
|
@@ -34607,116 +34728,6 @@ function FontSize$1() {
|
|
34607
34728
|
autoComplete: "off"
|
34608
34729
|
});
|
34609
34730
|
}
|
34610
|
-
function getContextMergeTags(mergeTags2, context, idx) {
|
34611
|
-
const loop = (currentIdx, combineMergeTags) => {
|
34612
|
-
var _a, _b;
|
34613
|
-
const parentBlockData = lodash.exports.get(context, currentIdx);
|
34614
|
-
if (!parentBlockData)
|
34615
|
-
return combineMergeTags;
|
34616
|
-
const parentBlock = BlockManager.getBlockByType(parentBlockData.type);
|
34617
|
-
if (parentBlock && parentBlock.render) {
|
34618
|
-
const dataSource = (_b = (_a = parentBlockData.data) == null ? void 0 : _a.value) == null ? void 0 : _b.dataSource;
|
34619
|
-
if (!dataSource)
|
34620
|
-
return combineMergeTags;
|
34621
|
-
Object.keys(dataSource).forEach((key) => {
|
34622
|
-
let formatKey = dataSource[key];
|
34623
|
-
const loopFormatKey = (currentLoopKeyIdx) => {
|
34624
|
-
const currentParentIdx = getParentIdx(currentLoopKeyIdx);
|
34625
|
-
if (currentParentIdx) {
|
34626
|
-
const currentBlockData = lodash.exports.get(context, currentParentIdx);
|
34627
|
-
if (!currentBlockData)
|
34628
|
-
return formatKey;
|
34629
|
-
currentBlockData.data.value.dataSource && Object.keys(currentBlockData.data.value.dataSource).forEach((item2) => {
|
34630
|
-
formatKey = formatKey.replace(item2, currentBlockData.data.value.dataSource[item2].replace(/{{([^}}]+)}}/g, "$1"));
|
34631
|
-
});
|
34632
|
-
loopFormatKey(currentParentIdx);
|
34633
|
-
}
|
34634
|
-
};
|
34635
|
-
loopFormatKey(currentIdx);
|
34636
|
-
const dataSourcePath = formatKey.replace(/{{([^}}]+)}}/g, "$1");
|
34637
|
-
combineMergeTags = __spreadValues({
|
34638
|
-
[key]: lodash.exports.get(combineMergeTags, dataSourcePath)
|
34639
|
-
}, combineMergeTags);
|
34640
|
-
});
|
34641
|
-
}
|
34642
|
-
const parentIdx = getParentIdx(currentIdx);
|
34643
|
-
if (!parentIdx)
|
34644
|
-
return combineMergeTags;
|
34645
|
-
return loop(parentIdx, combineMergeTags);
|
34646
|
-
};
|
34647
|
-
return loop(idx, lodash.exports.cloneDeep(mergeTags2));
|
34648
|
-
}
|
34649
|
-
const MergeTags$1 = React__default.memo((props) => {
|
34650
|
-
const [expandedKeys, setExpandedKeys] = useState([]);
|
34651
|
-
const { focusIdx: focusIdx2 } = useFocusIdx();
|
34652
|
-
const {
|
34653
|
-
mergeTags: mergeTags2 = {},
|
34654
|
-
mergeTagGenerate,
|
34655
|
-
renderMergeTagContent
|
34656
|
-
} = useEditorProps();
|
34657
|
-
const { values: values2 } = useBlock();
|
34658
|
-
const contextMergeTags = useMemo(() => getContextMergeTags(mergeTags2, values2, focusIdx2), [mergeTags2, values2, focusIdx2]);
|
34659
|
-
const treeOptions = useMemo(() => {
|
34660
|
-
const treeData = [];
|
34661
|
-
const deep = (key, title2, parent2, mapData = []) => {
|
34662
|
-
const currentMapData = {
|
34663
|
-
key,
|
34664
|
-
value: key,
|
34665
|
-
title: title2,
|
34666
|
-
children: []
|
34667
|
-
};
|
34668
|
-
mapData.push(currentMapData);
|
34669
|
-
const current = parent2[title2];
|
34670
|
-
if (current && typeof current === "object") {
|
34671
|
-
Object.keys(current).map((childKey) => deep(key + "." + childKey, childKey, current, currentMapData.children));
|
34672
|
-
}
|
34673
|
-
};
|
34674
|
-
Object.keys(contextMergeTags).map((key) => deep(key, key, contextMergeTags, treeData));
|
34675
|
-
return treeData;
|
34676
|
-
}, [contextMergeTags]);
|
34677
|
-
const onSelect = useCallback((key) => {
|
34678
|
-
const value = lodash.exports.get(contextMergeTags, key);
|
34679
|
-
if (lodash.exports.isObject(value)) {
|
34680
|
-
setExpandedKeys((keys2) => {
|
34681
|
-
if (keys2.includes(key)) {
|
34682
|
-
return keys2.filter((k) => k !== key);
|
34683
|
-
} else {
|
34684
|
-
return [...keys2, key];
|
34685
|
-
}
|
34686
|
-
});
|
34687
|
-
return;
|
34688
|
-
}
|
34689
|
-
return props.onChange(mergeTagGenerate(key));
|
34690
|
-
}, [contextMergeTags, props, mergeTagGenerate]);
|
34691
|
-
const mergeTagContent = useMemo(() => renderMergeTagContent ? renderMergeTagContent({
|
34692
|
-
onChange: props.onChange,
|
34693
|
-
isSelect: Boolean(props.isSelect),
|
34694
|
-
value: props.value
|
34695
|
-
}) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null), [renderMergeTagContent, props.onChange, props.isSelect, props.value]);
|
34696
|
-
if (renderMergeTagContent) {
|
34697
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, mergeTagContent);
|
34698
|
-
}
|
34699
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
34700
|
-
style: { color: "#333" }
|
34701
|
-
}, props.isSelect ? /* @__PURE__ */ React__default.createElement(TreeSelect$1, {
|
34702
|
-
value: props.value,
|
34703
|
-
size: "small",
|
34704
|
-
dropdownMenuStyle: { maxHeight: 400, overflow: "auto" },
|
34705
|
-
placeholder: t("Please select"),
|
34706
|
-
treeData: treeOptions,
|
34707
|
-
onChange: (val) => onSelect(val)
|
34708
|
-
}) : /* @__PURE__ */ React__default.createElement(Tree$1, {
|
34709
|
-
expandedKeys,
|
34710
|
-
onExpand: setExpandedKeys,
|
34711
|
-
selectedKeys: [],
|
34712
|
-
treeData: treeOptions,
|
34713
|
-
onSelect: (vals) => onSelect(vals[0]),
|
34714
|
-
style: {
|
34715
|
-
maxHeight: 400,
|
34716
|
-
overflow: "auto"
|
34717
|
-
}
|
34718
|
-
}));
|
34719
|
-
});
|
34720
34731
|
const borderStyleOptions = [
|
34721
34732
|
{
|
34722
34733
|
value: "dashed",
|
@@ -36097,6 +36108,40 @@ function Table() {
|
|
36097
36108
|
setVisible
|
36098
36109
|
}));
|
36099
36110
|
}
|
36111
|
+
function AdvancedTable() {
|
36112
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
36113
|
+
return /* @__PURE__ */ React__default.createElement(AttributesPanelWrapper, null, /* @__PURE__ */ React__default.createElement(CollapseWrapper, {
|
36114
|
+
defaultActiveKey: ["-1", "0", "1", "2", "3"]
|
36115
|
+
}, /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
36116
|
+
name: "1",
|
36117
|
+
header: t("Dimension")
|
36118
|
+
}, /* @__PURE__ */ React__default.createElement(Stack$4, null, /* @__PURE__ */ React__default.createElement(Width, null), /* @__PURE__ */ React__default.createElement(Stack$4.Item, null)), /* @__PURE__ */ React__default.createElement(Stack$4, {
|
36119
|
+
vertical: true
|
36120
|
+
}, /* @__PURE__ */ React__default.createElement(Padding, null)), /* @__PURE__ */ React__default.createElement(NumberField, {
|
36121
|
+
label: "Cell padding (px)",
|
36122
|
+
name: `${focusIdx2}.attributes.cellPadding`,
|
36123
|
+
config: pixelAdapter,
|
36124
|
+
max: 20,
|
36125
|
+
min: 0,
|
36126
|
+
step: 1
|
36127
|
+
})), /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
36128
|
+
name: "2",
|
36129
|
+
header: t("Decoration")
|
36130
|
+
}, /* @__PURE__ */ React__default.createElement(Color, null), /* @__PURE__ */ React__default.createElement(ContainerBackgroundColor, null), /* @__PURE__ */ React__default.createElement(TextField, {
|
36131
|
+
label: "Table border",
|
36132
|
+
name: `${focusIdx2}.attributes.border`
|
36133
|
+
}), /* @__PURE__ */ React__default.createElement(ColorPickerField, {
|
36134
|
+
label: "Cell border color",
|
36135
|
+
name: `${focusIdx2}.attributes.cellBorderColor`
|
36136
|
+
})), /* @__PURE__ */ React__default.createElement(Collapse$1.Item, {
|
36137
|
+
name: "2",
|
36138
|
+
header: t("Typography")
|
36139
|
+
}, /* @__PURE__ */ React__default.createElement(FontFamily, null), /* @__PURE__ */ React__default.createElement(FontSize$1, null), /* @__PURE__ */ React__default.createElement(InputWithUnitField, {
|
36140
|
+
label: t("Line height"),
|
36141
|
+
unitOptions: "percent",
|
36142
|
+
name: `${focusIdx2}.attributes.line-height`
|
36143
|
+
}), /* @__PURE__ */ React__default.createElement(FontStyle, null), /* @__PURE__ */ React__default.createElement(TextAlign, null))));
|
36144
|
+
}
|
36100
36145
|
const blocks = {
|
36101
36146
|
[BasicType.PAGE]: Page,
|
36102
36147
|
[BasicType.SECTION]: Section,
|
@@ -36127,6 +36172,7 @@ const blocks = {
|
|
36127
36172
|
[AdvancedType.CAROUSEL]: Carousel,
|
36128
36173
|
[AdvancedType.NAVBAR]: Navbar,
|
36129
36174
|
[AdvancedType.SOCIAL]: Social,
|
36175
|
+
[AdvancedType.TABLE]: AdvancedTable,
|
36130
36176
|
[AdvancedType.HERO]: Hero,
|
36131
36177
|
[AdvancedType.WRAPPER]: Wrapper,
|
36132
36178
|
[AdvancedType.SECTION]: Section,
|
@@ -36185,6 +36231,845 @@ const SelectionRangeProvider = (props) => {
|
|
36185
36231
|
}, props.children);
|
36186
36232
|
}, [props.children, value]);
|
36187
36233
|
};
|
36234
|
+
const getEditorElementClientRect = (target2) => {
|
36235
|
+
let left = target2.offsetLeft;
|
36236
|
+
let top = target2.offsetTop;
|
36237
|
+
const width = target2.clientWidth;
|
36238
|
+
const height = target2.clientHeight;
|
36239
|
+
let parentNode = target2.offsetParent;
|
36240
|
+
while (parentNode && parentNode.offsetParent) {
|
36241
|
+
if (parentNode.classList.contains("shadow-container")) {
|
36242
|
+
return { left, top, height, width };
|
36243
|
+
}
|
36244
|
+
left += parentNode.offsetLeft;
|
36245
|
+
top += parentNode.offsetTop;
|
36246
|
+
parentNode = parentNode.offsetParent;
|
36247
|
+
}
|
36248
|
+
return { left, top, height, width };
|
36249
|
+
};
|
36250
|
+
const getBoundaryFromRects = (startRect, endRect) => {
|
36251
|
+
let left = Math.min(startRect.left, endRect.left, startRect.left + startRect.width, endRect.left + endRect.width);
|
36252
|
+
let right = Math.max(startRect.left, endRect.left, startRect.left + startRect.width, endRect.left + endRect.width);
|
36253
|
+
let top = Math.min(startRect.top, endRect.top, startRect.top + startRect.height, endRect.top + endRect.height);
|
36254
|
+
let bottom = Math.max(startRect.top, endRect.top, startRect.top + startRect.height, endRect.top + endRect.height);
|
36255
|
+
let width = right - left;
|
36256
|
+
let height = bottom - top;
|
36257
|
+
return { top, bottom, left, right, width, height };
|
36258
|
+
};
|
36259
|
+
const ERROR_LIMIT = 2;
|
36260
|
+
const getCorrectBoundary = (el, currentBoundary) => {
|
36261
|
+
var _a, _b;
|
36262
|
+
const tableEl = (_b = (_a = el.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement;
|
36263
|
+
if (!tableEl) {
|
36264
|
+
return null;
|
36265
|
+
}
|
36266
|
+
let leftTopCell = el;
|
36267
|
+
let bottomRightCell = el;
|
36268
|
+
let leftTopRect = getEditorElementClientRect(el);
|
36269
|
+
let bottomRightRect = leftTopRect;
|
36270
|
+
const tableCells = tableEl.querySelectorAll("td");
|
36271
|
+
const tableCellRects = [];
|
36272
|
+
tableCells.forEach((tableCell) => {
|
36273
|
+
const { left, top, height, width } = getEditorElementClientRect(tableCell);
|
36274
|
+
tableCellRects.push({ left, top, height, width });
|
36275
|
+
let isIntersected = (left + ERROR_LIMIT >= currentBoundary.left && left + ERROR_LIMIT <= currentBoundary.right || left - ERROR_LIMIT + width >= currentBoundary.left && left - ERROR_LIMIT + width <= currentBoundary.right) && (top + ERROR_LIMIT >= currentBoundary.top && top + ERROR_LIMIT <= currentBoundary.bottom || top - ERROR_LIMIT + height >= currentBoundary.top && top - ERROR_LIMIT + height <= currentBoundary.bottom);
|
36276
|
+
if (isIntersected) {
|
36277
|
+
currentBoundary = getBoundaryFromRects(currentBoundary, {
|
36278
|
+
left,
|
36279
|
+
top,
|
36280
|
+
height,
|
36281
|
+
width
|
36282
|
+
});
|
36283
|
+
}
|
36284
|
+
});
|
36285
|
+
tableCells.forEach((tableCell, index2) => {
|
36286
|
+
const { left, top, height, width } = tableCellRects[index2];
|
36287
|
+
let isIntersected = (left + ERROR_LIMIT >= currentBoundary.left && left + ERROR_LIMIT <= currentBoundary.right || left - ERROR_LIMIT + width >= currentBoundary.left && left - ERROR_LIMIT + width <= currentBoundary.right) && (top + ERROR_LIMIT >= currentBoundary.top && top + ERROR_LIMIT <= currentBoundary.bottom || top - ERROR_LIMIT + height >= currentBoundary.top && top - ERROR_LIMIT + height <= currentBoundary.bottom);
|
36288
|
+
if (!isIntersected) {
|
36289
|
+
return;
|
36290
|
+
}
|
36291
|
+
if (top <= leftTopRect.top && left <= leftTopRect.left) {
|
36292
|
+
leftTopRect = tableCellRects[index2];
|
36293
|
+
leftTopCell = tableCell;
|
36294
|
+
}
|
36295
|
+
if (top === leftTopRect.top + ERROR_LIMIT || top === leftTopRect.top && left <= leftTopRect.left) {
|
36296
|
+
leftTopRect = tableCellRects[index2];
|
36297
|
+
leftTopCell = tableCell;
|
36298
|
+
}
|
36299
|
+
if (top + height > bottomRightRect.top + bottomRightRect.height + ERROR_LIMIT || top + height === bottomRightRect.top + bottomRightRect.height && left + width >= bottomRightRect.left + bottomRightRect.width) {
|
36300
|
+
bottomRightRect = tableCellRects[index2];
|
36301
|
+
bottomRightCell = tableCell;
|
36302
|
+
}
|
36303
|
+
});
|
36304
|
+
return { leftTopCell, bottomRightCell, boundary: currentBoundary };
|
36305
|
+
};
|
36306
|
+
const getBoundaryRectAndElement = (el1, el2) => {
|
36307
|
+
const rect1 = getEditorElementClientRect(el1);
|
36308
|
+
const rect2 = getEditorElementClientRect(el2);
|
36309
|
+
const boundary = getBoundaryFromRects(rect1, rect2);
|
36310
|
+
return getCorrectBoundary(el1, boundary);
|
36311
|
+
};
|
36312
|
+
function setStyle(domNode, rules) {
|
36313
|
+
if (typeof rules === "object") {
|
36314
|
+
for (let prop in rules) {
|
36315
|
+
domNode.style[prop] = rules[prop];
|
36316
|
+
}
|
36317
|
+
}
|
36318
|
+
}
|
36319
|
+
const getCurrentTable = (target2) => {
|
36320
|
+
let parentNode = target2.parentNode;
|
36321
|
+
while (parentNode) {
|
36322
|
+
if (parentNode.nodeName === "TABLE") {
|
36323
|
+
return parentNode;
|
36324
|
+
}
|
36325
|
+
parentNode = parentNode.parentNode;
|
36326
|
+
}
|
36327
|
+
return parentNode;
|
36328
|
+
};
|
36329
|
+
const getElementsBoundary = (el1, el2) => {
|
36330
|
+
const rect1 = el1.getBoundingClientRect();
|
36331
|
+
const rect2 = el2.getBoundingClientRect();
|
36332
|
+
const left = Math.min(rect1.left, rect2.left);
|
36333
|
+
const right = Math.max(rect1.right, rect2.right);
|
36334
|
+
const bottom = Math.max(rect1.bottom, rect2.bottom);
|
36335
|
+
const top = Math.min(rect1.top, rect2.top);
|
36336
|
+
return { left, top, right, bottom };
|
36337
|
+
};
|
36338
|
+
const checkEventInBoundingRect = (rect, { x, y }) => {
|
36339
|
+
return x >= rect.left && x <= rect.right && y <= rect.bottom && y >= rect.top;
|
36340
|
+
};
|
36341
|
+
const getCellIndex = (cellElement) => {
|
36342
|
+
let idxName = cellElement.getAttribute(DATA_CONTENT_EDITABLE_IDX);
|
36343
|
+
idxName = idxName.split("data.value.tableSource.")[1].split(".content")[0];
|
36344
|
+
return idxName.split(".").map((e) => Number(e));
|
36345
|
+
};
|
36346
|
+
const getTdBoundaryIndex = (leftTopCell, bottomRightCell) => {
|
36347
|
+
const idx1 = getCellIndex(leftTopCell);
|
36348
|
+
const idx2 = getCellIndex(bottomRightCell);
|
36349
|
+
const top = idx1[0];
|
36350
|
+
const left = idx1[1];
|
36351
|
+
const right = idx2[1];
|
36352
|
+
const bottom = idx2[0];
|
36353
|
+
return { left, top, right, bottom };
|
36354
|
+
};
|
36355
|
+
const getCorrectTableIndexBoundary = (tableIndexBoundary, tableData) => {
|
36356
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
36357
|
+
let { left, right, top, bottom } = tableIndexBoundary;
|
36358
|
+
tableData.forEach((tr, trIndex) => {
|
36359
|
+
tr.forEach((td) => {
|
36360
|
+
td.top = trIndex;
|
36361
|
+
td.bottom = trIndex + (td.rowSpan || 1) - 1;
|
36362
|
+
});
|
36363
|
+
});
|
36364
|
+
const maxTdCount = getMaxTdCount(tableData);
|
36365
|
+
const mergedCells = [];
|
36366
|
+
Array.from({ length: maxTdCount }).forEach((_, tdIndex) => {
|
36367
|
+
tableData.forEach((tr, trIndex) => {
|
36368
|
+
const mergedCell = mergedCells.find((e) => e[0] === trIndex && e[1] === tdIndex);
|
36369
|
+
if (mergedCell) {
|
36370
|
+
return;
|
36371
|
+
}
|
36372
|
+
const mergedTds = mergedCells.filter((e) => e[0] === trIndex && e[1] < tdIndex);
|
36373
|
+
const _tdIndex = tdIndex - mergedTds.length;
|
36374
|
+
const td = tr[_tdIndex];
|
36375
|
+
if (!td) {
|
36376
|
+
console.log("error case, should fix this error.");
|
36377
|
+
return;
|
36378
|
+
}
|
36379
|
+
const rowSpan = td.rowSpan || 1;
|
36380
|
+
const colSpan = td.colSpan || 1;
|
36381
|
+
td.left = tdIndex;
|
36382
|
+
td.right = tdIndex + colSpan - 1;
|
36383
|
+
if (rowSpan > 1 || colSpan > 1) {
|
36384
|
+
Array.from({ length: rowSpan }).forEach((_2, rowSpanIndex) => {
|
36385
|
+
Array.from({ length: colSpan }).forEach((_3, colSpanIndex) => {
|
36386
|
+
if (rowSpanIndex === 0 && colSpanIndex === 0) {
|
36387
|
+
return;
|
36388
|
+
}
|
36389
|
+
mergedCells.push([trIndex + rowSpanIndex, tdIndex + colSpanIndex]);
|
36390
|
+
});
|
36391
|
+
});
|
36392
|
+
}
|
36393
|
+
});
|
36394
|
+
});
|
36395
|
+
tableIndexBoundary.left = ((_b = (_a = tableData == null ? void 0 : tableData[top]) == null ? void 0 : _a[left]) == null ? void 0 : _b.left) || 0;
|
36396
|
+
tableIndexBoundary.right = ((_d = (_c = tableData == null ? void 0 : tableData[bottom]) == null ? void 0 : _c[right]) == null ? void 0 : _d.right) || 0;
|
36397
|
+
tableIndexBoundary.bottom = ((_f = (_e = tableData == null ? void 0 : tableData[bottom]) == null ? void 0 : _e[right]) == null ? void 0 : _f.bottom) || 0;
|
36398
|
+
tableIndexBoundary.top = ((_h = (_g = tableData == null ? void 0 : tableData[top]) == null ? void 0 : _g[left]) == null ? void 0 : _h.top) || 0;
|
36399
|
+
return tableIndexBoundary;
|
36400
|
+
};
|
36401
|
+
const getMaxTdCount = (tableData) => {
|
36402
|
+
let tdCount = 1;
|
36403
|
+
tableData.forEach((tr) => {
|
36404
|
+
let _tdCount = tr.reduce((count, td) => count + (td.colSpan || 1), 0);
|
36405
|
+
if (_tdCount > tdCount) {
|
36406
|
+
tdCount = _tdCount;
|
36407
|
+
}
|
36408
|
+
});
|
36409
|
+
return tdCount;
|
36410
|
+
};
|
36411
|
+
var styleText$1 = ".easy-email-table-operation-menu{background-color:#fff;box-shadow:0 2px 8px #00000026;font-size:14px;z-index:100;overflow:hidden;border-radius:4px;padding:4px 0}.easy-email-table-operation-menu .easy-email-table-operation-menu-dividing{height:1px;background-color:#efefef}.easy-email-table-operation-menu .easy-email-table-operation-color-picker{display:flex;align-items:center;flex-wrap:wrap;padding:0 16px 10px;background-color:#fff;overflow:hidden}.easy-email-table-operation-menu .easy-email-table-operation-color-picker .easy-email-table-operation-color-picker-item{width:20px;height:20px;border:1px solid #595959;margin-right:5px;margin-bottom:5px;cursor:pointer}.easy-email-table-operation-menu .easy-email-table-operation-menu-item{display:flex;align-items:center;padding:10px 16px;line-height:18px;background-color:#fff;cursor:pointer;color:#595959;overflow:hidden;text-overflow:ellipsis}.easy-email-table-operation-menu .easy-email-table-operation-menu-item:hover{background-color:#efefef}.easy-email-table-operation-menu .easy-email-table-operation-menu-item .easy-email-table-operation-menu-icon{margin-right:8px;height:20px;width:20px;font-size:0}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item{padding:10px 16px;background-color:#fff;color:#595959}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item>div:nth-child(2){margin-top:4px;display:flex;align-items:center;flex-shrink:0}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item>div:nth-child(2) .arco-input-inner-wrapper{box-shadow:none}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item>div:nth-child(2) .arco-btn-size-default{padding:0 12px}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item>div:nth-child(2) .arco-input-group{display:flex}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item>div:nth-child(2) .arco-input-group .arco-input-inner-wrapper{flex:1}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item>div:nth-child(2) .arco-input-group .arco-input-group-addafter{height:100%;width:auto}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item-color{height:28px;width:28px;flex-shrink:0;border:1px solid var(--color-neutral-3, #e5e6eb);border-right:none;padding:4px;cursor:pointer;position:relative}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item-color>div{height:100%;width:100%;border:1px solid var(--color-neutral-3, #e5e6eb);border-radius:2px}.easy-email-table-operation-menu .easy-email-table-operation-menu-bg-item-color input{cursor:pointer;position:absolute;width:100%;height:100%;z-index:1;left:0;top:0;opacity:0}\n";
|
36412
|
+
const CellBackgroundSelector = ({
|
36413
|
+
bgColorHandler,
|
36414
|
+
rootDom
|
36415
|
+
}) => {
|
36416
|
+
const [color2, setColor] = useState("#ffffff");
|
36417
|
+
useEffect(() => {
|
36418
|
+
if (!rootDom) {
|
36419
|
+
return;
|
36420
|
+
}
|
36421
|
+
const observer = new ResizeObserver((e) => {
|
36422
|
+
setColor("#ffffff");
|
36423
|
+
});
|
36424
|
+
observer.observe(rootDom);
|
36425
|
+
return () => {
|
36426
|
+
observer.disconnect();
|
36427
|
+
};
|
36428
|
+
}, []);
|
36429
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
36430
|
+
onClick: (e) => e.stopPropagation(),
|
36431
|
+
className: "easy-email-table-operation-menu-bg-item"
|
36432
|
+
}, /* @__PURE__ */ React__default.createElement("div", null, "Set Background Color"), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
36433
|
+
className: "easy-email-table-operation-menu-bg-item-color"
|
36434
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
36435
|
+
style: { backgroundColor: color2 }
|
36436
|
+
}), /* @__PURE__ */ React__default.createElement("input", {
|
36437
|
+
type: "color",
|
36438
|
+
value: color2,
|
36439
|
+
onChange: (e) => setColor(e.target.value)
|
36440
|
+
})), /* @__PURE__ */ React__default.createElement(Input$4.Search, {
|
36441
|
+
height: 28,
|
36442
|
+
searchButton: "Set",
|
36443
|
+
onSearch: () => bgColorHandler(color2),
|
36444
|
+
value: color2,
|
36445
|
+
onKeyDown: (e) => e.stopPropagation(),
|
36446
|
+
onChange: (e) => setColor(e)
|
36447
|
+
})));
|
36448
|
+
};
|
36449
|
+
const getCellBackgroundSelectorRoot = (bgColorHandler, rootDom) => {
|
36450
|
+
const node = document.createElement("div");
|
36451
|
+
render(/* @__PURE__ */ React__default.createElement(CellBackgroundSelector, {
|
36452
|
+
bgColorHandler,
|
36453
|
+
rootDom
|
36454
|
+
}), node);
|
36455
|
+
return node;
|
36456
|
+
};
|
36457
|
+
const MENU_CONFIG = {
|
36458
|
+
insertColumnRight: {
|
36459
|
+
text: "Insert column right",
|
36460
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M73.142857 336.64h526.628572v43.885714H73.142857zM73.142857 643.657143h526.628572v43.885714H73.142857zM336.457143 117.028571h43.885714v789.942858h-43.885714zM204.8 73.142857h614.4a131.657143 131.657143 0 0 1 131.657143 131.657143v614.4a131.657143 131.657143 0 0 1-131.657143 131.657143H204.8A131.657143 131.657143 0 0 1 73.142857 819.2V204.8A131.84 131.84 0 0 1 204.8 73.142857z m0 43.885714a87.771429 87.771429 0 0 0-87.771429 87.771429v614.4a87.771429 87.771429 0 0 0 87.771429 87.771429h614.4a87.771429 87.771429 0 0 0 87.771429-87.771429V204.8a87.771429 87.771429 0 0 0-87.771429-87.771429zM819.2 73.142857h-219.428571v877.714286h219.428571a131.657143 131.657143 0 0 0 131.657143-131.657143V204.8A131.84 131.84 0 0 0 819.2 73.142857z m44.068571 460.982857h-65.828571v65.828572H753.371429v-65.828572h-65.828572V490.057143h65.828572v-65.828572h44.068571v65.828572h65.828571z" /></svg>`,
|
36461
|
+
handler() {
|
36462
|
+
var _a;
|
36463
|
+
const _this = this;
|
36464
|
+
const right = _this.tableIndexBoundary.right;
|
36465
|
+
_this.tableData.forEach((tr) => {
|
36466
|
+
if (right === _this.maxTdCount - 1) {
|
36467
|
+
tr.push({ content: "-" });
|
36468
|
+
return;
|
36469
|
+
}
|
36470
|
+
if (tr.length === 0) {
|
36471
|
+
return tr.push({ content: "-" });
|
36472
|
+
}
|
36473
|
+
for (let index2 = 0; index2 < tr.length; index2++) {
|
36474
|
+
const tdLeft = tr[index2].left || 0;
|
36475
|
+
const tdRight = tr[index2].right || 0;
|
36476
|
+
if (tdRight === right) {
|
36477
|
+
tr.splice(index2 + 1, 0, { content: "-" });
|
36478
|
+
break;
|
36479
|
+
}
|
36480
|
+
if (tdLeft <= right && tdRight > right && tr[index2].colSpan) {
|
36481
|
+
tr[index2].colSpan = (tr[index2].colSpan || 1) + 1;
|
36482
|
+
break;
|
36483
|
+
}
|
36484
|
+
if (tdLeft > right && tdLeft - 1 === right) {
|
36485
|
+
tr.splice(index2, 0, { content: "-" });
|
36486
|
+
break;
|
36487
|
+
}
|
36488
|
+
if (tdLeft > right) {
|
36489
|
+
break;
|
36490
|
+
}
|
36491
|
+
}
|
36492
|
+
});
|
36493
|
+
(_a = _this.changeTableData) == null ? void 0 : _a.call(_this, _this.tableData);
|
36494
|
+
}
|
36495
|
+
},
|
36496
|
+
insertColumnLeft: {
|
36497
|
+
text: "Insert column left",
|
36498
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M380.342857 336.457143h526.811429v43.885714H380.342857z m0 307.2h526.811429v43.885714H380.342857zM643.657143 117.028571h43.885714v789.942858h-43.885714zM204.8 73.142857h614.582857A131.474286 131.474286 0 0 1 950.857143 204.8v614.4a131.657143 131.657143 0 0 1-131.657143 131.657143H204.8A131.657143 131.657143 0 0 1 73.142857 819.2V204.8A131.657143 131.657143 0 0 1 204.8 73.142857z m0 43.885714a87.588571 87.588571 0 0 0-87.588571 87.771429v614.4a87.588571 87.588571 0 0 0 87.588571 87.771429h614.582857a87.771429 87.771429 0 0 0 87.771429-87.771429V204.8a87.771429 87.771429 0 0 0-87.771429-87.771429zM204.8 73.142857A131.657143 131.657143 0 0 0 73.142857 204.8v614.4a131.657143 131.657143 0 0 0 131.657143 131.657143h219.428571V73.142857z m131.84 460.8h-65.828571v65.828572h-43.885715v-65.828572h-65.828571v-43.885714h65.828571v-65.828572h43.885715v65.828572h65.828571z" /></svg>`,
|
36499
|
+
handler() {
|
36500
|
+
var _a;
|
36501
|
+
const _this = this;
|
36502
|
+
const left = _this.tableIndexBoundary.left;
|
36503
|
+
_this.tableData.forEach((tr) => {
|
36504
|
+
if (left === 0) {
|
36505
|
+
tr.unshift({ content: "-" });
|
36506
|
+
return;
|
36507
|
+
}
|
36508
|
+
if (tr.length === 0) {
|
36509
|
+
return tr.push({ content: "-" });
|
36510
|
+
}
|
36511
|
+
for (let index2 = 0; index2 < tr.length; index2++) {
|
36512
|
+
const tdLeft = tr[index2].left || 0;
|
36513
|
+
const tdRight = tr[index2].right || 0;
|
36514
|
+
if (tdLeft === left) {
|
36515
|
+
tr.splice(index2, 0, { content: "-" });
|
36516
|
+
break;
|
36517
|
+
}
|
36518
|
+
if (tdLeft < left && tdRight >= left && tr[index2].colSpan) {
|
36519
|
+
tr[index2].colSpan = (tr[index2].colSpan || 1) + 1;
|
36520
|
+
break;
|
36521
|
+
}
|
36522
|
+
if (tdLeft > left && tr[index2 - 1] && (tr[index2 - 1].right || 0) + 1 === left) {
|
36523
|
+
tr.splice(index2, 0, { content: "-" });
|
36524
|
+
break;
|
36525
|
+
}
|
36526
|
+
if (tdLeft > left) {
|
36527
|
+
break;
|
36528
|
+
}
|
36529
|
+
}
|
36530
|
+
});
|
36531
|
+
(_a = _this.changeTableData) == null ? void 0 : _a.call(_this, _this.tableData);
|
36532
|
+
}
|
36533
|
+
},
|
36534
|
+
insertRowUp: {
|
36535
|
+
text: "Insert row up",
|
36536
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M73.142857 599.771429h877.714286v43.885714H73.142857zM336.457143 380.342857h43.885714v526.628572h-43.885714z m307.2 0h43.885714v526.628572h-43.885714zM204.8 73.142857h614.4a131.657143 131.657143 0 0 1 131.657143 131.657143v614.4a131.657143 131.657143 0 0 1-131.657143 131.657143H204.8A131.657143 131.657143 0 0 1 73.142857 819.2V204.8A131.657143 131.657143 0 0 1 204.8 73.142857z m0 43.885714a87.771429 87.771429 0 0 0-87.771429 87.771429v614.4a87.588571 87.588571 0 0 0 87.771429 87.771429h614.4a87.588571 87.588571 0 0 0 87.771429-87.771429V204.8a87.771429 87.771429 0 0 0-87.771429-87.771429zM819.2 73.142857H204.8A131.657143 131.657143 0 0 0 73.142857 204.8v219.428571h877.714286v-219.428571A131.657143 131.657143 0 0 0 819.2 73.142857z m-219.428571 197.485714h-65.828572v65.828572h-43.885714v-65.828572h-65.828572v-43.885714h65.828572V160.914286h43.885714v65.828571h65.828572z" /></svg>`,
|
36537
|
+
handler() {
|
36538
|
+
const _this = this;
|
36539
|
+
const top = _this.tableIndexBoundary.top;
|
36540
|
+
let maxTdCount = _this.maxTdCount;
|
36541
|
+
if (_this.tableData[top].length < maxTdCount) {
|
36542
|
+
for (let index2 = top - 1; index2 > -1; index2--) {
|
36543
|
+
const tr = _this.tableData[index2];
|
36544
|
+
tr.forEach((td, _index) => {
|
36545
|
+
if (td.bottom && td.bottom >= top) {
|
36546
|
+
td.rowSpan = (td.rowSpan || 1) + 1;
|
36547
|
+
maxTdCount -= td.colSpan || 1;
|
36548
|
+
}
|
36549
|
+
});
|
36550
|
+
if (tr.length === maxTdCount) {
|
36551
|
+
break;
|
36552
|
+
}
|
36553
|
+
}
|
36554
|
+
}
|
36555
|
+
_this.addRow(top, maxTdCount);
|
36556
|
+
}
|
36557
|
+
},
|
36558
|
+
insertRowDown: {
|
36559
|
+
text: "Insert row down",
|
36560
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M204.8 73.142857h614.4a131.657143 131.657143 0 0 1 131.657143 131.657143v614.4a131.657143 131.657143 0 0 1-131.657143 131.657143H204.8A131.657143 131.657143 0 0 1 73.142857 819.2V204.8A131.84 131.84 0 0 1 204.8 73.142857z m0 43.885714a87.771429 87.771429 0 0 0-87.771429 87.771429v614.4a87.771429 87.771429 0 0 0 87.771429 87.771429h614.4a87.771429 87.771429 0 0 0 87.771429-87.771429V204.8a87.771429 87.771429 0 0 0-87.771429-87.771429zM73.142857 336.457143h877.714286v44.068571H73.142857zM336.64 117.028571h43.885714v526.628572h-43.885714z m307.017143 0h44.068571v526.628572H643.657143zM73.142857 599.771429v219.428571a131.657143 131.657143 0 0 0 131.657143 131.657143h614.4a131.657143 131.657143 0 0 0 131.657143-131.657143v-219.428571z m526.628572 197.485714h-65.645715v65.828571H490.057143v-65.828571h-65.828572v-43.885714h65.828572v-65.828572h44.068571v65.828572h65.645715z" /></svg>`,
|
36561
|
+
handler() {
|
36562
|
+
const _this = this;
|
36563
|
+
let addCount = _this.maxTdCount;
|
36564
|
+
const bottom = _this.tableIndexBoundary.bottom;
|
36565
|
+
if (_this.tableData[bottom].length < _this.maxTdCount) {
|
36566
|
+
for (let index2 = bottom - 1; index2 > -1; index2--) {
|
36567
|
+
const tr = _this.tableData[index2];
|
36568
|
+
if (tr.length === _this.maxTdCount) {
|
36569
|
+
break;
|
36570
|
+
}
|
36571
|
+
tr.forEach((td, _index) => {
|
36572
|
+
if (td.bottom && td.bottom > bottom) {
|
36573
|
+
td.rowSpan = (td.rowSpan || 1) + 1;
|
36574
|
+
addCount -= td.colSpan || 1;
|
36575
|
+
}
|
36576
|
+
});
|
36577
|
+
}
|
36578
|
+
}
|
36579
|
+
_this.tableData[bottom].forEach((e) => {
|
36580
|
+
if (e.rowSpan && e.rowSpan > 1) {
|
36581
|
+
e.rowSpan += 1;
|
36582
|
+
addCount -= e.colSpan || 1;
|
36583
|
+
}
|
36584
|
+
});
|
36585
|
+
_this.addRow(bottom + 1, addCount);
|
36586
|
+
}
|
36587
|
+
},
|
36588
|
+
mergeCells: {
|
36589
|
+
text: "Merge selected cells",
|
36590
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M925.99596 99.038384c-25.470707-25.6-60.121212-39.822222-96.323233-39.822222H194.19798c-36.072727 0-70.723232 14.351515-96.323233 39.822222-25.6 25.6-39.822222 60.121212-39.822222 96.323232v635.474748c0 36.072727 14.351515 70.723232 39.822222 96.323232C123.474747 952.759596 158.125253 967.111111 194.19798 967.111111h635.474747c36.072727 0 70.723232-14.351515 96.323233-39.951515 25.6-25.6 39.951515-60.121212 39.951515-96.323232V195.361616c0-36.072727-14.351515-70.723232-39.951515-96.323232z m-277.850505 5.559596v226.909091H375.725253V104.59798h272.420202zM103.434343 195.361616c0-24.048485 9.567677-47.191919 26.634344-64.129293 17.066667-17.066667 40.080808-26.634343 64.129293-26.634343h136.145454v226.909091H103.434343V195.361616z m90.763637 726.367677c-24.048485 0-47.191919-9.567677-64.129293-26.634344-17.066667-17.066667-26.634343-40.080808-26.634344-64.129292V649.309091h226.909091v272.420202H194.19798z m181.527273 0V649.309091h272.290909v272.420202H375.725253z m544.711111-90.892929c0 24.048485-9.567677 47.191919-26.634344 64.129293-17.066667 17.066667-40.080808 26.634343-64.129293 26.634343H693.527273V649.309091h226.909091v181.527273zM693.527273 331.507071V104.59798h136.145454c24.048485 0 47.191919 9.567677 64.129293 26.634343 17.066667 17.066667 26.634343 40.080808 26.634344 64.129293v136.145455H693.527273z" /></svg>`,
|
36591
|
+
handler() {
|
36592
|
+
var _a;
|
36593
|
+
const _this = this;
|
36594
|
+
const { top, left, bottom, right } = _this.tableIndexBoundary;
|
36595
|
+
const leftTopItem = _this.tableData[top].find((e) => e.left === left);
|
36596
|
+
leftTopItem.rowSpan = bottom - top + 1;
|
36597
|
+
leftTopItem.colSpan = right - left + 1;
|
36598
|
+
_this.tableData.forEach((tr, trIndex) => {
|
36599
|
+
if (trIndex >= top && trIndex <= bottom) {
|
36600
|
+
if (bottom > top && trIndex > top && trIndex <= bottom) {
|
36601
|
+
leftTopItem.content += "<br />";
|
36602
|
+
}
|
36603
|
+
const deletedIndex = [];
|
36604
|
+
tr.forEach((td, tdIndex) => {
|
36605
|
+
if (top === trIndex && left === td.left) {
|
36606
|
+
return;
|
36607
|
+
}
|
36608
|
+
if (td.left >= left && td.right <= right) {
|
36609
|
+
leftTopItem.content += " " + td.content;
|
36610
|
+
deletedIndex.push(tdIndex);
|
36611
|
+
}
|
36612
|
+
});
|
36613
|
+
if (deletedIndex.length > 0) {
|
36614
|
+
tr.splice(deletedIndex[0], deletedIndex[deletedIndex.length - 1] - deletedIndex[0] + 1);
|
36615
|
+
}
|
36616
|
+
}
|
36617
|
+
});
|
36618
|
+
(_a = _this.changeTableData) == null ? void 0 : _a.call(_this, _this.tableData);
|
36619
|
+
}
|
36620
|
+
},
|
36621
|
+
deleteColumn: {
|
36622
|
+
text: "Delete selected columns",
|
36623
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M925.996 99.038c-25.47-25.6-60.121-39.822-96.323-39.822H194.198c-75.12 0.13-136.016 61.026-136.145 136.146v635.345c0 36.073 14.351 70.723 39.822 96.323 25.6 25.73 60.25 40.081 96.323 40.081h635.475c36.072 0 70.723-14.351 96.323-39.951 25.6-25.6 39.951-60.122 39.951-96.324V195.362c0-36.073-14.351-70.724-39.951-96.324z m-365.77 494.287L512 545.228l-48.226 48.097-32.194-31.935 48.355-48.226-48.226-48.097 32.194-32.194L512 480.97l48.097-48.097 32.194 32.194-48.097 48.097 48.226 48.226-32.194 31.935zM103.434 195.362c0-24.049 9.568-47.192 26.635-64.13 17.066-17.066 40.08-26.634 64.129-26.634h136.145v226.91H103.434V195.361z m0 181.656h226.91V649.31h-226.91V377.02z m90.764 544.84c-24.049 0-47.192-9.567-64.13-26.634-17.066-17.066-26.634-40.08-26.634-64.258V694.69h226.91v227.168H194.197z m726.238-90.763c0 24.048-9.438 47.192-26.505 64.259-17.066 17.066-40.21 26.634-64.258 26.505H693.527V694.69h226.91v136.404z m0-181.786H693.527V377.02h226.91v272.29zM693.527 331.507V104.598h136.146c24.048 0 47.192 9.438 64.258 26.505 17.067 17.067 26.635 40.21 26.505 64.259v136.145H693.527z" /></svg>`,
|
36624
|
+
handler() {
|
36625
|
+
var _a;
|
36626
|
+
const _this = this;
|
36627
|
+
const { left, right } = _this.tableIndexBoundary;
|
36628
|
+
_this.tableData.forEach((tr) => {
|
36629
|
+
const deleteIds = [];
|
36630
|
+
for (let index2 = 0; index2 < tr.length; index2++) {
|
36631
|
+
const td = tr[index2];
|
36632
|
+
const tdLeft = tr[index2].left || 0;
|
36633
|
+
const tdRight = tr[index2].right || 0;
|
36634
|
+
const colSpan = td.colSpan || 1;
|
36635
|
+
if (tdLeft > right) {
|
36636
|
+
break;
|
36637
|
+
}
|
36638
|
+
if (tdLeft >= left && tdRight <= right) {
|
36639
|
+
deleteIds.push(index2);
|
36640
|
+
continue;
|
36641
|
+
}
|
36642
|
+
if (tdLeft <= left && tdRight >= right) {
|
36643
|
+
td.colSpan = colSpan - (right - left) - 1;
|
36644
|
+
continue;
|
36645
|
+
}
|
36646
|
+
if (tdLeft > left && tdRight >= right) {
|
36647
|
+
td.colSpan = colSpan - (right - tdLeft) - 1;
|
36648
|
+
continue;
|
36649
|
+
}
|
36650
|
+
if (tdLeft < left && tdRight >= left) {
|
36651
|
+
td.colSpan = colSpan - (tdRight - left) - 1;
|
36652
|
+
continue;
|
36653
|
+
}
|
36654
|
+
}
|
36655
|
+
if (deleteIds.length) {
|
36656
|
+
tr.splice(deleteIds[0], deleteIds[deleteIds.length - 1] - deleteIds[0] + 1);
|
36657
|
+
}
|
36658
|
+
});
|
36659
|
+
(_a = _this.changeTableData) == null ? void 0 : _a.call(_this, _this.tableData);
|
36660
|
+
}
|
36661
|
+
},
|
36662
|
+
deleteRow: {
|
36663
|
+
text: "Delete selected rows",
|
36664
|
+
icon: `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="20px" height="20.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#595959" d="M925.99596 99.038384c-25.470707-25.6-60.121212-39.822222-96.323233-39.822222H194.19798c-36.072727 0-70.723232 14.351515-96.323233 39.822222-25.6 25.6-39.822222 60.121212-39.822222 96.323232v635.474748c0 36.072727 14.351515 70.723232 39.822222 96.323232C123.474747 952.759596 158.125253 967.111111 194.19798 967.111111h635.474747c36.072727 0 70.723232-14.351515 96.323233-39.951515 25.6-25.6 39.951515-60.121212 39.951515-96.323232V195.361616c0-36.072727-14.351515-70.723232-39.951515-96.323232z m-550.270707 5.559596h272.290909v227.167677H375.725253V104.59798z m56.242424 360.468687l31.935353-32.19394 48.09697 48.226263 48.09697-48.226263 32.193939 32.19394-48.09697 48.096969 48.226263 48.226263-32.193939 31.935354-48.226263-48.09697-48.226263 48.09697-31.935353-31.935354 48.226262-48.226263-48.096969-48.096969zM103.434343 195.361616c0-24.048485 9.567677-47.191919 26.634344-64.129293 17.066667-17.066667 40.080808-26.634343 64.129293-26.634343h136.145454v227.167677H103.434343V195.361616z m817.002021 635.733333c0 24.048485-9.567677 47.191919-26.634344 64.258586-17.066667 17.066667-40.080808 26.634343-64.129293 26.634344H194.19798c-24.048485 0-47.191919-9.567677-64.258586-26.634344C112.872727 878.157576 103.434343 855.014141 103.434343 830.836364V694.690909h226.909091v226.909091h45.381819V694.690909h272.290909v226.909091h45.381818V694.690909h226.909091v136.40404z m0-499.329292H693.527273V104.59798h136.145454c24.048485 0 47.191919 9.567677 64.129293 26.634343 17.066667 17.066667 26.634343 40.080808 26.634344 64.129293v136.404041z" /></svg>`,
|
36665
|
+
handler() {
|
36666
|
+
var _a;
|
36667
|
+
const _this = this;
|
36668
|
+
const { top, bottom } = _this.tableIndexBoundary;
|
36669
|
+
const deleteCount = bottom - top + 1;
|
36670
|
+
for (let index2 = bottom - 1; index2 > -1; index2--) {
|
36671
|
+
const tr = _this.tableData[index2];
|
36672
|
+
tr.forEach((td, _index) => {
|
36673
|
+
if (td.bottom && td.bottom >= top) {
|
36674
|
+
const deleteRowSpan = td.bottom >= bottom ? deleteCount : td.bottom - top + 1;
|
36675
|
+
td.rowSpan = (td.rowSpan || 1) - deleteRowSpan;
|
36676
|
+
}
|
36677
|
+
});
|
36678
|
+
}
|
36679
|
+
for (let index2 = top; index2 <= bottom; index2++) {
|
36680
|
+
const tr = _this.tableData[index2];
|
36681
|
+
tr.forEach((td, _index) => {
|
36682
|
+
const rowSpan = td.rowSpan || 1;
|
36683
|
+
if (rowSpan - 1 + top > bottom) {
|
36684
|
+
const nextRowCell = __spreadProps(__spreadValues({}, td), { rowSpan: rowSpan - (bottom - top + 1) });
|
36685
|
+
const nextRow = _this.tableData[bottom + 1];
|
36686
|
+
if (nextRow) {
|
36687
|
+
const index22 = Array.from({ length: _this.maxTdCount }).findIndex((_, index3) => index3 === nextRowCell.left);
|
36688
|
+
if (index22 > -1) {
|
36689
|
+
nextRow.splice(index22, 0, nextRowCell);
|
36690
|
+
}
|
36691
|
+
}
|
36692
|
+
}
|
36693
|
+
});
|
36694
|
+
}
|
36695
|
+
_this.tableData.splice(_this.tableIndexBoundary.top, deleteCount);
|
36696
|
+
(_a = _this.changeTableData) == null ? void 0 : _a.call(_this, _this.tableData);
|
36697
|
+
}
|
36698
|
+
},
|
36699
|
+
setCellBg: {
|
36700
|
+
text: "Set Background",
|
36701
|
+
render(tableOperationMenu) {
|
36702
|
+
const bgColorHandler = this.handler.bind(tableOperationMenu);
|
36703
|
+
const root2 = getCellBackgroundSelectorRoot(bgColorHandler, tableOperationMenu.domNode);
|
36704
|
+
return root2;
|
36705
|
+
},
|
36706
|
+
handler(color2) {
|
36707
|
+
var _a;
|
36708
|
+
const _this = this;
|
36709
|
+
const { top, bottom, left, right } = _this.tableIndexBoundary;
|
36710
|
+
_this.tableData.forEach((tr) => {
|
36711
|
+
for (let index2 = 0; index2 < tr.length; index2++) {
|
36712
|
+
const td = tr[index2];
|
36713
|
+
const tdTop = tr[index2].top || 0;
|
36714
|
+
const tdBottom = tr[index2].bottom || 0;
|
36715
|
+
const tdLeft = tr[index2].left || 0;
|
36716
|
+
const tdRight = tr[index2].right || 0;
|
36717
|
+
if (tdLeft > right) {
|
36718
|
+
break;
|
36719
|
+
}
|
36720
|
+
if (top <= tdTop && bottom >= tdBottom && left <= tdLeft && right >= tdRight) {
|
36721
|
+
td.backgroundColor = color2;
|
36722
|
+
}
|
36723
|
+
}
|
36724
|
+
});
|
36725
|
+
(_a = _this.changeTableData) == null ? void 0 : _a.call(_this, _this.tableData);
|
36726
|
+
_this.hide();
|
36727
|
+
}
|
36728
|
+
}
|
36729
|
+
};
|
36730
|
+
const MENU_HEIGHT = 305;
|
36731
|
+
const MENU_WIDTH = 200;
|
36732
|
+
class TableOperationMenu {
|
36733
|
+
constructor() {
|
36734
|
+
__publicField(this, "menuItems", MENU_CONFIG);
|
36735
|
+
__publicField(this, "domNode");
|
36736
|
+
__publicField(this, "styleDom");
|
36737
|
+
__publicField(this, "visible", false);
|
36738
|
+
__publicField(this, "changeTableData");
|
36739
|
+
__publicField(this, "tableData");
|
36740
|
+
__publicField(this, "tableIndexBoundary");
|
36741
|
+
__publicField(this, "maxTdCount", 0);
|
36742
|
+
this.menuInitial();
|
36743
|
+
this.mount();
|
36744
|
+
}
|
36745
|
+
mount() {
|
36746
|
+
if (this.domNode) {
|
36747
|
+
document.body.appendChild(this.domNode);
|
36748
|
+
}
|
36749
|
+
document.body.addEventListener("click", this.hide.bind(this));
|
36750
|
+
}
|
36751
|
+
destroy() {
|
36752
|
+
var _a;
|
36753
|
+
(_a = this.domNode) == null ? void 0 : _a.remove();
|
36754
|
+
if (this.styleDom) {
|
36755
|
+
document.head.removeChild(this.styleDom);
|
36756
|
+
}
|
36757
|
+
document.body.removeEventListener("click", this.hide.bind(this));
|
36758
|
+
}
|
36759
|
+
hide() {
|
36760
|
+
if (!this.visible) {
|
36761
|
+
return;
|
36762
|
+
}
|
36763
|
+
this.visible = false;
|
36764
|
+
setStyle(this.domNode, {
|
36765
|
+
display: "none"
|
36766
|
+
});
|
36767
|
+
}
|
36768
|
+
addRow(insertIndex, colCount) {
|
36769
|
+
var _a;
|
36770
|
+
const newRow = Array.from({ length: colCount }).map(() => ({ content: "-" }));
|
36771
|
+
this.tableData.splice(insertIndex, 0, newRow);
|
36772
|
+
(_a = this.changeTableData) == null ? void 0 : _a.call(this, this.tableData);
|
36773
|
+
}
|
36774
|
+
setTableData(tableData) {
|
36775
|
+
this.tableData = tableData || [];
|
36776
|
+
this.maxTdCount = getMaxTdCount(this.tableData);
|
36777
|
+
}
|
36778
|
+
setTableIndexBoundary(tableIndexBoundary) {
|
36779
|
+
this.tableIndexBoundary = getCorrectTableIndexBoundary(tableIndexBoundary, this.tableData);
|
36780
|
+
}
|
36781
|
+
showMenu({ x, y }) {
|
36782
|
+
this.visible = true;
|
36783
|
+
const maxHeight = window.innerHeight;
|
36784
|
+
const maxWidth = window.innerWidth;
|
36785
|
+
if (maxWidth - MENU_WIDTH < x) {
|
36786
|
+
x -= MENU_WIDTH;
|
36787
|
+
}
|
36788
|
+
if (maxHeight - MENU_HEIGHT < y) {
|
36789
|
+
y -= MENU_HEIGHT;
|
36790
|
+
}
|
36791
|
+
setStyle(this.domNode, {
|
36792
|
+
display: "block",
|
36793
|
+
position: "absolute",
|
36794
|
+
left: `${x}px`,
|
36795
|
+
top: `${y}px`,
|
36796
|
+
"min-height": "150px",
|
36797
|
+
width: `${MENU_WIDTH}px`,
|
36798
|
+
Height: `${MENU_HEIGHT}px`
|
36799
|
+
});
|
36800
|
+
}
|
36801
|
+
menuInitial() {
|
36802
|
+
this.styleDom = document.createElement("style");
|
36803
|
+
this.styleDom.innerText = styleText$1;
|
36804
|
+
document.head.appendChild(this.styleDom);
|
36805
|
+
this.domNode = document.createElement("div");
|
36806
|
+
this.domNode.classList.add("easy-email-table-operation-menu");
|
36807
|
+
setStyle(this.domNode, { display: "none" });
|
36808
|
+
for (let name2 in this.menuItems) {
|
36809
|
+
const itemOption = this.menuItems[name2];
|
36810
|
+
if (itemOption) {
|
36811
|
+
this.domNode.appendChild(itemOption.render ? itemOption.render(this) : this.menuItemCreator(Object.assign({}, itemOption)));
|
36812
|
+
if (["insertRowDown", "deleteRow"].indexOf(name2) > -1) {
|
36813
|
+
this.domNode.appendChild(dividingCreator());
|
36814
|
+
}
|
36815
|
+
}
|
36816
|
+
}
|
36817
|
+
function dividingCreator() {
|
36818
|
+
const dividing = document.createElement("div");
|
36819
|
+
dividing.classList.add("easy-email-table-operation-menu-dividing");
|
36820
|
+
return dividing;
|
36821
|
+
}
|
36822
|
+
}
|
36823
|
+
menuItemCreator({ text, icon, handler }) {
|
36824
|
+
const node = document.createElement("div");
|
36825
|
+
node.classList.add("easy-email-table-operation-menu-item");
|
36826
|
+
const iconSpan = document.createElement("span");
|
36827
|
+
iconSpan.classList.add("easy-email-table-operation-menu-icon");
|
36828
|
+
iconSpan.innerHTML = icon;
|
36829
|
+
const textSpan = document.createElement("span");
|
36830
|
+
textSpan.classList.add("easy-email-table-operation-menu-text");
|
36831
|
+
textSpan.innerText = text;
|
36832
|
+
node.appendChild(iconSpan);
|
36833
|
+
node.appendChild(textSpan);
|
36834
|
+
node.addEventListener("click", handler.bind(this), false);
|
36835
|
+
return node;
|
36836
|
+
}
|
36837
|
+
}
|
36838
|
+
class TableColumnTool {
|
36839
|
+
constructor(borderTool, root2) {
|
36840
|
+
__publicField(this, "borderTool", {});
|
36841
|
+
__publicField(this, "dragging", false);
|
36842
|
+
__publicField(this, "showBorderTool", false);
|
36843
|
+
__publicField(this, "startRect", {});
|
36844
|
+
__publicField(this, "startTdTop", 0);
|
36845
|
+
__publicField(this, "startTdLeft", 0);
|
36846
|
+
__publicField(this, "endTdTop", 0);
|
36847
|
+
__publicField(this, "endTdLeft", 0);
|
36848
|
+
__publicField(this, "width", 0);
|
36849
|
+
__publicField(this, "height", 0);
|
36850
|
+
__publicField(this, "selectedLeftTopCell");
|
36851
|
+
__publicField(this, "selectedBottomRightCell");
|
36852
|
+
__publicField(this, "startDom");
|
36853
|
+
__publicField(this, "endDom");
|
36854
|
+
__publicField(this, "hoveringTable", null);
|
36855
|
+
__publicField(this, "root");
|
36856
|
+
__publicField(this, "tableMenu");
|
36857
|
+
__publicField(this, "changeTableData");
|
36858
|
+
__publicField(this, "tableData", []);
|
36859
|
+
__publicField(this, "hideBorder", (e) => {
|
36860
|
+
if (e.target.id === "VisualEditorEditMode") {
|
36861
|
+
return;
|
36862
|
+
}
|
36863
|
+
this.visibleBorder(false);
|
36864
|
+
});
|
36865
|
+
__publicField(this, "hideBorderByKeyDown", () => {
|
36866
|
+
this.visibleBorder(false);
|
36867
|
+
});
|
36868
|
+
__publicField(this, "hideTableMenu", (e) => {
|
36869
|
+
var _a;
|
36870
|
+
if ((e == null ? void 0 : e.target.id) === "VisualEditorEditMode") {
|
36871
|
+
return;
|
36872
|
+
}
|
36873
|
+
(_a = this.tableMenu) == null ? void 0 : _a.hide();
|
36874
|
+
});
|
36875
|
+
__publicField(this, "visibleBorder", (show = true) => {
|
36876
|
+
if (this.showBorderTool === show) {
|
36877
|
+
return;
|
36878
|
+
}
|
36879
|
+
if (show) {
|
36880
|
+
setStyle(this.borderTool.top.parentElement, { display: "block" });
|
36881
|
+
} else {
|
36882
|
+
setStyle(this.borderTool.top.parentElement, { display: "none" });
|
36883
|
+
}
|
36884
|
+
this.showBorderTool = show;
|
36885
|
+
});
|
36886
|
+
__publicField(this, "renderBorder", () => {
|
36887
|
+
this.visibleBorder(true);
|
36888
|
+
const result = getBoundaryRectAndElement(this.startDom, this.endDom);
|
36889
|
+
if (!result) {
|
36890
|
+
return;
|
36891
|
+
}
|
36892
|
+
const { left, top, width, height } = result.boundary;
|
36893
|
+
this.selectedLeftTopCell = result.leftTopCell;
|
36894
|
+
this.selectedBottomRightCell = result.bottomRightCell;
|
36895
|
+
setStyle(this.borderTool.top, {
|
36896
|
+
"background-color": "rgb(65, 68, 77)",
|
36897
|
+
left: `${left}px`,
|
36898
|
+
top: `${top}px`,
|
36899
|
+
width: `${Math.abs(width)}px`,
|
36900
|
+
height: "2px",
|
36901
|
+
position: "absolute",
|
36902
|
+
"z-index": 10
|
36903
|
+
});
|
36904
|
+
setStyle(this.borderTool.bottom, {
|
36905
|
+
"background-color": "rgb(65, 68, 77)",
|
36906
|
+
left: `${left}px`,
|
36907
|
+
top: `${top + height}px`,
|
36908
|
+
width: `${Math.abs(width)}px`,
|
36909
|
+
height: "2px",
|
36910
|
+
position: "absolute",
|
36911
|
+
"z-index": 10
|
36912
|
+
});
|
36913
|
+
setStyle(this.borderTool.left, {
|
36914
|
+
"background-color": "rgb(65, 68, 77)",
|
36915
|
+
left: `${left}px`,
|
36916
|
+
top: `${top}px`,
|
36917
|
+
width: `2px`,
|
36918
|
+
height: `${Math.abs(height)}px`,
|
36919
|
+
position: "absolute",
|
36920
|
+
"z-index": 10
|
36921
|
+
});
|
36922
|
+
setStyle(this.borderTool.right, {
|
36923
|
+
"background-color": "rgb(65, 68, 77)",
|
36924
|
+
left: `${left + width}px`,
|
36925
|
+
top: `${top}px`,
|
36926
|
+
width: `2px`,
|
36927
|
+
height: `${Math.abs(height)}px`,
|
36928
|
+
position: "absolute",
|
36929
|
+
"z-index": 10
|
36930
|
+
});
|
36931
|
+
});
|
36932
|
+
__publicField(this, "handleContextmenu", (event2) => {
|
36933
|
+
if (this.showBorderTool) {
|
36934
|
+
const selectedBoundary = getElementsBoundary(this.selectedLeftTopCell, this.selectedBottomRightCell);
|
36935
|
+
if (checkEventInBoundingRect(selectedBoundary, event2)) {
|
36936
|
+
event2.preventDefault();
|
36937
|
+
return;
|
36938
|
+
}
|
36939
|
+
}
|
36940
|
+
this.hideTableMenu();
|
36941
|
+
});
|
36942
|
+
__publicField(this, "handleDrag", (e) => {
|
36943
|
+
e.preventDefault();
|
36944
|
+
if (this.dragging) {
|
36945
|
+
let target2 = e.target;
|
36946
|
+
while (target2 && target2.parentNode) {
|
36947
|
+
if (target2.nodeName === "TD" && target2.getAttribute("data-content_editable-type") === "rich_text") {
|
36948
|
+
const hoveringTable = getCurrentTable(target2);
|
36949
|
+
if (this.endDom === target2 || this.hoveringTable !== hoveringTable) {
|
36950
|
+
return;
|
36951
|
+
}
|
36952
|
+
this.endDom = target2;
|
36953
|
+
this.renderBorder();
|
36954
|
+
return;
|
36955
|
+
}
|
36956
|
+
target2 = target2.parentNode;
|
36957
|
+
}
|
36958
|
+
}
|
36959
|
+
});
|
36960
|
+
__publicField(this, "handleMouseup", (e) => {
|
36961
|
+
var _a, _b;
|
36962
|
+
e.preventDefault();
|
36963
|
+
if (this.dragging) {
|
36964
|
+
this.dragging = false;
|
36965
|
+
(_a = this.root) == null ? void 0 : _a.removeEventListener("mousemove", this.handleDrag);
|
36966
|
+
(_b = this.root) == null ? void 0 : _b.removeEventListener("mouseup", this.handleMouseup);
|
36967
|
+
}
|
36968
|
+
});
|
36969
|
+
if (!borderTool || !root2) {
|
36970
|
+
return;
|
36971
|
+
}
|
36972
|
+
this.borderTool = borderTool;
|
36973
|
+
this.root = root2;
|
36974
|
+
this.initTool();
|
36975
|
+
}
|
36976
|
+
initTool() {
|
36977
|
+
var _a, _b;
|
36978
|
+
(_a = this.root) == null ? void 0 : _a.addEventListener("contextmenu", this.handleContextmenu);
|
36979
|
+
(_b = this.root) == null ? void 0 : _b.addEventListener("mousedown", this.handleMousedown.bind(this));
|
36980
|
+
document.body.addEventListener("click", this.hideBorder, false);
|
36981
|
+
document.body.addEventListener("contextmenu", this.hideTableMenu, false);
|
36982
|
+
document.addEventListener("keydown", this.hideBorderByKeyDown);
|
36983
|
+
}
|
36984
|
+
destroy() {
|
36985
|
+
var _a, _b, _c;
|
36986
|
+
(_a = this.root) == null ? void 0 : _a.removeEventListener("mousedown", this.handleMousedown.bind(this));
|
36987
|
+
(_b = this.root) == null ? void 0 : _b.removeEventListener("contextmenu", this.handleContextmenu);
|
36988
|
+
document.body.removeEventListener("click", this.hideBorder, false);
|
36989
|
+
document.body.removeEventListener("contextmenu", this.hideTableMenu, false);
|
36990
|
+
document.removeEventListener("keydown", this.hideBorderByKeyDown);
|
36991
|
+
(_c = this.tableMenu) == null ? void 0 : _c.destroy();
|
36992
|
+
}
|
36993
|
+
handleMousedown(event2) {
|
36994
|
+
var _a, _b;
|
36995
|
+
let target2 = event2.target;
|
36996
|
+
if (event2.button == 0) {
|
36997
|
+
while (target2 && target2.parentNode) {
|
36998
|
+
if (target2.nodeName === "TD" && target2.getAttribute("data-content_editable-type") === "rich_text") {
|
36999
|
+
(_a = this.root) == null ? void 0 : _a.addEventListener("mousemove", this.handleDrag);
|
37000
|
+
(_b = this.root) == null ? void 0 : _b.addEventListener("mouseup", this.handleMouseup);
|
37001
|
+
this.dragging = true;
|
37002
|
+
this.startDom = target2;
|
37003
|
+
this.endDom = target2;
|
37004
|
+
this.hoveringTable = getCurrentTable(target2);
|
37005
|
+
this.renderBorder();
|
37006
|
+
return;
|
37007
|
+
}
|
37008
|
+
target2 = target2.parentNode;
|
37009
|
+
if (["TR", "TABLE", "BODY"].includes(target2.nodeName)) {
|
37010
|
+
this.visibleBorder(false);
|
37011
|
+
return;
|
37012
|
+
}
|
37013
|
+
}
|
37014
|
+
} else if (event2.button == 2) {
|
37015
|
+
if (this.showBorderTool) {
|
37016
|
+
const selectedBoundary = getElementsBoundary(this.selectedLeftTopCell, this.selectedBottomRightCell);
|
37017
|
+
if (checkEventInBoundingRect(selectedBoundary, event2)) {
|
37018
|
+
if (!this.tableMenu) {
|
37019
|
+
this.tableMenu = new TableOperationMenu();
|
37020
|
+
}
|
37021
|
+
this.tableMenu.setTableData(this.tableData);
|
37022
|
+
this.tableMenu.changeTableData = this.changeTableData;
|
37023
|
+
this.tableMenu.setTableIndexBoundary(getTdBoundaryIndex(this.selectedLeftTopCell, this.selectedBottomRightCell));
|
37024
|
+
this.tableMenu.showMenu(event2);
|
37025
|
+
return;
|
37026
|
+
}
|
37027
|
+
}
|
37028
|
+
}
|
37029
|
+
this.visibleBorder(false);
|
37030
|
+
}
|
37031
|
+
}
|
37032
|
+
function TableOperation() {
|
37033
|
+
const shadowRoot = getShadowRoot();
|
37034
|
+
const { focusIdx: focusIdx2 } = useFocusIdx();
|
37035
|
+
const { focusBlock: focusBlock2, change } = useBlock();
|
37036
|
+
const topRef = useRef(null);
|
37037
|
+
const bottomRef = useRef(null);
|
37038
|
+
const leftRef = useRef(null);
|
37039
|
+
const rightRef = useRef(null);
|
37040
|
+
const tool = useRef();
|
37041
|
+
useEffect(() => {
|
37042
|
+
const borderTool = {
|
37043
|
+
top: topRef.current,
|
37044
|
+
bottom: bottomRef.current,
|
37045
|
+
left: leftRef.current,
|
37046
|
+
right: rightRef.current
|
37047
|
+
};
|
37048
|
+
tool.current = new TableColumnTool(borderTool, shadowRoot.querySelector("body"));
|
37049
|
+
return () => {
|
37050
|
+
var _a;
|
37051
|
+
(_a = tool.current) == null ? void 0 : _a.destroy();
|
37052
|
+
};
|
37053
|
+
}, []);
|
37054
|
+
useEffect(() => {
|
37055
|
+
var _a, _b;
|
37056
|
+
if (tool.current) {
|
37057
|
+
tool.current.changeTableData = (data) => {
|
37058
|
+
change(`${focusIdx2}.data.value.tableSource`, lodash.exports.cloneDeep(data));
|
37059
|
+
};
|
37060
|
+
tool.current.tableData = lodash.exports.cloneDeep(((_b = (_a = focusBlock2 == null ? void 0 : focusBlock2.data) == null ? void 0 : _a.value) == null ? void 0 : _b.tableSource) || []);
|
37061
|
+
}
|
37062
|
+
}, [focusIdx2, focusBlock2]);
|
37063
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, shadowRoot && createPortal(/* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", {
|
37064
|
+
ref: topRef
|
37065
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
37066
|
+
ref: bottomRef
|
37067
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
37068
|
+
ref: leftRef
|
37069
|
+
}), /* @__PURE__ */ React__default.createElement("div", {
|
37070
|
+
ref: rightRef
|
37071
|
+
}))), shadowRoot.querySelector("body")));
|
37072
|
+
}
|
36188
37073
|
function AttributePanel() {
|
36189
37074
|
const { values: values2, focusBlock: focusBlock2 } = useBlock();
|
36190
37075
|
const { initialized } = useEditorContext();
|
@@ -36203,7 +37088,7 @@ function AttributePanel() {
|
|
36203
37088
|
style: { position: "absolute" }
|
36204
37089
|
}, /* @__PURE__ */ React__default.createElement(RichTextField, {
|
36205
37090
|
idx: focusIdx2
|
36206
|
-
})), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
37091
|
+
})), /* @__PURE__ */ React__default.createElement(TableOperation, null), /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, shadowRoot && ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement("style", null, `
|
36207
37092
|
.email-block [contentEditable="true"],
|
36208
37093
|
.email-block [contentEditable="true"] * {
|
36209
37094
|
outline: none;
|
@@ -36620,7 +37505,7 @@ function FontSize(props) {
|
|
36620
37505
|
className: "easy-email-extensions-Tools-Popover",
|
36621
37506
|
popupVisible: visible,
|
36622
37507
|
onVisibleChange,
|
36623
|
-
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$
|
37508
|
+
content: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("style", null, styleText$2), /* @__PURE__ */ React__default.createElement("div", {
|
36624
37509
|
style: {
|
36625
37510
|
maxWidth: 150,
|
36626
37511
|
maxHeight: 350,
|
@@ -37281,7 +38166,7 @@ function getDirectionFormDropPosition(position) {
|
|
37281
38166
|
return "bottom";
|
37282
38167
|
return "";
|
37283
38168
|
}
|
37284
|
-
|
38169
|
+
let iconsMap = {
|
37285
38170
|
[BasicType.TEXT]: "icon-text",
|
37286
38171
|
[BasicType.SECTION]: "icon-section",
|
37287
38172
|
[BasicType.COLUMN]: "icon-column",
|
@@ -37315,6 +38200,9 @@ const iconsMap = {
|
|
37315
38200
|
function getIconNameByBlockType(type) {
|
37316
38201
|
return lodash.exports.get(iconsMap, type) || "icon-number";
|
37317
38202
|
}
|
38203
|
+
function setIconsMap(map) {
|
38204
|
+
iconsMap = __spreadValues(__spreadValues({}, iconsMap), map);
|
38205
|
+
}
|
37318
38206
|
const tempEle = document.createElement("div");
|
37319
38207
|
function getBlockTitle(blockData, isFromContent = true) {
|
37320
38208
|
var _a;
|
@@ -46281,5 +47169,5 @@ const StandardLayout = (props) => {
|
|
46281
47169
|
style: { width: 0, overflow: "hidden" }
|
46282
47170
|
}))), /* @__PURE__ */ React__default.createElement(InteractivePrompt, null), /* @__PURE__ */ React__default.createElement(MergeTagBadgePrompt, null)));
|
46283
47171
|
};
|
46284
|
-
export {
|
47172
|
+
export { ExtensionProvider as $, AttributePanel as A, BlockLayer as B, Color as C, Decoration as D, FontWeight as E, FontFamily as F, Padding as G, Height as H, ClassName as I, PresetColorsProvider as J, ShortcutToolbar as K, LetterSpacing as L, MjmlToJson as M, NavbarLinkPadding as N, BlockMarketManager as O, Page as P, BlockMaskWrapper as Q, SourceCodePanel as R, SelectionRangeProvider as S, TextAlign as T, InteractivePrompt as U, VerticalAlign as V, Width as W, SimpleLayout as X, StandardLayout as Y, MergeTagBadgePrompt as Z, ExtensionContext as _, getIconNameByBlockType as a, useExtensionProps as a0, RICH_TEXT_TOOL_BAR as a1, TextField as a2, InputWithUnitField as a3, SearchField as a4, TextAreaField as a5, NumberField as a6, SliderField as a7, UploadField as a8, ImageUploaderField as a9, SelectField as aa, TreeSelectField as ab, AutoCompleteField as ac, RadioGroupField as ad, SwitchField as ae, CheckboxField as af, EditTabField as ag, EditGridTabField as ah, InlineTextField as ai, ColorPickerField as aj, enhancer as ak, RichTextField as al, ShadowDom as am, getBlockTitle as b, commonjsGlobal as c, BlockAttributeConfigurationManager as d, Align as e, AttributesPanelWrapper as f, getContextMergeTags as g, CollapseWrapper as h, Condition as i, ContainerBackgroundColor as j, TextDecoration as k, Background as l, LineHeight as m, TextTransform as n, BackgroundColor as o, Direction as p, Link as q, Border as r, setIconsMap as s, Margin as t, BorderColor as u, FontSize$1 as v, MergeTags$1 as w, BorderStyle as x, FontStyle as y, BorderWidth as z };
|
46285
47173
|
//# sourceMappingURL=index2.js.map
|