@nocobase/client 2.0.19 → 2.0.21

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.
@@ -1,4 +1,5 @@
1
1
  import { FieldModel } from '../../base/FieldModel';
2
2
  export declare class AssociationFieldModel extends FieldModel {
3
3
  operator: string;
4
+ updateAssociation: boolean;
4
5
  }
package/es/index.mjs CHANGED
@@ -9964,7 +9964,7 @@ function addAppVersion(e, t) {
9964
9964
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
9965
9965
  }), e;
9966
9966
  }
9967
- const name = "@nocobase/client", version = "2.0.19", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9967
+ const name = "@nocobase/client", version = "2.0.21", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9968
9968
  "@ahooksjs/use-url-state": "3.5.1",
9969
9969
  "@ant-design/cssinjs": "^1.11.1",
9970
9970
  "@ant-design/icons": "^5.6.1",
@@ -9987,10 +9987,10 @@ const name = "@nocobase/client", version = "2.0.19", license = "Apache-2.0", mai
9987
9987
  "@formily/reactive-react": "^2.2.27",
9988
9988
  "@formily/shared": "^2.2.27",
9989
9989
  "@formily/validator": "^2.2.27",
9990
- "@nocobase/evaluators": "2.0.19",
9991
- "@nocobase/flow-engine": "2.0.19",
9992
- "@nocobase/sdk": "2.0.19",
9993
- "@nocobase/utils": "2.0.19",
9990
+ "@nocobase/evaluators": "2.0.21",
9991
+ "@nocobase/flow-engine": "2.0.21",
9992
+ "@nocobase/sdk": "2.0.21",
9993
+ "@nocobase/utils": "2.0.21",
9994
9994
  "@tanstack/react-table": "^8.21.3",
9995
9995
  "@types/tabulator-tables": "^6.2.6",
9996
9996
  "acorn-jsx": "^5.3.2",
