@nocobase/client 1.9.58 → 1.9.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/es/index.mjs +11 -9
- package/es/schema-settings/SchemaSettingsDefaultValue.d.ts +18 -0
- package/lib/index.js +58 -58
- package/package.json +5 -5
package/es/index.mjs
CHANGED
|
@@ -2821,6 +2821,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2821
2821
|
get appendQueryStringToUrl() {
|
|
2822
2822
|
return appendQueryStringToUrl;
|
|
2823
2823
|
},
|
|
2824
|
+
get applyCollectionFieldUiSchemaToDefaultValueSchema() {
|
|
2825
|
+
return applyCollectionFieldUiSchemaToDefaultValueSchema;
|
|
2826
|
+
},
|
|
2824
2827
|
get attachmentFileTypes() {
|
|
2825
2828
|
return attachmentFileTypes;
|
|
2826
2829
|
},
|
|
@@ -8858,7 +8861,7 @@ function addAppVersion(e, t) {
|
|
|
8858
8861
|
addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
|
|
8859
8862
|
}), e;
|
|
8860
8863
|
}
|
|
8861
|
-
const name = "@nocobase/client", version = "1.9.
|
|
8864
|
+
const name = "@nocobase/client", version = "1.9.60", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
8862
8865
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
8863
8866
|
"@ant-design/cssinjs": "^1.11.1",
|
|
8864
8867
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -8879,9 +8882,9 @@ const name = "@nocobase/client", version = "1.9.58", license = "AGPL-3.0", main
|
|
|
8879
8882
|
"@formily/reactive-react": "^2.2.27",
|
|
8880
8883
|
"@formily/shared": "^2.2.27",
|
|
8881
8884
|
"@formily/validator": "^2.2.27",
|
|
8882
|
-
"@nocobase/evaluators": "1.9.
|
|
8883
|
-
"@nocobase/sdk": "1.9.
|
|
8884
|
-
"@nocobase/utils": "1.9.
|
|
8885
|
+
"@nocobase/evaluators": "1.9.60",
|
|
8886
|
+
"@nocobase/sdk": "1.9.60",
|
|
8887
|
+
"@nocobase/utils": "1.9.60",
|
|
8885
8888
|
ahooks: "^3.7.2",
|
|
8886
8889
|
antd: "5.24.2",
|
|
8887
8890
|
"antd-mobile": "^5.41.1",
|
|
@@ -14557,6 +14560,8 @@ function formatVariableScop(e) {
|
|
|
14557
14560
|
const getActionContext = (e) => {
|
|
14558
14561
|
var n;
|
|
14559
14562
|
return ((n = e.fieldSchema) == null ? void 0 : n["x-action-context"]) || {};
|
|
14563
|
+
}, applyCollectionFieldUiSchemaToDefaultValueSchema = (e, t) => {
|
|
14564
|
+
t && (e["x-component"] = t["x-component"] || "Input", e["x-use-component-props"] = e["x-use-component-props"] || t["x-use-component-props"], e["x-component-props"] = x(x({}, t["x-component-props"] || {}), e["x-component-props"] || {}), t.enum && (e.enum = t.enum), t.type && (e.type = t.type));
|
|
14560
14565
|
}, SchemaSettingsDefaultValue = function(t) {
|
|
14561
14566
|
var A, E, L;
|
|
14562
14567
|
const n = useFieldSchema(), o = (A = t == null ? void 0 : t.fieldSchema) != null ? A : n, r = useField(), { dn: a } = useDesignable(), { t: i } = useTranslation(), l = useActionContext(), c = getActionContext(l).collection;
|
|
@@ -14613,11 +14618,7 @@ const getActionContext = (e) => {
|
|
|
14613
14618
|
);
|
|
14614
14619
|
G["x-read-pretty"] = !1, G["x-disabled"] = !1, _.set(G, "x-decorator-props.showTitle", !1);
|
|
14615
14620
|
const H = getFieldDefaultValue(G, T);
|
|
14616
|
-
|
|
14617
|
-
const K = _.cloneDeep(T.uiSchema);
|
|
14618
|
-
G["x-component"] = K["x-component"] || "Input", G["x-use-component-props"] = G["x-use-component-props"] || K["x-use-component-props"], G["x-component-props"] = x(x({}, K["x-component-props"] || {}), G["x-component-props"] || {}), K.type && (G.type = K.type);
|
|
14619
|
-
}
|
|
14620
|
-
T.target && G["x-component-props"] && (G["x-component-props"].mode = "Select"), T != null && T.uiSchema.type && (G.type = T.uiSchema.type), (T == null ? void 0 : T.uiSchema["x-component"]) === "Checkbox" && (_.set(G, "x-component-props.defaultChecked", H), G.type = "void");
|
|
14621
|
+
G["x-component"] === "CollectionField" && (T != null && T.uiSchema) && applyCollectionFieldUiSchemaToDefaultValueSchema(G, T.uiSchema), T.target && G["x-component-props"] && (G["x-component-props"].mode = "Select"), (T == null ? void 0 : T.uiSchema["x-component"]) === "Checkbox" && (_.set(G, "x-component-props.defaultChecked", H), G.type = "void");
|
|
14621
14622
|
const U = useMemo(
|
|
14622
14623
|
() => P(x({}, G || {}), {
|
|
14623
14624
|
"x-decorator": "FormItem",
|
|
@@ -70620,6 +70621,7 @@ export {
|
|
|
70620
70621
|
actionSettingsItems,
|
|
70621
70622
|
allowAddNew,
|
|
70622
70623
|
appendQueryStringToUrl,
|
|
70624
|
+
applyCollectionFieldUiSchemaToDefaultValueSchema,
|
|
70623
70625
|
attachmentFileTypes,
|
|
70624
70626
|
autoFill,
|
|
70625
70627
|
autoIncrement,
|
|
@@ -8,6 +8,24 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Schema } from '@formily/react';
|
|
10
10
|
import React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* 将 CollectionField 的 uiSchema 映射到默认值弹窗里真正渲染的字段 schema。
|
|
13
|
+
*
|
|
14
|
+
* 默认值弹窗不会直接渲染 CollectionField,而是会把它替换成实际的表单组件。
|
|
15
|
+
* 这里必须把选项字段依赖的 `enum` 也带过去,否则下拉 / 单选 / 多选在弹窗里会没有可选项。
|
|
16
|
+
*
|
|
17
|
+
* @param clonedSchema 当前字段 schema 的克隆副本
|
|
18
|
+
* @param collectionFieldUiSchema 数据表字段上的 uiSchema
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const schema = { 'x-component': 'CollectionField' };
|
|
22
|
+
* applyCollectionFieldUiSchemaToDefaultValueSchema(schema, {
|
|
23
|
+
* 'x-component': 'Select',
|
|
24
|
+
* enum: [{ label: 'Option 1', value: 'option1' }],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const applyCollectionFieldUiSchemaToDefaultValueSchema: (clonedSchema: Record<string, any>, collectionFieldUiSchema: Record<string, any>) => void;
|
|
11
29
|
export declare const SchemaSettingsDefaultValue: (props: {
|
|
12
30
|
fieldSchema?: Schema;
|
|
13
31
|
hideVariableButton?: boolean;
|