@doreamonjs/page-detail 1.12.58 → 1.12.60

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,22 @@
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.60](https://github.com/doreamonjs/doreamon/compare/v1.12.59...v1.12.60) (2024-12-11)
7
+
8
+ **Note:** Version bump only for package @doreamonjs/page-detail
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.12.59](https://github.com/doreamonjs/doreamon/compare/v1.12.58...v1.12.59) (2024-12-11)
15
+
16
+ **Note:** Version bump only for package @doreamonjs/page-detail
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.12.58](https://github.com/doreamonjs/doreamon/compare/v1.12.57...v1.12.58) (2024-12-11)
7
23
 
8
24
  **Note:** Version bump only for package @doreamonjs/page-detail
package/lib/index.d.ts CHANGED
@@ -27,8 +27,8 @@ interface Attributes {
27
27
  actions: any[];
28
28
  detail: {
29
29
  loading?: (id: string, values: any, context: any) => boolean;
30
- basis: DetailBasis;
31
- modules: DetailModules;
30
+ basis: DetailBasis | ((values: any, context: any) => JSX.Element);
31
+ modules: DetailModules | ((values: any, context: any) => JSX.Element);
32
32
  };
33
33
  }
34
34
  interface Datasets {
@@ -50,7 +50,7 @@ export interface InfoItem {
50
50
  rollout?: string;
51
51
  }
52
52
  export interface DetailModules {
53
- items: TabItem[];
53
+ items?: TabItem[];
54
54
  default?: string;
55
55
  }
56
56
  export interface TabItem {
package/lib/index.js CHANGED
@@ -34,52 +34,77 @@ const DetailPage = (props) => {
34
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
- const renderBasisBottom = (_f = (_e = props.attributes.detail) === null || _e === void 0 ? void 0 : _e.basis) === null || _f === void 0 ? void 0 : _f.renderBottom;
38
- let title = (_k = (_h = (_g = values === null || values === void 0 ? void 0 : values.title) !== null && _g !== void 0 ? _g : values === null || values === void 0 ? void 0 : values.name) !== null && _h !== void 0 ? _h : (_j = props.attributes) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '-';
39
- let subTitle = (_l = values === null || values === void 0 ? void 0 : values.subTitle) !== null && _l !== void 0 ? _l : (_m = props.attributes) === null || _m === void 0 ? void 0 : _m.subTitle;
40
- if (!!((_p = (_o = props.attributes.detail) === null || _o === void 0 ? void 0 : _o.basis) === null || _p === void 0 ? void 0 : _p.title)) {
41
- const title_ = props.attributes.detail.basis.title;
42
- if (typeof title_ === 'function') {
43
- title = title_(values, props);
44
- }
45
- else {
46
- title = title_;
47
- }
37
+ let basisNode = null;
38
+ if (typeof props.attributes.detail.basis === 'function') {
39
+ basisNode = props.attributes.detail.basis(props.datasets.values, props);
48
40
  }
49
- if (!!((_r = (_q = props.attributes.detail) === null || _q === void 0 ? void 0 : _q.basis) === null || _r === void 0 ? void 0 : _r.subTitle)) {
50
- const subTitle_ = props.attributes.detail.basis.subTitle;
51
- if (typeof subTitle_ === 'function') {
52
- subTitle = subTitle_(values, props);
41
+ else {
42
+ const details = (_e = props.attributes.detail.basis) === null || _e === void 0 ? void 0 : _e.items;
43
+ const renderBasisBottom = (_g = (_f = props.attributes.detail) === null || _f === void 0 ? void 0 : _f.basis) === null || _g === void 0 ? void 0 : _g.renderBottom;
44
+ let title = (_l = (_j = (_h = values === null || values === void 0 ? void 0 : values.title) !== null && _h !== void 0 ? _h : values === null || values === void 0 ? void 0 : values.name) !== null && _j !== void 0 ? _j : (_k = props.attributes) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '-';
45
+ let subTitle = (_m = values === null || values === void 0 ? void 0 : values.subTitle) !== null && _m !== void 0 ? _m : (_o = props.attributes) === null || _o === void 0 ? void 0 : _o.subTitle;
46
+ if (!!((_q = (_p = props.attributes.detail) === null || _p === void 0 ? void 0 : _p.basis) === null || _q === void 0 ? void 0 : _q.title)) {
47
+ const title_ = props.attributes.detail.basis.title;
48
+ if (typeof title_ === 'function') {
49
+ title = title_(values, props);
50
+ }
51
+ else {
52
+ title = title_;
53
+ }
53
54
  }
54
- else {
55
- subTitle = subTitle_;
55
+ if (!!((_s = (_r = props.attributes.detail) === null || _r === void 0 ? void 0 : _r.basis) === null || _s === void 0 ? void 0 : _s.subTitle)) {
56
+ const subTitle_ = props.attributes.detail.basis.subTitle;
57
+ if (typeof subTitle_ === 'function') {
58
+ subTitle = subTitle_(values, props);
59
+ }
60
+ else {
61
+ subTitle = subTitle_;
62
+ }
56
63
  }
64
+ basisNode = (react_1.default.createElement(react_1.default.Fragment, null,
65
+ react_1.default.createElement(components_1.Card.Information, { title: !isMobile ? title : (react_1.default.createElement("div", null,
66
+ 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); } }),
67
+ react_1.default.createElement("div", { style: { display: 'inline-block' } }, title))), subTitle: subTitle, actions: props.attributes.actions, allowActionTypes: ['custom'], column: (_v = (_u = (_t = props.attributes.detail) === null || _t === void 0 ? void 0 : _t.basis) === null || _u === void 0 ? void 0 : _u.column) !== null && _v !== void 0 ? _v : 2, items: details, data: values, onActionClick: (action, values) => {
68
+ props.onActionTrigger(action, {
69
+ values,
70
+ });
71
+ } }),
72
+ !!renderBasisBottom && (react_1.default.createElement("div", { style: {
73
+ padding: 24,
74
+ paddingTop: 0,
75
+ } }, renderBasisBottom(values, props)))));
57
76
  }
58
- const details = (_s = props.attributes.detail.basis) === null || _s === void 0 ? void 0 : _s.items;
59
- const defaultTab = (_t = props.attributes.detail.modules) === null || _t === void 0 ? void 0 : _t.default;
60
- const tabs = (_v = (_u = props.attributes.detail.modules) === null || _u === void 0 ? void 0 : _u.items) === null || _v === void 0 ? void 0 : _v.filter((tab, index) => {
61
- let isVisible = tab.visible;
62
- if (typeof tab.visible === 'function') {
63
- isVisible = tab.visible(values, tab, index, props);
64
- }
65
- return isVisible !== false;
66
- }).map((tab, index) => {
67
- let title = tab.title;
68
- let render = tab.render;
69
- if (typeof title === 'function') {
70
- title = title(values, props);
71
- }
72
- if (!!tab.render && typeof tab.render === 'function') {
73
- render = () => {
74
- return tab.render(values, index, props);
77
+ let detailNode = null;
78
+ if (typeof props.attributes.detail.modules === 'function') {
79
+ detailNode = props.attributes.detail.modules(values, props);
80
+ }
81
+ else {
82
+ const defaultTab = (_w = props.attributes.detail.modules) === null || _w === void 0 ? void 0 : _w.default;
83
+ const tabs = (_y = (_x = props.attributes.detail.modules) === null || _x === void 0 ? void 0 : _x.items) === null || _y === void 0 ? void 0 : _y.filter((tab, index) => {
84
+ let isVisible = tab.visible;
85
+ if (typeof tab.visible === 'function') {
86
+ isVisible = tab.visible(values, tab, index, props);
87
+ }
88
+ return isVisible !== false;
89
+ }).map((tab, index) => {
90
+ let title = tab.title;
91
+ let render = tab.render;
92
+ if (typeof title === 'function') {
93
+ title = title(values, props);
94
+ }
95
+ if (!!tab.render && typeof tab.render === 'function') {
96
+ render = () => {
97
+ return tab.render(values, index, props);
98
+ };
99
+ }
100
+ return {
101
+ ...tab,
102
+ title,
103
+ render,
75
104
  };
76
- }
77
- return {
78
- ...tab,
79
- title,
80
- render,
81
- };
82
- });
105
+ });
106
+ detailNode = (react_1.default.createElement(components_1.Tab, { className: 'tab', items: tabs, defaultValue: defaultTab }));
107
+ }
83
108
  const isLoading = () => {
84
109
  var _a;
85
110
  const id = (_a = doreamon_1.default.dom.router.getQuery()) === null || _a === void 0 ? void 0 : _a.id;
@@ -119,18 +144,8 @@ const DetailPage = (props) => {
119
144
  react_1.default.createElement(antd_1.Skeleton, { paragraph: { rows: 10 } })));
120
145
  }
121
146
  return (react_1.default.createElement("div", { className: doreamon_1.default.classnames('page', componentName, props.className) },
122
- react_1.default.createElement(components_1.Card.Information, { title: !isMobile ? title : (react_1.default.createElement("div", null,
123
- 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); } }),
124
- 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) => {
125
- props.onActionTrigger(action, {
126
- values,
127
- });
128
- } }),
129
- !!renderBasisBottom && (react_1.default.createElement("div", { style: {
130
- padding: 24,
131
- paddingTop: 0,
132
- } }, renderBasisBottom(values, props))),
133
- react_1.default.createElement(components_1.Tab, { className: 'tab', items: tabs, defaultValue: defaultTab })));
147
+ basisNode,
148
+ detailNode));
134
149
  };
135
150
  exports.DetailPage = DetailPage;
136
151
  exports.default = exports.DetailPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doreamonjs/page-detail",
3
- "version": "1.12.58",
3
+ "version": "1.12.60",
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.58",
74
+ "@doreamonjs/components": "^1.12.60",
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": "da5170bb7b7e720ae39d4ce54565d54bb51b875f"
83
+ "gitHead": "cefe391151e626fd617a3686a03f24e31aca1de4"
84
84
  }