@nocobase/client 2.0.31 → 2.0.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.
|
@@ -17,6 +17,13 @@ import { DetailsGridModel } from './DetailsGridModel';
|
|
|
17
17
|
* @param idx Form.List 的索引
|
|
18
18
|
*/
|
|
19
19
|
export declare function getValueWithIndex(record: any, fieldPath: string, idx?: string[]): any;
|
|
20
|
+
export declare function getDetailsItemValue(options: {
|
|
21
|
+
record: any;
|
|
22
|
+
currentObject?: any;
|
|
23
|
+
fieldPath: string;
|
|
24
|
+
prefixFieldPath?: string;
|
|
25
|
+
idx?: string[];
|
|
26
|
+
}): any;
|
|
20
27
|
export declare class DetailsItemModel extends DisplayItemModel<{
|
|
21
28
|
parent: DetailsGridModel;
|
|
22
29
|
subModels: {
|
package/es/index.mjs
CHANGED
|
@@ -80,7 +80,7 @@ import { ErrorBoundary } from "react-error-boundary";
|
|
|
80
80
|
import * as reactI18next from "react-i18next";
|
|
81
81
|
import { useTranslation, initReactI18next, Trans, I18nextProvider } from "react-i18next";
|
|
82
82
|
import * as nocobaseSDK from "@nocobase/sdk";
|
|
83
|
-
import { APIClient as APIClient$1, getSubAppName } from "@nocobase/sdk";
|
|
83
|
+
import { APIClient as APIClient$1, hasHeaderValue, getSubAppName } from "@nocobase/sdk";
|
|
84
84
|
import get$1 from "lodash/get";
|
|
85
85
|
import merge$1 from "lodash/merge";
|
|
86
86
|
import set$1 from "lodash/set";
|
|
@@ -3777,6 +3777,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3777
3777
|
get getDefaultOperator() {
|
|
3778
3778
|
return getDefaultOperator;
|
|
3779
3779
|
},
|
|
3780
|
+
get getDetailsItemValue() {
|
|
3781
|
+
return getDetailsItemValue;
|
|
3782
|
+
},
|
|
3780
3783
|
get getDisplayNumber() {
|
|
3781
3784
|
return getDisplayNumber;
|
|
3782
3785
|
},
|
|
@@ -5280,7 +5283,7 @@ class APIClient extends APIClient$1 {
|
|
|
5280
5283
|
o.headers["X-With-ACL-Meta"] = !0;
|
|
5281
5284
|
const n = this.getHeaders();
|
|
5282
5285
|
return Object.keys(n).forEach((r) => {
|
|
5283
|
-
o.headers
|
|
5286
|
+
hasHeaderValue(o.headers, r) || (o.headers[r] = n[r]);
|
|
5284
5287
|
}), o;
|
|
5285
5288
|
}), super.interceptors(), this.useNotificationMiddleware(), this.axios.interceptors.response.use(
|
|
5286
5289
|
(o) => o,
|
|
@@ -9964,7 +9967,7 @@ function addAppVersion(e, t) {
|
|
|
9964
9967
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9965
9968
|
}), e;
|
|
9966
9969
|
}
|
|
9967
|
-
const name = "@nocobase/client", version = "2.0.
|
|
9970
|
+
const name = "@nocobase/client", version = "2.0.32", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9968
9971
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9969
9972
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9970
9973
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9987,10 +9990,10 @@ const name = "@nocobase/client", version = "2.0.31", license = "Apache-2.0", mai
|
|
|
9987
9990
|
"@formily/reactive-react": "^2.2.27",
|
|
9988
9991
|
"@formily/shared": "^2.2.27",
|
|
9989
9992
|
"@formily/validator": "^2.2.27",
|
|
9990
|
-
"@nocobase/evaluators": "2.0.
|
|
9991
|
-
"@nocobase/flow-engine": "2.0.
|
|
9992
|
-
"@nocobase/sdk": "2.0.
|
|
9993
|
-
"@nocobase/utils": "2.0.
|
|
9993
|
+
"@nocobase/evaluators": "2.0.32",
|
|
9994
|
+
"@nocobase/flow-engine": "2.0.32",
|
|
9995
|
+
"@nocobase/sdk": "2.0.32",
|
|
9996
|
+
"@nocobase/utils": "2.0.32",
|
|
9994
9997
|
"@tanstack/react-table": "^8.21.3",
|
|
9995
9998
|
"@types/tabulator-tables": "^6.2.6",
|
|
9996
9999
|
"acorn-jsx": "^5.3.2",
|
|
@@ -79468,6 +79471,18 @@ function getValueWithIndex(e, t, o) {
|
|
|
79468
79471
|
}
|
|
79469
79472
|
return get(e, r);
|
|
79470
79473
|
}
|
|
79474
|
+
function getDetailsItemValue(e) {
|
|
79475
|
+
const { record: t, currentObject: o, fieldPath: n, prefixFieldPath: r, idx: i } = e, a = getValueWithIndex(t, n, i);
|
|
79476
|
+
if (a !== void 0 || o == null)
|
|
79477
|
+
return a;
|
|
79478
|
+
if (r && n === r)
|
|
79479
|
+
return o;
|
|
79480
|
+
const l = r && n.startsWith(`${r}.`) ? n.slice(r.length + 1) : n;
|
|
79481
|
+
return l ? get(o, l) : o;
|
|
79482
|
+
}
|
|
79483
|
+
function normalizeDetailsAssociationValue(e, t) {
|
|
79484
|
+
return !isToManyAssociationField(e) || Array.isArray(t) ? t : t && typeof t == "object" && Array.isArray(t.rows) ? t.rows : t == null ? [] : [t];
|
|
79485
|
+
}
|
|
79471
79486
|
class DetailsItemModel extends DisplayItemModel {
|
|
79472
79487
|
static defineChildren(t) {
|
|
79473
79488
|
const o = t.collection;
|
|
@@ -79513,29 +79528,38 @@ class DetailsItemModel extends DisplayItemModel {
|
|
|
79513
79528
|
});
|
|
79514
79529
|
}
|
|
79515
79530
|
renderItem() {
|
|
79516
|
-
const t = this.subModels.field, o = this.context.fieldIndex, n = this.context.record, r = this.context.currentObject, i = this.context.item, a = this.context.getPropertyOptions("item"), l = o != null ? (() => {
|
|
79517
|
-
const
|
|
79518
|
-
|
|
79531
|
+
const t = this.subModels.field, o = this.context.fieldIndex, n = this.context.record, r = this.context.currentObject, i = this.context.item, a = this.context.getPropertyOptions("item"), l = this.context.prefixFieldPath, c = o != null ? (() => {
|
|
79532
|
+
const p = t.createFork({}, `${o}`);
|
|
79533
|
+
p.context.defineProperty("fieldIndex", {
|
|
79519
79534
|
get: () => o
|
|
79520
|
-
}),
|
|
79535
|
+
}), p.context.defineProperty("record", {
|
|
79521
79536
|
get: () => n,
|
|
79522
79537
|
cache: !1
|
|
79523
|
-
}),
|
|
79538
|
+
}), p.context.defineProperty("currentObject", {
|
|
79524
79539
|
get: () => r,
|
|
79525
79540
|
cache: !1
|
|
79526
79541
|
});
|
|
79527
|
-
const
|
|
79528
|
-
return
|
|
79542
|
+
const g = a || {}, { value: m } = g, h = ee(g, ["value"]);
|
|
79543
|
+
return p.context.defineProperty("item", A(x({}, h), {
|
|
79529
79544
|
get: () => i,
|
|
79530
79545
|
cache: !1
|
|
79531
|
-
})), this.context.pattern &&
|
|
79546
|
+
})), this.context.pattern && p.context.defineProperty("pattern", {
|
|
79532
79547
|
get: () => this.context.pattern
|
|
79533
|
-
}),
|
|
79534
|
-
})() : t,
|
|
79548
|
+
}), p;
|
|
79549
|
+
})() : t, u = this.context.pattern ? A(x(x({}, this.context.blockModel.props), this.props), {
|
|
79535
79550
|
pattern: this.context.pattern,
|
|
79536
79551
|
disabled: this.context.pattern === "readPretty"
|
|
79537
|
-
}) : x(x({}, this.context.blockModel.props), this.props),
|
|
79538
|
-
|
|
79552
|
+
}) : x(x({}, this.context.blockModel.props), this.props), d = normalizeDetailsAssociationValue(
|
|
79553
|
+
this.collectionField,
|
|
79554
|
+
getDetailsItemValue({
|
|
79555
|
+
record: n,
|
|
79556
|
+
currentObject: r,
|
|
79557
|
+
fieldPath: this.fieldPath,
|
|
79558
|
+
prefixFieldPath: l,
|
|
79559
|
+
idx: o
|
|
79560
|
+
})
|
|
79561
|
+
);
|
|
79562
|
+
return /* @__PURE__ */ jsx(FormItem$2, A(x({}, u), { value: d, children: /* @__PURE__ */ jsx(FieldModelRenderer, { model: c }) }));
|
|
79539
79563
|
}
|
|
79540
79564
|
}
|
|
79541
79565
|
DetailsItemModel.define({
|
|
@@ -84131,16 +84155,20 @@ const LargeFieldEdit = observer((a) => {
|
|
|
84131
84155
|
)
|
|
84132
84156
|
}
|
|
84133
84157
|
);
|
|
84134
|
-
}), handleModelName = (e) => ["RadioGroupFieldModel", "CheckboxGroupFieldModel"].includes(e) ? "SelectFieldModel" : e, MemoFieldRenderer = React.memo(FieldModelRenderer, (e, t) => e.value === t.value && e.model === t.model)
|
|
84158
|
+
}), handleModelName = (e) => ["RadioGroupFieldModel", "CheckboxGroupFieldModel"].includes(e) ? "SelectFieldModel" : e, MemoFieldRenderer = React.memo(FieldModelRenderer, (e, t) => e.value === t.value && e.model === t.model);
|
|
84159
|
+
function shouldCommitImmediately(e) {
|
|
84160
|
+
return Array.isArray(e) ? !0 : e && typeof e == "object" ? !("target" in e) : !1;
|
|
84161
|
+
}
|
|
84162
|
+
const FieldModelRendererOptimize = React.memo((e) => {
|
|
84135
84163
|
const c = e, { model: t, onChange: o, value: n } = c, r = ee(c, ["model", "onChange", "value"]), i = React.useRef(e == null ? void 0 : e.value);
|
|
84136
84164
|
useEffect(() => {
|
|
84137
84165
|
i.current = n;
|
|
84138
84166
|
}, [n]);
|
|
84139
84167
|
const a = React.useCallback(
|
|
84140
84168
|
(u) => {
|
|
84141
|
-
i.current = u;
|
|
84169
|
+
i.current = u, shouldCommitImmediately(u) && (o == null || o(u));
|
|
84142
84170
|
},
|
|
84143
|
-
[
|
|
84171
|
+
[o]
|
|
84144
84172
|
), l = React.useCallback(() => {
|
|
84145
84173
|
o == null || o(i.current);
|
|
84146
84174
|
}, [o]);
|
|
@@ -95801,6 +95829,7 @@ const models = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
95801
95829
|
formatNumber,
|
|
95802
95830
|
getAllDataModels,
|
|
95803
95831
|
getDefaultOperator,
|
|
95832
|
+
getDetailsItemValue,
|
|
95804
95833
|
getDisplayNumber,
|
|
95805
95834
|
getValueWithIndex,
|
|
95806
95835
|
injectRecordPickerPopupContext,
|
|
@@ -108678,6 +108707,7 @@ export {
|
|
|
108678
108707
|
getDatePickerLabels,
|
|
108679
108708
|
getDateRanges,
|
|
108680
108709
|
getDefaultOperator,
|
|
108710
|
+
getDetailsItemValue,
|
|
108681
108711
|
getDisplayNumber,
|
|
108682
108712
|
getFieldDefaultValue,
|
|
108683
108713
|
getFlowPageMenuSchema,
|