hzerojs-plugin-yqcloud-jssdk 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +13 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -33,8 +33,9 @@ __export(src_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(src_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_modal = __toESM(require("choerodon-ui/pro/lib/modal"));
|
|
37
|
+
var import_menu = __toESM(require("choerodon-ui/pro/lib/menu"));
|
|
38
|
+
var import_popover = __toESM(require("choerodon-ui/lib/popover"));
|
|
38
39
|
var import_axios = __toESM(require("axios"));
|
|
39
40
|
var import_index = require("./index.css");
|
|
40
41
|
var YQ_API_HOST = "https://api.test.yqcloud.com";
|
|
@@ -126,8 +127,13 @@ var src_default = (props) => {
|
|
|
126
127
|
if (fieldData) {
|
|
127
128
|
urlParam = `&fieldData=${fieldData}${authParam}`;
|
|
128
129
|
}
|
|
129
|
-
const
|
|
130
|
+
const handleIframeLoad = () => {
|
|
131
|
+
modal.update({ movable: true });
|
|
132
|
+
};
|
|
133
|
+
const modal = import_modal.default.open({
|
|
130
134
|
maskClosable: true,
|
|
135
|
+
movable: false,
|
|
136
|
+
// 初始禁用拖拽,等待 iframe 加载完成
|
|
131
137
|
bodyStyle: {
|
|
132
138
|
width: "100%",
|
|
133
139
|
height: "100%",
|
|
@@ -147,7 +153,7 @@ var src_default = (props) => {
|
|
|
147
153
|
margin: "0"
|
|
148
154
|
},
|
|
149
155
|
header: null,
|
|
150
|
-
children: /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", width: "100%", height: "calc(100% - 40px)", bottom: "0" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", top: "-30px", right: "10px" }, onClick: () => modal.close() }, /* @__PURE__ */ import_react.default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react.default.createElement("path", { d: "M8 8L40 40", stroke: "#333", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M8 40L40 8", stroke: "#333", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }))), /* @__PURE__ */ import_react.default.createElement("iframe", { id: "yq-sdk-frame", style: { width: "100%", height: "100%" }, src: `${openFunction.link}${urlParam}`, frameBorder: "0" })),
|
|
156
|
+
children: /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", width: "100%", height: "calc(100% - 40px)", bottom: "0" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { position: "absolute", top: "-30px", right: "10px" }, onClick: () => modal.close() }, /* @__PURE__ */ import_react.default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ import_react.default.createElement("path", { d: "M8 8L40 40", stroke: "#333", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ import_react.default.createElement("path", { d: "M8 40L40 8", stroke: "#333", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }))), /* @__PURE__ */ import_react.default.createElement("iframe", { id: "yq-sdk-frame", style: { width: "100%", height: "100%" }, src: `${openFunction.link}${urlParam}`, frameBorder: "0", onLoad: handleIframeLoad })),
|
|
151
157
|
footer: null
|
|
152
158
|
});
|
|
153
159
|
function closeModal(e) {
|
|
@@ -161,9 +167,9 @@ var src_default = (props) => {
|
|
|
161
167
|
function defaultIcon() {
|
|
162
168
|
return /* @__PURE__ */ import_react.default.createElement("div", { type: "picture", style: { width: 18, height: 18, marginRight: 10, display: "inline-block" } });
|
|
163
169
|
}
|
|
164
|
-
const menu = /* @__PURE__ */ import_react.default.createElement(
|
|
170
|
+
const menu = /* @__PURE__ */ import_react.default.createElement(import_menu.default, null, (_a = appConfig == null ? void 0 : appConfig.openFunctions) == null ? void 0 : _a.map((openFunction) => {
|
|
165
171
|
if (openFunction.enabledFlag) {
|
|
166
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
172
|
+
return /* @__PURE__ */ import_react.default.createElement(import_menu.default.Item, { onClick: () => openModal(openFunction), key: openFunction.id }, openFunction.icon ? /* @__PURE__ */ import_react.default.createElement(
|
|
167
173
|
"img",
|
|
168
174
|
{
|
|
169
175
|
style: { width: 18, height: 18, marginRight: 10 },
|
|
@@ -175,5 +181,5 @@ var src_default = (props) => {
|
|
|
175
181
|
return null;
|
|
176
182
|
}));
|
|
177
183
|
const onlyOneButton = /* @__PURE__ */ import_react.default.createElement("div", { className: "yq-hzero-jssdk-btn", style: { padding: 0 }, onClick: () => openModal(appConfig == null ? void 0 : appConfig.openFunctions[0]) }, appConfig.icon ? /* @__PURE__ */ import_react.default.createElement("img", { style: { width: 18, height: 18, marginRight: 10 }, src: `${apiHost}/hfle/yqc/v1/0/files/public/download-by-key?fileKey=${appConfig.icon}`, alt: "" }) : /* @__PURE__ */ import_react.default.createElement("div", { type: "picture", style: { width: 18, height: 18, marginRight: 10, display: "inline-block" } }), (entryDetail == null ? void 0 : entryDetail.entryName) || (appConfig == null ? void 0 : appConfig.displayName) || (appConfig == null ? void 0 : appConfig.name));
|
|
178
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "yqcloud-hzero-jssdk", ref: eleRef }, ((_b = appConfig == null ? void 0 : appConfig.openFunctions) == null ? void 0 : _b.length) === 1 ? onlyOneButton : /* @__PURE__ */ import_react.default.createElement(
|
|
184
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "yqcloud-hzero-jssdk", ref: eleRef }, ((_b = appConfig == null ? void 0 : appConfig.openFunctions) == null ? void 0 : _b.length) === 1 ? onlyOneButton : /* @__PURE__ */ import_react.default.createElement(import_popover.default, { overlayClassName: "yqcloud-hzero-jssdk-popover", overlayStyle: { padding: 0 }, openClassName: "yqcloud-hzero-jssdk-popover", content: menu, placement: "left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "yq-hzero-jssdk-btn", style: { padding: 0 } }, appConfig.icon ? /* @__PURE__ */ import_react.default.createElement("img", { style: { width: 18, height: 18, marginRight: 10 }, src: `${apiHost}/hfle/yqc/v1/0/files/public/download-by-key?fileKey=${appConfig.icon}`, alt: "" }) : /* @__PURE__ */ import_react.default.createElement("div", { type: "picture", style: { width: 18, height: 18, marginRight: 10, display: "inline-block" } }), (entryDetail == null ? void 0 : entryDetail.entryName) || (appConfig == null ? void 0 : appConfig.displayName) || (appConfig == null ? void 0 : appConfig.name))));
|
|
179
185
|
};
|