@nocobase/client 0.15.0-alpha.4 → 0.16.0-alpha.1

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.
Files changed (3) hide show
  1. package/es/index.mjs +23 -10
  2. package/lib/index.js +23 -10
  3. package/package.json +5 -5
package/es/index.mjs CHANGED
@@ -19795,9 +19795,9 @@ const TableBlockProvider = (props) => {
19795
19795
  const { getCollection, getCollectionField } = useCollectionManager();
19796
19796
  const record = useRecord();
19797
19797
  const collection2 = getCollection(props.collection);
19798
- const { treeTable } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
19798
+ const { treeTable, dragSortBy } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
19799
19799
  if (props.dragSort) {
19800
- params["sort"] = ["sort"];
19800
+ params["sort"] = dragSortBy || ["sort"];
19801
19801
  }
19802
19802
  let childrenColumnName = "children";
19803
19803
  if ((collection2 == null ? void 0 : collection2.tree) && treeTable !== false) {
@@ -22961,7 +22961,8 @@ const Action = observer(
22961
22961
  title,
22962
22962
  onClick,
22963
22963
  style,
22964
- openSize
22964
+ openSize,
22965
+ disabled: propsDisabled
22965
22966
  } = _a, others = __objRest(_a, [
22966
22967
  "popover",
22967
22968
  "confirm",
@@ -22974,7 +22975,8 @@ const Action = observer(
22974
22975
  "title",
22975
22976
  "onClick",
22976
22977
  "style",
22977
- "openSize"
22978
+ "openSize",
22979
+ "disabled"
22978
22980
  ]);
22979
22981
  const { wrapSSR, componentCls, hashId } = useStyles$j();
22980
22982
  const { t } = useTranslation();
@@ -22989,7 +22991,7 @@ const Action = observer(
22989
22991
  const record = useRecord();
22990
22992
  const designerProps = fieldSchema["x-designer-props"];
22991
22993
  const openMode = (_b = fieldSchema == null ? void 0 : fieldSchema["x-component-props"]) == null ? void 0 : _b["openMode"];
22992
- const disabled = form.disabled || field.disabled || ((_c = field.data) == null ? void 0 : _c.disabled) || props.disabled;
22994
+ const disabled = form.disabled || field.disabled || ((_c = field.data) == null ? void 0 : _c.disabled) || propsDisabled;
22993
22995
  const linkageRules = (fieldSchema == null ? void 0 : fieldSchema["x-linkage-rules"]) || [];
22994
22996
  const { designable } = useDesignable();
22995
22997
  const tarComponent = useComponent(component) || component;
@@ -42962,7 +42964,7 @@ function IconField(props) {
42962
42964
  const { value, onChange, disabled } = props;
42963
42965
  const [visible, setVisible] = useState(false);
42964
42966
  const { t } = useTranslation();
42965
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Input$4.Group, { compact: true, children: [
42967
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Space$1.Compact, { children: [
42966
42968
  /* @__PURE__ */ jsx(
42967
42969
  PopoverWithStopPropagation,
42968
42970
  {
@@ -48112,6 +48114,7 @@ const TableBlockDesigner = () => {
48112
48114
  },
48113
48115
  [dn, field.decoratorProps, fieldSchema, service]
48114
48116
  );
48117
+ const api = useAPIClient();
48115
48118
  return (
48116
48119
  // fix https://nocobase.height.app/T-2259
48117
48120
  /* @__PURE__ */ jsx(RecordProvider, { parent: record, record: {}, children: /* @__PURE__ */ jsxs(GeneralSchemaDesigner, { template: template2, title: title || name, children: [
@@ -48142,18 +48145,28 @@ const TableBlockDesigner = () => {
48142
48145
  {
48143
48146
  title: t("Enable drag and drop sorting"),
48144
48147
  checked: field.decoratorProps.dragSort,
48145
- onChange: (dragSort2) => {
48146
- var _a2;
48148
+ onChange: (dragSort2) => __async(void 0, null, function* () {
48149
+ var _a2, _b2, _c2;
48150
+ if (dragSort2 && collectionField) {
48151
+ const { data } = yield api.resource("collections.fields", collectionField.collectionName).update({
48152
+ filterByTk: collectionField.name,
48153
+ values: {
48154
+ sortable: true
48155
+ }
48156
+ });
48157
+ const sortBy = (_b2 = (_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.sortBy;
48158
+ fieldSchema["x-decorator-props"].dragSortBy = sortBy;
48159
+ }
48147
48160
  field.decoratorProps.dragSort = dragSort2;
48148
48161
  fieldSchema["x-decorator-props"].dragSort = dragSort2;
48149
- service.run(__spreadProps(__spreadValues({}, (_a2 = service.params) == null ? void 0 : _a2[0]), { sort: "sort" }));
48162
+ service.run(__spreadProps(__spreadValues({}, (_c2 = service.params) == null ? void 0 : _c2[0]), { sort: fieldSchema["x-decorator-props"].dragSortBy }));
48150
48163
  dn.emit("patch", {
48151
48164
  schema: {
48152
48165
  ["x-uid"]: fieldSchema["x-uid"],
48153
48166
  "x-decorator-props": fieldSchema["x-decorator-props"]
48154
48167
  }
48155
48168
  });
48156
- }
48169
+ })
48157
48170
  }
48158
48171
  ),
48159
48172
  /* @__PURE__ */ jsx(FixedBlockDesignerItem, {}),
package/lib/index.js CHANGED
@@ -20445,9 +20445,9 @@ const TableBlockProvider = (props) => {
20445
20445
  const { getCollection, getCollectionField } = useCollectionManager();
20446
20446
  const record = useRecord();
20447
20447
  const collection2 = getCollection(props.collection);
20448
- const { treeTable } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
20448
+ const { treeTable, dragSortBy } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
20449
20449
  if (props.dragSort) {
20450
- params["sort"] = ["sort"];
20450
+ params["sort"] = dragSortBy || ["sort"];
20451
20451
  }
20452
20452
  let childrenColumnName = "children";
20453
20453
  if ((collection2 == null ? void 0 : collection2.tree) && treeTable !== false) {
@@ -23611,7 +23611,8 @@ const Action = (0, import_react.observer)(
23611
23611
  title,
23612
23612
  onClick,
23613
23613
  style,
23614
- openSize
23614
+ openSize,
23615
+ disabled: propsDisabled
23615
23616
  } = _a, others = __objRest(_a, [
23616
23617
  "popover",
23617
23618
  "confirm",
@@ -23624,7 +23625,8 @@ const Action = (0, import_react.observer)(
23624
23625
  "title",
23625
23626
  "onClick",
23626
23627
  "style",
23627
- "openSize"
23628
+ "openSize",
23629
+ "disabled"
23628
23630
  ]);
23629
23631
  const { wrapSSR, componentCls, hashId } = useStyles$j();
23630
23632
  const { t } = (0, import_react_i18next.useTranslation)();
@@ -23639,7 +23641,7 @@ const Action = (0, import_react.observer)(
23639
23641
  const record = useRecord();
23640
23642
  const designerProps = fieldSchema["x-designer-props"];
23641
23643
  const openMode = (_b = fieldSchema == null ? void 0 : fieldSchema["x-component-props"]) == null ? void 0 : _b["openMode"];
23642
- const disabled = form.disabled || field.disabled || ((_c = field.data) == null ? void 0 : _c.disabled) || props.disabled;
23644
+ const disabled = form.disabled || field.disabled || ((_c = field.data) == null ? void 0 : _c.disabled) || propsDisabled;
23643
23645
  const linkageRules = (fieldSchema == null ? void 0 : fieldSchema["x-linkage-rules"]) || [];
23644
23646
  const { designable } = useDesignable();
23645
23647
  const tarComponent = useComponent(component) || component;
@@ -43612,7 +43614,7 @@ function IconField(props) {
43612
43614
  const { value, onChange, disabled } = props;
43613
43615
  const [visible, setVisible] = (0, import_react2.useState)(false);
43614
43616
  const { t } = (0, import_react_i18next.useTranslation)();
43615
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Input.Group, { compact: true, children: [
43617
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Space.Compact, { children: [
43616
43618
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43617
43619
  PopoverWithStopPropagation,
43618
43620
  {
@@ -48762,6 +48764,7 @@ const TableBlockDesigner = () => {
48762
48764
  },
48763
48765
  [dn, field.decoratorProps, fieldSchema, service]
48764
48766
  );
48767
+ const api = useAPIClient();
48765
48768
  return (
48766
48769
  // fix https://nocobase.height.app/T-2259
48767
48770
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecordProvider, { parent: record, record: {}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(GeneralSchemaDesigner, { template: template2, title: title || name, children: [
@@ -48792,18 +48795,28 @@ const TableBlockDesigner = () => {
48792
48795
  {
48793
48796
  title: t("Enable drag and drop sorting"),
48794
48797
  checked: field.decoratorProps.dragSort,
48795
- onChange: (dragSort2) => {
48796
- var _a2;
48798
+ onChange: (dragSort2) => __async(void 0, null, function* () {
48799
+ var _a2, _b2, _c2;
48800
+ if (dragSort2 && collectionField) {
48801
+ const { data } = yield api.resource("collections.fields", collectionField.collectionName).update({
48802
+ filterByTk: collectionField.name,
48803
+ values: {
48804
+ sortable: true
48805
+ }
48806
+ });
48807
+ const sortBy = (_b2 = (_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.sortBy;
48808
+ fieldSchema["x-decorator-props"].dragSortBy = sortBy;
48809
+ }
48797
48810
  field.decoratorProps.dragSort = dragSort2;
48798
48811
  fieldSchema["x-decorator-props"].dragSort = dragSort2;
48799
- service.run(__spreadProps(__spreadValues({}, (_a2 = service.params) == null ? void 0 : _a2[0]), { sort: "sort" }));
48812
+ service.run(__spreadProps(__spreadValues({}, (_c2 = service.params) == null ? void 0 : _c2[0]), { sort: fieldSchema["x-decorator-props"].dragSortBy }));
48800
48813
  dn.emit("patch", {
48801
48814
  schema: {
48802
48815
  ["x-uid"]: fieldSchema["x-uid"],
48803
48816
  "x-decorator-props": fieldSchema["x-decorator-props"]
48804
48817
  }
48805
48818
  });
48806
- }
48819
+ })
48807
48820
  }
48808
48821
  ),
48809
48822
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FixedBlockDesignerItem, {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.15.0-alpha.4",
3
+ "version": "0.16.0-alpha.1",
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.15.0-alpha.4",
29
- "@nocobase/sdk": "0.15.0-alpha.4",
30
- "@nocobase/utils": "0.15.0-alpha.4",
28
+ "@nocobase/evaluators": "0.16.0-alpha.1",
29
+ "@nocobase/sdk": "0.16.0-alpha.1",
30
+ "@nocobase/utils": "0.16.0-alpha.1",
31
31
  "@types/requirejs": "^2.1.34",
32
32
  "ahooks": "^3.7.2",
33
33
  "antd": "^5.8.6",
@@ -76,5 +76,5 @@
76
76
  "dumi": "^2.2.0",
77
77
  "dumi-theme-nocobase": "^0.2.14"
78
78
  },
79
- "gitHead": "380045c660ea0432f3e8fd7cf01c3cfe7275db34"
79
+ "gitHead": "e8aaf48d169448376a06d87f090786cd7649255e"
80
80
  }