@doreamonjs/page-detail 1.12.16 → 1.12.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.12.19](https://github.com/doreamonjs/doreamon/compare/v1.12.18...v1.12.19) (2024-08-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * page-detail if no id in values, use loading method ([118ec31](https://github.com/doreamonjs/doreamon/commit/118ec31a4d9d58d869582fbdf531a14f75044533))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.12.17](https://github.com/doreamonjs/doreamon/compare/v1.12.16...v1.12.17) (2024-07-23)
18
+
19
+ **Note:** Version bump only for package @doreamonjs/page-detail
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.12.16](https://github.com/doreamonjs/doreamon/compare/v1.12.15...v1.12.16) (2024-07-22)
7
26
 
8
27
  **Note:** Version bump only for package @doreamonjs/page-detail
package/lib/index.d.ts CHANGED
@@ -26,6 +26,7 @@ interface Attributes {
26
26
  subTitle?: string;
27
27
  actions: any[];
28
28
  detail: {
29
+ loading?: (id: string, values: any, context: any) => boolean;
29
30
  basis: DetailBasis;
30
31
  modules: DetailModules;
31
32
  };
package/lib/index.js CHANGED
@@ -31,7 +31,7 @@ const icons_1 = require("@ant-design/icons");
31
31
  require("./index.less");
32
32
  const componentName = 'doreamonjs-design-page-detail';
33
33
  const DetailPage = (props) => {
34
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
34
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
35
35
  const [isMobile] = react_1.useState((_b = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, "(max-width: 767px)")) === null || _b === void 0 ? void 0 : _b.matches);
36
36
  const values = (_d = (_c = props === null || props === void 0 ? void 0 : props.datasets) === null || _c === void 0 ? void 0 : _c.values) !== null && _d !== void 0 ? _d : {};
37
37
  const renderBasisBottom = (_f = (_e = props.attributes.detail) === null || _e === void 0 ? void 0 : _e.basis) === null || _f === void 0 ? void 0 : _f.renderBottom;
@@ -80,7 +80,24 @@ const DetailPage = (props) => {
80
80
  render,
81
81
  };
82
82
  });
83
- if (+((_w = doreamon_1.default.dom.router.getQuery()) === null || _w === void 0 ? void 0 : _w.id) !== (values === null || values === void 0 ? void 0 : values.id)) {
83
+ const isLoading = () => {
84
+ var _a;
85
+ const id = (_a = doreamon_1.default.dom.router.getQuery()) === null || _a === void 0 ? void 0 : _a.id;
86
+ if (typeof props.attributes.detail.loading === 'function') {
87
+ return props.attributes.detail.loading(id, values, props);
88
+ }
89
+ if (Object.keys(values).length === 0) {
90
+ return true;
91
+ }
92
+ if (typeof (values === null || values === void 0 ? void 0 : values.id) === 'string') {
93
+ return id !== (values === null || values === void 0 ? void 0 : values.id);
94
+ }
95
+ else if (typeof (values === null || values === void 0 ? void 0 : values.id) === 'number') {
96
+ return +id !== (values === null || values === void 0 ? void 0 : values.id);
97
+ }
98
+ return false;
99
+ };
100
+ if (isLoading()) {
84
101
  return (react_1.default.createElement("div", { style: {
85
102
  width: '100%',
86
103
  height: '500px',
@@ -92,7 +109,7 @@ const DetailPage = (props) => {
92
109
  return (react_1.default.createElement("div", { className: doreamon_1.default.classnames('page', componentName, props.className) },
93
110
  react_1.default.createElement(components_1.Card.Information, { title: !isMobile ? title : (react_1.default.createElement("div", null,
94
111
  react_1.default.createElement(icons_1.ArrowLeftOutlined, { style: { marginRight: 8 }, onClick: () => { var _a, _b, _c, _d, _e; return (_e = (_d = (_c = (_b = (_a = window) === null || _a === void 0 ? void 0 : _a.__DOREAMONJS_SDK) === null || _b === void 0 ? void 0 : _b.shared) === null || _c === void 0 ? void 0 : _c.router) === null || _d === void 0 ? void 0 : _d.goBack) === null || _e === void 0 ? void 0 : _e.call(_d); } }),
95
- react_1.default.createElement("div", { style: { display: 'inline-block' } }, title))), subTitle: subTitle, actions: props.attributes.actions, allowActionTypes: ['custom'], column: (_z = (_y = (_x = props.attributes.detail) === null || _x === void 0 ? void 0 : _x.basis) === null || _y === void 0 ? void 0 : _y.column) !== null && _z !== void 0 ? _z : 2, items: details, data: values, onActionClick: (action, values) => {
112
+ react_1.default.createElement("div", { style: { display: 'inline-block' } }, title))), subTitle: subTitle, actions: props.attributes.actions, allowActionTypes: ['custom'], column: (_y = (_x = (_w = props.attributes.detail) === null || _w === void 0 ? void 0 : _w.basis) === null || _x === void 0 ? void 0 : _x.column) !== null && _y !== void 0 ? _y : 2, items: details, data: values, onActionClick: (action, values) => {
96
113
  props.onActionTrigger(action, {
97
114
  values,
98
115
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doreamonjs/page-detail",
3
- "version": "1.12.16",
3
+ "version": "1.12.19",
4
4
  "description": "detail page",
5
5
  "keywords": [
6
6
  "doreamonjs",
@@ -71,7 +71,7 @@
71
71
  "@znode/fs": "^1.0.2"
72
72
  },
73
73
  "dependencies": {
74
- "@doreamonjs/components": "^1.12.16",
74
+ "@doreamonjs/components": "^1.12.17",
75
75
  "@zodash/doreamon": "^1.1.5",
76
76
  "antd": "4.18.9",
77
77
  "react-monaco-editor": "^0.50.1",
@@ -80,5 +80,5 @@
80
80
  "xterm-addon-attach": "^0.6.0",
81
81
  "xterm-addon-fit": "^0.5.0"
82
82
  },
83
- "gitHead": "70e323bd599f62fc9a9407d2e2d71af3ee69bf86"
83
+ "gitHead": "c5aafbf95c3f8d213f2c9412a38fae9d0f6b1880"
84
84
  }