@@ -10649,49 +10649,55 @@ function useParsedFilter({
10649
10649
  filterOption: e,
10650
10650
  onFilterChange: t
10651
10651
  }) {
10652
- const { parseFilter: o, findVariable: n } = useParseDataScopeFilter(), [r, i] = useState({}), [a, l] = useState(!!e);
10653
- return useEffect(() => {
10654
- if (!e)
10652
+ const { parseFilter: o, findVariable: n } = useParseDataScopeFilter(), r = JSON.stringify(e), i = useRef(e), a = useRef(t), [l, c] = useState({}), [u, d] = useState(() => e ? null : r), p = !!e && u !== r;
10653
+ return i.current = e, a.current = t, useEffect(() => {
10654
+ const m = i.current;
10655
+ if (!m) {
10656
+ c({}), d(r);
10655
10657
  return;
10656
- const c = () => L(this, null, function* () {
10657
- l(!0);
10658
- const d = yield o(e);
10659
- l(!1), i(d), t == null || t(d);
10660
- });
10661
- c();
10662
- const u = _.debounce(c, DEBOUNCE_WAIT);
10663
- reaction(
10664
- () => flatten(e, {
10665
- breakOn({ key: p }) {
10666
- return p.startsWith("$") && p !== "$and" && p !== "$or";
10658
+ }
10659
+ let h = !1;
10660
+ const g = () => L(this, null, function* () {
10661
+ var S;
10662
+ const b = yield o(m);
10663
+ h || (c(b), d(r), (S = a.current) == null || S.call(a, b));
10664
+ });
10665
+ g();
10666
+ const f = _.debounce(g, DEBOUNCE_WAIT), y = reaction(
10667
+ () => flatten(m, {
10668
+ breakOn({ key: S }) {
10669
+ return S.startsWith("$") && S !== "$and" && S !== "$or";
10667
10670
  },
10668
- transformValue(p) {
10669
- if (!isVariable$1(p))
10670
- return p;
10671
- const m = getVariableName(p), h = n(m);
10672
- let g = null;
10673
- const y = getPath(p).split(".");
10674
- return y.forEach((b, S) => {
10675
- const C = y.slice(0, S + 1).join("."), F = getValuesByPath(
10671
+ transformValue(S) {
10672
+ if (!isVariable$1(S))
10673
+ return S;
10674
+ const C = getVariableName(S), F = n(C);
10675
+ let P = null;
10676
+ const k = getPath(S).split(".");
10677
+ return k.forEach((I, M) => {
10678
+ const E = k.slice(0, M + 1).join("."), $ = getValuesByPath(
10676
10679
  {
10677
- [m]: (h == null ? void 0 : h.ctx) || {}
10680
+ [C]: (F == null ? void 0 : F.ctx) || {}
10678
10681
  },
10679
- C
10682
+ E
10680
10683
  );
10681
- _.isEmpty(F) || (g = F);
10682
- }), g;
10684
+ _.isEmpty($) || (P = $);
10685
+ }), P;
10683
10686
  }
10684
10687
  }),
10685
- u,
10688
+ f,
10686
10689
  {
10687
10690
  equals: _.isEqual
10688
10691
  }
10689
10692
  );
10690
- }, [JSON.stringify(e), o, n]), {
10693
+ return () => {
10694
+ h = !0, f.cancel(), y();
10695
+ };
10696
+ }, [r, n, o]), {
10691
10697
  /** 数据范围的筛选参数 */
10692
- filter: r,
10698
+ filter: l,
10693
10699
  /** 表示是否正在解析筛选参数中的变量 */
10694
- parseVariableLoading: a
10700
+ parseVariableLoading: p
10695
10701
  };
10696
10702
  }
10697
10703
  const useParentRecordCommon = (e) => {
@@ -30264,10 +30270,10 @@ function requestParentRecordData(a) {
30264
30270
  });
30265
30271
  }
30266
30272
  const BlockRequestContextProvider = (e) => {
30267
- var l, c, u, d, p, m;
30268
- const t = useRef(e.recordRequest), o = useRef((l = e.recordRequest) == null ? void 0 : l.data), { active: n } = useKeepAlive(), r = useRef(n), i = useDeferredValue(n), a = useDataBlockProps();
30269
- return i && !r.current && (_.isNil(a.dataLoadingMode) || a.dataLoadingMode === "auto") && ((c = e.recordRequest) == null || c.refresh()), i && // the stage when loading just ended
30270
- r.current && !((u = e.recordRequest) != null && u.loading) && !_.isEqual(o.current, (d = e.recordRequest) == null ? void 0 : d.data) && (o.current = (p = e.recordRequest) == null ? void 0 : p.data), i !== r.current && (r.current = i), t.current = e.recordRequest, /* @__PURE__ */ jsx(BlockRequestRefContext.Provider, { value: t, children: /* @__PURE__ */ jsx(BlockRequestLoadingContext.Provider, { value: (m = e.recordRequest) == null ? void 0 : m.loading, children: /* @__PURE__ */ jsx(BlockRequestDataContext.Provider, { value: o.current, children: e.children }) }) });
30273
+ var d, p, m, h, g, f;
30274
+ const t = useRef(e.recordRequest), o = useRef((d = e.recordRequest) == null ? void 0 : d.data), { active: n } = useKeepAlive(), r = useLocationSearch(), i = useRef(n), a = useRef(r), l = useDeferredValue(n), c = useDataBlockProps(), u = i.current;
30275
+ return l && !u && a.current === r && (_.isNil(c.dataLoadingMode) || c.dataLoadingMode === "auto") && ((p = e.recordRequest) == null || p.refresh()), l && // the stage when loading just ended
30276
+ u && !((m = e.recordRequest) != null && m.loading) && !_.isEqual(o.current, (h = e.recordRequest) == null ? void 0 : h.data) && (o.current = (g = e.recordRequest) == null ? void 0 : g.data), n && u && (a.current = r), l !== u && (i.current = l), t.current = e.recordRequest, /* @__PURE__ */ jsx(BlockRequestRefContext.Provider, { value: t, children: /* @__PURE__ */ jsx(BlockRequestLoadingContext.Provider, { value: (f = e.recordRequest) == null ? void 0 : f.loading, children: /* @__PURE__ */ jsx(BlockRequestDataContext.Provider, { value: o.current, children: e.children }) }) });
30271
30277
  }, BlockRequestProvider = React.memo(({ children: e }) => {
30272
30278
  var y, b;
30273
30279
  const t = useDataBlockProps(), {
@@ -30624,7 +30630,7 @@ const useStyles$a = genStyleHook("nb-markdown", (e, { isDarkTheme: t }) => {
30624
30630
  }, t ? i : r)
30625
30631
  };
30626
30632
  }), parseMarkdown$1 = _.memoize((e) => L(void 0, null, function* () {
30627
- return e && (yield import("./md-oH2RssNY.mjs")).default.render(e);
30633
+ return e && (yield import("./md-BbvRKckr.mjs")).default.render(e);
30628
30634
  }));
30629
30635
  function useParseMarkdown$1(e) {
30630
30636
  const [t, o] = useState(""), [n, r] = useState(!0);
@@ -72037,7 +72043,7 @@ BlockGridModel.registerFlow({
72037
72043
  }
72038
72044
  });
72039
72045
  const parseMarkdown = _.memoize((e) => L(void 0, null, function* () {
72040
- return e && (yield import("./md-BbvRKckr.mjs")).default.render(e);
72046
+ return e && (yield import("./md-oH2RssNY.mjs")).default.render(e);
72041
72047
  }));
72042
72048
  function useParseMarkdown(e) {
72043
72049
  const [t, o] = useState(""), [n, r] = useState(!0);
@@ -81187,6 +81193,7 @@ class AssociationFieldModel extends FieldModel {
81187
81193
  constructor() {
81188
81194
  super(...arguments);
81189
81195
  R(this, "operator", "$eq");
81196
+ R(this, "updateAssociation", !0);
81190
81197
  }
81191
81198
  }
81192
81199
  AssociationFieldModel.registerFlow({
@@ -81196,7 +81203,13 @@ AssociationFieldModel.registerFlow({
81196
81203
  init: {
81197
81204
  handler(e, t) {
81198
81205
  return L(this, null, function* () {
81199
- e.model.updateAssociation && e.model.context.blockModel.context.resource.addUpdateAssociationValues(e.model.parent.fieldPath);
81206
+ var o, n;
81207
+ if (e.model.updateAssociation) {
81208
+ const r = e.model.context.blockModel, i = (o = r == null ? void 0 : r.context) == null ? void 0 : o.resource, a = (n = e.model.parent) == null ? void 0 : n.fieldPath;
81209
+ if (!i || !a)
81210
+ return;
81211
+ i.addUpdateAssociationValues(a);
81212
+ }
81200
81213
  });
81201
81214
  }
81202
81215
  },