@nocobase/client 2.0.34 → 2.0.35

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.
@@ -16,6 +16,16 @@ export declare function buildRecordPickerParentItemContext(ctx: any): {
16
16
  parentItemResolver: ((subPath: string) => boolean) | undefined;
17
17
  };
18
18
  export declare function injectRecordPickerPopupContext(model: FlowModel, viewCtx: any, fieldModel?: any): void;
19
+ export declare function buildRecordPickerPopupContextInputArgs(ctx: any, options?: {
20
+ currentItemValue?: any;
21
+ extraInputArgs?: Record<string, any>;
22
+ }): {
23
+ parentItem: ItemChain;
24
+ parentItemMeta: any;
25
+ parentItemResolver: (subPath: string) => boolean;
26
+ currentItemValue: any;
27
+ openerUids: string[];
28
+ };
19
29
  export declare function RecordPickerContent({ model, toOne }: {
20
30
  model: any;
21
31
  toOne?: boolean;
@@ -46,6 +46,8 @@ export declare function createItemChainMetaFactory(options: {
46
46
  title: string;
47
47
  showIndex?: boolean;
48
48
  showParentIndex?: boolean;
49
+ disableValueBranch?: boolean;
50
+ valueBranchDisabledReason?: string;
49
51
  collectionAccessor: () => any;
50
52
  propertiesAccessor: (ctx: any) => any;
51
53
  parentCollectionAccessor?: () => any;
@@ -54,6 +56,7 @@ export declare function createItemChainMetaFactory(options: {
54
56
  }): any;
55
57
  export declare function createItemChainResolver(options: {
56
58
  collectionAccessor: () => any;
59
+ disableValueBranch?: boolean;
57
60
  propertiesAccessor?: () => unknown;
58
61
  parentCollectionAccessor?: () => any;
59
62
  parentPropertiesAccessor?: () => unknown;
@@ -72,6 +75,8 @@ export type AssociationItemChainContextPropertyOptions = {
72
75
  title: string;
73
76
  showIndex?: boolean;
74
77
  showParentIndex?: boolean;
78
+ disableValueBranch?: boolean;
79
+ valueBranchDisabledReason?: string;
75
80
  collectionAccessor: () => any;
76
81
  propertiesAccessor: (ctx: any) => any;
77
82
  resolverPropertiesAccessor?: () => unknown;
package/es/index.mjs CHANGED
@@ -3498,6 +3498,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3498
3498
  get buildRecordPickerParentItemContext() {
3499
3499
  return buildRecordPickerParentItemContext;
3500
3500
  },
3501
+ get buildRecordPickerPopupContextInputArgs() {
3502
+ return buildRecordPickerPopupContextInputArgs;
3503
+ },
3501
3504
  get canMakeAssociationBlock() {
3502
3505
  return canMakeAssociationBlock;
3503
3506
  },
@@ -9973,7 +9976,7 @@ function addAppVersion(e, t) {
9973
9976
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
9974
9977
  }), e;
9975
9978
  }
9976
- const name = "@nocobase/client", version = "2.0.34", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9979
+ const name = "@nocobase/client", version = "2.0.35", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9977
9980
  "@ahooksjs/use-url-state": "3.5.1",
9978
9981
  "@ant-design/cssinjs": "^1.11.1",
9979
9982
  "@ant-design/icons": "^5.6.1",
@@ -9996,10 +9999,10 @@ const name = "@nocobase/client", version = "2.0.34", license = "Apache-2.0", mai
9996
9999
  "@formily/reactive-react": "^2.2.27",
9997
10000
  "@formily/shared": "^2.2.27",
9998
10001
  "@formily/validator": "^2.2.27",
9999
- "@nocobase/evaluators": "2.0.34",
10000
- "@nocobase/flow-engine": "2.0.34",
10001
- "@nocobase/sdk": "2.0.34",
10002
- "@nocobase/utils": "2.0.34",
10002
+ "@nocobase/evaluators": "2.0.35",
10003
+ "@nocobase/flow-engine": "2.0.35",
10004
+ "@nocobase/sdk": "2.0.35",
10005
+ "@nocobase/utils": "2.0.35",
10003
10006
  "@tanstack/react-table": "^8.21.3",
10004
10007
  "@types/tabulator-tables": "^6.2.6",
10005
10008
  "acorn-jsx": "^5.3.2",
@@ -83140,56 +83143,63 @@ function createItemChainMetaFactory(e) {
83140
83143
  title: o,
83141
83144
  showIndex: n,
83142
83145
  showParentIndex: r,
83143
- collectionAccessor: i,
83144
- propertiesAccessor: a,
83145
- parentCollectionAccessor: l,
83146
- parentPropertiesAccessor: c,
83147
- parentItemMetaAccessor: u
83148
- } = e, d = createAssociationAwareObjectMetaFactory(i, o, a), p = l ? createAssociationAwareObjectMetaFactory(
83149
- l,
83146
+ disableValueBranch: i,
83147
+ valueBranchDisabledReason: a,
83148
+ collectionAccessor: l,
83149
+ propertiesAccessor: c,
83150
+ parentCollectionAccessor: u,
83151
+ parentPropertiesAccessor: d,
83152
+ parentItemMetaAccessor: p
83153
+ } = e, m = createAssociationAwareObjectMetaFactory(l, o, c), h = u ? createAssociationAwareObjectMetaFactory(
83154
+ u,
83150
83155
  o,
83151
- (h) => {
83152
- var g, f, y;
83153
- return (y = c == null ? void 0 : c(h)) != null ? y : (f = (g = h == null ? void 0 : h.item) == null ? void 0 : g.parentItem) == null ? void 0 : f.value;
83156
+ (f) => {
83157
+ var y, b, S;
83158
+ return (S = d == null ? void 0 : d(f)) != null ? S : (b = (y = f == null ? void 0 : f.item) == null ? void 0 : y.parentItem) == null ? void 0 : b.value;
83154
83159
  }
83155
- ) : null, m = () => L(this, null, function* () {
83156
- var v, k;
83157
- const h = yield d();
83158
- if (!h)
83160
+ ) : null, g = () => L(this, null, function* () {
83161
+ var I, M;
83162
+ const f = yield m();
83163
+ if (!f)
83159
83164
  return null;
83160
- const g = yield resolveMetaFactory(u == null ? void 0 : u()), f = p ? yield p() : null, y = h.buildVariablesParams, b = g ? g.buildVariablesParams : f == null ? void 0 : f.buildVariablesParams, S = () => ({ type: "number", title: t("Index (starts from 0)") }), C = () => ({ type: "number", title: t("Total count") }), F = {};
83161
- if (n !== !1 && (F.index = S(), F.length = C()), F.value = A(x({}, h), { title: t("Attributes") }), g)
83162
- F.parentItem = A(x({}, g), {
83163
- title: ((v = g.title) == null ? void 0 : v.replace(t("Current item"), t("Parent item"))) || t("Parent item")
83165
+ const y = yield resolveMetaFactory(p == null ? void 0 : p()), b = h ? yield h() : null, S = f.buildVariablesParams, C = y ? y.buildVariablesParams : b == null ? void 0 : b.buildVariablesParams, F = () => ({ type: "number", title: t("Index (starts from 0)") }), P = () => ({ type: "number", title: t("Total count") }), v = {};
83166
+ if (n !== !1 && (v.index = F(), v.length = P()), v.value = x(A(x({}, f), {
83167
+ title: t("Attributes")
83168
+ }), i ? {
83169
+ disabled: !0,
83170
+ disabledReason: a || t("Attributes are unavailable before selecting a record")
83171
+ } : {}), y)
83172
+ v.parentItem = A(x({}, y), {
83173
+ title: ((I = y.title) == null ? void 0 : I.replace(t("Current item"), t("Parent item"))) || t("Parent item")
83164
83174
  });
83165
83175
  else {
83166
- const I = {};
83167
- r !== !1 && (I.index = S(), I.length = C()), I.value = f ? A(x({}, f), { title: t("Attributes") }) : { type: "object", title: t("Attributes") }, F.parentItem = {
83176
+ const E = {};
83177
+ r !== !1 && (E.index = F(), E.length = P()), E.value = b ? A(x({}, b), { title: t("Attributes") }) : { type: "object", title: t("Attributes") }, v.parentItem = {
83168
83178
  type: "object",
83169
- title: ((k = g == null ? void 0 : g.title) == null ? void 0 : k.replace(t("Current item"), t("Parent item"))) || t("Parent item"),
83170
- properties: I
83179
+ title: ((M = y == null ? void 0 : y.title) == null ? void 0 : M.replace(t("Current item"), t("Parent item"))) || t("Parent item"),
83180
+ properties: E
83171
83181
  };
83172
83182
  }
83173
83183
  return {
83174
83184
  type: "object",
83175
83185
  title: o,
83176
- properties: F,
83177
- buildVariablesParams: (I) => L(this, null, function* () {
83178
- var E;
83179
- const M = {};
83180
- if (typeof y == "function") {
83181
- const $ = yield y(I);
83182
- $ && typeof $ == "object" && Object.keys($).length && (M.value = $);
83183
- }
83184
- if (typeof b == "function") {
83185
- const $ = yield b(createScopedItemContext(I, (E = I == null ? void 0 : I.item) == null ? void 0 : E.parentItem));
83186
- $ && typeof $ == "object" && Object.keys($).length && (M.parentItem = g ? $ : { value: $ });
83187
- }
83188
- return M;
83186
+ properties: v,
83187
+ buildVariablesParams: (E) => L(this, null, function* () {
83188
+ var D;
83189
+ const $ = {};
83190
+ if (!i && typeof S == "function") {
83191
+ const T = yield S(E);
83192
+ T && typeof T == "object" && Object.keys(T).length && ($.value = T);
83193
+ }
83194
+ if (typeof C == "function") {
83195
+ const T = yield C(createScopedItemContext(E, (D = E == null ? void 0 : E.item) == null ? void 0 : D.parentItem));
83196
+ T && typeof T == "object" && Object.keys(T).length && ($.parentItem = y ? T : { value: T });
83197
+ }
83198
+ return $;
83189
83199
  })
83190
83200
  };
83191
83201
  });
83192
- return m.title = o, m;
83202
+ return g.title = o, g;
83193
83203
  }
83194
83204
  function createItemChainResolver(e) {
83195
83205
  const t = createAssociationSubpathResolver(e.collectionAccessor, e.propertiesAccessor), o = typeof e.parentCollectionAccessor == "function" ? createAssociationSubpathResolver(e.parentCollectionAccessor, e.parentPropertiesAccessor) : null;
@@ -83199,7 +83209,7 @@ function createItemChainResolver(e) {
83199
83209
  if (!r || r === "value")
83200
83210
  return !1;
83201
83211
  if (r.startsWith("value."))
83202
- return t(r.slice(6));
83212
+ return e.disableValueBranch ? !1 : t(r.slice(6));
83203
83213
  if (r === "parentItem")
83204
83214
  return !1;
83205
83215
  if (r.startsWith("parentItem.")) {
@@ -83224,6 +83234,8 @@ function createAssociationItemChainContextPropertyOptions(e) {
83224
83234
  title: e.title,
83225
83235
  showIndex: e.showIndex,
83226
83236
  showParentIndex: e.showParentIndex,
83237
+ disableValueBranch: e.disableValueBranch,
83238
+ valueBranchDisabledReason: e.valueBranchDisabledReason,
83227
83239
  collectionAccessor: e.collectionAccessor,
83228
83240
  propertiesAccessor: e.propertiesAccessor,
83229
83241
  parentCollectionAccessor: e.parentCollectionAccessor,
@@ -83232,6 +83244,7 @@ function createAssociationItemChainContextPropertyOptions(e) {
83232
83244
  },
83233
83245
  resolverOptions: {
83234
83246
  collectionAccessor: e.collectionAccessor,
83247
+ disableValueBranch: e.disableValueBranch,
83235
83248
  propertiesAccessor: e.resolverPropertiesAccessor,
83236
83249
  parentCollectionAccessor: e.parentCollectionAccessor,
83237
83250
  parentPropertiesAccessor: t,
@@ -83289,6 +83302,8 @@ function injectRecordPickerPopupContext(e, t, o) {
83289
83302
  }, u = createAssociationItemChainContextPropertyOptions({
83290
83303
  t: i,
83291
83304
  title: buildCurrentItemTitle(i, r),
83305
+ disableValueBranch: !0,
83306
+ valueBranchDisabledReason: i("Attributes are unavailable before selecting a record"),
83292
83307
  collectionAccessor: () => a,
83293
83308
  propertiesAccessor: c,
83294
83309
  resolverPropertiesAccessor: c,
@@ -83308,6 +83323,16 @@ function injectRecordPickerPopupContext(e, t, o) {
83308
83323
  get: d
83309
83324
  }, u));
83310
83325
  }
83326
+ function buildRecordPickerPopupContextInputArgs(e, t = {}) {
83327
+ const { parentItem: o, parentItemMeta: n, parentItemResolver: r } = buildRecordPickerParentItemContext(e), i = buildOpenerUids(e, e.inputArgs);
83328
+ return A(x({}, t.extraInputArgs || {}), {
83329
+ parentItem: o,
83330
+ parentItemMeta: n,
83331
+ parentItemResolver: r,
83332
+ currentItemValue: t.currentItemValue,
83333
+ openerUids: i
83334
+ });
83335
+ }
83311
83336
  function RemoteModelRenderer$1({ options: e, fieldModel: t }) {
83312
83337
  const o = useFlowViewContext(), { data: n, loading: r } = useRequest$1(
83313
83338
  () => L(this, null, function* () {
@@ -83538,7 +83563,7 @@ RecordPickerFieldModel.registerFlow({
83538
83563
  size: "medium"
83539
83564
  },
83540
83565
  handler(e, t) {
83541
- var y, b, S, C, F, P, v;
83566
+ var p, m, h, g, f, y, b;
83542
83567
  const { onChange: o } = e.inputArgs, n = ["belongsTo", "hasOne"].includes(e.collectionField.type), r = {
83543
83568
  drawer: {
83544
83569
  small: "30%",
@@ -83551,40 +83576,38 @@ RecordPickerFieldModel.registerFlow({
83551
83576
  large: "80%"
83552
83577
  },
83553
83578
  embed: {}
83554
- }, i = e.inputArgs.mode || t.mode || "drawer", a = e.inputArgs.size || t.size || "medium", l = (y = e.collectionField) == null ? void 0 : y.collection, c = (S = (b = e.item) == null ? void 0 : b.value) != null ? S : e.record, u = c ? (C = l == null ? void 0 : l.getFilterByTK) == null ? void 0 : C.call(l, c) : void 0, d = (F = e.collectionField) == null ? void 0 : F.resourceName, { parentItem: p, parentItemMeta: m, parentItemResolver: h } = buildRecordPickerParentItemContext(e), g = (P = e.inputArgs.currentItemValue) != null ? P : {}, f = buildOpenerUids(e, e.inputArgs);
83579
+ }, i = e.inputArgs.mode || t.mode || "drawer", a = e.inputArgs.size || t.size || "medium", l = (p = e.collectionField) == null ? void 0 : p.collection, c = (h = (m = e.item) == null ? void 0 : m.value) != null ? h : e.record, u = c ? (g = l == null ? void 0 : l.getFilterByTK) == null ? void 0 : g.call(l, c) : void 0, d = (f = e.collectionField) == null ? void 0 : f.resourceName;
83555
83580
  e.viewer.open({
83556
83581
  type: i,
83557
83582
  width: r[i][a],
83558
83583
  inheritContext: !1,
83559
83584
  target: e.layoutContentElement,
83560
- inputArgs: A(x({
83585
+ inputArgs: A(x(A(x({
83561
83586
  parentId: e.model.uid,
83562
83587
  scene: "select",
83563
83588
  dataSourceKey: e.collection.dataSourceKey,
83564
- collectionName: (v = e.collectionField) == null ? void 0 : v.target
83589
+ collectionName: (y = e.collectionField) == null ? void 0 : y.target
83565
83590
  }, d && u != null ? { associationName: d, sourceId: u } : {}), {
83566
- collectionField: e.collectionField,
83567
- parentItem: p,
83568
- parentItemMeta: m,
83569
- parentItemResolver: h,
83570
- currentItemValue: g,
83571
- openerUids: f,
83591
+ collectionField: e.collectionField
83592
+ }), buildRecordPickerPopupContextInputArgs(e, {
83593
+ currentItemValue: (b = e.inputArgs.currentItemValue) != null ? b : {}
83594
+ })), {
83572
83595
  rowSelectionProps: {
83573
83596
  type: n ? "radio" : "checkbox",
83574
83597
  defaultSelectedRows: () => e.model.props.value,
83575
83598
  renderCell: void 0,
83576
83599
  selectedRowKeys: void 0,
83577
- onChange: (k, I) => {
83578
- var $, D;
83579
- const E = e.model.selectBlockModel.findSubModel("items", (T) => T);
83600
+ onChange: (S, C) => {
83601
+ var v, k;
83602
+ const P = e.model.selectBlockModel.findSubModel("items", (I) => I);
83580
83603
  if (n)
83581
- e.model.selectedRows.value = I == null ? void 0 : I[0], o(e.model.selectedRows.value), (D = ($ = e.model)._closeView) == null || D.call($);
83604
+ e.model.selectedRows.value = C == null ? void 0 : C[0], o(e.model.selectedRows.value), (k = (v = e.model)._closeView) == null || k.call(v);
83582
83605
  else {
83583
- E.resource.setSelectedRows(I);
83584
- const B = [...e.model.props.value || [], ...I].filter(
83585
- (N, j, O) => j === O.findIndex((q) => q[e.collection.filterTargetKey] === N[e.collection.filterTargetKey])
83606
+ P.resource.setSelectedRows(C);
83607
+ const E = [...e.model.props.value || [], ...C].filter(
83608
+ ($, D, T) => D === T.findIndex((w) => w[e.collection.filterTargetKey] === $[e.collection.filterTargetKey])
83586
83609
  );
83587
- e.model.selectedRows.value = B;
83610
+ e.model.selectedRows.value = E;
83588
83611
  }
83589
83612
  }
83590
83613
  }
@@ -85073,7 +85096,7 @@ SubTableFieldModel.registerFlow({
85073
85096
  size: "medium"
85074
85097
  },
85075
85098
  handler(e, t) {
85076
- var i;
85099
+ var a, l, c;
85077
85100
  const o = {
85078
85101
  drawer: {
85079
85102
  small: "30%",
@@ -85087,35 +85110,40 @@ SubTableFieldModel.registerFlow({
85087
85110
  },
85088
85111
  embed: {}
85089
85112
  }, n = e.isMobileLayout ? "embed" : e.inputArgs.mode || t.mode || "drawer", r = e.inputArgs.size || t.size || "medium";
85090
- e.model.selectedRows.value = e.model.props.value || [], e.viewer.open({
85113
+ e.model.selectedRows.value = e.model.props.value || [];
85114
+ const i = (l = (a = e.inputArgs.currentItemValue) != null ? a : e.model.props.value) != null ? l : [];
85115
+ e.viewer.open({
85091
85116
  type: n,
85092
85117
  width: o[n][r],
85093
85118
  inheritContext: !1,
85094
85119
  target: e.layoutContentElement,
85095
- inputArgs: {
85120
+ inputArgs: A(x({
85096
85121
  parentId: e.model.uid,
85097
85122
  scene: "select",
85098
85123
  dataSourceKey: e.collection.dataSourceKey,
85099
- collectionName: (i = e.collectionField) == null ? void 0 : i.target,
85100
- collectionField: e.collectionField,
85124
+ collectionName: (c = e.collectionField) == null ? void 0 : c.target,
85125
+ collectionField: e.collectionField
85126
+ }, buildRecordPickerPopupContextInputArgs(e, {
85127
+ currentItemValue: i
85128
+ })), {
85101
85129
  rowSelectionProps: {
85102
85130
  type: "checkbox",
85103
85131
  defaultSelectedRows: () => e.model.props.value,
85104
85132
  renderCell: void 0,
85105
85133
  selectedRowKeys: void 0,
85106
- onChange: (a, l) => {
85107
- const d = [
85134
+ onChange: (u, d) => {
85135
+ const h = [
85108
85136
  ...e.model.props.value || [],
85109
- ...l.map((p) => A(x({}, p), {
85137
+ ...d.map((g) => A(x({}, g), {
85110
85138
  __is_stored__: !0
85111
85139
  }))
85112
85140
  ].filter(
85113
- (p, m, h) => m === h.findIndex((g) => g[e.collection.filterTargetKey] === p[e.collection.filterTargetKey])
85141
+ (g, f, y) => f === y.findIndex((b) => b[e.collection.filterTargetKey] === g[e.collection.filterTargetKey])
85114
85142
  );
85115
- e.model.selectedRows.value = d;
85143
+ e.model.selectedRows.value = h;
85116
85144
  }
85117
85145
  }
85118
- },
85146
+ }),
85119
85147
  content: () => /* @__PURE__ */ jsx(RecordPickerContent, { model: e.model }),
85120
85148
  styles: {
85121
85149
  content: x({
@@ -85607,7 +85635,7 @@ SubFormListFieldModel.registerFlow({
85607
85635
  size: "medium"
85608
85636
  },
85609
85637
  handler(e, t) {
85610
- var i;
85638
+ var a, l, c;
85611
85639
  const o = {
85612
85640
  drawer: {
85613
85641
  small: "30%",
@@ -85621,37 +85649,42 @@ SubFormListFieldModel.registerFlow({
85621
85649
  },
85622
85650
  embed: {}
85623
85651
  }, n = e.isMobileLayout ? "embed" : e.inputArgs.mode || t.mode || "drawer", r = e.inputArgs.size || t.size || "medium";
85624
- e.model.selectedRows.value = e.model.props.value || [], e.viewer.open({
85652
+ e.model.selectedRows.value = e.model.props.value || [];
85653
+ const i = (l = (a = e.inputArgs.currentItemValue) != null ? a : e.model.props.value) != null ? l : [];
85654
+ e.viewer.open({
85625
85655
  type: n,
85626
85656
  width: o[n][r],
85627
85657
  inheritContext: !1,
85628
85658
  target: e.layoutContentElement,
85629
- inputArgs: {
85659
+ inputArgs: A(x({
85630
85660
  parentId: e.model.uid,
85631
85661
  scene: "select",
85632
85662
  dataSourceKey: e.collection.dataSourceKey,
85633
- collectionName: (i = e.collectionField) == null ? void 0 : i.target,
85634
- collectionField: e.collectionField,
85663
+ collectionName: (c = e.collectionField) == null ? void 0 : c.target,
85664
+ collectionField: e.collectionField
85665
+ }, buildRecordPickerPopupContextInputArgs(e, {
85666
+ currentItemValue: i
85667
+ })), {
85635
85668
  rowSelectionProps: {
85636
85669
  type: "checkbox",
85637
85670
  defaultSelectedRows: () => e.model.props.value,
85638
85671
  renderCell: void 0,
85639
85672
  selectedRowKeys: void 0,
85640
- onChange: (a, l) => {
85641
- const d = [
85673
+ onChange: (u, d) => {
85674
+ const h = [
85642
85675
  ...e.model.props.value || [],
85643
- ...l.map((p) => A(x({}, p), {
85676
+ ...d.map((g) => A(x({}, g), {
85644
85677
  __is_stored__: !0
85645
85678
  }))
85646
85679
  ].filter(
85647
- (p, m, h) => m === h.findIndex(
85648
- (g) => g[e.collection.filterTargetKey] === p[e.collection.filterTargetKey]
85649
- ) || p.__is_new__
85680
+ (g, f, y) => f === y.findIndex(
85681
+ (b) => b[e.collection.filterTargetKey] === g[e.collection.filterTargetKey]
85682
+ ) || g.__is_new__
85650
85683
  );
85651
- e.model.selectedRows.value = d;
85684
+ e.model.selectedRows.value = h;
85652
85685
  }
85653
85686
  }
85654
- },
85687
+ }),
85655
85688
  content: () => /* @__PURE__ */ jsx(RecordPickerContent, { model: e.model }),
85656
85689
  styles: {
85657
85690
  content: x({
@@ -87349,7 +87382,7 @@ PopupSubTableFieldModel.registerFlow({
87349
87382
  size: "medium"
87350
87383
  },
87351
87384
  handler(e, t) {
87352
- var i;
87385
+ var a, l, c;
87353
87386
  const o = {
87354
87387
  drawer: {
87355
87388
  small: "30%",
@@ -87363,41 +87396,46 @@ PopupSubTableFieldModel.registerFlow({
87363
87396
  },
87364
87397
  embed: {}
87365
87398
  }, n = e.isMobileLayout ? "embed" : e.inputArgs.mode || t.mode || "drawer", r = e.inputArgs.size || t.size || "medium";
87366
- e.model.selectedRows.value = e.model.props.value || [], e.viewer.open({
87399
+ e.model.selectedRows.value = e.model.props.value || [];
87400
+ const i = (l = (a = e.inputArgs.currentItemValue) != null ? a : e.model.props.value) != null ? l : [];
87401
+ e.viewer.open({
87367
87402
  type: n,
87368
87403
  width: o[n][r],
87369
87404
  inheritContext: !1,
87370
87405
  target: e.layoutContentElement,
87371
- inputArgs: {
87406
+ inputArgs: A(x({
87372
87407
  parentId: e.model.uid,
87373
87408
  scene: "select",
87374
87409
  dataSourceKey: e.collection.dataSourceKey,
87375
- collectionName: (i = e.collectionField) == null ? void 0 : i.target,
87376
- collectionField: e.collectionField,
87410
+ collectionName: (c = e.collectionField) == null ? void 0 : c.target,
87411
+ collectionField: e.collectionField
87412
+ }, buildRecordPickerPopupContextInputArgs(e, {
87413
+ currentItemValue: i
87414
+ })), {
87377
87415
  rowSelectionProps: {
87378
87416
  type: "checkbox",
87379
87417
  defaultSelectedRows: () => e.model.props.value,
87380
87418
  renderCell: void 0,
87381
87419
  selectedRowKeys: void 0,
87382
- onChange: (a, l) => {
87383
- const c = e.model.props.value || [], u = e.collection.filterTargetKey, d = [
87384
- ...c,
87385
- ...l.map((h) => A(x({}, h), {
87420
+ onChange: (u, d) => {
87421
+ const p = e.model.props.value || [], m = e.collection.filterTargetKey, h = [
87422
+ ...p,
87423
+ ...d.map((y) => A(x({}, y), {
87386
87424
  __is_stored__: !0
87387
87425
  }))
87388
- ], p = /* @__PURE__ */ new Map(), m = [];
87389
- for (const h of d) {
87390
- const g = getRowKey(h, u);
87391
- if (g == null) {
87392
- m.push(h);
87426
+ ], g = /* @__PURE__ */ new Map(), f = [];
87427
+ for (const y of h) {
87428
+ const b = getRowKey(y, m);
87429
+ if (b == null) {
87430
+ f.push(y);
87393
87431
  continue;
87394
87432
  }
87395
- p.has(g) || (p.set(g, h), m.push(h));
87433
+ g.has(b) || (g.set(b, y), f.push(y));
87396
87434
  }
87397
- e.model.selectedRows.value = m;
87435
+ e.model.selectedRows.value = f;
87398
87436
  }
87399
87437
  }
87400
- },
87438
+ }),
87401
87439
  content: () => /* @__PURE__ */ jsx(RecordPickerContent, { model: e.model }),
87402
87440
  styles: {
87403
87441
  content: x({
@@ -95828,6 +95866,7 @@ const models = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
95828
95866
  ViewActionModel,
95829
95867
  buildDisplayPathFromValue,
95830
95868
  buildRecordPickerParentItemContext,
95869
+ buildRecordPickerPopupContextInputArgs,
95831
95870
  collectAssociationHydrationCandidates,
95832
95871
  collectCascadeHydrationCandidate,
95833
95872
  connectFields,
@@ -108622,6 +108661,7 @@ export {
108622
108661
  blockLinkageRules,
108623
108662
  buildDisplayPathFromValue,
108624
108663
  buildRecordPickerParentItemContext,
108664
+ buildRecordPickerPopupContextInputArgs,
108625
108665
  canMakeAssociationBlock,
108626
108666
  collectAssociationHydrationCandidates,
108627
108667
  collectCascadeHydrationCandidate,