@nocobase/client 0.19.0-alpha.6 → 0.19.0-alpha.8

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.
@@ -70,6 +70,7 @@ export declare const useDetailsPaginationProps: () => {
70
70
  current: any;
71
71
  total: any;
72
72
  pageSize: number;
73
+ showSizeChanger: boolean;
73
74
  onChange(page: any): Promise<void>;
74
75
  style: {
75
76
  marginTop: number;
package/es/index.mjs CHANGED
@@ -100,7 +100,7 @@ import * as dndKitCore from "@dnd-kit/core";
100
100
  import { DndContext as DndContext$1, rectIntersection, DragOverlay, useDraggable, useDroppable, useDndContext, useDndMonitor, useSensor, MouseSensor, useSensors } from "@dnd-kit/core";
101
101
  import cronstrue from "cronstrue";
102
102
  import * as formilyJsonReactive from "@formily/reactive";
103
- import { untracked, define, observable, action, reaction, autorun, toJS } from "@formily/reactive";
103
+ import { raw, untracked, define, observable, action, reaction, autorun, toJS } from "@formily/reactive";
104
104
  import get from "lodash/get";
105
105
  import merge$1 from "lodash/merge";
106
106
  import set$1 from "lodash/set";
@@ -312,6 +312,9 @@ const nocobaseClient = /* @__PURE__ */ _mergeNamespaces({
312
312
  get ApplicationContext() {
313
313
  return ApplicationContext;
314
314
  },
315
+ get AssignedFieldValues() {
316
+ return AssignedFieldValues;
317
+ },
315
318
  get AssociationField() {
316
319
  return AssociationField;
317
320
  },
@@ -3482,7 +3485,9 @@ const VariablesProvider = ({ children }) => {
3482
3485
  data = yield waitForData;
3483
3486
  clearRequested(url2);
3484
3487
  }
3485
- current[key] = data.data.data;
3488
+ if (!raw(current)[key]) {
3489
+ raw(current)[key] = data.data.data;
3490
+ }
3486
3491
  current = getValuesByPath(current, key);
3487
3492
  } else {
3488
3493
  current = getValuesByPath(current, key);
@@ -17377,7 +17382,7 @@ const useParseDefaultValue = () => {
17377
17382
  const variables = useVariables$1();
17378
17383
  const localVariables = useLocalVariables$1();
17379
17384
  const record = useRecord();
17380
- const { isInAssignFieldValues, isInSetDefaultValueDialog, isInFormDataTemplate, isInSubTable } = useFlag() || {};
17385
+ const { isInAssignFieldValues, isInSetDefaultValueDialog, isInFormDataTemplate, isInSubTable, isInSubForm } = useFlag() || {};
17381
17386
  const { getField } = useCollection();
17382
17387
  const { isSpecialCase, setDefaultValue } = useSpecialCase();
17383
17388
  const index2 = useRecordIndex();
@@ -17443,6 +17448,8 @@ const useParseDefaultValue = () => {
17443
17448
  () => run({ forceUpdate: true })
17444
17449
  );
17445
17450
  return dispose;
17451
+ } else if (field.value == null && (isInSubTable || isInSubForm)) {
17452
+ field.setValue(fieldSchema.default);
17446
17453
  }
17447
17454
  }, [fieldSchema.default]);
17448
17455
  };
@@ -18762,14 +18769,14 @@ const useCreateActionProps = () => {
18762
18769
  (_c = (_b2 = __parent == null ? void 0 : __parent.service) == null ? void 0 : _b2.refresh) == null ? void 0 : _c.call(_b2);
18763
18770
  if (!(onSuccess == null ? void 0 : onSuccess.successMessage)) {
18764
18771
  message.success(t("Saved successfully"));
18765
- yield form.reset();
18772
+ yield form.reset(void 0, { forceClear: true });
18766
18773
  return;
18767
18774
  }
18768
18775
  if (onSuccess == null ? void 0 : onSuccess.manualClose) {
18769
18776
  modal.success({
18770
18777
  title: compile2(onSuccess == null ? void 0 : onSuccess.successMessage),
18771
18778
  onOk: () => __async(this, null, function* () {
18772
- yield form.reset();
18779
+ yield form.reset(void 0, { forceClear: true });
18773
18780
  if ((onSuccess == null ? void 0 : onSuccess.redirecting) && (onSuccess == null ? void 0 : onSuccess.redirectTo)) {
18774
18781
  if (isURL(onSuccess.redirectTo)) {
18775
18782
  window.location.href = onSuccess.redirectTo;
@@ -18781,7 +18788,7 @@ const useCreateActionProps = () => {
18781
18788
  });
18782
18789
  } else {
18783
18790
  message.success(compile2(onSuccess == null ? void 0 : onSuccess.successMessage));
18784
- yield form.reset();
18791
+ yield form.reset(void 0, { forceClear: true });
18785
18792
  if ((onSuccess == null ? void 0 : onSuccess.redirecting) && (onSuccess == null ? void 0 : onSuccess.redirectTo)) {
18786
18793
  if (isURL(onSuccess.redirectTo)) {
18787
18794
  window.location.href = onSuccess.redirectTo;
@@ -19474,6 +19481,7 @@ const useDetailsPaginationProps = () => {
19474
19481
  current: ((_f = (_e = (_d = ctx.service) == null ? void 0 : _d.data) == null ? void 0 : _e.meta) == null ? void 0 : _f.page) || 1,
19475
19482
  total: count,
19476
19483
  pageSize: 1,
19484
+ showSizeChanger: false,
19477
19485
  onChange(page) {
19478
19486
  return __async(this, null, function* () {
19479
19487
  var _a2, _b2;
@@ -19683,16 +19691,22 @@ const useAssociationNames$1 = () => {
19683
19691
  const isAssociationSubfield = s2.name.includes(".");
19684
19692
  const isAssociationField = collectionField && ["hasOne", "hasMany", "belongsTo", "belongsToMany"].includes(collectionField.type);
19685
19693
  if (s2["x-linkage-rules"]) {
19686
- const rules = s2["x-linkage-rules"];
19687
- rules.forEach(({ condition }) => {
19688
- const type2 = Object.keys(condition)[0] || "$and";
19689
- const list = condition[type2];
19694
+ const collectAppends = (obj) => {
19695
+ const type2 = Object.keys(obj)[0] || "$and";
19696
+ const list = obj[type2];
19690
19697
  list.forEach((item) => {
19698
+ if ("$and" in item || "$or" in item) {
19699
+ return collectAppends(item);
19700
+ }
19691
19701
  const fieldNames = getTargetField$1(item);
19692
19702
  if (fieldNames.length > 1) {
19693
19703
  appends.add(fieldNames.join("."));
19694
19704
  }
19695
19705
  });
19706
+ };
19707
+ const rules = s2["x-linkage-rules"];
19708
+ rules.forEach(({ condition }) => {
19709
+ collectAppends(condition);
19696
19710
  });
19697
19711
  }
19698
19712
  const isTreeCollection = isAssociationField && ((_a = getCollection(collectionField.target)) == null ? void 0 : _a.template) === "tree";
@@ -21518,13 +21532,16 @@ function getAllKeys(obj) {
21518
21532
  return keys;
21519
21533
  }
21520
21534
  const conditionAnalyses = (_0) => __async(void 0, [_0], function* ({
21521
- rules,
21535
+ ruleGroup,
21522
21536
  variables,
21523
21537
  localVariables
21524
21538
  }) {
21525
- const type2 = Object.keys(rules)[0] || "$and";
21526
- const conditions = rules[type2];
21539
+ const type2 = Object.keys(ruleGroup)[0] || "$and";
21540
+ const conditions = ruleGroup[type2];
21527
21541
  let results2 = conditions.map((condition) => __async(void 0, null, function* () {
21542
+ if ("$and" in condition || "$or" in condition) {
21543
+ return yield conditionAnalyses({ ruleGroup: condition, variables, localVariables });
21544
+ }
21528
21545
  const jsonlogic = getInnermostKeyAndValue(condition);
21529
21546
  const operator = jsonlogic == null ? void 0 : jsonlogic.key;
21530
21547
  if (!operator) {
@@ -21571,7 +21588,6 @@ const collectFieldStateOfLinkageRules = ({
21571
21588
  value,
21572
21589
  field,
21573
21590
  condition,
21574
- values,
21575
21591
  variables,
21576
21592
  localVariables
21577
21593
  }) => {
@@ -21583,13 +21599,17 @@ const collectFieldStateOfLinkageRules = ({
21583
21599
  const { evaluate } = evaluators.get("formula.js");
21584
21600
  switch (operator) {
21585
21601
  case ActionType.Required:
21586
- requiredResult.push(getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), true));
21602
+ requiredResult.push(
21603
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), true)
21604
+ );
21587
21605
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
21588
21606
  required: requiredResult
21589
21607
  });
21590
21608
  break;
21591
21609
  case ActionType.InRequired:
21592
- requiredResult.push(getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), false));
21610
+ requiredResult.push(
21611
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), false)
21612
+ );
21593
21613
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
21594
21614
  required: requiredResult
21595
21615
  });
@@ -21598,7 +21618,7 @@ const collectFieldStateOfLinkageRules = ({
21598
21618
  case ActionType.None:
21599
21619
  case ActionType.Hidden:
21600
21620
  displayResult.push(
21601
- getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), operator)
21621
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), operator)
21602
21622
  );
21603
21623
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
21604
21624
  display: displayResult
@@ -21608,7 +21628,7 @@ const collectFieldStateOfLinkageRules = ({
21608
21628
  case ActionType.ReadOnly:
21609
21629
  case ActionType.ReadPretty:
21610
21630
  patternResult.push(
21611
- getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), operator)
21631
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), operator)
21612
21632
  );
21613
21633
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
21614
21634
  pattern: patternResult
@@ -21641,7 +21661,7 @@ const collectFieldStateOfLinkageRules = ({
21641
21661
  valueResult.push(getTempFieldState(true, getValue2()));
21642
21662
  } else {
21643
21663
  valueResult.push(
21644
- getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), getValue2())
21664
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), getValue2())
21645
21665
  );
21646
21666
  }
21647
21667
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
@@ -21676,7 +21696,7 @@ function replaceVariables(_0, _1) {
21676
21696
  }
21677
21697
  return {
21678
21698
  exp: value.replace(REGEX_OF_VARIABLE, (match) => {
21679
- return store[match] || match;
21699
+ return `{{${store[match] || match}}}`;
21680
21700
  }),
21681
21701
  scope
21682
21702
  };
@@ -21918,7 +21938,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
21918
21938
  const displayResult = ((_b = field == null ? void 0 : field.stateOfLinkageRules) == null ? void 0 : _b.display) || ["visible"];
21919
21939
  switch (operator) {
21920
21940
  case ActionType.Visible:
21921
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
21941
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
21922
21942
  displayResult.push(operator);
21923
21943
  field.data = field.data || {};
21924
21944
  field.data.hidden = false;
@@ -21929,7 +21949,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
21929
21949
  field.display = last(displayResult);
21930
21950
  break;
21931
21951
  case ActionType.Hidden:
21932
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
21952
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
21933
21953
  field.data = field.data || {};
21934
21954
  field.data.hidden = true;
21935
21955
  } else {
@@ -21938,7 +21958,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
21938
21958
  }
21939
21959
  break;
21940
21960
  case ActionType.Disabled:
21941
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
21961
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
21942
21962
  disableResult.push(true);
21943
21963
  }
21944
21964
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
@@ -21948,7 +21968,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
21948
21968
  field.componentProps["disabled"] = last(disableResult);
21949
21969
  break;
21950
21970
  case ActionType.Active:
21951
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
21971
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
21952
21972
  disableResult.push(false);
21953
21973
  }
21954
21974
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
@@ -22148,18 +22168,12 @@ function AssignedFieldValues() {
22148
22168
  const { dn } = useDesignable();
22149
22169
  const { t } = useTranslation();
22150
22170
  const fieldSchema = useFieldSchema();
22151
- const field = useField();
22152
- const [initialSchema, setInitialSchema] = useState();
22153
- useEffect(() => {
22154
- const schemaUid = uid();
22155
- const schema3 = {
22156
- type: "void",
22157
- "x-uid": schemaUid,
22158
- "x-component": "Grid",
22159
- "x-initializer": "CustomFormItemInitializers"
22160
- };
22161
- setInitialSchema(schema3);
22162
- }, [field.address]);
22171
+ const initialSchema = {
22172
+ type: "void",
22173
+ "x-uid": uid(),
22174
+ "x-component": "Grid",
22175
+ "x-initializer": "CustomFormItemInitializers"
22176
+ };
22163
22177
  const tips = {
22164
22178
  "customize:update": t(
22165
22179
  "After clicking the custom button, the following fields of the current record will be saved according to the following form."
@@ -29839,7 +29853,7 @@ const WithForm = (props) => {
29839
29853
  const result = [fieldValuesInCondition, variableValuesInCondition, variableValuesInExpression].map((item) => JSON.stringify(item)).join(",");
29840
29854
  return result;
29841
29855
  },
29842
- getSubscriber(action2, field, rule, form2, variables, localVariables),
29856
+ getSubscriber(action2, field, rule, variables, localVariables),
29843
29857
  { fireImmediately: true }
29844
29858
  )
29845
29859
  );
@@ -29892,20 +29906,20 @@ const Form$1 = observer$1(
29892
29906
  },
29893
29907
  { displayName: "Form" }
29894
29908
  );
29895
- function getSubscriber(action2, field, rule, form, variables, localVariables) {
29909
+ function getSubscriber(action2, field, rule, variables, localVariables) {
29896
29910
  return () => {
29897
29911
  collectFieldStateOfLinkageRules({
29898
29912
  operator: action2.operator,
29899
29913
  value: action2.value,
29900
29914
  field,
29901
29915
  condition: rule.condition,
29902
- values: form.values,
29903
29916
  variables,
29904
29917
  localVariables
29905
29918
  });
29906
29919
  setTimeout(() => __async(this, null, function* () {
29920
+ var _a;
29907
29921
  const fieldName = getFieldNameByOperator(action2.operator);
29908
- if (!field.stateOfLinkageRules[fieldName]) {
29922
+ if (!((_a = field.stateOfLinkageRules) == null ? void 0 : _a[fieldName])) {
29909
29923
  return;
29910
29924
  }
29911
29925
  let stateList = field.stateOfLinkageRules[fieldName];
@@ -41035,6 +41049,7 @@ const components$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
41035
41049
  ActionContextProvider,
41036
41050
  ActionDesigner,
41037
41051
  AppendsTreeSelect,
41052
+ AssignedFieldValues,
41038
41053
  AssociationField,
41039
41054
  AssociationSelect,
41040
41055
  AutoComplete,
@@ -51449,7 +51464,7 @@ const DeleteCollectionAction = (props) => {
51449
51464
  const Title = () => {
51450
51465
  return /* @__PURE__ */ jsxs("span", { children: [
51451
51466
  /* @__PURE__ */ jsx(ExclamationCircleFilled, { style: { color: "#faad14", marginRight: "12px", fontSize: "22px" } }),
51452
- /* @__PURE__ */ jsx("span", { style: { fontSize: "19px" }, children: t("Delete record") })
51467
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "19px" }, children: t("Delete collection") })
51453
51468
  ] });
51454
51469
  };
51455
51470
  return /* @__PURE__ */ jsx(RecordProvider, { record, children: /* @__PURE__ */ jsxs(ActionContextProvider, { value: { visible, setVisible }, children: [
@@ -51466,7 +51481,7 @@ const DeleteCollectionAction = (props) => {
51466
51481
  "x-component": "Action.Modal",
51467
51482
  title: /* @__PURE__ */ jsx(Title, {}),
51468
51483
  "x-component-props": {
51469
- width: 500,
51484
+ width: 520,
51470
51485
  getContainer: "{{ getContainer }}",
51471
51486
  className: css`
51472
51487
  .ant-modal-body {
@@ -51509,7 +51524,10 @@ const DeleteCollectionAction = (props) => {
51509
51524
  "x-component": "Action",
51510
51525
  "x-component-props": {
51511
51526
  type: "primary",
51512
- useAction: "{{ useDestroyCollectionAction }}"
51527
+ useAction: "{{ useDestroyCollectionAction }}",
51528
+ style: {
51529
+ marginLeft: "8px"
51530
+ }
51513
51531
  }
51514
51532
  }
51515
51533
  }
@@ -56051,7 +56069,7 @@ const PinnedPluginList = () => {
56051
56069
  background: none;
56052
56070
  color: rgba(255, 255, 255, 0.65);
56053
56071
  &:hover {
56054
- background: rgba(255, 255, 255, 0.1);
56072
+ background: rgba(255, 255, 255, 0.1) !important;
56055
56073
  }
56056
56074
  }
56057
56075
  `,
@@ -61411,6 +61429,7 @@ export {
61411
61429
  AppendsTreeSelect,
61412
61430
  Application,
61413
61431
  ApplicationContext,
61432
+ AssignedFieldValues,
61414
61433
  AssociationField,
61415
61434
  AssociationFilter,
61416
61435
  AssociationFilterDesignerDelete,
@@ -2,6 +2,7 @@ import { ModalProps } from 'antd';
2
2
  import React from 'react';
3
3
  import { SchemaSettingOptions, SchemaSettings } from '../../../application/schema-settings';
4
4
  declare function ButtonEditor(props: any): React.JSX.Element;
5
+ export declare function AssignedFieldValues(): React.JSX.Element;
5
6
  declare function RemoveButton(props?: {
6
7
  onConfirmOk?: ModalProps['onOk'];
7
8
  }): React.JSX.Element;
@@ -7,7 +7,6 @@ interface Props {
7
7
  [key: string]: any;
8
8
  };
9
9
  condition: any;
10
- values: any;
11
10
  variables: VariablesContextType;
12
11
  localVariables: VariableOption[];
13
12
  }
@@ -18,5 +17,5 @@ export declare function getTempFieldState(condition: boolean | Promise<boolean>,
18
17
  condition: boolean;
19
18
  value: any;
20
19
  }>;
21
- export declare const collectFieldStateOfLinkageRules: ({ operator, value, field, condition, values, variables, localVariables, }: Props) => any;
20
+ export declare const collectFieldStateOfLinkageRules: ({ operator, value, field, condition, variables, localVariables, }: Props) => any;
22
21
  export {};
@@ -11,8 +11,8 @@ export declare function getInnermostKeyAndValue(obj: any): {
11
11
  value: any;
12
12
  };
13
13
  export declare const getTargetField: (obj: any) => any[];
14
- export declare const conditionAnalyses: ({ rules, variables, localVariables, }: {
15
- rules: any;
14
+ export declare const conditionAnalyses: ({ ruleGroup, variables, localVariables, }: {
15
+ ruleGroup: any;
16
16
  variables: VariablesContextType;
17
17
  localVariables: VariableOption[];
18
18
  }) => Promise<boolean>;
package/lib/index.js CHANGED
@@ -72,6 +72,7 @@ __export(es_exports, {
72
72
  AppendsTreeSelect: () => AppendsTreeSelect,
73
73
  Application: () => Application,
74
74
  ApplicationContext: () => ApplicationContext,
75
+ AssignedFieldValues: () => AssignedFieldValues,
75
76
  AssociationField: () => AssociationField,
76
77
  AssociationFilter: () => AssociationFilter,
77
78
  AssociationFilterDesignerDelete: () => AssociationFilterDesignerDelete,
@@ -1044,6 +1045,9 @@ const nocobaseClient = /* @__PURE__ */ _mergeNamespaces$1({
1044
1045
  get ApplicationContext() {
1045
1046
  return ApplicationContext;
1046
1047
  },
1048
+ get AssignedFieldValues() {
1049
+ return AssignedFieldValues;
1050
+ },
1047
1051
  get AssociationField() {
1048
1052
  return AssociationField;
1049
1053
  },
@@ -4213,7 +4217,9 @@ const VariablesProvider = ({ children }) => {
4213
4217
  data = yield waitForData;
4214
4218
  clearRequested(url2);
4215
4219
  }
4216
- current[key] = data.data.data;
4220
+ if (!(0, import_reactive.raw)(current)[key]) {
4221
+ (0, import_reactive.raw)(current)[key] = data.data.data;
4222
+ }
4217
4223
  current = (0, import_client.getValuesByPath)(current, key);
4218
4224
  } else {
4219
4225
  current = (0, import_client.getValuesByPath)(current, key);
@@ -18108,7 +18114,7 @@ const useParseDefaultValue = () => {
18108
18114
  const variables = useVariables$1();
18109
18115
  const localVariables = useLocalVariables$1();
18110
18116
  const record = useRecord();
18111
- const { isInAssignFieldValues, isInSetDefaultValueDialog, isInFormDataTemplate, isInSubTable } = useFlag() || {};
18117
+ const { isInAssignFieldValues, isInSetDefaultValueDialog, isInFormDataTemplate, isInSubTable, isInSubForm } = useFlag() || {};
18112
18118
  const { getField } = useCollection();
18113
18119
  const { isSpecialCase, setDefaultValue } = useSpecialCase();
18114
18120
  const index2 = useRecordIndex();
@@ -18174,6 +18180,8 @@ const useParseDefaultValue = () => {
18174
18180
  () => run({ forceUpdate: true })
18175
18181
  );
18176
18182
  return dispose;
18183
+ } else if (field.value == null && (isInSubTable || isInSubForm)) {
18184
+ field.setValue(fieldSchema.default);
18177
18185
  }
18178
18186
  }, [fieldSchema.default]);
18179
18187
  };
@@ -19493,14 +19501,14 @@ const useCreateActionProps = () => {
19493
19501
  (_c = (_b2 = __parent == null ? void 0 : __parent.service) == null ? void 0 : _b2.refresh) == null ? void 0 : _c.call(_b2);
19494
19502
  if (!(onSuccess == null ? void 0 : onSuccess.successMessage)) {
19495
19503
  import_antd.message.success(t("Saved successfully"));
19496
- yield form.reset();
19504
+ yield form.reset(void 0, { forceClear: true });
19497
19505
  return;
19498
19506
  }
19499
19507
  if (onSuccess == null ? void 0 : onSuccess.manualClose) {
19500
19508
  modal.success({
19501
19509
  title: compile2(onSuccess == null ? void 0 : onSuccess.successMessage),
19502
19510
  onOk: () => __async(this, null, function* () {
19503
- yield form.reset();
19511
+ yield form.reset(void 0, { forceClear: true });
19504
19512
  if ((onSuccess == null ? void 0 : onSuccess.redirecting) && (onSuccess == null ? void 0 : onSuccess.redirectTo)) {
19505
19513
  if ((0, import_client.isURL)(onSuccess.redirectTo)) {
19506
19514
  window.location.href = onSuccess.redirectTo;
@@ -19512,7 +19520,7 @@ const useCreateActionProps = () => {
19512
19520
  });
19513
19521
  } else {
19514
19522
  import_antd.message.success(compile2(onSuccess == null ? void 0 : onSuccess.successMessage));
19515
- yield form.reset();
19523
+ yield form.reset(void 0, { forceClear: true });
19516
19524
  if ((onSuccess == null ? void 0 : onSuccess.redirecting) && (onSuccess == null ? void 0 : onSuccess.redirectTo)) {
19517
19525
  if ((0, import_client.isURL)(onSuccess.redirectTo)) {
19518
19526
  window.location.href = onSuccess.redirectTo;
@@ -20205,6 +20213,7 @@ const useDetailsPaginationProps = () => {
20205
20213
  current: ((_f = (_e = (_d = ctx.service) == null ? void 0 : _d.data) == null ? void 0 : _e.meta) == null ? void 0 : _f.page) || 1,
20206
20214
  total: count,
20207
20215
  pageSize: 1,
20216
+ showSizeChanger: false,
20208
20217
  onChange(page) {
20209
20218
  return __async(this, null, function* () {
20210
20219
  var _a2, _b2;
@@ -20414,16 +20423,22 @@ const useAssociationNames$1 = () => {
20414
20423
  const isAssociationSubfield = s2.name.includes(".");
20415
20424
  const isAssociationField = collectionField && ["hasOne", "hasMany", "belongsTo", "belongsToMany"].includes(collectionField.type);
20416
20425
  if (s2["x-linkage-rules"]) {
20417
- const rules = s2["x-linkage-rules"];
20418
- rules.forEach(({ condition }) => {
20419
- const type2 = Object.keys(condition)[0] || "$and";
20420
- const list = condition[type2];
20426
+ const collectAppends = (obj) => {
20427
+ const type2 = Object.keys(obj)[0] || "$and";
20428
+ const list = obj[type2];
20421
20429
  list.forEach((item) => {
20430
+ if ("$and" in item || "$or" in item) {
20431
+ return collectAppends(item);
20432
+ }
20422
20433
  const fieldNames = getTargetField$1(item);
20423
20434
  if (fieldNames.length > 1) {
20424
20435
  appends.add(fieldNames.join("."));
20425
20436
  }
20426
20437
  });
20438
+ };
20439
+ const rules = s2["x-linkage-rules"];
20440
+ rules.forEach(({ condition }) => {
20441
+ collectAppends(condition);
20427
20442
  });
20428
20443
  }
20429
20444
  const isTreeCollection = isAssociationField && ((_a = getCollection(collectionField.target)) == null ? void 0 : _a.template) === "tree";
@@ -22249,13 +22264,16 @@ function getAllKeys(obj) {
22249
22264
  return keys;
22250
22265
  }
22251
22266
  const conditionAnalyses = (_0) => __async(void 0, [_0], function* ({
22252
- rules,
22267
+ ruleGroup,
22253
22268
  variables,
22254
22269
  localVariables
22255
22270
  }) {
22256
- const type2 = Object.keys(rules)[0] || "$and";
22257
- const conditions = rules[type2];
22271
+ const type2 = Object.keys(ruleGroup)[0] || "$and";
22272
+ const conditions = ruleGroup[type2];
22258
22273
  let results2 = conditions.map((condition) => __async(void 0, null, function* () {
22274
+ if ("$and" in condition || "$or" in condition) {
22275
+ return yield conditionAnalyses({ ruleGroup: condition, variables, localVariables });
22276
+ }
22259
22277
  const jsonlogic = getInnermostKeyAndValue(condition);
22260
22278
  const operator = jsonlogic == null ? void 0 : jsonlogic.key;
22261
22279
  if (!operator) {
@@ -22302,7 +22320,6 @@ const collectFieldStateOfLinkageRules = ({
22302
22320
  value,
22303
22321
  field,
22304
22322
  condition,
22305
- values,
22306
22323
  variables,
22307
22324
  localVariables
22308
22325
  }) => {
@@ -22314,13 +22331,17 @@ const collectFieldStateOfLinkageRules = ({
22314
22331
  const { evaluate } = import_client3.evaluators.get("formula.js");
22315
22332
  switch (operator) {
22316
22333
  case ActionType.Required:
22317
- requiredResult.push(getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), true));
22334
+ requiredResult.push(
22335
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), true)
22336
+ );
22318
22337
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
22319
22338
  required: requiredResult
22320
22339
  });
22321
22340
  break;
22322
22341
  case ActionType.InRequired:
22323
- requiredResult.push(getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), false));
22342
+ requiredResult.push(
22343
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), false)
22344
+ );
22324
22345
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
22325
22346
  required: requiredResult
22326
22347
  });
@@ -22329,7 +22350,7 @@ const collectFieldStateOfLinkageRules = ({
22329
22350
  case ActionType.None:
22330
22351
  case ActionType.Hidden:
22331
22352
  displayResult.push(
22332
- getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), operator)
22353
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), operator)
22333
22354
  );
22334
22355
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
22335
22356
  display: displayResult
@@ -22339,7 +22360,7 @@ const collectFieldStateOfLinkageRules = ({
22339
22360
  case ActionType.ReadOnly:
22340
22361
  case ActionType.ReadPretty:
22341
22362
  patternResult.push(
22342
- getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), operator)
22363
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), operator)
22343
22364
  );
22344
22365
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
22345
22366
  pattern: patternResult
@@ -22372,7 +22393,7 @@ const collectFieldStateOfLinkageRules = ({
22372
22393
  valueResult.push(getTempFieldState(true, getValue2()));
22373
22394
  } else {
22374
22395
  valueResult.push(
22375
- getTempFieldState(conditionAnalyses({ rules: condition, variables, localVariables }), getValue2())
22396
+ getTempFieldState(conditionAnalyses({ ruleGroup: condition, variables, localVariables }), getValue2())
22376
22397
  );
22377
22398
  }
22378
22399
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
@@ -22407,7 +22428,7 @@ function replaceVariables(_0, _1) {
22407
22428
  }
22408
22429
  return {
22409
22430
  exp: value.replace(REGEX_OF_VARIABLE, (match) => {
22410
- return store[match] || match;
22431
+ return `{{${store[match] || match}}}`;
22411
22432
  }),
22412
22433
  scope
22413
22434
  };
@@ -22649,7 +22670,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
22649
22670
  const displayResult = ((_b = field == null ? void 0 : field.stateOfLinkageRules) == null ? void 0 : _b.display) || ["visible"];
22650
22671
  switch (operator) {
22651
22672
  case ActionType.Visible:
22652
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
22673
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
22653
22674
  displayResult.push(operator);
22654
22675
  field.data = field.data || {};
22655
22676
  field.data.hidden = false;
@@ -22660,7 +22681,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
22660
22681
  field.display = (0, import_lodash.last)(displayResult);
22661
22682
  break;
22662
22683
  case ActionType.Hidden:
22663
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
22684
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
22664
22685
  field.data = field.data || {};
22665
22686
  field.data.hidden = true;
22666
22687
  } else {
@@ -22669,7 +22690,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
22669
22690
  }
22670
22691
  break;
22671
22692
  case ActionType.Disabled:
22672
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
22693
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
22673
22694
  disableResult.push(true);
22674
22695
  }
22675
22696
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
@@ -22679,7 +22700,7 @@ const linkageAction = (_0) => __async(void 0, [_0], function* ({
22679
22700
  field.componentProps["disabled"] = (0, import_lodash.last)(disableResult);
22680
22701
  break;
22681
22702
  case ActionType.Active:
22682
- if (yield conditionAnalyses({ rules: condition, variables, localVariables })) {
22703
+ if (yield conditionAnalyses({ ruleGroup: condition, variables, localVariables })) {
22683
22704
  disableResult.push(false);
22684
22705
  }
22685
22706
  field.stateOfLinkageRules = __spreadProps(__spreadValues({}, field.stateOfLinkageRules), {
@@ -22879,18 +22900,12 @@ function AssignedFieldValues() {
22879
22900
  const { dn } = useDesignable();
22880
22901
  const { t } = (0, import_react_i18next.useTranslation)();
22881
22902
  const fieldSchema = (0, import_react.useFieldSchema)();
22882
- const field = (0, import_react.useField)();
22883
- const [initialSchema, setInitialSchema] = (0, import_react2.useState)();
22884
- (0, import_react2.useEffect)(() => {
22885
- const schemaUid = (0, import_shared.uid)();
22886
- const schema3 = {
22887
- type: "void",
22888
- "x-uid": schemaUid,
22889
- "x-component": "Grid",
22890
- "x-initializer": "CustomFormItemInitializers"
22891
- };
22892
- setInitialSchema(schema3);
22893
- }, [field.address]);
22903
+ const initialSchema = {
22904
+ type: "void",
22905
+ "x-uid": (0, import_shared.uid)(),
22906
+ "x-component": "Grid",
22907
+ "x-initializer": "CustomFormItemInitializers"
22908
+ };
22894
22909
  const tips = {
22895
22910
  "customize:update": t(
22896
22911
  "After clicking the custom button, the following fields of the current record will be saved according to the following form."
@@ -30570,7 +30585,7 @@ const WithForm = (props) => {
30570
30585
  const result = [fieldValuesInCondition, variableValuesInCondition, variableValuesInExpression].map((item) => JSON.stringify(item)).join(",");
30571
30586
  return result;
30572
30587
  },
30573
- getSubscriber(action2, field, rule, form2, variables, localVariables),
30588
+ getSubscriber(action2, field, rule, variables, localVariables),
30574
30589
  { fireImmediately: true }
30575
30590
  )
30576
30591
  );
@@ -30623,20 +30638,20 @@ const Form$1 = (0, import_react.observer)(
30623
30638
  },
30624
30639
  { displayName: "Form" }
30625
30640
  );
30626
- function getSubscriber(action2, field, rule, form, variables, localVariables) {
30641
+ function getSubscriber(action2, field, rule, variables, localVariables) {
30627
30642
  return () => {
30628
30643
  collectFieldStateOfLinkageRules({
30629
30644
  operator: action2.operator,
30630
30645
  value: action2.value,
30631
30646
  field,
30632
30647
  condition: rule.condition,
30633
- values: form.values,
30634
30648
  variables,
30635
30649
  localVariables
30636
30650
  });
30637
30651
  setTimeout(() => __async(this, null, function* () {
30652
+ var _a;
30638
30653
  const fieldName = getFieldNameByOperator(action2.operator);
30639
- if (!field.stateOfLinkageRules[fieldName]) {
30654
+ if (!((_a = field.stateOfLinkageRules) == null ? void 0 : _a[fieldName])) {
30640
30655
  return;
30641
30656
  }
30642
30657
  let stateList = field.stateOfLinkageRules[fieldName];
@@ -41766,6 +41781,7 @@ const components$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
41766
41781
  ActionContextProvider,
41767
41782
  ActionDesigner,
41768
41783
  AppendsTreeSelect,
41784
+ AssignedFieldValues,
41769
41785
  AssociationField,
41770
41786
  AssociationSelect,
41771
41787
  AutoComplete,
@@ -52180,7 +52196,7 @@ const DeleteCollectionAction = (props) => {
52180
52196
  const Title = () => {
52181
52197
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
52182
52198
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ExclamationCircleFilled, { style: { color: "#faad14", marginRight: "12px", fontSize: "22px" } }),
52183
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: "19px" }, children: t("Delete record") })
52199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: "19px" }, children: t("Delete collection") })
52184
52200
  ] });
52185
52201
  };
52186
52202
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordProvider, { record, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ActionContextProvider, { value: { visible, setVisible }, children: [
@@ -52197,7 +52213,7 @@ const DeleteCollectionAction = (props) => {
52197
52213
  "x-component": "Action.Modal",
52198
52214
  title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, {}),
52199
52215
  "x-component-props": {
52200
- width: 500,
52216
+ width: 520,
52201
52217
  getContainer: "{{ getContainer }}",
52202
52218
  className: import_css.css`
52203
52219
  .ant-modal-body {
@@ -52240,7 +52256,10 @@ const DeleteCollectionAction = (props) => {
52240
52256
  "x-component": "Action",
52241
52257
  "x-component-props": {
52242
52258
  type: "primary",
52243
- useAction: "{{ useDestroyCollectionAction }}"
52259
+ useAction: "{{ useDestroyCollectionAction }}",
52260
+ style: {
52261
+ marginLeft: "8px"
52262
+ }
52244
52263
  }
52245
52264
  }
52246
52265
  }
@@ -56782,7 +56801,7 @@ const PinnedPluginList = () => {
56782
56801
  background: none;
56783
56802
  color: rgba(255, 255, 255, 0.65);
56784
56803
  &:hover {
56785
- background: rgba(255, 255, 255, 0.1);
56804
+ background: rgba(255, 255, 255, 0.1) !important;
56786
56805
  }
56787
56806
  }
56788
56807
  `,
@@ -200,6 +200,7 @@ module.exports = {
200
200
  "Before change": "Before change",
201
201
  "After change": "After change",
202
202
  "Delete record": "Delete record",
203
+ "Delete collection": "Delete collection",
203
204
  "Create collection": "Create collection",
204
205
  "Collection display name": "Collection display name",
205
206
  "Collection name": "Collection name",
@@ -171,6 +171,7 @@ module.exports = {
171
171
  "Before change": "\u5909\u66F4\u524D",
172
172
  "After change": "\u5909\u66F4\u5F8C",
173
173
  "Delete record": "\u30EC\u30B3\u30FC\u30C9\u524A\u9664",
174
+ "Delete collection": "\u30C7\u30FC\u30BF\u30C6\u30FC\u30D6\u30EB\u306E\u524A\u9664",
174
175
  "Create collection": "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u4F5C\u6210",
175
176
  "Collection display name": "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D",
176
177
  "Collection name": "\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u8B58\u5225\u5B50",
@@ -210,6 +210,7 @@ module.exports = {
210
210
  "Before change": "\u53D8\u66F4\u524D",
211
211
  "After change": "\u53D8\u66F4\u540E",
212
212
  "Delete record": "\u5220\u9664\u6570\u636E",
213
+ "Delete collection": "\u5220\u9664\u6570\u636E\u8868",
213
214
  "Create collection": "\u521B\u5EFA\u6570\u636E\u8868",
214
215
  "Collection display name": "\u6570\u636E\u8868\u540D\u79F0",
215
216
  "Collection name": "\u6570\u636E\u8868\u6807\u8BC6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.19.0-alpha.6",
3
+ "version": "0.19.0-alpha.8",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",
@@ -25,9 +25,9 @@
25
25
  "@formily/reactive-react": "^2.2.27",
26
26
  "@formily/shared": "^2.2.27",
27
27
  "@formily/validator": "^2.2.27",
28
- "@nocobase/evaluators": "0.19.0-alpha.6",
29
- "@nocobase/sdk": "0.19.0-alpha.6",
30
- "@nocobase/utils": "0.19.0-alpha.6",
28
+ "@nocobase/evaluators": "0.19.0-alpha.8",
29
+ "@nocobase/sdk": "0.19.0-alpha.8",
30
+ "@nocobase/utils": "0.19.0-alpha.8",
31
31
  "ahooks": "^3.7.2",
32
32
  "antd": "^5.12.8",
33
33
  "antd-style": "3.4.5",
@@ -72,5 +72,5 @@
72
72
  "dumi": "^2.2.0",
73
73
  "dumi-theme-nocobase": "^0.2.19"
74
74
  },
75
- "gitHead": "2eb524db98c7f4136fe1a9a1b1259cd72cf6635f"
75
+ "gitHead": "b8fbe613e320e40ebf2da1bf64907eab0197b589"
76
76
  }