@pisell/lowcode-renderer 1.0.1 → 1.0.3

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.
@@ -16,8 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  import { injectComponents } from "@alilc/lowcode-plugin-inject";
17
17
  import { AssetLoader, buildComponents } from "@alilc/lowcode-utils";
18
18
  import { Skeleton } from "antd";
19
- import isArray from "lodash/isArray";
20
- import mergeWith from "lodash/mergeWith";
19
+ import { isArray, mergeWith } from "lodash-es";
21
20
  import { useEffect, useState } from "react";
22
21
  import ReactRenderer from "../ReactRenderer";
23
22
  import appHelper from "../appHelper";
@@ -3,9 +3,9 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
3
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
5
  import urls from "./URL";
6
- import { injectedConfig } from "../../config";
6
+ import { getShopId, injectedConfig } from "../../config";
7
7
  var getParams = function getParams(values) {
8
- var shop_id = injectedConfig.shop_id;
8
+ var shop_id = getShopId();
9
9
  var _ref = values || {},
10
10
  date = _ref.date;
11
11
 
@@ -1,8 +1,9 @@
1
1
  declare type InjectedConfigType = {
2
- shop_id: number;
2
+ shop_id: number | (() => number);
3
3
  request: any;
4
4
  dayjs: any;
5
5
  };
6
6
  declare let injectedConfig: InjectedConfigType;
7
7
  export declare const injectConfig: (context: InjectedConfigType) => void;
8
- export { injectedConfig };
8
+ declare const getShopId: () => number;
9
+ export { injectedConfig, getShopId };
@@ -2,4 +2,10 @@ var injectedConfig = {};
2
2
  export var injectConfig = function injectConfig(context) {
3
3
  injectedConfig = context;
4
4
  };
5
- export { injectedConfig };
5
+ var getShopId = function getShopId() {
6
+ if (typeof injectedConfig.shop_id === "function") {
7
+ return injectedConfig.shop_id();
8
+ }
9
+ return injectedConfig.shop_id;
10
+ };
11
+ export { injectedConfig, getShopId };
@@ -35,8 +35,7 @@ module.exports = __toCommonJS(Render_exports);
35
35
  var import_lowcode_plugin_inject = require("@alilc/lowcode-plugin-inject");
36
36
  var import_lowcode_utils = require("@alilc/lowcode-utils");
37
37
  var import_antd = require("antd");
38
- var import_isArray = __toESM(require("lodash/isArray"));
39
- var import_mergeWith = __toESM(require("lodash/mergeWith"));
38
+ var import_lodash_es = require("lodash-es");
40
39
  var import_react = require("react");
41
40
  var import_ReactRenderer = __toESM(require("../ReactRenderer"));
42
41
  var import_appHelper = __toESM(require("../appHelper"));
@@ -102,7 +101,7 @@ var Render = (props) => {
102
101
  return /* @__PURE__ */ React.createElement("div", { style: { padding: 20 } }, /* @__PURE__ */ React.createElement(import_antd.Skeleton, { loading: true, active: true, round: true }));
103
102
  }
104
103
  function customizer(objValue, srcValue) {
105
- if ((0, import_isArray.default)(objValue)) {
104
+ if ((0, import_lodash_es.isArray)(objValue)) {
106
105
  return objValue.concat(srcValue || []);
107
106
  }
108
107
  }
@@ -112,9 +111,9 @@ var Render = (props) => {
112
111
  className: `lowcode-plugin-sample-preview-content ${className}`,
113
112
  schema: {
114
113
  ...schema,
115
- dataSource: (0, import_mergeWith.default)(schema.dataSource, projectDataSource, customizer)
114
+ dataSource: (0, import_lodash_es.mergeWith)(schema.dataSource, projectDataSource, customizer)
116
115
  },
117
- appHelper: (0, import_mergeWith.default)(import_appHelper.default, propsAppHelper),
116
+ appHelper: (0, import_lodash_es.mergeWith)(import_appHelper.default, propsAppHelper),
118
117
  components
119
118
  }
120
119
  );
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(report_exports);
35
35
  var import_URL = __toESM(require("./URL"));
36
36
  var import_config = require("../../config");
37
37
  var getParams = (values) => {
38
- let shop_id = import_config.injectedConfig.shop_id;
38
+ let shop_id = (0, import_config.getShopId)();
39
39
  let { date } = values || {};
40
40
  let start_at = 0;
41
41
  let end_at = 0;
@@ -1,8 +1,9 @@
1
1
  declare type InjectedConfigType = {
2
- shop_id: number;
2
+ shop_id: number | (() => number);
3
3
  request: any;
4
4
  dayjs: any;
5
5
  };
6
6
  declare let injectedConfig: InjectedConfigType;
7
7
  export declare const injectConfig: (context: InjectedConfigType) => void;
8
- export { injectedConfig };
8
+ declare const getShopId: () => number;
9
+ export { injectedConfig, getShopId };
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/config/index.ts
20
20
  var config_exports = {};
21
21
  __export(config_exports, {
22
+ getShopId: () => getShopId,
22
23
  injectConfig: () => injectConfig,
23
24
  injectedConfig: () => injectedConfig
24
25
  });
@@ -27,8 +28,15 @@ var injectedConfig = {};
27
28
  var injectConfig = (context) => {
28
29
  injectedConfig = context;
29
30
  };
31
+ var getShopId = () => {
32
+ if (typeof injectedConfig.shop_id === "function") {
33
+ return injectedConfig.shop_id();
34
+ }
35
+ return injectedConfig.shop_id;
36
+ };
30
37
  // Annotate the CommonJS export names for ESM import in node:
31
38
  0 && (module.exports = {
39
+ getShopId,
32
40
  injectConfig,
33
41
  injectedConfig
34
42
  });
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@pisell/lowcode-renderer",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
+ "sideEffects": false,
4
5
  "main": "./lib/index.js",
5
6
  "module": "./es/index.js",
6
7
  "types": "./lib/index.d.ts",
@@ -15,7 +16,7 @@
15
16
  "@alilc/lowcode-renderer-core": "^1.1.7",
16
17
  "antd": "^5.6.4",
17
18
  "@alifd/next": "^1.25.44",
18
- "lodash": "^4.17.21"
19
+ "lodash-es": "^4.17.21"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "react": ">=16.9.0",