@pisell/materials 6.0.5 → 6.0.7
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/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +21 -53
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -50
- package/es/components/config-provider/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +20 -11
- package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +11 -3
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +10 -3
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +36 -20
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +50 -35
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +38 -10
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +48 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +7 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +16 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.js +7 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.js +10 -31
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/es/components/dataSourceComponents/hooks/useActions.js +73 -36
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +53 -6
- package/es/components/login-and-register/index.d.ts +82 -0
- package/es/components/login-and-register/index.js +360 -0
- package/es/components/login-and-register/index.less +211 -0
- package/es/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/es/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/es/components/organizationTenantSwitcher/index.js +96 -0
- package/es/components/organizationTenantSwitcher/index.less +88 -0
- package/es/components/page/index.js +8 -6
- package/es/components/page-header/index.d.ts +14 -0
- package/es/components/page-header/index.js +36 -0
- package/es/components/page-header/index.less +45 -0
- package/es/components/pisellAvatar/index.d.ts +19 -0
- package/es/components/pisellAvatar/index.js +89 -0
- package/es/components/pisellAvatar/index.less +26 -0
- package/es/components/pisellModal/components/PcModal/index.js +1 -1
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/pisellText/components/Amount/index.js +1 -1
- package/es/components/profileMenu/index.d.ts +26 -0
- package/es/components/profileMenu/index.js +115 -0
- package/es/components/profileMenu/index.less +135 -0
- package/es/components/select/index.js +3 -2
- package/es/components/table/Header/index.js +8 -11
- package/es/index.d.ts +6 -0
- package/es/index.js +7 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +1 -0
- package/lib/components/config-provider/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +22 -4
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/index.js +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +17 -3
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +16 -6
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +9 -5
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +19 -9
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +51 -5
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +46 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +6 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +17 -2
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.js +20 -12
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/lib/components/dataSourceComponents/hooks/useActions.js +25 -7
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +48 -7
- package/lib/components/login-and-register/index.d.ts +82 -0
- package/lib/components/login-and-register/index.js +261 -0
- package/lib/components/login-and-register/index.less +211 -0
- package/lib/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/lib/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/lib/components/organizationTenantSwitcher/index.js +119 -0
- package/lib/components/organizationTenantSwitcher/index.less +88 -0
- package/lib/components/page/index.js +6 -6
- package/lib/components/page-header/index.d.ts +14 -0
- package/lib/components/page-header/index.js +63 -0
- package/lib/components/page-header/index.less +45 -0
- package/lib/components/pisellAvatar/index.d.ts +19 -0
- package/lib/components/pisellAvatar/index.js +108 -0
- package/lib/components/pisellAvatar/index.less +26 -0
- package/lib/components/pisellModal/components/PcModal/index.js +1 -1
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/pisellText/components/Amount/index.js +2 -2
- package/lib/components/profileMenu/index.d.ts +26 -0
- package/lib/components/profileMenu/index.js +113 -0
- package/lib/components/profileMenu/index.less +135 -0
- package/lib/components/select/index.js +2 -1
- package/lib/components/table/Header/index.js +11 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.js +18 -0
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +1 -0
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +1 -0
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +1 -0
- package/lowcode/_utils/defaultSchema.ts +64 -0
- package/lowcode/data-source-form/meta.ts +130 -0
- package/lowcode/data-source-form/utils.ts +33 -3
- package/lowcode/data-source-table/meta.ts +420 -3
- package/lowcode/data-source-table/utils.tsx +6 -0
- package/lowcode/form-item-date-picker/snippets.ts +3 -0
- package/lowcode/form-item-input/snippets.ts +3 -1
- package/lowcode/form-item-input-number/snippets.ts +4 -0
- package/lowcode/form-item-input.email/snippets.ts +3 -0
- package/lowcode/form-item-input.json/snippets.ts +4 -1
- package/lowcode/form-item-input.password/snippets.ts +3 -0
- package/lowcode/form-item-input.phone/snippets.ts +3 -0
- package/lowcode/form-item-input.text-area/snippets.ts +3 -1
- package/lowcode/form-item-input.url/snippets.ts +3 -0
- package/lowcode/form-item-select/meta.ts +2 -1
- package/lowcode/form-item-select/snippets.ts +6 -0
- package/lowcode/form-item-time-picker/snippets.ts +3 -0
- package/lowcode/form-item-translation/snippets.ts +3 -1
- package/lowcode/login-and-register/meta.ts +541 -0
- package/lowcode/login-and-register/snippets.ts +38 -0
- package/lowcode/organization-tenant-switch/meta.ts +127 -0
- package/lowcode/page-header/meta.ts +68 -124
- package/lowcode/page-header/snippets.ts +1 -1
- package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
- package/lowcode/pisell-avatar/meta.ts +111 -0
- package/lowcode/pisell-avatar/snippets.ts +14 -0
- package/lowcode/pisell-tags/__screenshots__/tag-1.png +0 -0
- package/lowcode/pisell-tags/meta.ts +123 -0
- package/lowcode/pisell-tags/snippets.ts +14 -0
- package/lowcode/profile-menu/meta.ts +175 -0
- package/lowcode/profile-menu/snippets.ts +71 -0
- package/lowcode/submit-button/meta.ts +6 -0
- package/package.json +3 -3
|
@@ -29,7 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/components/dataSourceComponents/fields/Input.Url/ReadPretty.tsx
|
|
30
30
|
var ReadPretty_exports = {};
|
|
31
31
|
__export(ReadPretty_exports, {
|
|
32
|
-
default: () => ReadPretty_default
|
|
32
|
+
default: () => ReadPretty_default,
|
|
33
|
+
formatUrl: () => formatUrl
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(ReadPretty_exports);
|
|
35
36
|
var import_react = __toESM(require("react"));
|
|
@@ -37,17 +38,31 @@ var import_antd = require("antd");
|
|
|
37
38
|
var import_classnames = __toESM(require("classnames"));
|
|
38
39
|
var import_ReadPretty = require("./ReadPretty.less");
|
|
39
40
|
var { Link } = import_antd.Typography;
|
|
41
|
+
var formatUrl = (url) => {
|
|
42
|
+
if (!url)
|
|
43
|
+
return "";
|
|
44
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
45
|
+
return url;
|
|
46
|
+
}
|
|
47
|
+
return `https://${url}`;
|
|
48
|
+
};
|
|
40
49
|
var UrlReadPretty = (props) => {
|
|
41
50
|
const { value, renderMode } = props;
|
|
51
|
+
const formattedUrl = formatUrl(value);
|
|
42
52
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
43
53
|
Link,
|
|
44
54
|
{
|
|
45
55
|
className: (0, import_classnames.default)("pisell-url-read-pretty", {
|
|
46
56
|
"pisell-url-read-pretty-table-view": renderMode === "tableView"
|
|
47
57
|
}),
|
|
48
|
-
href:
|
|
58
|
+
href: formattedUrl,
|
|
59
|
+
target: "_blank"
|
|
49
60
|
},
|
|
50
61
|
value
|
|
51
62
|
);
|
|
52
63
|
};
|
|
53
64
|
var ReadPretty_default = UrlReadPretty;
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
formatUrl
|
|
68
|
+
});
|
|
@@ -34,7 +34,11 @@ __export(Select_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Select_exports);
|
|
35
35
|
var import_utils = require("../../dataSourceForm/utils");
|
|
36
36
|
var import_WithMode = __toESM(require("./WithMode"));
|
|
37
|
-
var SelectWithFormItem = (0, import_utils.withFormItem)(import_WithMode.default
|
|
37
|
+
var SelectWithFormItem = (0, import_utils.withFormItem)(import_WithMode.default, {
|
|
38
|
+
innerProps: {
|
|
39
|
+
getPopupContainer: (triggerNode) => triggerNode.parentElement
|
|
40
|
+
}
|
|
41
|
+
});
|
|
38
42
|
var SelectWithOptions = (0, import_utils.withOptions)(SelectWithFormItem);
|
|
39
43
|
var SelectWithDataSource = (0, import_utils.withDataSource)(SelectWithOptions);
|
|
40
44
|
var Select_default = SelectWithDataSource;
|
|
@@ -8,7 +8,10 @@ export interface MediaType {
|
|
|
8
8
|
maxsize: number;
|
|
9
9
|
}
|
|
10
10
|
export declare const useMediaConfig: () => {
|
|
11
|
-
data:
|
|
11
|
+
data: {
|
|
12
|
+
upload_onetime_limit: any;
|
|
13
|
+
upload_maxsize: any;
|
|
14
|
+
};
|
|
12
15
|
};
|
|
13
16
|
export declare const useMediaTypes: () => {
|
|
14
17
|
data: MediaType[];
|
|
@@ -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/dataSourceComponents/fields/Upload/serve.ts
|
|
@@ -27,6 +37,7 @@ module.exports = __toCommonJS(serve_exports);
|
|
|
27
37
|
var import_ahooks = require("ahooks");
|
|
28
38
|
var import_utils = require("./utils");
|
|
29
39
|
var import_utils2 = require("../../../table/utils");
|
|
40
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
30
41
|
var getMediaTypeList = async () => {
|
|
31
42
|
const { data } = await import_utils2.request.getRequest().get(
|
|
32
43
|
`/media_type:list`,
|
|
@@ -41,19 +52,16 @@ var getMediaTypeList = async () => {
|
|
|
41
52
|
);
|
|
42
53
|
return data;
|
|
43
54
|
};
|
|
44
|
-
var getMediaConfig = async () => {
|
|
45
|
-
const data = await import_utils2.request.getRequest().get(`/core/module/media/config`, {});
|
|
46
|
-
return data;
|
|
47
|
-
};
|
|
48
55
|
var useMediaConfig = () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
57
|
+
const context = (0, import_useEngineContext.default)();
|
|
58
|
+
const data = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.data) == null ? void 0 : _d.store) == null ? void 0 : _e.getStore) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
|
|
59
|
+
return {
|
|
60
|
+
data: {
|
|
61
|
+
upload_onetime_limit: data == null ? void 0 : data.media_upload_onetime_limit,
|
|
62
|
+
upload_maxsize: data == null ? void 0 : data.media_upload_maxsize
|
|
63
|
+
}
|
|
64
|
+
};
|
|
57
65
|
};
|
|
58
66
|
var useMediaTypes = () => {
|
|
59
67
|
const { data } = (0, import_ahooks.useRequest)(getMediaTypeList, {
|
|
@@ -3,8 +3,9 @@ export interface UseActionsParams {
|
|
|
3
3
|
dataSource?: DataSourceType;
|
|
4
4
|
currentValue?: 'server' | 'local';
|
|
5
5
|
__designMode?: string;
|
|
6
|
+
extraParams?: Record<string, any>;
|
|
6
7
|
}
|
|
7
|
-
declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, }?: UseActionsParams) => {
|
|
8
|
+
declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, extraParams: propsExtraParams, }?: UseActionsParams) => {
|
|
8
9
|
create: (values: Record<string, any>) => Promise<any>;
|
|
9
10
|
get: () => Promise<any>;
|
|
10
11
|
update: (values: Record<string, any>) => Promise<any>;
|
|
@@ -44,7 +44,8 @@ var import_locales = require("../../../locales");
|
|
|
44
44
|
var useActions = ({
|
|
45
45
|
dataSource: propsDataSource,
|
|
46
46
|
currentValue: propsCurrentValue,
|
|
47
|
-
__designMode
|
|
47
|
+
__designMode,
|
|
48
|
+
extraParams: propsExtraParams
|
|
48
49
|
} = {}) => {
|
|
49
50
|
const { dataSource: ctxDataSource, __designMode: ctxDesignMode } = (0, import_useDataSource.default)();
|
|
50
51
|
const { parseVariable } = (0, import_useVariables.default)();
|
|
@@ -68,6 +69,15 @@ var useActions = ({
|
|
|
68
69
|
const currentRecord = (0, import_react.useMemo)(() => {
|
|
69
70
|
return parseVariable == null ? void 0 : parseVariable(currentValue, {});
|
|
70
71
|
}, [currentValue, parseVariable]);
|
|
72
|
+
const extraParams = (0, import_react.useMemo)(() => {
|
|
73
|
+
return Object.entries(propsExtraParams || {}).reduce((acc, [key, value]) => {
|
|
74
|
+
acc[key] = Object.entries(value || {}).reduce((acc2, [k, v]) => {
|
|
75
|
+
acc2[k] = parseVariable == null ? void 0 : parseVariable(v, {});
|
|
76
|
+
return acc2;
|
|
77
|
+
}, {});
|
|
78
|
+
return acc;
|
|
79
|
+
}, {});
|
|
80
|
+
}, [propsExtraParams, parseVariable]);
|
|
71
81
|
const getParsedActions = (0, import_ahooks.useMemoizedFn)(() => {
|
|
72
82
|
return parseActions(originalActions, { currentRecord });
|
|
73
83
|
});
|
|
@@ -88,7 +98,7 @@ var useActions = ({
|
|
|
88
98
|
headers,
|
|
89
99
|
body
|
|
90
100
|
});
|
|
91
|
-
if (
|
|
101
|
+
if (["pisell2-api", "mypisell-api"].includes(dataSourceKey)) {
|
|
92
102
|
return result.data;
|
|
93
103
|
}
|
|
94
104
|
return result;
|
|
@@ -132,7 +142,12 @@ var useActions = ({
|
|
|
132
142
|
const getApi = genCustomApi(actions == null ? void 0 : actions.get);
|
|
133
143
|
return getApi({});
|
|
134
144
|
}
|
|
135
|
-
|
|
145
|
+
const res = await (0, import_serve.getNocobaseData)({
|
|
146
|
+
key: name || "",
|
|
147
|
+
query: extraParams == null ? void 0 : extraParams.get,
|
|
148
|
+
headers: getHeaders()
|
|
149
|
+
});
|
|
150
|
+
return (res == null ? void 0 : res.data) || {};
|
|
136
151
|
} else if (currentValue) {
|
|
137
152
|
return parseVariable == null ? void 0 : parseVariable(currentValue, {});
|
|
138
153
|
}
|
|
@@ -151,7 +166,7 @@ var useActions = ({
|
|
|
151
166
|
const updateApi = genCustomApi(actions == null ? void 0 : actions.update);
|
|
152
167
|
return updateApi(formatCreateUpdateParams(values));
|
|
153
168
|
} else {
|
|
154
|
-
const id = values == null ? void 0 : values.id;
|
|
169
|
+
const id = (extraParams == null ? void 0 : extraParams.filterByTk) || (values == null ? void 0 : values.id);
|
|
155
170
|
if (!id || !name) {
|
|
156
171
|
(0, import_pisellToast.default)({
|
|
157
172
|
content: (0, import_locales.getText)("pisell-action-get-data")
|
|
@@ -160,9 +175,9 @@ var useActions = ({
|
|
|
160
175
|
}
|
|
161
176
|
return (0, import_serve.updateNocobaseData)({
|
|
162
177
|
key: name,
|
|
163
|
-
id,
|
|
164
178
|
data: formatCreateUpdateParams(values),
|
|
165
|
-
headers: getHeaders()
|
|
179
|
+
headers: getHeaders(),
|
|
180
|
+
query: { filterByTk: id, ...extraParams == null ? void 0 : extraParams.update }
|
|
166
181
|
});
|
|
167
182
|
}
|
|
168
183
|
});
|
|
@@ -182,7 +197,10 @@ var useActions = ({
|
|
|
182
197
|
return formatListResult(
|
|
183
198
|
await (0, import_serve.getNocobaseDataList)({
|
|
184
199
|
key: name,
|
|
185
|
-
params:
|
|
200
|
+
params: {
|
|
201
|
+
...formatParams,
|
|
202
|
+
...(extraParams == null ? void 0 : extraParams.list) || {}
|
|
203
|
+
},
|
|
186
204
|
headers: getHeaders()
|
|
187
205
|
})
|
|
188
206
|
);
|
|
@@ -88,6 +88,13 @@ export declare type DataSourceContextProps = {
|
|
|
88
88
|
list?: boolean;
|
|
89
89
|
get?: boolean;
|
|
90
90
|
};
|
|
91
|
+
extraParams?: {
|
|
92
|
+
list?: Record<string, any>;
|
|
93
|
+
get?: Record<string, any>;
|
|
94
|
+
update?: Record<string, any>;
|
|
95
|
+
create?: Record<string, any>;
|
|
96
|
+
destroy?: Record<string, any>;
|
|
97
|
+
};
|
|
91
98
|
__id?: string;
|
|
92
99
|
__designMode?: string;
|
|
93
100
|
};
|
|
@@ -44,6 +44,7 @@ var DataSourceProvider = (props) => {
|
|
|
44
44
|
children,
|
|
45
45
|
dataSource: propsDataSource,
|
|
46
46
|
currentValue,
|
|
47
|
+
extraParams,
|
|
47
48
|
actions: externalActions,
|
|
48
49
|
overrideData,
|
|
49
50
|
autoRun,
|
|
@@ -55,7 +56,8 @@ var DataSourceProvider = (props) => {
|
|
|
55
56
|
const standardActions = (0, import_useActions.default)({
|
|
56
57
|
dataSource,
|
|
57
58
|
currentValue,
|
|
58
|
-
__designMode
|
|
59
|
+
__designMode,
|
|
60
|
+
extraParams
|
|
59
61
|
});
|
|
60
62
|
const list = (externalActions == null ? void 0 : externalActions.list) || standardActions.list;
|
|
61
63
|
const get = (externalActions == null ? void 0 : externalActions.get) || standardActions.get;
|
|
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(VariablesProvider_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_utils = require("@pisell/utils");
|
|
37
37
|
var import_ahooks = require("ahooks");
|
|
38
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
38
39
|
var import_VariablesContext = __toESM(require("./VariablesContext"));
|
|
39
40
|
var import_utils2 = require("../../dataSourceForm/utils");
|
|
40
41
|
var import_utils3 = require("../../../../utils");
|
|
@@ -46,14 +47,54 @@ var defaultCustomizer = (objValue, srcValue) => {
|
|
|
46
47
|
};
|
|
47
48
|
var VARIABLE_PATTERN = /{{([^}]+)}}/g;
|
|
48
49
|
var VariablesProvider = (props) => {
|
|
50
|
+
var _a;
|
|
49
51
|
const { children, variables } = props;
|
|
50
|
-
const
|
|
52
|
+
const context = (0, import_useEngineContext.default)();
|
|
53
|
+
const { getApp } = ((_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
54
|
+
const initialQuery = (0, import_react.useMemo)(() => {
|
|
55
|
+
var _a2, _b, _c;
|
|
56
|
+
const currentLocation = (_c = (_b = (_a2 = getApp == null ? void 0 : getApp()) == null ? void 0 : _a2.history) == null ? void 0 : _b.instance) == null ? void 0 : _c.location;
|
|
57
|
+
if (currentLocation == null ? void 0 : currentLocation.search) {
|
|
58
|
+
const searchParams = new URLSearchParams(currentLocation.search);
|
|
59
|
+
const query = {};
|
|
60
|
+
searchParams.forEach((value2, key) => {
|
|
61
|
+
query[key] = value2;
|
|
62
|
+
});
|
|
63
|
+
return query;
|
|
64
|
+
}
|
|
65
|
+
return {};
|
|
66
|
+
}, []);
|
|
67
|
+
const variablesRef = (0, import_react.useRef)(
|
|
68
|
+
(0, import_utils3.mergeWith)(
|
|
69
|
+
variables,
|
|
70
|
+
{
|
|
71
|
+
global: {
|
|
72
|
+
query: initialQuery
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
defaultCustomizer
|
|
76
|
+
)
|
|
77
|
+
);
|
|
51
78
|
const listenersRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
|
|
79
|
+
const setQueryVariable = (0, import_ahooks.useMemoizedFn)((search) => {
|
|
80
|
+
const searchParams = new URLSearchParams(search);
|
|
81
|
+
const query = {};
|
|
82
|
+
searchParams.forEach((value2, key) => {
|
|
83
|
+
query[key] = value2;
|
|
84
|
+
});
|
|
85
|
+
registerVariable({
|
|
86
|
+
global: query
|
|
87
|
+
});
|
|
88
|
+
});
|
|
52
89
|
(0, import_react.useEffect)(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
90
|
+
var _a2, _b, _c;
|
|
91
|
+
const unlisten = (_c = (_b = (_a2 = getApp == null ? void 0 : getApp()) == null ? void 0 : _a2.history) == null ? void 0 : _b.instance) == null ? void 0 : _c.listen((location) => {
|
|
92
|
+
setQueryVariable(location.search);
|
|
93
|
+
});
|
|
94
|
+
return () => {
|
|
95
|
+
unlisten == null ? void 0 : unlisten();
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
57
98
|
const registerVariable = (0, import_ahooks.useMemoizedFn)((value2) => {
|
|
58
99
|
variablesRef.current = (0, import_utils3.mergeWith)(
|
|
59
100
|
variablesRef.current,
|
|
@@ -87,11 +128,11 @@ var VariablesProvider = (props) => {
|
|
|
87
128
|
);
|
|
88
129
|
const parseVariable = (0, import_ahooks.useMemoizedFn)(
|
|
89
130
|
(str, localVariables = {}) => {
|
|
90
|
-
var
|
|
131
|
+
var _a2;
|
|
91
132
|
if (!(0, import_utils.isString)(str)) {
|
|
92
133
|
return str;
|
|
93
134
|
}
|
|
94
|
-
if (((
|
|
135
|
+
if (((_a2 = str.match(VARIABLE_PATTERN)) == null ? void 0 : _a2[0]) === str) {
|
|
95
136
|
const key = (0, import_utils4.getVariableKey)(str);
|
|
96
137
|
if (!key)
|
|
97
138
|
return str;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
/**
|
|
4
|
+
* loginAndRegister组件的属性接口
|
|
5
|
+
*/
|
|
6
|
+
export interface loginAndRegisterProps {
|
|
7
|
+
/** Logo相关配置 */
|
|
8
|
+
showLogo?: boolean;
|
|
9
|
+
logo?: string;
|
|
10
|
+
logoPosition?: 'left' | 'center' | 'right';
|
|
11
|
+
logoSize?: {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
};
|
|
15
|
+
/** 标题相关配置 */
|
|
16
|
+
title?: string;
|
|
17
|
+
showTitle?: boolean;
|
|
18
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
19
|
+
/** 副标题相关配置 */
|
|
20
|
+
subtitle?: string;
|
|
21
|
+
showSubtitle?: boolean;
|
|
22
|
+
subtitleAlign?: 'left' | 'center' | 'right';
|
|
23
|
+
/** 登录方式配置 */
|
|
24
|
+
loginMethods?: ('email' | 'google' | 'facebook' | 'apple')[];
|
|
25
|
+
defaultLoginMethod?: 'email' | 'google' | 'facebook' | 'apple';
|
|
26
|
+
/** 表单配置 */
|
|
27
|
+
emailLabel?: string;
|
|
28
|
+
passwordLabel?: string;
|
|
29
|
+
emailPlaceholder?: string;
|
|
30
|
+
passwordPlaceholder?: string;
|
|
31
|
+
emailRules?: any[];
|
|
32
|
+
buttonText?: string;
|
|
33
|
+
rememberMeText?: string;
|
|
34
|
+
forgotPasswordText?: string;
|
|
35
|
+
showRememberMe?: boolean;
|
|
36
|
+
showForgotPassword?: boolean;
|
|
37
|
+
/** 社交登录配置 */
|
|
38
|
+
socialLoginTexts?: {
|
|
39
|
+
google?: string;
|
|
40
|
+
facebook?: string;
|
|
41
|
+
apple?: string;
|
|
42
|
+
};
|
|
43
|
+
/** 底部配置 */
|
|
44
|
+
showFooter?: boolean;
|
|
45
|
+
showSignUp?: boolean;
|
|
46
|
+
signUpText?: string;
|
|
47
|
+
signUpLink?: string;
|
|
48
|
+
signUpPosition?: 'left' | 'center' | 'right';
|
|
49
|
+
otherLinks?: Array<{
|
|
50
|
+
text: string;
|
|
51
|
+
url: string;
|
|
52
|
+
}>;
|
|
53
|
+
otherLinksPosition?: 'left' | 'center' | 'right';
|
|
54
|
+
/** 登录/注册切换配置 */
|
|
55
|
+
showTabs?: boolean;
|
|
56
|
+
loginTabText?: string;
|
|
57
|
+
registerTabText?: string;
|
|
58
|
+
/** 注册表单配置 */
|
|
59
|
+
registerEmailPlaceholder?: string;
|
|
60
|
+
registerPasswordPlaceholder?: string;
|
|
61
|
+
registerButtonText?: string;
|
|
62
|
+
/** 事件回调 */
|
|
63
|
+
onLogin?: (values: {
|
|
64
|
+
email: string;
|
|
65
|
+
loginMethod: string;
|
|
66
|
+
}) => void;
|
|
67
|
+
onSocialLogin?: (type: 'google' | 'facebook' | 'apple') => void;
|
|
68
|
+
onSignUp?: () => void;
|
|
69
|
+
onRegister?: (values: {
|
|
70
|
+
email: string;
|
|
71
|
+
password: string;
|
|
72
|
+
}) => void;
|
|
73
|
+
/** 新增背景图片属性 */
|
|
74
|
+
backgroundImage?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Saas登录组件
|
|
78
|
+
* @param props - 组件属性
|
|
79
|
+
* @returns React组件
|
|
80
|
+
*/
|
|
81
|
+
declare const loginAndRegister: React.FC<loginAndRegisterProps>;
|
|
82
|
+
export default loginAndRegister;
|