@pisell/materials 6.0.4 → 6.0.6
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.js +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +10 -16
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +22 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +6 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +11 -9
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +8 -7
- package/es/components/page/index.js +4 -2
- package/es/components/select/index.js +4 -3
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +4 -5
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +23 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +6 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +8 -14
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +1 -6
- package/lib/components/page/index.js +2 -2
- package/lib/components/select/index.js +3 -2
- package/lowcode/data-source-table/meta.ts +281 -0
- package/package.json +2 -2
|
@@ -53,8 +53,8 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
53
53
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
54
54
|
while (1) switch (_context.prev = _context.next) {
|
|
55
55
|
case 0:
|
|
56
|
-
_context.prev = 0;
|
|
57
56
|
setLoading(true);
|
|
57
|
+
_context.prev = 1;
|
|
58
58
|
if (!(renderMode === 'edit')) {
|
|
59
59
|
_context.next = 7;
|
|
60
60
|
break;
|
|
@@ -75,23 +75,14 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
75
75
|
res = _context.sent;
|
|
76
76
|
form === null || form === void 0 ? void 0 : form.resetFields();
|
|
77
77
|
case 12:
|
|
78
|
-
_context.
|
|
79
|
-
break;
|
|
80
|
-
case 14:
|
|
81
|
-
_context.prev = 14;
|
|
82
|
-
_context.t0 = _context["catch"](0);
|
|
83
|
-
PisellToast({
|
|
84
|
-
content: "\u64CD\u4F5C\u5931\u8D25\uFF1A".concat(_context.t0.message)
|
|
85
|
-
});
|
|
86
|
-
case 17:
|
|
87
|
-
_context.prev = 17;
|
|
78
|
+
_context.prev = 12;
|
|
88
79
|
setLoading(false);
|
|
89
|
-
return _context.finish(
|
|
90
|
-
case
|
|
80
|
+
return _context.finish(12);
|
|
81
|
+
case 15:
|
|
91
82
|
case "end":
|
|
92
83
|
return _context.stop();
|
|
93
84
|
}
|
|
94
|
-
}, _callee, null, [[
|
|
85
|
+
}, _callee, null, [[1,, 12, 15]]);
|
|
95
86
|
}));
|
|
96
87
|
return function onSubmit(_x2) {
|
|
97
88
|
return _ref.apply(this, arguments);
|
|
@@ -160,12 +151,15 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
160
151
|
afterSubmitFunc();
|
|
161
152
|
}
|
|
162
153
|
}
|
|
163
|
-
_context2.next =
|
|
154
|
+
_context2.next = 16;
|
|
164
155
|
break;
|
|
165
156
|
case 13:
|
|
166
157
|
_context2.prev = 13;
|
|
167
158
|
_context2.t0 = _context2["catch"](0);
|
|
168
|
-
|
|
159
|
+
PisellToast({
|
|
160
|
+
content: "".concat(_context2.t0.message)
|
|
161
|
+
});
|
|
162
|
+
case 16:
|
|
169
163
|
case "end":
|
|
170
164
|
return _context2.stop();
|
|
171
165
|
}
|
|
@@ -43,6 +43,11 @@ var BaseTable = function BaseTable(props) {
|
|
|
43
43
|
handleValuesChange = _useTableQuery.handleValuesChange,
|
|
44
44
|
refreshData = _useTableQuery.refreshData,
|
|
45
45
|
handleFilterChange = _useTableQuery.handleFilterChange;
|
|
46
|
+
var handleAllValuesChange = function handleAllValuesChange(changedValues, values) {
|
|
47
|
+
var _props$onValuesChange;
|
|
48
|
+
props === null || props === void 0 ? void 0 : (_props$onValuesChange = props.onValuesChange) === null || _props$onValuesChange === void 0 ? void 0 : _props$onValuesChange.call(props, changedValues, values);
|
|
49
|
+
handleValuesChange(changedValues, values);
|
|
50
|
+
};
|
|
46
51
|
|
|
47
52
|
// 设计模式下对抽屉的显隐处理
|
|
48
53
|
useDesignMode(props, {
|
|
@@ -88,7 +93,7 @@ var BaseTable = function BaseTable(props) {
|
|
|
88
93
|
}, others, transformProps, {
|
|
89
94
|
dataSource: (data === null || data === void 0 ? void 0 : data.data) || [],
|
|
90
95
|
loading: list === null || list === void 0 ? void 0 : list.loading,
|
|
91
|
-
onValuesChange:
|
|
96
|
+
onValuesChange: handleAllValuesChange
|
|
92
97
|
})), /*#__PURE__*/React.createElement(ActionsProvider, {
|
|
93
98
|
visible: drawerVisible,
|
|
94
99
|
setVisible: setDrawerVisible,
|
|
@@ -143,8 +143,8 @@ var useFormat = function useFormat(_ref4) {
|
|
|
143
143
|
|
|
144
144
|
// list接口请求 参数格式化
|
|
145
145
|
var formatListParams = useMemoizedFn(function (params) {
|
|
146
|
-
// 如果dataSourceKey为空 则为标准数据源
|
|
147
|
-
if (!dataSourceKey) {
|
|
146
|
+
// 如果dataSourceKey为空 pisell2 main 则为标准数据源
|
|
147
|
+
if (!dataSourceKey || ['pisell2', 'main'].includes(dataSourceKey)) {
|
|
148
148
|
return _objectSpread(_objectSpread({}, params), {}, {
|
|
149
149
|
filter: formatFilter(params.filter, fields),
|
|
150
150
|
sort: formatSort(params.sort)
|
|
@@ -30,11 +30,17 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
30
30
|
buttons: any[] | null;
|
|
31
31
|
filter: React.JSX.Element | null;
|
|
32
32
|
onRow: (record: any) => any;
|
|
33
|
+
actionButtons: any[] | null;
|
|
33
34
|
titleButtons?: {
|
|
34
35
|
show: boolean;
|
|
35
36
|
maxCount: number;
|
|
36
37
|
items: OperationItem[];
|
|
37
38
|
} | undefined;
|
|
39
|
+
tableButtons?: {
|
|
40
|
+
show: boolean;
|
|
41
|
+
maxCount: number;
|
|
42
|
+
items: OperationItem[];
|
|
43
|
+
} | undefined;
|
|
38
44
|
operation?: {
|
|
39
45
|
show: boolean;
|
|
40
46
|
title: string;
|
|
@@ -74,5 +80,6 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
74
80
|
sortBy: string;
|
|
75
81
|
}[];
|
|
76
82
|
} | undefined;
|
|
83
|
+
onValuesChange?: ((changedValues: any, values: any) => void) | undefined;
|
|
77
84
|
};
|
|
78
85
|
export default useTableProps;
|
|
@@ -38,6 +38,7 @@ var useTableProps = function useTableProps(props) {
|
|
|
38
38
|
var propsTitle = originProps.title,
|
|
39
39
|
propsSubTitle = originProps.subTitle,
|
|
40
40
|
titleButtons = originProps.titleButtons,
|
|
41
|
+
tableButtons = originProps.tableButtons,
|
|
41
42
|
operation = originProps.operation,
|
|
42
43
|
propsFilter = originProps.filter,
|
|
43
44
|
search = originProps.search,
|
|
@@ -209,6 +210,25 @@ var useTableProps = function useTableProps(props) {
|
|
|
209
210
|
});
|
|
210
211
|
});
|
|
211
212
|
}, [titleButtons]);
|
|
213
|
+
var actionButtons = useMemo(function () {
|
|
214
|
+
var _tableButtons$items;
|
|
215
|
+
if (!(tableButtons !== null && tableButtons !== void 0 && tableButtons.show)) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
return tableButtons === null || tableButtons === void 0 ? void 0 : (_tableButtons$items = tableButtons.items) === null || _tableButtons$items === void 0 ? void 0 : _tableButtons$items.map(function (button) {
|
|
219
|
+
var actionType = button.actionType,
|
|
220
|
+
buttonProps = button.buttonProps;
|
|
221
|
+
return _objectSpread(_objectSpread(_objectSpread({}, button), buttonProps), {}, {
|
|
222
|
+
size: "large",
|
|
223
|
+
title: button.label,
|
|
224
|
+
onClick: function onClick() {
|
|
225
|
+
if (actionType === 'add') {
|
|
226
|
+
handleOpenDrawer(null, button);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}, [tableButtons]);
|
|
212
232
|
var filter = useMemo(function () {
|
|
213
233
|
if (!(propsFilter !== null && propsFilter !== void 0 && propsFilter.show) && !(search !== null && search !== void 0 && search.show)) {
|
|
214
234
|
return null;
|
|
@@ -255,7 +275,8 @@ var useTableProps = function useTableProps(props) {
|
|
|
255
275
|
subTitle: subTitle,
|
|
256
276
|
buttons: buttons,
|
|
257
277
|
filter: filter,
|
|
258
|
-
onRow: onRow
|
|
278
|
+
onRow: onRow,
|
|
279
|
+
actionButtons: actionButtons
|
|
259
280
|
});
|
|
260
281
|
};
|
|
261
282
|
export default useTableProps;
|
|
@@ -40,7 +40,7 @@ var useTableQuery = function useTableQuery(props) {
|
|
|
40
40
|
if ("tabs" in params) {
|
|
41
41
|
var _params$tabs, _params$tabs2;
|
|
42
42
|
sort = ((_params$tabs = params.tabs) === null || _params$tabs === void 0 ? void 0 : _params$tabs.sortBy) || sortBy || "";
|
|
43
|
-
filter = ((_params$tabs2 = params.tabs) === null || _params$tabs2 === void 0 ? void 0 : _params$tabs2.filterBy) || {};
|
|
43
|
+
filter = _objectSpread(_objectSpread({}, prev.filter), ((_params$tabs2 = params.tabs) === null || _params$tabs2 === void 0 ? void 0 : _params$tabs2.filterBy) || {});
|
|
44
44
|
}
|
|
45
45
|
if ("order_by" in params) {
|
|
46
46
|
var _allParams$tabs;
|
|
@@ -58,7 +58,7 @@ var useTableQuery = function useTableQuery(props) {
|
|
|
58
58
|
setQueryPageConfig(function (prev) {
|
|
59
59
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
60
60
|
page: 1,
|
|
61
|
-
filter: _objectSpread(_objectSpread({}, allFields), filterBy || {})
|
|
61
|
+
filter: _objectSpread(_objectSpread(_objectSpread({}, prev.filter), allFields), filterBy || {})
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -18,6 +18,11 @@ export interface DataSourceTableProps {
|
|
|
18
18
|
maxCount: number;
|
|
19
19
|
items: OperationItem[];
|
|
20
20
|
};
|
|
21
|
+
tableButtons?: {
|
|
22
|
+
show: boolean;
|
|
23
|
+
maxCount: number;
|
|
24
|
+
items: OperationItem[];
|
|
25
|
+
};
|
|
21
26
|
buttons?: any[];
|
|
22
27
|
operation?: {
|
|
23
28
|
show: boolean;
|
|
@@ -61,4 +66,5 @@ export interface DataSourceTableProps {
|
|
|
61
66
|
sortBy: string;
|
|
62
67
|
}[];
|
|
63
68
|
};
|
|
69
|
+
onValuesChange?: (changedValues: any, values: any) => void;
|
|
64
70
|
}
|
|
@@ -109,15 +109,17 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
109
109
|
},
|
|
110
110
|
onBlur: handleBlur,
|
|
111
111
|
popupMatchSelectWidth: false,
|
|
112
|
-
optionLabelProp: "
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
optionLabelProp: "inputValue",
|
|
113
|
+
optionFilterProp: "label",
|
|
114
|
+
showSearch: true,
|
|
115
|
+
options: countries.map(function (country) {
|
|
116
|
+
return {
|
|
117
|
+
value: country.code,
|
|
118
|
+
label: "".concat(translationOriginal(country.name), " (").concat(country.prefix, ")"),
|
|
119
|
+
inputValue: country.prefix
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
}), /*#__PURE__*/React.createElement(Input, _extends({}, props, {
|
|
121
123
|
status: status,
|
|
122
124
|
type: "tel",
|
|
123
125
|
value: phoneNumber,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useRef
|
|
1
|
+
import React, { useMemo, useRef } from 'react';
|
|
2
2
|
import { isArr, isString, isUndefined } from '@pisell/utils';
|
|
3
3
|
import { useMemoizedFn } from 'ahooks';
|
|
4
4
|
import VariablesContext from "./VariablesContext";
|
|
@@ -18,14 +18,15 @@ var VariablesProvider = function VariablesProvider(props) {
|
|
|
18
18
|
variables = props.variables;
|
|
19
19
|
|
|
20
20
|
// 变量存储
|
|
21
|
-
var variablesRef = useRef({});
|
|
21
|
+
var variablesRef = useRef(variables || {});
|
|
22
22
|
// 添加变量变化监听器存储
|
|
23
23
|
var listenersRef = useRef(new Set());
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
24
|
+
|
|
25
|
+
// useEffect(() => {
|
|
26
|
+
// if (variables) {
|
|
27
|
+
// variablesRef.current = variables;
|
|
28
|
+
// }
|
|
29
|
+
// }, [variables]);
|
|
29
30
|
|
|
30
31
|
// 注册变量
|
|
31
32
|
var registerVariable = useMemoizedFn(function (value) {
|
|
@@ -45,7 +45,7 @@ var localeDateMap = {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
var Page = function Page(props) {
|
|
48
|
-
var _context$appHelper, _context$engine, _context$engine$props, _localeDateMap;
|
|
48
|
+
var _context$appHelper, _context$engine, _context$engine$props, _localeDateMap, _context$engine2, _context$engine2$prop;
|
|
49
49
|
var children = props.children,
|
|
50
50
|
style = props.style,
|
|
51
51
|
className = props.className,
|
|
@@ -253,7 +253,9 @@ var Page = function Page(props) {
|
|
|
253
253
|
}
|
|
254
254
|
}, /*#__PURE__*/React.createElement(PisellConfigProvider, {
|
|
255
255
|
locale: locale
|
|
256
|
-
}, /*#__PURE__*/React.createElement(VariablesProvider,
|
|
256
|
+
}, /*#__PURE__*/React.createElement(VariablesProvider, {
|
|
257
|
+
variables: ((_context$engine2 = context.engine) === null || _context$engine2 === void 0 ? void 0 : (_context$engine2$prop = _context$engine2.props) === null || _context$engine2$prop === void 0 ? void 0 : _context$engine2$prop.variables) || {}
|
|
258
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
257
259
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
258
260
|
'--theme-color': themeColor || '#7F56D9'
|
|
259
261
|
}),
|
|
@@ -41,7 +41,7 @@ var SelectBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
41
41
|
setSearchValue = _useState2[1];
|
|
42
42
|
var filteredOptions = useMemo(function () {
|
|
43
43
|
if (!searchValue) return options;
|
|
44
|
-
return options.filter(function (option) {
|
|
44
|
+
return (options || []).filter(function (option) {
|
|
45
45
|
var _option$optionFilterP;
|
|
46
46
|
var optionValue = ((_option$optionFilterP = option[optionFilterProp]) === null || _option$optionFilterP === void 0 ? void 0 : _option$optionFilterP.toString().toLowerCase()) || '';
|
|
47
47
|
return optionValue.includes(searchValue.toLowerCase());
|
|
@@ -73,10 +73,11 @@ var SelectBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
73
73
|
return mode === 'multiple' && isShowDropdown && selectAll;
|
|
74
74
|
}, [mode, selectAll, isShowDropdown]);
|
|
75
75
|
var checkboxChecked = useMemo(function () {
|
|
76
|
+
var _state$sort, _filteredOptions$map, _filteredOptions$map$;
|
|
76
77
|
if (mode !== 'multiple') return false;
|
|
77
|
-
return (state === null || state === void 0 ? void 0 : state.length) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) && state.sort().join('') === filteredOptions.map(function (item) {
|
|
78
|
+
return (state === null || state === void 0 ? void 0 : state.length) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) && (state === null || state === void 0 ? void 0 : (_state$sort = state.sort()) === null || _state$sort === void 0 ? void 0 : _state$sort.join('')) === (filteredOptions === null || filteredOptions === void 0 ? void 0 : (_filteredOptions$map = filteredOptions.map(function (item) {
|
|
78
79
|
return item.value;
|
|
79
|
-
}).sort()
|
|
80
|
+
})) === null || _filteredOptions$map === void 0 ? void 0 : (_filteredOptions$map$ = _filteredOptions$map.sort()) === null || _filteredOptions$map$ === void 0 ? void 0 : _filteredOptions$map$.join(''));
|
|
80
81
|
}, [state, filteredOptions]);
|
|
81
82
|
var dropdownRender = useCallback(propsDropdownRender ? propsDropdownRender : function (originNode) {
|
|
82
83
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showSearch && /*#__PURE__*/React.createElement(Input, {
|
|
@@ -62,18 +62,14 @@ var SubmitButton = (props) => {
|
|
|
62
62
|
const { create, update } = (0, import_useDataSource.default)();
|
|
63
63
|
const isDisabled = status === "disabled";
|
|
64
64
|
const onSubmit = async (values) => {
|
|
65
|
+
setLoading(true);
|
|
65
66
|
try {
|
|
66
|
-
setLoading(true);
|
|
67
67
|
if (renderMode === "edit") {
|
|
68
68
|
await update.runAsync(values);
|
|
69
69
|
} else if (renderMode === "add") {
|
|
70
70
|
const res = await create.runAsync(values);
|
|
71
71
|
form == null ? void 0 : form.resetFields();
|
|
72
72
|
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
(0, import_pisellToast.default)({
|
|
75
|
-
content: `操作失败:${error.message}`
|
|
76
|
-
});
|
|
77
73
|
} finally {
|
|
78
74
|
setLoading(false);
|
|
79
75
|
}
|
|
@@ -130,6 +126,9 @@ var SubmitButton = (props) => {
|
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
} catch (error) {
|
|
129
|
+
(0, import_pisellToast.default)({
|
|
130
|
+
content: `${error.message}`
|
|
131
|
+
});
|
|
133
132
|
}
|
|
134
133
|
};
|
|
135
134
|
const onSubmitClick = async () => {
|
|
@@ -68,6 +68,11 @@ var BaseTable = (props) => {
|
|
|
68
68
|
drawerContent
|
|
69
69
|
} = (0, import_useDrawerState.default)(operationContent);
|
|
70
70
|
const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange } = (0, import_useTableQuery.default)(props);
|
|
71
|
+
const handleAllValuesChange = (changedValues, values) => {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = props == null ? void 0 : props.onValuesChange) == null ? void 0 : _a.call(props, changedValues, values);
|
|
74
|
+
handleValuesChange(changedValues, values);
|
|
75
|
+
};
|
|
71
76
|
(0, import_useDesignMode.default)(props, {
|
|
72
77
|
registerValueVariable,
|
|
73
78
|
openDrawer,
|
|
@@ -112,7 +117,7 @@ var BaseTable = (props) => {
|
|
|
112
117
|
...transformProps,
|
|
113
118
|
dataSource: (data == null ? void 0 : data.data) || [],
|
|
114
119
|
loading: list == null ? void 0 : list.loading,
|
|
115
|
-
onValuesChange:
|
|
120
|
+
onValuesChange: handleAllValuesChange
|
|
116
121
|
}
|
|
117
122
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
118
123
|
import_ActionsProvider.default,
|
|
@@ -142,7 +142,7 @@ var useFormat = ({ dataSourceKey, fields }) => {
|
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
const formatListParams = (0, import_ahooks.useMemoizedFn)((params) => {
|
|
145
|
-
if (!dataSourceKey) {
|
|
145
|
+
if (!dataSourceKey || ["pisell2", "main"].includes(dataSourceKey)) {
|
|
146
146
|
return {
|
|
147
147
|
...params,
|
|
148
148
|
filter: formatFilter(params.filter, fields),
|
|
@@ -30,11 +30,17 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
30
30
|
buttons: any[] | null;
|
|
31
31
|
filter: React.JSX.Element | null;
|
|
32
32
|
onRow: (record: any) => any;
|
|
33
|
+
actionButtons: any[] | null;
|
|
33
34
|
titleButtons?: {
|
|
34
35
|
show: boolean;
|
|
35
36
|
maxCount: number;
|
|
36
37
|
items: OperationItem[];
|
|
37
38
|
} | undefined;
|
|
39
|
+
tableButtons?: {
|
|
40
|
+
show: boolean;
|
|
41
|
+
maxCount: number;
|
|
42
|
+
items: OperationItem[];
|
|
43
|
+
} | undefined;
|
|
38
44
|
operation?: {
|
|
39
45
|
show: boolean;
|
|
40
46
|
title: string;
|
|
@@ -74,5 +80,6 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
74
80
|
sortBy: string;
|
|
75
81
|
}[];
|
|
76
82
|
} | undefined;
|
|
83
|
+
onValuesChange?: ((changedValues: any, values: any) => void) | undefined;
|
|
77
84
|
};
|
|
78
85
|
export default useTableProps;
|
|
@@ -59,6 +59,7 @@ var useTableProps = (props) => {
|
|
|
59
59
|
title: propsTitle,
|
|
60
60
|
subTitle: propsSubTitle,
|
|
61
61
|
titleButtons,
|
|
62
|
+
tableButtons,
|
|
62
63
|
operation,
|
|
63
64
|
filter: propsFilter,
|
|
64
65
|
search,
|
|
@@ -198,6 +199,26 @@ var useTableProps = (props) => {
|
|
|
198
199
|
};
|
|
199
200
|
});
|
|
200
201
|
}, [titleButtons]);
|
|
202
|
+
const actionButtons = (0, import_react.useMemo)(() => {
|
|
203
|
+
var _a2;
|
|
204
|
+
if (!(tableButtons == null ? void 0 : tableButtons.show)) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return (_a2 = tableButtons == null ? void 0 : tableButtons.items) == null ? void 0 : _a2.map((button) => {
|
|
208
|
+
const { actionType, buttonProps } = button;
|
|
209
|
+
return {
|
|
210
|
+
...button,
|
|
211
|
+
...buttonProps,
|
|
212
|
+
size: "large",
|
|
213
|
+
title: button.label,
|
|
214
|
+
onClick: () => {
|
|
215
|
+
if (actionType === "add") {
|
|
216
|
+
handleOpenDrawer(null, button);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}, [tableButtons]);
|
|
201
222
|
const filter = (0, import_react.useMemo)(() => {
|
|
202
223
|
if (!(propsFilter == null ? void 0 : propsFilter.show) && !(search == null ? void 0 : search.show)) {
|
|
203
224
|
return null;
|
|
@@ -248,7 +269,8 @@ var useTableProps = (props) => {
|
|
|
248
269
|
subTitle,
|
|
249
270
|
buttons,
|
|
250
271
|
filter,
|
|
251
|
-
onRow
|
|
272
|
+
onRow,
|
|
273
|
+
actionButtons
|
|
252
274
|
};
|
|
253
275
|
};
|
|
254
276
|
var useTableProps_default = useTableProps;
|
|
@@ -42,7 +42,7 @@ var useTableQuery = (props) => {
|
|
|
42
42
|
let filter = prev.filter;
|
|
43
43
|
if ("tabs" in params) {
|
|
44
44
|
sort = ((_a2 = params.tabs) == null ? void 0 : _a2.sortBy) || sortBy || "";
|
|
45
|
-
filter = ((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {};
|
|
45
|
+
filter = { ...prev.filter, ...((_b2 = params.tabs) == null ? void 0 : _b2.filterBy) || {} };
|
|
46
46
|
}
|
|
47
47
|
if ("order_by" in params) {
|
|
48
48
|
sort = params.order_by || ((_c2 = allParams.tabs) == null ? void 0 : _c2.sortBy) || sortBy;
|
|
@@ -62,7 +62,7 @@ var useTableQuery = (props) => {
|
|
|
62
62
|
setQueryPageConfig((prev) => ({
|
|
63
63
|
...prev,
|
|
64
64
|
page: 1,
|
|
65
|
-
filter: { ...allFields, ...filterBy || {} }
|
|
65
|
+
filter: { ...prev.filter, ...allFields, ...filterBy || {} }
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
68
68
|
);
|
|
@@ -18,6 +18,11 @@ export interface DataSourceTableProps {
|
|
|
18
18
|
maxCount: number;
|
|
19
19
|
items: OperationItem[];
|
|
20
20
|
};
|
|
21
|
+
tableButtons?: {
|
|
22
|
+
show: boolean;
|
|
23
|
+
maxCount: number;
|
|
24
|
+
items: OperationItem[];
|
|
25
|
+
};
|
|
21
26
|
buttons?: any[];
|
|
22
27
|
operation?: {
|
|
23
28
|
show: boolean;
|
|
@@ -61,4 +66,5 @@ export interface DataSourceTableProps {
|
|
|
61
66
|
sortBy: string;
|
|
62
67
|
}[];
|
|
63
68
|
};
|
|
69
|
+
onValuesChange?: (changedValues: any, values: any) => void;
|
|
64
70
|
}
|
|
@@ -111,21 +111,15 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, ...props }) =>
|
|
|
111
111
|
style: { width: "90px" },
|
|
112
112
|
onBlur: handleBlur,
|
|
113
113
|
popupMatchSelectWidth: false,
|
|
114
|
-
optionLabelProp: "
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Option,
|
|
119
|
-
{
|
|
120
|
-
key: country.code,
|
|
114
|
+
optionLabelProp: "inputValue",
|
|
115
|
+
optionFilterProp: "label",
|
|
116
|
+
showSearch: true,
|
|
117
|
+
options: countries.map((country) => ({
|
|
121
118
|
value: country.code,
|
|
122
|
-
label: country.prefix
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
country.prefix,
|
|
127
|
-
")"
|
|
128
|
-
))
|
|
119
|
+
label: `${translationOriginal(country.name)} (${country.prefix})`,
|
|
120
|
+
inputValue: country.prefix
|
|
121
|
+
}))
|
|
122
|
+
}
|
|
129
123
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
130
124
|
import_antd.Input,
|
|
131
125
|
{
|
|
@@ -47,13 +47,8 @@ var defaultCustomizer = (objValue, srcValue) => {
|
|
|
47
47
|
var VARIABLE_PATTERN = /{{([^}]+)}}/g;
|
|
48
48
|
var VariablesProvider = (props) => {
|
|
49
49
|
const { children, variables } = props;
|
|
50
|
-
const variablesRef = (0, import_react.useRef)({});
|
|
50
|
+
const variablesRef = (0, import_react.useRef)(variables || {});
|
|
51
51
|
const listenersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
52
|
-
(0, import_react.useEffect)(() => {
|
|
53
|
-
if (variables) {
|
|
54
|
-
variablesRef.current = variables;
|
|
55
|
-
}
|
|
56
|
-
}, [variables]);
|
|
57
52
|
const registerVariable = (0, import_ahooks.useMemoizedFn)((value2) => {
|
|
58
53
|
variablesRef.current = (0, import_utils3.mergeWith)(
|
|
59
54
|
variablesRef.current,
|
|
@@ -69,7 +69,7 @@ var localeDateMap = {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
var Page = (props) => {
|
|
72
|
-
var _a, _b, _c, _d;
|
|
72
|
+
var _a, _b, _c, _d, _e, _f;
|
|
73
73
|
const { children, style, className, locale: propsLocale, ...others } = props;
|
|
74
74
|
const context = (0, import_useEngineContext.default)();
|
|
75
75
|
const { platform, themeColor } = ((_a = context.appHelper) == null ? void 0 : _a.constants) || {};
|
|
@@ -271,7 +271,7 @@ var Page = (props) => {
|
|
|
271
271
|
dateAdapter: import_AdapterDayjs.AdapterDayjs,
|
|
272
272
|
adapterLocale: ((_d = localeDateMap == null ? void 0 : localeDateMap[locale]) == null ? void 0 : _d.adapterLocale) || "en"
|
|
273
273
|
},
|
|
274
|
-
/* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(import_VariablesProvider.default, null, /* @__PURE__ */ import_react.default.createElement(
|
|
274
|
+
/* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(import_VariablesProvider.default, { variables: ((_f = (_e = context.engine) == null ? void 0 : _e.props) == null ? void 0 : _f.variables) || {} }, /* @__PURE__ */ import_react.default.createElement(
|
|
275
275
|
"div",
|
|
276
276
|
{
|
|
277
277
|
style: {
|
|
@@ -63,7 +63,7 @@ var SelectBase = (0, import_react.forwardRef)((props, ref) => {
|
|
|
63
63
|
const filteredOptions = (0, import_react.useMemo)(() => {
|
|
64
64
|
if (!searchValue)
|
|
65
65
|
return options;
|
|
66
|
-
return options.filter(
|
|
66
|
+
return (options || []).filter(
|
|
67
67
|
(option) => {
|
|
68
68
|
var _a;
|
|
69
69
|
const optionValue = ((_a = option[optionFilterProp]) == null ? void 0 : _a.toString().toLowerCase()) || "";
|
|
@@ -98,9 +98,10 @@ var SelectBase = (0, import_react.forwardRef)((props, ref) => {
|
|
|
98
98
|
return mode === "multiple" && isShowDropdown && selectAll;
|
|
99
99
|
}, [mode, selectAll, isShowDropdown]);
|
|
100
100
|
const checkboxChecked = (0, import_react.useMemo)(() => {
|
|
101
|
+
var _a, _b, _c;
|
|
101
102
|
if (mode !== "multiple")
|
|
102
103
|
return false;
|
|
103
|
-
return (state == null ? void 0 : state.length) === (filteredOptions == null ? void 0 : filteredOptions.length) && state.sort().join("") === filteredOptions.map((item) => item.value).sort().join("");
|
|
104
|
+
return (state == null ? void 0 : state.length) === (filteredOptions == null ? void 0 : filteredOptions.length) && ((_a = state == null ? void 0 : state.sort()) == null ? void 0 : _a.join("")) === ((_c = (_b = filteredOptions == null ? void 0 : filteredOptions.map((item) => item.value)) == null ? void 0 : _b.sort()) == null ? void 0 : _c.join(""));
|
|
104
105
|
}, [state, filteredOptions]);
|
|
105
106
|
const dropdownRender = (0, import_react.useCallback)(
|
|
106
107
|
propsDropdownRender ? propsDropdownRender : (originNode) => {
|