@nocobase/client 1.4.30 → 1.4.32
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/collection-manager/interfaces/checkbox.d.ts +20 -0
- package/es/collection-manager/interfaces/properties/operators.d.ts +20 -0
- package/es/index.mjs +246 -146
- package/es/modules/blocks/filter-blocks/FilterCollectionField.d.ts +15 -0
- package/es/schema-settings/VariableInput/hooks/useParentRecordVariable.d.ts +2 -2
- package/lib/index.js +90 -90
- package/package.json +5 -5
|
@@ -48,10 +48,30 @@ export declare class CheckboxFieldInterface extends CollectionFieldInterface {
|
|
|
48
48
|
value: string;
|
|
49
49
|
selected: boolean;
|
|
50
50
|
noValue: boolean;
|
|
51
|
+
schema: {
|
|
52
|
+
'x-component': string;
|
|
53
|
+
'x-component-props': {
|
|
54
|
+
multiple: boolean;
|
|
55
|
+
options: {
|
|
56
|
+
label: string;
|
|
57
|
+
value: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
51
61
|
} | {
|
|
52
62
|
label: string;
|
|
53
63
|
value: string;
|
|
54
64
|
noValue: boolean;
|
|
65
|
+
schema: {
|
|
66
|
+
'x-component': string;
|
|
67
|
+
'x-component-props': {
|
|
68
|
+
multiple: boolean;
|
|
69
|
+
options: {
|
|
70
|
+
label: string;
|
|
71
|
+
value: boolean;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
55
75
|
selected?: undefined;
|
|
56
76
|
})[];
|
|
57
77
|
};
|
|
@@ -184,10 +184,30 @@ export declare const boolean: ({
|
|
|
184
184
|
value: string;
|
|
185
185
|
selected: boolean;
|
|
186
186
|
noValue: boolean;
|
|
187
|
+
schema: {
|
|
188
|
+
'x-component': string;
|
|
189
|
+
'x-component-props': {
|
|
190
|
+
multiple: boolean;
|
|
191
|
+
options: {
|
|
192
|
+
label: string;
|
|
193
|
+
value: boolean;
|
|
194
|
+
}[];
|
|
195
|
+
};
|
|
196
|
+
};
|
|
187
197
|
} | {
|
|
188
198
|
label: string;
|
|
189
199
|
value: string;
|
|
190
200
|
noValue: boolean;
|
|
201
|
+
schema: {
|
|
202
|
+
'x-component': string;
|
|
203
|
+
'x-component-props': {
|
|
204
|
+
multiple: boolean;
|
|
205
|
+
options: {
|
|
206
|
+
label: string;
|
|
207
|
+
value: boolean;
|
|
208
|
+
}[];
|
|
209
|
+
};
|
|
210
|
+
};
|
|
191
211
|
selected?: undefined;
|
|
192
212
|
})[];
|
|
193
213
|
export declare const tableoid: {
|
package/es/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ export * from "@emotion/css";
|
|
|
54
54
|
import jsxRuntime, { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
55
55
|
import * as formilyReact from "@formily/react";
|
|
56
56
|
import { SchemaOptionsContext, SchemaExpressionScopeContext, Schema, useField, useFieldSchema, useExpressionScope, connect, mapProps, useForm, Observer, observer as observer$1, SchemaComponentsContext, ExpressionScope, FormProvider as FormProvider$1, RecursionField, mapReadPretty, FormContext, useFormEffects, FieldContext, ObjectField, ArrayField, createSchemaField, SchemaContext } from "@formily/react";
|
|
57
|
-
import _, { filter, get, capitalize, cloneDeep as cloneDeep$1, isArray, uniqBy, every, some, findIndex, set as set$1, isObject as isObject$1, isString, isEmpty as isEmpty$1, isEqual,
|
|
57
|
+
import _, { filter, get, capitalize, cloneDeep as cloneDeep$1, isArray, uniqBy, every, some, findIndex, set as set$1, isObject as isObject$1, isString, isEmpty as isEmpty$1, isEqual, concat, last, clone, debounce, castArray, differenceBy, unionBy, omit as omit$1, isFunction as isFunction$1, isBoolean, uniq as uniq$2, pick as pick$1 } from "lodash";
|
|
58
58
|
import React, { createContext, useContext, useCallback, useRef, useEffect, isValidElement, useMemo, useState, memo, createElement, Fragment as Fragment$1, useLayoutEffect, useTransition, forwardRef, useImperativeHandle, createRef, startTransition } from "react";
|
|
59
59
|
import * as ReactRouterDom from "react-router-dom";
|
|
60
60
|
import { useNavigate, useLocation, Outlet, useHref, UNSAFE_RouteContext, UNSAFE_LocationContext, useRoutes, HashRouter, BrowserRouter, MemoryRouter, useParams, Link as Link$1, Navigate, NavLink, useSearchParams, useOutletContext, useMatch, Router } from "react-router-dom";
|
|
@@ -4277,7 +4277,19 @@ const useAttach = (e) => {
|
|
|
4277
4277
|
const t = useContext(SchemaOptionsContext), o = useContext(SchemaExpressionScopeContext);
|
|
4278
4278
|
return (n, r) => {
|
|
4279
4279
|
let i = !1, a;
|
|
4280
|
-
if (typeof n == "string" && n.startsWith("{{") && (i = !0, a = n), n && typeof n == "object" && !isValidElement(n)
|
|
4280
|
+
if (typeof n == "string" && n.startsWith("{{") && (i = !0, a = n), n && typeof n == "object" && !isValidElement(n))
|
|
4281
|
+
try {
|
|
4282
|
+
a = JSON.stringify(n), i = hasVariable(a);
|
|
4283
|
+
} catch (l) {
|
|
4284
|
+
console.error(l), i = !1;
|
|
4285
|
+
}
|
|
4286
|
+
if (Array.isArray(n))
|
|
4287
|
+
try {
|
|
4288
|
+
i = hasVariable(JSON.stringify(n));
|
|
4289
|
+
} catch (l) {
|
|
4290
|
+
console.error(l), i = !1;
|
|
4291
|
+
}
|
|
4292
|
+
if (i) {
|
|
4281
4293
|
const l = x(x(x({}, t.scope), o), r);
|
|
4282
4294
|
if (!a)
|
|
4283
4295
|
return Schema.compile(n, l);
|
|
@@ -4301,7 +4313,7 @@ function addAppVersion(e, t) {
|
|
|
4301
4313
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
4302
4314
|
}), e;
|
|
4303
4315
|
}
|
|
4304
|
-
const name = "@nocobase/client", version$1 = "1.4.
|
|
4316
|
+
const name = "@nocobase/client", version$1 = "1.4.32", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
4305
4317
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
4306
4318
|
"@ant-design/cssinjs": "^1.11.1",
|
|
4307
4319
|
"@ant-design/icons": "^5.1.4",
|
|
@@ -4323,9 +4335,9 @@ const name = "@nocobase/client", version$1 = "1.4.30", license = "AGPL-3.0", mai
|
|
|
4323
4335
|
"@formily/reactive-react": "^2.2.27",
|
|
4324
4336
|
"@formily/shared": "^2.2.27",
|
|
4325
4337
|
"@formily/validator": "^2.2.27",
|
|
4326
|
-
"@nocobase/evaluators": "1.4.
|
|
4327
|
-
"@nocobase/sdk": "1.4.
|
|
4328
|
-
"@nocobase/utils": "1.4.
|
|
4338
|
+
"@nocobase/evaluators": "1.4.32",
|
|
4339
|
+
"@nocobase/sdk": "1.4.32",
|
|
4340
|
+
"@nocobase/utils": "1.4.32",
|
|
4329
4341
|
ahooks: "^3.7.2",
|
|
4330
4342
|
antd: "5.12.8",
|
|
4331
4343
|
"antd-style": "3.7.1",
|
|
@@ -5730,8 +5742,49 @@ const date = dayjs(), spaceCSS = css`
|
|
|
5730
5742
|
{ label: '{{t("is empty")}}', value: "$empty", noValue: !0 },
|
|
5731
5743
|
{ label: '{{t("is not empty")}}', value: "$notEmpty", noValue: !0 }
|
|
5732
5744
|
], boolean = [
|
|
5733
|
-
{
|
|
5734
|
-
|
|
5745
|
+
{
|
|
5746
|
+
label: '{{t("Yes")}}',
|
|
5747
|
+
value: "$isTruly",
|
|
5748
|
+
selected: !0,
|
|
5749
|
+
noValue: !0,
|
|
5750
|
+
schema: {
|
|
5751
|
+
"x-component": "Select",
|
|
5752
|
+
"x-component-props": {
|
|
5753
|
+
multiple: !1,
|
|
5754
|
+
options: [
|
|
5755
|
+
{
|
|
5756
|
+
label: '{{t("Yes")}}',
|
|
5757
|
+
value: !0
|
|
5758
|
+
},
|
|
5759
|
+
{
|
|
5760
|
+
label: '{{t("No")}}',
|
|
5761
|
+
value: !1
|
|
5762
|
+
}
|
|
5763
|
+
]
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
},
|
|
5767
|
+
{
|
|
5768
|
+
label: '{{t("No")}}',
|
|
5769
|
+
value: "$isFalsy",
|
|
5770
|
+
noValue: !0,
|
|
5771
|
+
schema: {
|
|
5772
|
+
"x-component": "Select",
|
|
5773
|
+
"x-component-props": {
|
|
5774
|
+
multiple: !1,
|
|
5775
|
+
options: [
|
|
5776
|
+
{
|
|
5777
|
+
label: '{{t("Yes")}}',
|
|
5778
|
+
value: !0
|
|
5779
|
+
},
|
|
5780
|
+
{
|
|
5781
|
+
label: '{{t("No")}}',
|
|
5782
|
+
value: !1
|
|
5783
|
+
}
|
|
5784
|
+
]
|
|
5785
|
+
}
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5735
5788
|
], tableoid = [
|
|
5736
5789
|
{
|
|
5737
5790
|
label: '{{t("is any of")}}',
|
|
@@ -11397,13 +11450,13 @@ const ParentCollectionProvider = (e) => {
|
|
|
11397
11450
|
const e = useCollectionField();
|
|
11398
11451
|
return e ? `${e.collectionName}.${e.name}` : null;
|
|
11399
11452
|
}, useCurrentParentRecordContext = () => {
|
|
11400
|
-
var
|
|
11401
|
-
const e = useCollectionRecord(), { name: t, dataSource: o } = useParentCollection() || {}, n = useCollection(), { isInSubForm: r, isInSubTable: i } = useFlag() || {}, a = t ? o : n == null ? void 0 : n.dataSource;
|
|
11453
|
+
var c, u;
|
|
11454
|
+
const e = useCollectionRecord(), { name: t, dataSource: o } = useParentCollection() || {}, n = useCollection(), { isInSubForm: r, isInSubTable: i } = useFlag() || {}, a = t ? o : n == null ? void 0 : n.dataSource, l = useCollectionField();
|
|
11402
11455
|
return {
|
|
11403
11456
|
// 当该变量使用在区块数据范围的时候,由于某些区块(如 Table)是在 DataBlockProvider 之前解析 filter 的,
|
|
11404
11457
|
// 导致此时 record.parentRecord 的值还是空的,此时正确的值应该是 record,所以在后面加了 record?.data 来防止这种情况
|
|
11405
|
-
currentParentRecordCtx: ((
|
|
11406
|
-
shouldDisplayCurrentParentRecord: !!((
|
|
11458
|
+
currentParentRecordCtx: ((c = e == null ? void 0 : e.parentRecord) == null ? void 0 : c.data) || (e == null ? void 0 : e.data),
|
|
11459
|
+
shouldDisplayCurrentParentRecord: !!((u = e == null ? void 0 : e.parentRecord) != null && u.data) && !r && !i && l,
|
|
11407
11460
|
// 在后面加上 collection?.name 的原因如上面的变量一样
|
|
11408
11461
|
collectionName: t || (n == null ? void 0 : n.name),
|
|
11409
11462
|
dataSource: a
|
|
@@ -12518,7 +12571,7 @@ const useDef$3 = () => ({}), useProps = (e = {}) => {
|
|
|
12518
12571
|
return x(x({}, o), r);
|
|
12519
12572
|
}, PopupLevelContext = React.createContext(0), ActionContainer = observer$1(
|
|
12520
12573
|
(e) => {
|
|
12521
|
-
const { getComponentByOpenMode: t, defaultOpenMode: o } = useOpenModeContext(), { openMode: n = o } = useActionContext(), i = React.useContext(PopupLevelContext) + 1, a = t(n);
|
|
12574
|
+
const { getComponentByOpenMode: t, defaultOpenMode: o } = useOpenModeContext() || {}, { openMode: n = o } = useActionContext(), i = React.useContext(PopupLevelContext) + 1, a = t(n) || ActionDrawer;
|
|
12522
12575
|
return /* @__PURE__ */ jsx(PopupLevelContext.Provider, { value: i, children: /* @__PURE__ */ jsx(a, x({ footerNodeName: "Action.Container.Footer", level: i || 1 }, e)) });
|
|
12523
12576
|
},
|
|
12524
12577
|
{ displayName: "ActionContainer" }
|
|
@@ -13371,9 +13424,106 @@ const useCollectOperator = () => {
|
|
|
13371
13424
|
}, [e.name, o]), e["x-filter-operator"] && t(e.name, e["x-filter-operator"]);
|
|
13372
13425
|
}, useFormItemProps = () => {
|
|
13373
13426
|
useCollectOperator();
|
|
13374
|
-
},
|
|
13427
|
+
}, isPatternDisabled = (e) => {
|
|
13428
|
+
var t;
|
|
13429
|
+
return ((t = e == null ? void 0 : e["x-component-props"]) == null ? void 0 : t["pattern-disable"]) == !0;
|
|
13430
|
+
}, DefaultValueContext = React.createContext(null), DefaultValueProvider = (e) => {
|
|
13431
|
+
const t = useMemo(() => ({
|
|
13432
|
+
isAllowToSetDefaultValue: e.isAllowToSetDefaultValue
|
|
13433
|
+
}), [e.isAllowToSetDefaultValue]);
|
|
13434
|
+
return /* @__PURE__ */ jsx(DefaultValueContext.Provider, { value: t, children: e.children });
|
|
13435
|
+
}, useIsAllowToSetDefaultValue = ({ form: e, fieldSchema: t, collectionField: o } = {}) => {
|
|
13436
|
+
const n = useDataSourceManager(), r = useCollectionManager(), i = useCollection(), { form: a } = useFormBlockContext(), l = useFieldSchema(), { type: c } = useFormBlockType(), { isAllowToSetDefaultValue: u = _isAllowToSetDefaultValue } = useContext(DefaultValueContext) || {};
|
|
13437
|
+
return {
|
|
13438
|
+
isAllowToSetDefaultValue: useCallback(
|
|
13439
|
+
(p) => {
|
|
13440
|
+
const m = i.getField(l.name) || r.getCollectionField(l["x-collection-field"]);
|
|
13441
|
+
return u({
|
|
13442
|
+
collectionField: o || m,
|
|
13443
|
+
getInterface: n == null ? void 0 : n.collectionFieldInterfaceManager.getFieldInterface.bind(n == null ? void 0 : n.collectionFieldInterfaceManager),
|
|
13444
|
+
form: e || a,
|
|
13445
|
+
formBlockType: c,
|
|
13446
|
+
fieldSchema: t || l,
|
|
13447
|
+
isSubTableColumn: p
|
|
13448
|
+
});
|
|
13449
|
+
},
|
|
13450
|
+
[
|
|
13451
|
+
r,
|
|
13452
|
+
i,
|
|
13453
|
+
o,
|
|
13454
|
+
n == null ? void 0 : n.collectionFieldInterfaceManager,
|
|
13455
|
+
t,
|
|
13456
|
+
e,
|
|
13457
|
+
l,
|
|
13458
|
+
a,
|
|
13459
|
+
u,
|
|
13460
|
+
c
|
|
13461
|
+
]
|
|
13462
|
+
)
|
|
13463
|
+
};
|
|
13464
|
+
}, interfacesOfUnsupportedDefaultValue = [
|
|
13465
|
+
"o2o",
|
|
13466
|
+
"oho",
|
|
13467
|
+
"obo",
|
|
13468
|
+
"o2m",
|
|
13469
|
+
"attachment",
|
|
13470
|
+
"expression",
|
|
13471
|
+
"point",
|
|
13472
|
+
"lineString",
|
|
13473
|
+
"circle",
|
|
13474
|
+
"polygon",
|
|
13475
|
+
"sequence",
|
|
13476
|
+
"formula"
|
|
13477
|
+
];
|
|
13478
|
+
function _isAllowToSetDefaultValue({
|
|
13479
|
+
collectionField: e,
|
|
13480
|
+
getInterface: t,
|
|
13481
|
+
formBlockType: o,
|
|
13482
|
+
form: n,
|
|
13483
|
+
fieldSchema: r,
|
|
13484
|
+
isSubTableColumn: i
|
|
13485
|
+
}) {
|
|
13486
|
+
var a;
|
|
13487
|
+
return i ? !interfacesOfUnsupportedDefaultValue.includes(e == null ? void 0 : e.interface) && !isSystemField(e, t) : !e || e.target && ((a = r["x-component-props"]) != null && a.mode) && !["Picker", "Select"].includes(r["x-component-props"].mode) || o !== "create" ? !1 : !(n != null && n.readPretty) && !isPatternDisabled(r) && !interfacesOfUnsupportedDefaultValue.includes(e == null ? void 0 : e.interface) && !isSystemField(e, t);
|
|
13488
|
+
}
|
|
13489
|
+
const setFieldProps$1 = (e, t, o) => {
|
|
13490
|
+
untracked(() => {
|
|
13491
|
+
e[t] === void 0 && (e[t] = o);
|
|
13492
|
+
});
|
|
13493
|
+
}, setRequired$1 = (e, t, o) => {
|
|
13494
|
+
typeof t.required == "undefined" && (e.required = !!o.required);
|
|
13495
|
+
}, FilterCollectionFieldInternalField = (e) => {
|
|
13496
|
+
var g, f, C, S;
|
|
13497
|
+
const t = useCompile(), o = useField(), n = useFieldSchema(), { getInterface: r } = useCollectionManager_deprecated(), { uiSchema: i, defaultValue: a, interface: l } = useCollectionField(), { isAllowToSetDefaultValue: c } = useIsAllowToSetDefaultValue(), u = r(l), d = (f = (g = u == null ? void 0 : u.filterable) == null ? void 0 : g.operators) == null ? void 0 : f.find(
|
|
13498
|
+
(b, y) => b.value === n["x-filter-operator"] || y === 0
|
|
13499
|
+
), p = useComponent(
|
|
13500
|
+
((C = d == null ? void 0 : d.schema) == null ? void 0 : C["x-component"]) || ((S = n["x-component-props"]) == null ? void 0 : S.component) || (i == null ? void 0 : i["x-component"]) || "Input"
|
|
13501
|
+
), m = useFormBlockContext(), h = useDynamicComponentProps(i == null ? void 0 : i["x-use-component-props"], e);
|
|
13502
|
+
return useEffect(() => {
|
|
13503
|
+
var F;
|
|
13504
|
+
if (!i)
|
|
13505
|
+
return;
|
|
13506
|
+
const b = t(i);
|
|
13507
|
+
if (setFieldProps$1(o, "content", b["x-content"]), setFieldProps$1(o, "title", b.title), setFieldProps$1(o, "description", b.description), m != null && m.form) {
|
|
13508
|
+
const P = c() ? n.default || a : void 0;
|
|
13509
|
+
P != null && setFieldProps$1(o, "initialValue", P);
|
|
13510
|
+
}
|
|
13511
|
+
if (!o.validator && (b["x-validator"] || n["x-validator"])) {
|
|
13512
|
+
const P = concat([], b["x-validator"] || [], n["x-validator"] || []);
|
|
13513
|
+
o.validator = P;
|
|
13514
|
+
}
|
|
13515
|
+
n["x-disabled"] === !0 && (o.disabled = !0), n["x-read-pretty"] === !0 && (o.readPretty = !0), setRequired$1(o, n, b), o.dataSource = b.enum;
|
|
13516
|
+
const y = t(x(x({}, ((F = d == null ? void 0 : d.schema) == null ? void 0 : F["x-component-props"]) || {}), b["x-component-props"] || {})) || {};
|
|
13517
|
+
o.componentProps = merge(y, o.componentProps || {}, h || {});
|
|
13518
|
+
}, [i]), i ? /* @__PURE__ */ jsx(p, x(x({}, e), h)) : null;
|
|
13519
|
+
}, FilterCollectionField = connect((e) => {
|
|
13520
|
+
const t = useFieldSchema();
|
|
13521
|
+
return useField(), /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent: ErrorFallback.Modal, onError: (o) => console.log(o), children: /* @__PURE__ */ jsx(CollectionFieldProvider, { name: t.name, children: /* @__PURE__ */ jsx(FilterCollectionFieldInternalField, x({}, e)) }) });
|
|
13522
|
+
});
|
|
13523
|
+
FilterCollectionField.displayName = "FilterCollectionField";
|
|
13524
|
+
const FilterFormBlockProvider = withDynamicSchemaProps((e) => {
|
|
13375
13525
|
const o = useFieldSchema()["x-filter-operators"] || {};
|
|
13376
|
-
return /* @__PURE__ */ jsx(CollectOperators, { defaultOperators: o, children: /* @__PURE__ */ jsx(DatePickerProvider, { value: { utc: !1 }, children: /* @__PURE__ */ jsx(
|
|
13526
|
+
return /* @__PURE__ */ jsx(SchemaComponentOptions, { components: { CollectionField: FilterCollectionField }, children: /* @__PURE__ */ jsx(CollectOperators, { defaultOperators: o, children: /* @__PURE__ */ jsx(DatePickerProvider, { value: { utc: !1 }, children: /* @__PURE__ */ jsx(
|
|
13377
13527
|
ActionBarProvider,
|
|
13378
13528
|
{
|
|
13379
13529
|
forceProps: {
|
|
@@ -13385,7 +13535,7 @@ const useCollectOperator = () => {
|
|
|
13385
13535
|
},
|
|
13386
13536
|
children: /* @__PURE__ */ jsx(DefaultValueProvider, { isAllowToSetDefaultValue: () => !1, children: /* @__PURE__ */ jsx(FormBlockProvider, x({ name: "filter-form" }, e)) })
|
|
13387
13537
|
}
|
|
13388
|
-
) }) });
|
|
13538
|
+
) }) }) });
|
|
13389
13539
|
}), FormFieldContext = createContext({});
|
|
13390
13540
|
FormFieldContext.displayName = "FormFieldContext";
|
|
13391
13541
|
const InternalFormFieldProvider = (e) => {
|
|
@@ -14267,17 +14417,17 @@ function useTableColumnInitializerFields() {
|
|
|
14267
14417
|
});
|
|
14268
14418
|
}
|
|
14269
14419
|
function useAssociatedTableColumnInitializerFields() {
|
|
14270
|
-
var
|
|
14271
|
-
const {
|
|
14272
|
-
return (
|
|
14273
|
-
getCollectionFields:
|
|
14274
|
-
field:
|
|
14275
|
-
getInterface:
|
|
14276
|
-
getCollection:
|
|
14277
|
-
schemaName:
|
|
14420
|
+
var a;
|
|
14421
|
+
const { fields: e } = useCollection_deprecated(), { t } = useTranslation(), { getInterface: o, getCollectionFields: n, getCollection: r } = useCollectionManager_deprecated();
|
|
14422
|
+
return (a = e == null ? void 0 : e.filter((l) => ["o2o", "oho", "obo", "m2o"].includes(l.interface))) == null ? void 0 : a.map((l) => getGroupItemForTable({
|
|
14423
|
+
getCollectionFields: n,
|
|
14424
|
+
field: l,
|
|
14425
|
+
getInterface: o,
|
|
14426
|
+
getCollection: r,
|
|
14427
|
+
schemaName: l.name,
|
|
14278
14428
|
maxDepth: 2,
|
|
14279
14429
|
depth: 1,
|
|
14280
|
-
t
|
|
14430
|
+
t
|
|
14281
14431
|
}));
|
|
14282
14432
|
}
|
|
14283
14433
|
function getGroupItemForTable({
|
|
@@ -16155,69 +16305,7 @@ const createSubmitActionSettings = new SchemaSettings({
|
|
|
16155
16305
|
] });
|
|
16156
16306
|
},
|
|
16157
16307
|
{ displayName: "GeneralSchemaItems" }
|
|
16158
|
-
),
|
|
16159
|
-
var t;
|
|
16160
|
-
return ((t = e == null ? void 0 : e["x-component-props"]) == null ? void 0 : t["pattern-disable"]) == !0;
|
|
16161
|
-
}, DefaultValueContext = React.createContext(null), DefaultValueProvider = (e) => {
|
|
16162
|
-
const t = useMemo(() => ({
|
|
16163
|
-
isAllowToSetDefaultValue: e.isAllowToSetDefaultValue
|
|
16164
|
-
}), [e.isAllowToSetDefaultValue]);
|
|
16165
|
-
return /* @__PURE__ */ jsx(DefaultValueContext.Provider, { value: t, children: e.children });
|
|
16166
|
-
}, useIsAllowToSetDefaultValue = ({ form: e, fieldSchema: t, collectionField: o } = {}) => {
|
|
16167
|
-
const n = useDataSourceManager(), r = useCollectionManager(), i = useCollection(), { form: a } = useFormBlockContext(), l = useFieldSchema(), { type: c } = useFormBlockType(), { isAllowToSetDefaultValue: u = _isAllowToSetDefaultValue } = useContext(DefaultValueContext) || {};
|
|
16168
|
-
return {
|
|
16169
|
-
isAllowToSetDefaultValue: useCallback(
|
|
16170
|
-
(p) => {
|
|
16171
|
-
const m = i.getField(l.name) || r.getCollectionField(l["x-collection-field"]);
|
|
16172
|
-
return u({
|
|
16173
|
-
collectionField: o || m,
|
|
16174
|
-
getInterface: n == null ? void 0 : n.collectionFieldInterfaceManager.getFieldInterface.bind(n == null ? void 0 : n.collectionFieldInterfaceManager),
|
|
16175
|
-
form: e || a,
|
|
16176
|
-
formBlockType: c,
|
|
16177
|
-
fieldSchema: t || l,
|
|
16178
|
-
isSubTableColumn: p
|
|
16179
|
-
});
|
|
16180
|
-
},
|
|
16181
|
-
[
|
|
16182
|
-
r,
|
|
16183
|
-
i,
|
|
16184
|
-
o,
|
|
16185
|
-
n == null ? void 0 : n.collectionFieldInterfaceManager,
|
|
16186
|
-
t,
|
|
16187
|
-
e,
|
|
16188
|
-
l,
|
|
16189
|
-
a,
|
|
16190
|
-
u,
|
|
16191
|
-
c
|
|
16192
|
-
]
|
|
16193
|
-
)
|
|
16194
|
-
};
|
|
16195
|
-
}, interfacesOfUnsupportedDefaultValue = [
|
|
16196
|
-
"o2o",
|
|
16197
|
-
"oho",
|
|
16198
|
-
"obo",
|
|
16199
|
-
"o2m",
|
|
16200
|
-
"attachment",
|
|
16201
|
-
"expression",
|
|
16202
|
-
"point",
|
|
16203
|
-
"lineString",
|
|
16204
|
-
"circle",
|
|
16205
|
-
"polygon",
|
|
16206
|
-
"sequence",
|
|
16207
|
-
"formula"
|
|
16208
|
-
];
|
|
16209
|
-
function _isAllowToSetDefaultValue({
|
|
16210
|
-
collectionField: e,
|
|
16211
|
-
getInterface: t,
|
|
16212
|
-
formBlockType: o,
|
|
16213
|
-
form: n,
|
|
16214
|
-
fieldSchema: r,
|
|
16215
|
-
isSubTableColumn: i
|
|
16216
|
-
}) {
|
|
16217
|
-
var a;
|
|
16218
|
-
return i ? !interfacesOfUnsupportedDefaultValue.includes(e == null ? void 0 : e.interface) && !isSystemField(e, t) : !e || e.target && ((a = r["x-component-props"]) != null && a.mode) && !["Picker", "Select"].includes(r["x-component-props"].mode) || o !== "create" ? !1 : !(n != null && n.readPretty) && !isPatternDisabled(r) && !interfacesOfUnsupportedDefaultValue.includes(e == null ? void 0 : e.interface) && !isSystemField(e, t);
|
|
16219
|
-
}
|
|
16220
|
-
const validateJSON$1 = {
|
|
16308
|
+
), validateJSON$1 = {
|
|
16221
16309
|
validator: `{{(value, rule)=> {
|
|
16222
16310
|
if (!value) {
|
|
16223
16311
|
return '';
|
|
@@ -25433,7 +25521,7 @@ const getAppends = ({
|
|
|
25433
25521
|
}
|
|
25434
25522
|
} else
|
|
25435
25523
|
[
|
|
25436
|
-
|
|
25524
|
+
// 'ActionBar',
|
|
25437
25525
|
"Action",
|
|
25438
25526
|
"Action.Link",
|
|
25439
25527
|
"Action.Modal",
|
|
@@ -25468,7 +25556,7 @@ const getAppends = ({
|
|
|
25468
25556
|
getCollectionJoinField: t,
|
|
25469
25557
|
getCollection: o,
|
|
25470
25558
|
dataSource: e
|
|
25471
|
-
}), a = fillParentFields(a),
|
|
25559
|
+
}), a = fillParentFields(a), { appends: [...a], updateAssociationValues: [...i] };
|
|
25472
25560
|
} };
|
|
25473
25561
|
};
|
|
25474
25562
|
function getTargetField(e) {
|
|
@@ -26478,43 +26566,51 @@ function forEachLinkageRule(e, t) {
|
|
|
26478
26566
|
});
|
|
26479
26567
|
});
|
|
26480
26568
|
}
|
|
26481
|
-
const
|
|
26482
|
-
|
|
26483
|
-
|
|
26484
|
-
|
|
26485
|
-
|
|
26569
|
+
const isSubFormOrSubTableField = (e) => {
|
|
26570
|
+
for (; e; ) {
|
|
26571
|
+
if (isSubMode(e))
|
|
26572
|
+
return !0;
|
|
26573
|
+
if (e["x-component"] === "FormV2")
|
|
26574
|
+
return !1;
|
|
26575
|
+
e = e.parent;
|
|
26576
|
+
}
|
|
26577
|
+
return !1;
|
|
26578
|
+
}, useLinkageRulesForSubTableOrSubForm = () => {
|
|
26579
|
+
const e = useFieldSchema(), t = useField(), { fieldSchema: o, formValue: n } = useSubFormValue(), r = useLocalVariables(), i = useVariables(), a = getLinkageRules$1(o);
|
|
26486
26580
|
useEffect(() => {
|
|
26487
|
-
if (!
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
|
|
26581
|
+
if (!isSubFormOrSubTableField(e))
|
|
26582
|
+
return;
|
|
26583
|
+
if (!t.onUnmount.__rested) {
|
|
26584
|
+
const c = t.onUnmount;
|
|
26585
|
+
t.onUnmount = () => {
|
|
26586
|
+
var u;
|
|
26587
|
+
(u = t.__disposes) == null || u.forEach((d) => {
|
|
26588
|
+
d();
|
|
26589
|
+
}), c();
|
|
26590
|
+
}, t.onUnmount.__rested = !0;
|
|
26495
26591
|
}
|
|
26496
|
-
if (!
|
|
26592
|
+
if (!a)
|
|
26497
26593
|
return;
|
|
26498
|
-
|
|
26499
|
-
|
|
26594
|
+
t.__disposes && t.__disposes.forEach((c) => {
|
|
26595
|
+
c();
|
|
26500
26596
|
});
|
|
26501
|
-
const
|
|
26502
|
-
forEachLinkageRule(
|
|
26503
|
-
var
|
|
26504
|
-
(
|
|
26597
|
+
const l = t.__disposes = [];
|
|
26598
|
+
forEachLinkageRule(a, (c, u) => {
|
|
26599
|
+
var d;
|
|
26600
|
+
(d = c.targetFields) != null && d.includes(e.name) && l.push(
|
|
26505
26601
|
bindLinkageRulesToFiled({
|
|
26506
|
-
field:
|
|
26507
|
-
linkageRules:
|
|
26508
|
-
formValues:
|
|
26509
|
-
localVariables:
|
|
26510
|
-
action:
|
|
26511
|
-
rule:
|
|
26512
|
-
variables:
|
|
26602
|
+
field: t,
|
|
26603
|
+
linkageRules: a,
|
|
26604
|
+
formValues: n,
|
|
26605
|
+
localVariables: r,
|
|
26606
|
+
action: c,
|
|
26607
|
+
rule: u,
|
|
26608
|
+
variables: i,
|
|
26513
26609
|
variableNameOfLeftCondition: "$iteration"
|
|
26514
26610
|
})
|
|
26515
26611
|
);
|
|
26516
|
-
}),
|
|
26517
|
-
}, [
|
|
26612
|
+
}), t.__linkageRules = a;
|
|
26613
|
+
}, [t, e == null ? void 0 : e.name, n, JSON.stringify(a), r, i]);
|
|
26518
26614
|
};
|
|
26519
26615
|
function getLinkageRules$1(e) {
|
|
26520
26616
|
var t;
|
|
@@ -32362,7 +32458,11 @@ const tableBlockSettings = new SchemaSettings({
|
|
|
32362
32458
|
return e && !t;
|
|
32363
32459
|
}
|
|
32364
32460
|
}),
|
|
32365
|
-
getAllowMultiple({ title: "Allow multiple selection" }),
|
|
32461
|
+
v(x({}, getAllowMultiple({ title: "Allow multiple selection" })), {
|
|
32462
|
+
useVisible() {
|
|
32463
|
+
return useField().componentProps.multiple !== !1;
|
|
32464
|
+
}
|
|
32465
|
+
}),
|
|
32366
32466
|
v(x({}, titleField$1), {
|
|
32367
32467
|
useVisible: useIsAssociationField
|
|
32368
32468
|
}),
|
|
@@ -34086,9 +34186,9 @@ const ReadPretty$b = observer$1(
|
|
|
34086
34186
|
return ((o = t == null ? void 0 : t.label) != null ? o : "").toLowerCase().includes((e || "").toLowerCase());
|
|
34087
34187
|
}, InternalSelect = connect(
|
|
34088
34188
|
(e) => {
|
|
34089
|
-
const
|
|
34090
|
-
let
|
|
34091
|
-
if (
|
|
34189
|
+
const d = e, { objectValue: t, loading: o, value: n, rawOptions: r, defaultValue: i } = d, a = K(d, ["objectValue", "loading", "value", "rawOptions", "defaultValue"]), l = useCompile();
|
|
34190
|
+
let c = e.multiple ? "multiple" : e.mode;
|
|
34191
|
+
if (c && !["multiple", "tags"].includes(c) && (c = void 0), t)
|
|
34092
34192
|
return /* @__PURE__ */ jsx(
|
|
34093
34193
|
ObjectSelect,
|
|
34094
34194
|
v(x({
|
|
@@ -34096,16 +34196,16 @@ const ReadPretty$b = observer$1(
|
|
|
34096
34196
|
}, a), {
|
|
34097
34197
|
defaultValue: i,
|
|
34098
34198
|
value: n,
|
|
34099
|
-
mode:
|
|
34199
|
+
mode: c,
|
|
34100
34200
|
loading: o
|
|
34101
34201
|
})
|
|
34102
34202
|
);
|
|
34103
|
-
const
|
|
34203
|
+
const u = (p) => ["tags", "multiple"].includes(e.mode) || e.multiple ? p ? toArr$3(p) : void 0 : p;
|
|
34104
34204
|
return /* @__PURE__ */ jsx(
|
|
34105
34205
|
Select$1,
|
|
34106
34206
|
v(x({
|
|
34107
34207
|
role: "button",
|
|
34108
|
-
"data-testid": `select-${
|
|
34208
|
+
"data-testid": `select-${c || "single"}`,
|
|
34109
34209
|
showSearch: !0,
|
|
34110
34210
|
filterOption,
|
|
34111
34211
|
allowClear: {
|
|
@@ -34113,27 +34213,27 @@ const ReadPretty$b = observer$1(
|
|
|
34113
34213
|
},
|
|
34114
34214
|
popupMatchSelectWidth: !1,
|
|
34115
34215
|
notFoundContent: o ? /* @__PURE__ */ jsx(Spin, {}) : /* @__PURE__ */ jsx(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE }),
|
|
34116
|
-
value:
|
|
34117
|
-
defaultValue:
|
|
34118
|
-
tagRender: (
|
|
34216
|
+
value: u(n),
|
|
34217
|
+
defaultValue: u(i),
|
|
34218
|
+
tagRender: (p) => (
|
|
34119
34219
|
// @ts-ignore
|
|
34120
34220
|
/* @__PURE__ */ jsx(
|
|
34121
34221
|
Tag,
|
|
34122
34222
|
v(x({
|
|
34123
34223
|
role: "button",
|
|
34124
|
-
"aria-label":
|
|
34224
|
+
"aria-label": p.label,
|
|
34125
34225
|
closeIcon: /* @__PURE__ */ jsx(CloseOutlined, { role: "button", "aria-label": "icon-close-tag" })
|
|
34126
|
-
},
|
|
34127
|
-
children:
|
|
34226
|
+
}, p), {
|
|
34227
|
+
children: p.label
|
|
34128
34228
|
})
|
|
34129
34229
|
)
|
|
34130
34230
|
)
|
|
34131
|
-
}, a), {
|
|
34132
|
-
onChange: (
|
|
34133
|
-
var
|
|
34134
|
-
(
|
|
34231
|
+
}, l(a)), {
|
|
34232
|
+
onChange: (p) => {
|
|
34233
|
+
var m;
|
|
34234
|
+
(m = e.onChange) == null || m.call(e, p === void 0 ? null : p);
|
|
34135
34235
|
},
|
|
34136
|
-
mode:
|
|
34236
|
+
mode: c,
|
|
34137
34237
|
maxTagCount: "responsive"
|
|
34138
34238
|
})
|
|
34139
34239
|
);
|
|
@@ -35929,7 +36029,7 @@ const AppendsTreeSelect = (e) => {
|
|
|
35929
36029
|
CustomDropdownRender: m === "quickAdd" && P
|
|
35930
36030
|
})
|
|
35931
36031
|
),
|
|
35932
|
-
m === "modalAdd" && /* @__PURE__ */ jsx(SchemaComponentContext.Provider, { value: v(x({}, y), { draggable: !1 }), children: /* @__PURE__ */ jsx(RecordProvider, { isNew: !0, record: null, parent: b, children: /* @__PURE__ */ jsx(ClearCollectionFieldContext, { children: /* @__PURE__ */ jsx(
|
|
36032
|
+
m === "modalAdd" && /* @__PURE__ */ jsx(SchemaComponentContext.Provider, { value: v(x({}, y), { draggable: !1 }), children: /* @__PURE__ */ jsx(RecordProvider, { isNew: !0, record: null, parent: b, children: /* @__PURE__ */ jsx(VariablePopupRecordProvider, { children: /* @__PURE__ */ jsx(ClearCollectionFieldContext, { children: /* @__PURE__ */ jsx(
|
|
35933
36033
|
RecursionField,
|
|
35934
36034
|
{
|
|
35935
36035
|
onlyRenderProperties: !0,
|
|
@@ -35937,7 +36037,7 @@ const AppendsTreeSelect = (e) => {
|
|
|
35937
36037
|
schema: i,
|
|
35938
36038
|
filterProperties: (A) => A["x-component"] === "Action"
|
|
35939
36039
|
}
|
|
35940
|
-
) }) }) })
|
|
36040
|
+
) }) }) }) })
|
|
35941
36041
|
] }) }, i.name);
|
|
35942
36042
|
},
|
|
35943
36043
|
{ displayName: "AssociationSelect" }
|
|
@@ -37981,7 +38081,7 @@ const CreateRecordAction$1 = forwardRef(InternalCreateRecordAction), initializer
|
|
|
37981
38081
|
};
|
|
37982
38082
|
return /* @__PURE__ */ jsxs(CollectionProvider_deprecated, { name: a == null ? void 0 : a.target, children: [
|
|
37983
38083
|
/* @__PURE__ */ jsx(CreateAction, v(x({}, e), { onClick: (f) => g(f) })),
|
|
37984
|
-
/* @__PURE__ */ jsx(ActionContextProvider, { value: v(x({}, n), { visible: l, setVisible: c }), children: /* @__PURE__ */ jsx(CollectionProvider_deprecated, { name: d, dataSource: m, children: /* @__PURE__ */ jsx(
|
|
38084
|
+
/* @__PURE__ */ jsx(ActionContextProvider, { value: v(x({}, n), { visible: l, setVisible: c }), children: /* @__PURE__ */ jsx(CollectionProvider_deprecated, { name: d, dataSource: m, children: /* @__PURE__ */ jsx(TabsContextProvider, { children: /* @__PURE__ */ jsx(
|
|
37985
38085
|
RecursionField,
|
|
37986
38086
|
{
|
|
37987
38087
|
onlyRenderProperties: !0,
|
|
@@ -37989,7 +38089,7 @@ const CreateRecordAction$1 = forwardRef(InternalCreateRecordAction), initializer
|
|
|
37989
38089
|
schema: o,
|
|
37990
38090
|
filterProperties: (f) => f["x-component"] === "AssociationField.AddNewer"
|
|
37991
38091
|
}
|
|
37992
|
-
) }) })
|
|
38092
|
+
) }) }) })
|
|
37993
38093
|
] });
|
|
37994
38094
|
},
|
|
37995
38095
|
{ displayName: "CreateRecordAction" }
|
|
@@ -52954,12 +53054,12 @@ const useBlockContext = () => useContext(BlockContext), useCompatDataBlockParent
|
|
|
52954
53054
|
const { association: e } = useDataBlockProps();
|
|
52955
53055
|
return useContext(BlockAssociationContext) || e;
|
|
52956
53056
|
}, useFilterByTk = (e) => {
|
|
52957
|
-
const { resource: t, __parent: o } = useBlockRequestContext(), n = useRecordIndex(), r = useCollectionRecordData(), i = useCollection_deprecated(),
|
|
52958
|
-
if (!
|
|
53057
|
+
const { resource: t, __parent: o } = useBlockRequestContext(), n = useRecordIndex(), r = useCollectionRecordData(), i = useCollection_deprecated(), a = useBlockAssociationContext(), l = (e == null ? void 0 : e.association) || a, c = useContext(WithoutTableFieldResource), u = useCollectionManager();
|
|
53058
|
+
if (!c && (t instanceof TableFieldResource || (o == null ? void 0 : o.block) === "TableField"))
|
|
52959
53059
|
return n;
|
|
52960
|
-
if (
|
|
52961
|
-
const d =
|
|
52962
|
-
return r == null ? void 0 : r[d.targetKey || "id"];
|
|
53060
|
+
if (l) {
|
|
53061
|
+
const d = u.getCollectionField(l);
|
|
53062
|
+
return r == null ? void 0 : r[d.targetKey || d.sourceKey || "id"];
|
|
52963
53063
|
}
|
|
52964
53064
|
if (isArray(i.filterTargetKey)) {
|
|
52965
53065
|
const d = {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* TODO: 初步适配
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const FilterCollectionFieldInternalField: React.FC;
|
|
15
|
+
export declare const FilterCollectionField: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
|