@pisell/materials 1.0.83 → 1.0.84
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/es/components/table/Table/fields/text/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/text/Show/index.js +19 -2
- package/es/components/table/Table/fields/text/Show/index.less +9 -0
- package/es/components/table/Table/fields/types/index.d.ts +2 -0
- package/es/components/table/Table/index.js +3 -1
- package/es/components/table/index.d.ts +1 -0
- package/es/components/table/index.js +10 -0
- package/es/components/table/model.d.ts +1 -0
- package/es/components/table/model.js +6 -0
- package/es/hooks/useEngineContext.d.ts +9 -0
- package/es/hooks/useEngineContext.js +7 -0
- package/lib/components/table/Table/fields/text/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/text/Show/index.js +37 -1
- package/lib/components/table/Table/fields/text/Show/index.less +9 -0
- package/lib/components/table/Table/fields/types/index.d.ts +2 -0
- package/lib/components/table/Table/index.js +3 -1
- package/lib/components/table/index.d.ts +1 -0
- package/lib/components/table/index.js +14 -4
- package/lib/components/table/model.d.ts +1 -0
- package/lib/components/table/model.js +4 -0
- package/lib/hooks/useEngineContext.d.ts +9 -0
- package/lib/hooks/useEngineContext.js +33 -0
- package/package.json +1 -1
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
var _excluded = ["title", "editable", "dataIndex", "field_type", "record", "handleSave"];
|
|
1
|
+
var _excluded = ["title", "editable", "dataIndex", "field_type", "record", "handleSave", "action", "contentClassName"];
|
|
2
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
import { useSharedState } from "../../../../../../hooks";
|
|
5
|
+
import { Context } from "../../../../model";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
import "./index.less";
|
|
4
8
|
var Show = function Show(props) {
|
|
9
|
+
var modal = useSharedState(Context);
|
|
5
10
|
var title = props.title,
|
|
6
11
|
editable = props.editable,
|
|
7
12
|
dataIndex = props.dataIndex,
|
|
8
13
|
field_type = props.field_type,
|
|
9
14
|
record = props.record,
|
|
10
15
|
handleSave = props.handleSave,
|
|
16
|
+
action = props.action,
|
|
17
|
+
contentClassName = props.contentClassName,
|
|
11
18
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
var onClick = function onClick() {
|
|
20
|
+
var _modal$state, _modal$state$utils;
|
|
21
|
+
if (action && modal !== null && modal !== void 0 && (_modal$state = modal.state) !== null && _modal$state !== void 0 && (_modal$state$utils = _modal$state.utils) !== null && _modal$state$utils !== void 0 && _modal$state$utils.action) {
|
|
22
|
+
var _modal$state2, _modal$state2$utils;
|
|
23
|
+
modal === null || modal === void 0 ? void 0 : (_modal$state2 = modal.state) === null || _modal$state2 === void 0 ? void 0 : (_modal$state2$utils = _modal$state2.utils) === null || _modal$state2$utils === void 0 ? void 0 : _modal$state2$utils.action(action, record);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
12
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
-
className: ""
|
|
27
|
+
className: classNames(contentClassName || "", {
|
|
28
|
+
"table-fields-text-link": action
|
|
29
|
+
}, contentClassName),
|
|
30
|
+
onClick: onClick
|
|
14
31
|
}, record[dataIndex]);
|
|
15
32
|
};
|
|
16
33
|
export default Show;
|
|
@@ -11,6 +11,8 @@ export declare type FieldPropsType = {
|
|
|
11
11
|
}[];
|
|
12
12
|
handleSave: () => void;
|
|
13
13
|
onChange: (value: any, record: any) => void;
|
|
14
|
+
action?: string;
|
|
15
|
+
contentClassName?: string;
|
|
14
16
|
};
|
|
15
17
|
export declare type FieldType = "text" | "image";
|
|
16
18
|
export declare type EditPropsType = {
|
|
@@ -73,7 +73,9 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
73
73
|
field_type: col.field_type,
|
|
74
74
|
lock: col.lock,
|
|
75
75
|
width: col.width || 0,
|
|
76
|
-
|
|
76
|
+
action: col.action || "",
|
|
77
|
+
render: col.render,
|
|
78
|
+
contentClassName: col.contentClassName || ""
|
|
77
79
|
};
|
|
78
80
|
var filterObj = {};
|
|
79
81
|
|
|
@@ -22,7 +22,9 @@ import GridViewTable from "./Table";
|
|
|
22
22
|
import { useSharedState } from "../../hooks";
|
|
23
23
|
import "./index.less";
|
|
24
24
|
import { Provider, Context } from "./model";
|
|
25
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
25
26
|
var GridView = Provider(function (props) {
|
|
27
|
+
var _context$appHelper;
|
|
26
28
|
var modal = useSharedState(Context);
|
|
27
29
|
var _Form$useForm = Form.useForm(),
|
|
28
30
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
@@ -38,6 +40,14 @@ var GridView = Provider(function (props) {
|
|
|
38
40
|
summary = props.summary,
|
|
39
41
|
_onValuesChange = props.onValuesChange,
|
|
40
42
|
other = _objectWithoutProperties(props, _excluded);
|
|
43
|
+
var context = useEngineContext();
|
|
44
|
+
var utils = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
modal.dispatch({
|
|
47
|
+
type: "setUtils",
|
|
48
|
+
payload: utils || {}
|
|
49
|
+
});
|
|
50
|
+
}, [utils]);
|
|
41
51
|
useEffect(function () {
|
|
42
52
|
modal.dispatch({
|
|
43
53
|
type: "setDefaultColumns",
|
|
@@ -52,6 +52,7 @@ var defaultState = {
|
|
|
52
52
|
currentCell: null,
|
|
53
53
|
quickFilter: [],
|
|
54
54
|
otherFilter: [],
|
|
55
|
+
utils: {},
|
|
55
56
|
setting: {
|
|
56
57
|
field: {
|
|
57
58
|
edit: 0
|
|
@@ -87,6 +88,11 @@ var _getContext = getContext({
|
|
|
87
88
|
quickFilter: payload
|
|
88
89
|
});
|
|
89
90
|
},
|
|
91
|
+
setUtils: function setUtils(state, payload) {
|
|
92
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
93
|
+
utils: payload
|
|
94
|
+
});
|
|
95
|
+
},
|
|
90
96
|
syncStorage: function syncStorage(state, payload) {
|
|
91
97
|
return _objectSpread({}, state);
|
|
92
98
|
},
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
var defaultContext = /*#__PURE__*/createContext({});
|
|
3
|
+
var useEngineContext = function useEngineContext() {
|
|
4
|
+
var context = useContext(window.__appContext || defaultContext);
|
|
5
|
+
return context || {};
|
|
6
|
+
};
|
|
7
|
+
export default useEngineContext;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/components/table/Table/fields/text/Show/index.tsx
|
|
@@ -22,7 +32,12 @@ __export(Show_exports, {
|
|
|
22
32
|
default: () => Show_default
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(Show_exports);
|
|
35
|
+
var import_hooks = require("../../../../../../hooks");
|
|
36
|
+
var import_model = require("../../../../model");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_index = require("./index.less");
|
|
25
39
|
var Show = (props) => {
|
|
40
|
+
const modal = (0, import_hooks.useSharedState)(import_model.Context);
|
|
26
41
|
const {
|
|
27
42
|
title,
|
|
28
43
|
editable,
|
|
@@ -30,8 +45,29 @@ var Show = (props) => {
|
|
|
30
45
|
field_type,
|
|
31
46
|
record,
|
|
32
47
|
handleSave,
|
|
48
|
+
action,
|
|
49
|
+
contentClassName,
|
|
33
50
|
...restProps
|
|
34
51
|
} = props;
|
|
35
|
-
|
|
52
|
+
const onClick = () => {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
|
+
if (action && ((_b = (_a = modal == null ? void 0 : modal.state) == null ? void 0 : _a.utils) == null ? void 0 : _b.action)) {
|
|
55
|
+
(_d = (_c = modal == null ? void 0 : modal.state) == null ? void 0 : _c.utils) == null ? void 0 : _d.action(action, record);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ React.createElement(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: (0, import_classnames.default)(
|
|
62
|
+
contentClassName || "",
|
|
63
|
+
{
|
|
64
|
+
"table-fields-text-link": action
|
|
65
|
+
},
|
|
66
|
+
contentClassName
|
|
67
|
+
),
|
|
68
|
+
onClick
|
|
69
|
+
},
|
|
70
|
+
record[dataIndex]
|
|
71
|
+
);
|
|
36
72
|
};
|
|
37
73
|
var Show_default = Show;
|
|
@@ -11,6 +11,8 @@ export declare type FieldPropsType = {
|
|
|
11
11
|
}[];
|
|
12
12
|
handleSave: () => void;
|
|
13
13
|
onChange: (value: any, record: any) => void;
|
|
14
|
+
action?: string;
|
|
15
|
+
contentClassName?: string;
|
|
14
16
|
};
|
|
15
17
|
export declare type FieldType = "text" | "image";
|
|
16
18
|
export declare type EditPropsType = {
|
|
@@ -87,7 +87,9 @@ var GridViewTable = ({ tableProps }) => {
|
|
|
87
87
|
field_type: col.field_type,
|
|
88
88
|
lock: col.lock,
|
|
89
89
|
width: col.width || 0,
|
|
90
|
-
|
|
90
|
+
action: col.action || "",
|
|
91
|
+
render: col.render,
|
|
92
|
+
contentClassName: col.contentClassName || ""
|
|
91
93
|
};
|
|
92
94
|
let filterObj = {};
|
|
93
95
|
if (col.defaultFilters) {
|
|
@@ -41,7 +41,9 @@ var import_Table = __toESM(require("./Table"));
|
|
|
41
41
|
var import_hooks = require("../../hooks");
|
|
42
42
|
var import_index = require("./index.less");
|
|
43
43
|
var import_model = require("./model");
|
|
44
|
+
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
44
45
|
var GridView = (0, import_model.Provider)((props) => {
|
|
46
|
+
var _a;
|
|
45
47
|
const modal = (0, import_hooks.useSharedState)(import_model.Context);
|
|
46
48
|
const [form] = import_antd.Form.useForm();
|
|
47
49
|
const {
|
|
@@ -58,6 +60,14 @@ var GridView = (0, import_model.Provider)((props) => {
|
|
|
58
60
|
// pagination,
|
|
59
61
|
...other
|
|
60
62
|
} = props;
|
|
63
|
+
const context = (0, import_useEngineContext.default)();
|
|
64
|
+
const utils = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils;
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
modal.dispatch({
|
|
67
|
+
type: "setUtils",
|
|
68
|
+
payload: utils || {}
|
|
69
|
+
});
|
|
70
|
+
}, [utils]);
|
|
61
71
|
(0, import_react.useEffect)(() => {
|
|
62
72
|
modal.dispatch({
|
|
63
73
|
type: "setDefaultColumns",
|
|
@@ -75,10 +85,10 @@ var GridView = (0, import_model.Provider)((props) => {
|
|
|
75
85
|
const initialValues = (0, import_react.useMemo)(
|
|
76
86
|
() => ((filter == null ? void 0 : filter.list) || []).reduce(
|
|
77
87
|
(p, c) => {
|
|
78
|
-
var
|
|
88
|
+
var _a2;
|
|
79
89
|
return {
|
|
80
90
|
...p,
|
|
81
|
-
[c.name]: (
|
|
91
|
+
[c.name]: (_a2 = c == null ? void 0 : c.other) == null ? void 0 : _a2.defaultValue
|
|
82
92
|
};
|
|
83
93
|
},
|
|
84
94
|
{}
|
|
@@ -91,7 +101,7 @@ var GridView = (0, import_model.Provider)((props) => {
|
|
|
91
101
|
form,
|
|
92
102
|
layout: "vertical",
|
|
93
103
|
onValuesChange: (cur, values) => {
|
|
94
|
-
var
|
|
104
|
+
var _a2;
|
|
95
105
|
let _values = { ...values };
|
|
96
106
|
const currentKey = Object.keys(cur)[0];
|
|
97
107
|
if (currentKey !== "pagination") {
|
|
@@ -100,7 +110,7 @@ var GridView = (0, import_model.Provider)((props) => {
|
|
|
100
110
|
page: 1
|
|
101
111
|
};
|
|
102
112
|
} else {
|
|
103
|
-
if ((
|
|
113
|
+
if ((_a2 = other == null ? void 0 : other.pagination) == null ? void 0 : _a2.localPagination) {
|
|
104
114
|
return;
|
|
105
115
|
}
|
|
106
116
|
}
|
|
@@ -89,6 +89,7 @@ var defaultState = {
|
|
|
89
89
|
currentCell: null,
|
|
90
90
|
quickFilter: [],
|
|
91
91
|
otherFilter: [],
|
|
92
|
+
utils: {},
|
|
92
93
|
setting: {
|
|
93
94
|
field: {
|
|
94
95
|
edit: 0
|
|
@@ -117,6 +118,9 @@ var { Provider, Context } = (0, import_miniRedux.default)({
|
|
|
117
118
|
setQuickFilter(state, payload) {
|
|
118
119
|
return { ...state, quickFilter: payload };
|
|
119
120
|
},
|
|
121
|
+
setUtils(state, payload) {
|
|
122
|
+
return { ...state, utils: payload };
|
|
123
|
+
},
|
|
120
124
|
syncStorage(state, payload) {
|
|
121
125
|
return { ...state };
|
|
122
126
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useEngineContext.ts
|
|
20
|
+
var useEngineContext_exports = {};
|
|
21
|
+
__export(useEngineContext_exports, {
|
|
22
|
+
default: () => useEngineContext_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useEngineContext_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var defaultContext = (0, import_react.createContext)({});
|
|
27
|
+
var useEngineContext = () => {
|
|
28
|
+
const context = (0, import_react.useContext)(
|
|
29
|
+
window.__appContext || defaultContext
|
|
30
|
+
);
|
|
31
|
+
return context || {};
|
|
32
|
+
};
|
|
33
|
+
var useEngineContext_default = useEngineContext;
|