@nocobase/client 0.15.0-alpha.3 → 0.15.0-alpha.5

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 +92 -78
  2. package/lib/index.js +90 -76
  3. package/package.json +5 -5
package/es/index.mjs CHANGED
@@ -88,7 +88,7 @@ import * as ahooks from "ahooks";
88
88
  import { useSetState, useRequest as useRequest$1, useBoolean, useEventListener, useCookieState, useMemoizedFn, useDebounce, useSessionStorageState } from "ahooks";
89
89
  import cloneDeep from "lodash/cloneDeep";
90
90
  import * as nocobaseClientUtils from "@nocobase/utils/client";
91
- import { isPlainObject, error, getDefaultFormat, str2moment, toGmt, toLocal, dayjs as dayjs$1, getValuesByPath, flatten, unflatten as unflatten$1, forEach, nextTick, isURL, parse, isPortalInBody, isString as isString$1, uid as uid$2, toFixedByStep } from "@nocobase/utils/client";
91
+ import { isPlainObject, error, getDefaultFormat, str2moment, toGmt, toLocal, dayjs as dayjs$1, getValuesByPath, flatten, unflatten as unflatten$1, forEach, nextTick, isURL, parse, isPortalInBody, isString as isString$1, uid as uid$1, toFixedByStep } from "@nocobase/utils/client";
92
92
  import deepmerge from "deepmerge";
93
93
  import uniq$1 from "lodash/uniq";
94
94
  import template from "lodash/template";
@@ -109,7 +109,7 @@ import * as formilyReactiveReact from "@formily/reactive-react";
109
109
  import { observer as observer$1 } from "@formily/reactive-react";
110
110
  import { ErrorBoundary, useErrorBoundary } from "react-error-boundary";
111
111
  import * as antIcons from "@ant-design/icons";
112
- import antIcons__default, { createFromIconfontCN, CopyOutlined, HighlightOutlined, CloseCircleOutlined, PlusOutlined, DragOutlined, MenuOutlined, DownOutlined, CloseCircleFilled, CloseOutlined, LoadingOutlined, DownloadOutlined as DownloadOutlined$1, DeleteOutlined, SearchOutlined, TableOutlined, FormOutlined, OrderedListOutlined, EditOutlined, LeftOutlined, RightOutlined, CheckOutlined, InboxOutlined, RightSquareOutlined, SyncOutlined, ExclamationCircleFilled, ApiOutlined, SettingOutlined, ReadOutlined, ReloadOutlined } from "@ant-design/icons";
112
+ import antIcons__default, { createFromIconfontCN, CopyOutlined, HighlightOutlined, CloseCircleOutlined, PlusOutlined, DragOutlined, MenuOutlined, DownOutlined, CloseCircleFilled, CloseOutlined, LoadingOutlined, DownloadOutlined as DownloadOutlined$1, DeleteOutlined, SearchOutlined, TableOutlined, FormOutlined, OrderedListOutlined, EditOutlined, LeftOutlined, RightOutlined, CheckOutlined, InboxOutlined, RightSquareOutlined, SyncOutlined, ExclamationCircleFilled, ApiOutlined, SettingOutlined, ReadOutlined, ReloadOutlined, DisconnectOutlined } from "@ant-design/icons";
113
113
  import * as i18next from "i18next";
114
114
  import i18next__default from "i18next";
115
115
  import * as antdCssinjs from "@ant-design/cssinjs";
@@ -162,11 +162,10 @@ import ReactDragListView from "react-drag-listview";
162
162
  import { spliceArrayState, exchangeArrayState } from "@formily/core/esm/shared/internals";
163
163
  import useAntdInputStyle from "antd/es/input/style";
164
164
  import sanitizeHTML from "sanitize-html";
165
- import { uid as uid$1 } from "@nocobase/utils";
166
165
  import LRUCache from "lru-cache";
167
166
  import { parseExpression } from "cron-parser";
168
- import { eq } from "date-arithmetic";
169
167
  import { dayjsLocalizer, Calendar as Calendar$2 } from "react-big-calendar";
168
+ import * as dates from "react-big-calendar/lib/utils/dates";
170
169
  import solarLunar from "solarlunar-es";
171
170
  import { Navigate as Navigate$1 } from "react-big-calendar/dist/react-big-calendar.esm";
172
171
  import { useAttach as useAttach$1 } from "@formily/react/esm/hooks/useAttach";
@@ -19796,9 +19795,9 @@ const TableBlockProvider = (props) => {
19796
19795
  const { getCollection, getCollectionField } = useCollectionManager();
19797
19796
  const record = useRecord();
19798
19797
  const collection2 = getCollection(props.collection);
19799
- const { treeTable } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
19798
+ const { treeTable, dragSortBy } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
19800
19799
  if (props.dragSort) {
19801
- params["sort"] = ["sort"];
19800
+ params["sort"] = dragSortBy || ["sort"];
19802
19801
  }
19803
19802
  let childrenColumnName = "children";
19804
19803
  if ((collection2 == null ? void 0 : collection2.tree) && treeTable !== false) {
@@ -19839,16 +19838,17 @@ const useTableBlockProps = () => {
19839
19838
  const globalSort = (_c = (_b = (_a = fieldSchema.parent) == null ? void 0 : _a["x-decorator-props"]) == null ? void 0 : _b["params"]) == null ? void 0 : _c["sort"];
19840
19839
  const { getDataBlocks } = useFilterBlock();
19841
19840
  useEffect(() => {
19842
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n;
19841
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p;
19843
19842
  if (!((_a2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _a2.loading)) {
19844
19843
  field.value = [];
19845
19844
  field.value = (_c2 = (_b2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _b2.data) == null ? void 0 : _c2.data;
19845
+ field.setInitialValue((_e2 = (_d2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _d2.data) == null ? void 0 : _e2.data);
19846
19846
  field.data = field.data || {};
19847
- field.data.selectedRowKeys = (_e2 = (_d2 = ctx == null ? void 0 : ctx.field) == null ? void 0 : _d2.data) == null ? void 0 : _e2.selectedRowKeys;
19847
+ field.data.selectedRowKeys = (_g2 = (_f2 = ctx == null ? void 0 : ctx.field) == null ? void 0 : _f2.data) == null ? void 0 : _g2.selectedRowKeys;
19848
19848
  field.componentProps.pagination = field.componentProps.pagination || {};
19849
- field.componentProps.pagination.pageSize = (_h2 = (_g2 = (_f2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _f2.data) == null ? void 0 : _g2.meta) == null ? void 0 : _h2.pageSize;
19850
- field.componentProps.pagination.total = (_k = (_j = (_i2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _i2.data) == null ? void 0 : _j.meta) == null ? void 0 : _k.count;
19851
- field.componentProps.pagination.current = (_n = (_m = (_l = ctx == null ? void 0 : ctx.service) == null ? void 0 : _l.data) == null ? void 0 : _m.meta) == null ? void 0 : _n.page;
19849
+ field.componentProps.pagination.pageSize = (_j = (_i2 = (_h2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _h2.data) == null ? void 0 : _i2.meta) == null ? void 0 : _j.pageSize;
19850
+ field.componentProps.pagination.total = (_m = (_l = (_k = ctx == null ? void 0 : ctx.service) == null ? void 0 : _k.data) == null ? void 0 : _l.meta) == null ? void 0 : _m.count;
19851
+ field.componentProps.pagination.current = (_p = (_o = (_n = ctx == null ? void 0 : ctx.service) == null ? void 0 : _n.data) == null ? void 0 : _o.meta) == null ? void 0 : _p.page;
19852
19852
  }
19853
19853
  }, [(_d = ctx == null ? void 0 : ctx.service) == null ? void 0 : _d.loading]);
19854
19854
  return {
@@ -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;
@@ -37233,10 +37235,10 @@ const Calendar$1 = observer(
37233
37235
  agendaDateFormat: "M-DD",
37234
37236
  dayHeaderFormat: "YYYY-M-DD",
37235
37237
  dayRangeHeaderFormat: ({ start, end }, culture, local) => {
37236
- if (eq(start, end, "month")) {
37237
- return local.format(start, "Y-M", culture);
37238
+ if (dates.eq(start, end, "month")) {
37239
+ return local.format(start, "YYYY-M", culture);
37238
37240
  }
37239
- return `${local.format(start, "Y-M", culture)} - ${local.format(end, "Y-M", culture)}`;
37241
+ return `${local.format(start, "YYYY-M", culture)} - ${local.format(end, "YYYY-M", culture)}`;
37240
37242
  }
37241
37243
  },
37242
37244
  components: components2,
@@ -37710,7 +37712,7 @@ function useOptions$2({ filter, isTableOid }) {
37710
37712
  const field = useField();
37711
37713
  const ctx = useContext(FilterContext$2);
37712
37714
  const collection2 = useCollection();
37713
- const targetCollection = isTableOid && (((_a = ctx == null ? void 0 : ctx.field) == null ? void 0 : _a.collectionName) || collection2.name);
37715
+ const targetCollection = isTableOid && (((_a = ctx == null ? void 0 : ctx.field) == null ? void 0 : _a.collectionName) || ctx.collectionName || collection2.name);
37714
37716
  const inheritCollections = useSelfAndChildrenCollections(targetCollection);
37715
37717
  const { collections = [] } = useCollectionManager();
37716
37718
  const currentCollections = (field == null ? void 0 : field.dataSource) ? collections.filter((v) => {
@@ -39224,12 +39226,12 @@ const G2Plot = observer(
39224
39226
  );
39225
39227
  G2Plot.Designer = G2PlotDesigner;
39226
39228
  G2Plot.plots = plots;
39227
- const convertToBarTasks = (tasks, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39229
+ const convertToBarTasks = (tasks, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39228
39230
  let barTasks = tasks.map((t, i) => {
39229
39231
  return convertToBarTask(
39230
39232
  t,
39231
39233
  i,
39232
- dates,
39234
+ dates2,
39233
39235
  columnWidth,
39234
39236
  rowHeight,
39235
39237
  taskHeight,
@@ -39259,14 +39261,14 @@ const convertToBarTasks = (tasks, dates, columnWidth, rowHeight, taskHeight, bar
39259
39261
  });
39260
39262
  return barTasks;
39261
39263
  };
39262
- const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39264
+ const convertToBarTask = (task, index2, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39263
39265
  let barTask;
39264
39266
  switch (task.type) {
39265
39267
  case "milestone":
39266
39268
  barTask = convertToMilestone(
39267
39269
  task,
39268
39270
  index2,
39269
- dates,
39271
+ dates2,
39270
39272
  columnWidth,
39271
39273
  rowHeight,
39272
39274
  taskHeight,
@@ -39280,7 +39282,7 @@ const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeigh
39280
39282
  barTask = convertToBar(
39281
39283
  task,
39282
39284
  index2,
39283
- dates,
39285
+ dates2,
39284
39286
  columnWidth,
39285
39287
  rowHeight,
39286
39288
  taskHeight * 0.5,
@@ -39297,7 +39299,7 @@ const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeigh
39297
39299
  barTask = convertToBar(
39298
39300
  task,
39299
39301
  index2,
39300
- dates,
39302
+ dates2,
39301
39303
  columnWidth,
39302
39304
  rowHeight,
39303
39305
  taskHeight,
@@ -39313,15 +39315,15 @@ const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeigh
39313
39315
  }
39314
39316
  return barTask;
39315
39317
  };
39316
- const convertToBar = (task, index2, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) => {
39318
+ const convertToBar = (task, index2, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) => {
39317
39319
  let x1;
39318
39320
  let x2;
39319
39321
  if (rtl) {
39320
- x2 = taskXCoordinateRTL(task.start, dates, columnWidth);
39321
- x1 = taskXCoordinateRTL(task.end, dates, columnWidth);
39322
+ x2 = taskXCoordinateRTL(task.start, dates2, columnWidth);
39323
+ x1 = taskXCoordinateRTL(task.end, dates2, columnWidth);
39322
39324
  } else {
39323
- x1 = taskXCoordinate(task.start, dates, columnWidth);
39324
- x2 = taskXCoordinate(task.end, dates, columnWidth);
39325
+ x1 = taskXCoordinate(task.start, dates2, columnWidth);
39326
+ x2 = taskXCoordinate(task.end, dates2, columnWidth);
39325
39327
  }
39326
39328
  let typeInternal = task.type;
39327
39329
  if (typeInternal === "task" && x2 - x1 < handleWidth * 2) {
@@ -39353,8 +39355,8 @@ const convertToBar = (task, index2, dates, columnWidth, rowHeight, taskHeight, b
39353
39355
  styles
39354
39356
  });
39355
39357
  };
39356
- const convertToMilestone = (task, index2, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39357
- const x = taskXCoordinate(task.start, dates, columnWidth);
39358
+ const convertToMilestone = (task, index2, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39359
+ const x = taskXCoordinate(task.start, dates2, columnWidth);
39358
39360
  const y = taskYCoordinate(index2, rowHeight, taskHeight);
39359
39361
  const x1 = x - taskHeight * 0.5;
39360
39362
  const x2 = x + taskHeight * 0.5;
@@ -39383,16 +39385,16 @@ const convertToMilestone = (task, index2, dates, columnWidth, rowHeight, taskHei
39383
39385
  styles
39384
39386
  });
39385
39387
  };
39386
- const taskXCoordinate = (xDate, dates, columnWidth) => {
39388
+ const taskXCoordinate = (xDate, dates2, columnWidth) => {
39387
39389
  var _a, _b, _c;
39388
- const index2 = dates.findIndex((d) => (d == null ? void 0 : d.getTime()) >= (xDate == null ? void 0 : xDate.getTime())) - 1;
39389
- const remainderMillis = (xDate == null ? void 0 : xDate.getTime()) - ((_a = dates[index2]) == null ? void 0 : _a.getTime());
39390
- const percentOfInterval = remainderMillis / (((_b = dates[index2 + 1]) == null ? void 0 : _b.getTime()) - ((_c = dates[index2]) == null ? void 0 : _c.getTime()));
39390
+ const index2 = dates2.findIndex((d) => (d == null ? void 0 : d.getTime()) >= (xDate == null ? void 0 : xDate.getTime())) - 1;
39391
+ const remainderMillis = (xDate == null ? void 0 : xDate.getTime()) - ((_a = dates2[index2]) == null ? void 0 : _a.getTime());
39392
+ const percentOfInterval = remainderMillis / (((_b = dates2[index2 + 1]) == null ? void 0 : _b.getTime()) - ((_c = dates2[index2]) == null ? void 0 : _c.getTime()));
39391
39393
  const x = index2 * columnWidth + percentOfInterval * columnWidth;
39392
39394
  return isNaN(x) ? 0 : x;
39393
39395
  };
39394
- const taskXCoordinateRTL = (xDate, dates, columnWidth) => {
39395
- let x = taskXCoordinate(xDate, dates, columnWidth);
39396
+ const taskXCoordinateRTL = (xDate, dates2, columnWidth) => {
39397
+ let x = taskXCoordinate(xDate, dates2, columnWidth);
39396
39398
  x += columnWidth;
39397
39399
  return isNaN(x) ? 0 : x;
39398
39400
  };
@@ -39705,7 +39707,7 @@ const ganttDateRange = (tasks, viewMode, preStepsCount) => {
39705
39707
  };
39706
39708
  const seedDates = (startDate, endDate, viewMode) => {
39707
39709
  let currentDate = new Date(startDate);
39708
- const dates = [currentDate];
39710
+ const dates2 = [currentDate];
39709
39711
  while (currentDate < endDate) {
39710
39712
  switch (viewMode) {
39711
39713
  case ViewMode.Year:
@@ -39733,9 +39735,9 @@ const seedDates = (startDate, endDate, viewMode) => {
39733
39735
  currentDate = addToDate(currentDate, 1, "hour");
39734
39736
  break;
39735
39737
  }
39736
- dates.push(currentDate);
39738
+ dates2.push(currentDate);
39737
39739
  }
39738
- return dates;
39740
+ return dates2;
39739
39741
  };
39740
39742
  const getLocaleMonth = (date2, locale2) => {
39741
39743
  let bottomValue = getCachedDateTimeFormat(locale2, {
@@ -40286,11 +40288,11 @@ const Calendar = ({
40286
40288
  const bottomValues2 = [];
40287
40289
  let weeksCount = 1;
40288
40290
  const topDefaultHeight = headerHeight * 0.5;
40289
- const dates = dateSetup.dates;
40290
- for (let i = dates.length - 1; i >= 0; i--) {
40291
- const date2 = dates[i];
40291
+ const dates2 = dateSetup.dates;
40292
+ for (let i = dates2.length - 1; i >= 0; i--) {
40293
+ const date2 = dates2[i];
40292
40294
  let topValue = "";
40293
- if (i === 0 || date2.getMonth() !== dates[i - 1].getMonth()) {
40295
+ if (i === 0 || date2.getMonth() !== dates2[i - 1].getMonth()) {
40294
40296
  topValue = `${getLocaleMonth(date2, locale2)}, ${date2.getFullYear()}`;
40295
40297
  }
40296
40298
  const bottomValue = `W${getWeekNumberISO8601(date2)}`;
@@ -40307,7 +40309,7 @@ const Calendar = ({
40307
40309
  )
40308
40310
  );
40309
40311
  if (topValue) {
40310
- if (i !== dates.length - 1) {
40312
+ if (i !== dates2.length - 1) {
40311
40313
  topValues2.push(
40312
40314
  /* @__PURE__ */ jsx(
40313
40315
  TopPartOfCalendar,
@@ -40333,9 +40335,9 @@ const Calendar = ({
40333
40335
  const topValues2 = [];
40334
40336
  const bottomValues2 = [];
40335
40337
  const topDefaultHeight = headerHeight * 0.5;
40336
- const dates = dateSetup.dates;
40337
- for (let i = 0; i < dates.length; i++) {
40338
- const date2 = dates[i];
40338
+ const dates2 = dateSetup.dates;
40339
+ for (let i = 0; i < dates2.length; i++) {
40340
+ const date2 = dates2[i];
40339
40341
  const bottomValue = `${date2.getDate().toString()}`;
40340
40342
  bottomValues2.push(
40341
40343
  /* @__PURE__ */ jsx(
@@ -40349,7 +40351,7 @@ const Calendar = ({
40349
40351
  date2.getTime()
40350
40352
  )
40351
40353
  );
40352
- if (i + 1 !== dates.length && date2.getMonth() !== dates[i + 1].getMonth()) {
40354
+ if (i + 1 !== dates2.length && date2.getMonth() !== dates2[i + 1].getMonth()) {
40353
40355
  const topValue = getLocaleMonth(date2, locale2);
40354
40356
  topValues2.push(
40355
40357
  /* @__PURE__ */ jsx(
@@ -40374,9 +40376,9 @@ const Calendar = ({
40374
40376
  const bottomValues2 = [];
40375
40377
  const ticks = viewMode === ViewMode.HalfDay ? 2 : 4;
40376
40378
  const topDefaultHeight = headerHeight * 0.5;
40377
- const dates = dateSetup.dates;
40378
- for (let i = 0; i < dates.length; i++) {
40379
- const date2 = dates[i];
40379
+ const dates2 = dateSetup.dates;
40380
+ for (let i = 0; i < dates2.length; i++) {
40381
+ const date2 = dates2[i];
40380
40382
  const bottomValue = getCachedDateTimeFormat(locale2, {
40381
40383
  hour: "numeric"
40382
40384
  }).format(date2).replace("时", "");
@@ -40393,7 +40395,7 @@ const Calendar = ({
40393
40395
  date2.getTime()
40394
40396
  )
40395
40397
  );
40396
- if (i === 0 || date2.getDate() !== dates[i - 1].getDate()) {
40398
+ if (i === 0 || date2.getDate() !== dates2[i - 1].getDate()) {
40397
40399
  const topValue = `${getLocalDayOfWeek(date2, locale2, "short")}, ${date2.getDate()} ${getLocaleMonth(
40398
40400
  date2,
40399
40401
  locale2
@@ -40421,9 +40423,9 @@ const Calendar = ({
40421
40423
  const topValues2 = [];
40422
40424
  const bottomValues2 = [];
40423
40425
  const topDefaultHeight = headerHeight * 0.5;
40424
- const dates = dateSetup.dates;
40425
- for (let i = 0; i < dates.length; i++) {
40426
- const date2 = dates[i];
40426
+ const dates2 = dateSetup.dates;
40427
+ for (let i = 0; i < dates2.length; i++) {
40428
+ const date2 = dates2[i];
40427
40429
  const bottomValue = (_a = getCachedDateTimeFormat(locale2, {
40428
40430
  hour: "numeric"
40429
40431
  }).format(date2)) == null ? void 0 : _a.replace("时", "");
@@ -40440,8 +40442,8 @@ const Calendar = ({
40440
40442
  date2.getTime()
40441
40443
  )
40442
40444
  );
40443
- if (i !== 0 && date2.getDate() !== dates[i - 1].getDate()) {
40444
- const displayDate = dates[i - 1];
40445
+ if (i !== 0 && date2.getDate() !== dates2[i - 1].getDate()) {
40446
+ const displayDate = dates2[i - 1];
40445
40447
  const topValue = `${getLocalDayOfWeek(displayDate, locale2, "long")}, ${displayDate.getDate()} ${getLocaleMonth(
40446
40448
  displayDate,
40447
40449
  locale2
@@ -40530,10 +40532,10 @@ const useStyles$b = genStyleHook("nb-grid-body", (token) => {
40530
40532
  }
40531
40533
  };
40532
40534
  });
40533
- const empty = [{ id: uid$2() }, { id: uid$2() }, { id: uid$2() }];
40535
+ const empty = [{ id: uid$1() }, { id: uid$1() }, { id: uid$1() }];
40534
40536
  const GridBody = ({
40535
40537
  tasks,
40536
- dates,
40538
+ dates: dates2,
40537
40539
  rowHeight,
40538
40540
  svgWidth,
40539
40541
  columnWidth,
@@ -40581,14 +40583,14 @@ const GridBody = ({
40581
40583
  let tickX = 0;
40582
40584
  const ticks = [];
40583
40585
  let today = /* @__PURE__ */ jsx("rect", {});
40584
- for (let i = 0; i < dates.length; i++) {
40585
- const date2 = dates[i];
40586
+ for (let i = 0; i < dates2.length; i++) {
40587
+ const date2 = dates2[i];
40586
40588
  ticks.push(/* @__PURE__ */ jsx("line", { x1: tickX, y1: 0, x2: tickX, y2: y, className: cx("gridTick") }, date2.getTime()));
40587
- if (i + 1 !== dates.length && date2.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || // if current date is last
40588
- i !== 0 && i + 1 === dates.length && date2.getTime() < now.getTime() && addToDate(date2, date2.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
40589
+ if (i + 1 !== dates2.length && date2.getTime() < now.getTime() && dates2[i + 1].getTime() >= now.getTime() || // if current date is last
40590
+ i !== 0 && i + 1 === dates2.length && date2.getTime() < now.getTime() && addToDate(date2, date2.getTime() - dates2[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
40589
40591
  today = /* @__PURE__ */ jsx("rect", { x: tickX, y: 0, width: columnWidth, height: y, fill: todayColor });
40590
40592
  }
40591
- if (rtl && i + 1 !== dates.length && date2.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
40593
+ if (rtl && i + 1 !== dates2.length && date2.getTime() >= now.getTime() && dates2[i + 1].getTime() < now.getTime()) {
40592
40594
  today = /* @__PURE__ */ jsx("rect", { x: tickX + columnWidth, y: 0, width: columnWidth, height: y, fill: todayColor });
40593
40595
  }
40594
40596
  tickX += columnWidth;
@@ -41055,7 +41057,7 @@ let lastAction = null;
41055
41057
  let lastStart = null;
41056
41058
  const TaskGanttContent = ({
41057
41059
  tasks,
41058
- dates,
41060
+ dates: dates2,
41059
41061
  ganttEvent,
41060
41062
  selectedTask,
41061
41063
  rowHeight,
@@ -41084,10 +41086,10 @@ const TaskGanttContent = ({
41084
41086
  const [isMoving, setIsMoving] = useState(false);
41085
41087
  useEffect(() => {
41086
41088
  var _a2, _b, _c, _d;
41087
- const dateDelta = ((_a2 = dates[1]) == null ? void 0 : _a2.getTime()) - ((_b = dates[0]) == null ? void 0 : _b.getTime()) - ((_c = dates[1]) == null ? void 0 : _c.getTimezoneOffset()) * 60 * 1e3 + ((_d = dates[0]) == null ? void 0 : _d.getTimezoneOffset()) * 60 * 1e3;
41089
+ const dateDelta = ((_a2 = dates2[1]) == null ? void 0 : _a2.getTime()) - ((_b = dates2[0]) == null ? void 0 : _b.getTime()) - ((_c = dates2[1]) == null ? void 0 : _c.getTimezoneOffset()) * 60 * 1e3 + ((_d = dates2[0]) == null ? void 0 : _d.getTimezoneOffset()) * 60 * 1e3;
41088
41090
  const newXStep = timeStep * columnWidth / dateDelta;
41089
41091
  setXStep(newXStep);
41090
- }, [columnWidth, dates, timeStep]);
41092
+ }, [columnWidth, dates2, timeStep]);
41091
41093
  useEffect(() => {
41092
41094
  const handleMouseMove = (event) => __async(void 0, null, function* () {
41093
41095
  var _a2;
@@ -41502,9 +41504,9 @@ const Gantt = (props) => {
41502
41504
  ]);
41503
41505
  useEffect(() => {
41504
41506
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate == null ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
41505
- const dates = dateSetup.dates;
41506
- const index2 = dates.findIndex(
41507
- (d, i) => viewDate.valueOf() >= d.valueOf() && i + 1 !== dates.length && viewDate.valueOf() < dates[i + 1].valueOf()
41507
+ const dates2 = dateSetup.dates;
41508
+ const index2 = dates2.findIndex(
41509
+ (d, i) => viewDate.valueOf() >= d.valueOf() && i + 1 !== dates2.length && viewDate.valueOf() < dates2[i + 1].valueOf()
41508
41510
  );
41509
41511
  if (index2 === -1) {
41510
41512
  return;
@@ -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, {}),
@@ -65891,8 +65904,9 @@ const getProps = (app) => {
65891
65904
  if (app.ws.serverDown) {
65892
65905
  return {
65893
65906
  status: "error",
65894
- title: "App error",
65895
- subTitle: "The server is down"
65907
+ icon: /* @__PURE__ */ jsx(DisconnectOutlined, {}),
65908
+ title: "You're offline",
65909
+ subTitle: "Please check the server status or network connection status"
65896
65910
  };
65897
65911
  }
65898
65912
  if (!app.error) {
package/lib/index.js CHANGED
@@ -752,11 +752,10 @@ var import_react_drag_listview = __toESM(require("react-drag-listview"));
752
752
  var import_internals = require("@formily/core/esm/shared/internals");
753
753
  var import_style3 = __toESM(require("antd/es/input/style"));
754
754
  var import_sanitize_html = __toESM(require("sanitize-html"));
755
- var import_utils = require("@nocobase/utils");
756
755
  var import_lru_cache = __toESM(require("lru-cache"));
757
756
  var import_cron_parser = require("cron-parser");
758
- var import_date_arithmetic = require("date-arithmetic");
759
757
  var import_react_big_calendar = require("react-big-calendar");
758
+ var dates = __toESM(require("react-big-calendar/lib/utils/dates"));
760
759
  var import_solarlunar_es = __toESM(require("solarlunar-es"));
761
760
  var import_react_big_calendar2 = require("react-big-calendar/dist/react-big-calendar.esm");
762
761
  var import_useAttach = require("@formily/react/esm/hooks/useAttach");
@@ -20446,9 +20445,9 @@ const TableBlockProvider = (props) => {
20446
20445
  const { getCollection, getCollectionField } = useCollectionManager();
20447
20446
  const record = useRecord();
20448
20447
  const collection2 = getCollection(props.collection);
20449
- const { treeTable } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
20448
+ const { treeTable, dragSortBy } = (fieldSchema == null ? void 0 : fieldSchema["x-decorator-props"]) || {};
20450
20449
  if (props.dragSort) {
20451
- params["sort"] = ["sort"];
20450
+ params["sort"] = dragSortBy || ["sort"];
20452
20451
  }
20453
20452
  let childrenColumnName = "children";
20454
20453
  if ((collection2 == null ? void 0 : collection2.tree) && treeTable !== false) {
@@ -20489,16 +20488,17 @@ const useTableBlockProps = () => {
20489
20488
  const globalSort = (_c = (_b = (_a = fieldSchema.parent) == null ? void 0 : _a["x-decorator-props"]) == null ? void 0 : _b["params"]) == null ? void 0 : _c["sort"];
20490
20489
  const { getDataBlocks } = useFilterBlock();
20491
20490
  (0, import_react2.useEffect)(() => {
20492
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n;
20491
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p;
20493
20492
  if (!((_a2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _a2.loading)) {
20494
20493
  field.value = [];
20495
20494
  field.value = (_c2 = (_b2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _b2.data) == null ? void 0 : _c2.data;
20495
+ field.setInitialValue((_e2 = (_d2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _d2.data) == null ? void 0 : _e2.data);
20496
20496
  field.data = field.data || {};
20497
- field.data.selectedRowKeys = (_e2 = (_d2 = ctx == null ? void 0 : ctx.field) == null ? void 0 : _d2.data) == null ? void 0 : _e2.selectedRowKeys;
20497
+ field.data.selectedRowKeys = (_g2 = (_f2 = ctx == null ? void 0 : ctx.field) == null ? void 0 : _f2.data) == null ? void 0 : _g2.selectedRowKeys;
20498
20498
  field.componentProps.pagination = field.componentProps.pagination || {};
20499
- field.componentProps.pagination.pageSize = (_h2 = (_g2 = (_f2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _f2.data) == null ? void 0 : _g2.meta) == null ? void 0 : _h2.pageSize;
20500
- field.componentProps.pagination.total = (_k = (_j = (_i2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _i2.data) == null ? void 0 : _j.meta) == null ? void 0 : _k.count;
20501
- field.componentProps.pagination.current = (_n = (_m = (_l = ctx == null ? void 0 : ctx.service) == null ? void 0 : _l.data) == null ? void 0 : _m.meta) == null ? void 0 : _n.page;
20499
+ field.componentProps.pagination.pageSize = (_j = (_i2 = (_h2 = ctx == null ? void 0 : ctx.service) == null ? void 0 : _h2.data) == null ? void 0 : _i2.meta) == null ? void 0 : _j.pageSize;
20500
+ field.componentProps.pagination.total = (_m = (_l = (_k = ctx == null ? void 0 : ctx.service) == null ? void 0 : _k.data) == null ? void 0 : _l.meta) == null ? void 0 : _m.count;
20501
+ field.componentProps.pagination.current = (_p = (_o = (_n = ctx == null ? void 0 : ctx.service) == null ? void 0 : _n.data) == null ? void 0 : _o.meta) == null ? void 0 : _p.page;
20502
20502
  }
20503
20503
  }, [(_d = ctx == null ? void 0 : ctx.service) == null ? void 0 : _d.loading]);
20504
20504
  return {
@@ -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;
@@ -37883,10 +37885,10 @@ const Calendar$1 = (0, import_react.observer)(
37883
37885
  agendaDateFormat: "M-DD",
37884
37886
  dayHeaderFormat: "YYYY-M-DD",
37885
37887
  dayRangeHeaderFormat: ({ start, end }, culture, local) => {
37886
- if ((0, import_date_arithmetic.eq)(start, end, "month")) {
37887
- return local.format(start, "Y-M", culture);
37888
+ if (dates.eq(start, end, "month")) {
37889
+ return local.format(start, "YYYY-M", culture);
37888
37890
  }
37889
- return `${local.format(start, "Y-M", culture)} - ${local.format(end, "Y-M", culture)}`;
37891
+ return `${local.format(start, "YYYY-M", culture)} - ${local.format(end, "YYYY-M", culture)}`;
37890
37892
  }
37891
37893
  },
37892
37894
  components: components2,
@@ -38360,7 +38362,7 @@ function useOptions$2({ filter, isTableOid }) {
38360
38362
  const field = (0, import_react.useField)();
38361
38363
  const ctx = (0, import_react2.useContext)(FilterContext$2);
38362
38364
  const collection2 = useCollection();
38363
- const targetCollection = isTableOid && (((_a = ctx == null ? void 0 : ctx.field) == null ? void 0 : _a.collectionName) || collection2.name);
38365
+ const targetCollection = isTableOid && (((_a = ctx == null ? void 0 : ctx.field) == null ? void 0 : _a.collectionName) || ctx.collectionName || collection2.name);
38364
38366
  const inheritCollections = useSelfAndChildrenCollections(targetCollection);
38365
38367
  const { collections = [] } = useCollectionManager();
38366
38368
  const currentCollections = (field == null ? void 0 : field.dataSource) ? collections.filter((v) => {
@@ -38826,7 +38828,7 @@ function replaceVariables(_0, _1) {
38826
38828
  }
38827
38829
  const waitForParsing = (_a = value.match(REGEX_OF_VARIABLE)) == null ? void 0 : _a.map((item) => __async(this, null, function* () {
38828
38830
  const result = yield variables.parseVariable(item, localVariables);
38829
- const id2 = `_${(0, import_utils.uid)()}`;
38831
+ const id2 = `_${(0, import_client.uid)()}`;
38830
38832
  scope[id2] = result;
38831
38833
  store[item] = id2;
38832
38834
  return result;
@@ -39874,12 +39876,12 @@ const G2Plot = (0, import_react.observer)(
39874
39876
  );
39875
39877
  G2Plot.Designer = G2PlotDesigner;
39876
39878
  G2Plot.plots = plots;
39877
- const convertToBarTasks = (tasks, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39879
+ const convertToBarTasks = (tasks, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39878
39880
  let barTasks = tasks.map((t, i) => {
39879
39881
  return convertToBarTask(
39880
39882
  t,
39881
39883
  i,
39882
- dates,
39884
+ dates2,
39883
39885
  columnWidth,
39884
39886
  rowHeight,
39885
39887
  taskHeight,
@@ -39909,14 +39911,14 @@ const convertToBarTasks = (tasks, dates, columnWidth, rowHeight, taskHeight, bar
39909
39911
  });
39910
39912
  return barTasks;
39911
39913
  };
39912
- const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39914
+ const convertToBarTask = (task, index2, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
39913
39915
  let barTask;
39914
39916
  switch (task.type) {
39915
39917
  case "milestone":
39916
39918
  barTask = convertToMilestone(
39917
39919
  task,
39918
39920
  index2,
39919
- dates,
39921
+ dates2,
39920
39922
  columnWidth,
39921
39923
  rowHeight,
39922
39924
  taskHeight,
@@ -39930,7 +39932,7 @@ const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeigh
39930
39932
  barTask = convertToBar(
39931
39933
  task,
39932
39934
  index2,
39933
- dates,
39935
+ dates2,
39934
39936
  columnWidth,
39935
39937
  rowHeight,
39936
39938
  taskHeight * 0.5,
@@ -39947,7 +39949,7 @@ const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeigh
39947
39949
  barTask = convertToBar(
39948
39950
  task,
39949
39951
  index2,
39950
- dates,
39952
+ dates2,
39951
39953
  columnWidth,
39952
39954
  rowHeight,
39953
39955
  taskHeight,
@@ -39963,15 +39965,15 @@ const convertToBarTask = (task, index2, dates, columnWidth, rowHeight, taskHeigh
39963
39965
  }
39964
39966
  return barTask;
39965
39967
  };
39966
- const convertToBar = (task, index2, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) => {
39968
+ const convertToBar = (task, index2, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) => {
39967
39969
  let x1;
39968
39970
  let x2;
39969
39971
  if (rtl) {
39970
- x2 = taskXCoordinateRTL(task.start, dates, columnWidth);
39971
- x1 = taskXCoordinateRTL(task.end, dates, columnWidth);
39972
+ x2 = taskXCoordinateRTL(task.start, dates2, columnWidth);
39973
+ x1 = taskXCoordinateRTL(task.end, dates2, columnWidth);
39972
39974
  } else {
39973
- x1 = taskXCoordinate(task.start, dates, columnWidth);
39974
- x2 = taskXCoordinate(task.end, dates, columnWidth);
39975
+ x1 = taskXCoordinate(task.start, dates2, columnWidth);
39976
+ x2 = taskXCoordinate(task.end, dates2, columnWidth);
39975
39977
  }
39976
39978
  let typeInternal = task.type;
39977
39979
  if (typeInternal === "task" && x2 - x1 < handleWidth * 2) {
@@ -40003,8 +40005,8 @@ const convertToBar = (task, index2, dates, columnWidth, rowHeight, taskHeight, b
40003
40005
  styles
40004
40006
  });
40005
40007
  };
40006
- const convertToMilestone = (task, index2, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
40007
- const x = taskXCoordinate(task.start, dates, columnWidth);
40008
+ const convertToMilestone = (task, index2, dates2, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) => {
40009
+ const x = taskXCoordinate(task.start, dates2, columnWidth);
40008
40010
  const y = taskYCoordinate(index2, rowHeight, taskHeight);
40009
40011
  const x1 = x - taskHeight * 0.5;
40010
40012
  const x2 = x + taskHeight * 0.5;
@@ -40033,16 +40035,16 @@ const convertToMilestone = (task, index2, dates, columnWidth, rowHeight, taskHei
40033
40035
  styles
40034
40036
  });
40035
40037
  };
40036
- const taskXCoordinate = (xDate, dates, columnWidth) => {
40038
+ const taskXCoordinate = (xDate, dates2, columnWidth) => {
40037
40039
  var _a, _b, _c;
40038
- const index2 = dates.findIndex((d) => (d == null ? void 0 : d.getTime()) >= (xDate == null ? void 0 : xDate.getTime())) - 1;
40039
- const remainderMillis = (xDate == null ? void 0 : xDate.getTime()) - ((_a = dates[index2]) == null ? void 0 : _a.getTime());
40040
- const percentOfInterval = remainderMillis / (((_b = dates[index2 + 1]) == null ? void 0 : _b.getTime()) - ((_c = dates[index2]) == null ? void 0 : _c.getTime()));
40040
+ const index2 = dates2.findIndex((d) => (d == null ? void 0 : d.getTime()) >= (xDate == null ? void 0 : xDate.getTime())) - 1;
40041
+ const remainderMillis = (xDate == null ? void 0 : xDate.getTime()) - ((_a = dates2[index2]) == null ? void 0 : _a.getTime());
40042
+ const percentOfInterval = remainderMillis / (((_b = dates2[index2 + 1]) == null ? void 0 : _b.getTime()) - ((_c = dates2[index2]) == null ? void 0 : _c.getTime()));
40041
40043
  const x = index2 * columnWidth + percentOfInterval * columnWidth;
40042
40044
  return isNaN(x) ? 0 : x;
40043
40045
  };
40044
- const taskXCoordinateRTL = (xDate, dates, columnWidth) => {
40045
- let x = taskXCoordinate(xDate, dates, columnWidth);
40046
+ const taskXCoordinateRTL = (xDate, dates2, columnWidth) => {
40047
+ let x = taskXCoordinate(xDate, dates2, columnWidth);
40046
40048
  x += columnWidth;
40047
40049
  return isNaN(x) ? 0 : x;
40048
40050
  };
@@ -40355,7 +40357,7 @@ const ganttDateRange = (tasks, viewMode, preStepsCount) => {
40355
40357
  };
40356
40358
  const seedDates = (startDate, endDate, viewMode) => {
40357
40359
  let currentDate = new Date(startDate);
40358
- const dates = [currentDate];
40360
+ const dates2 = [currentDate];
40359
40361
  while (currentDate < endDate) {
40360
40362
  switch (viewMode) {
40361
40363
  case ViewMode.Year:
@@ -40383,9 +40385,9 @@ const seedDates = (startDate, endDate, viewMode) => {
40383
40385
  currentDate = addToDate(currentDate, 1, "hour");
40384
40386
  break;
40385
40387
  }
40386
- dates.push(currentDate);
40388
+ dates2.push(currentDate);
40387
40389
  }
40388
- return dates;
40390
+ return dates2;
40389
40391
  };
40390
40392
  const getLocaleMonth = (date2, locale2) => {
40391
40393
  let bottomValue = getCachedDateTimeFormat(locale2, {
@@ -40936,11 +40938,11 @@ const Calendar = ({
40936
40938
  const bottomValues2 = [];
40937
40939
  let weeksCount = 1;
40938
40940
  const topDefaultHeight = headerHeight * 0.5;
40939
- const dates = dateSetup.dates;
40940
- for (let i = dates.length - 1; i >= 0; i--) {
40941
- const date2 = dates[i];
40941
+ const dates2 = dateSetup.dates;
40942
+ for (let i = dates2.length - 1; i >= 0; i--) {
40943
+ const date2 = dates2[i];
40942
40944
  let topValue = "";
40943
- if (i === 0 || date2.getMonth() !== dates[i - 1].getMonth()) {
40945
+ if (i === 0 || date2.getMonth() !== dates2[i - 1].getMonth()) {
40944
40946
  topValue = `${getLocaleMonth(date2, locale2)}, ${date2.getFullYear()}`;
40945
40947
  }
40946
40948
  const bottomValue = `W${getWeekNumberISO8601(date2)}`;
@@ -40957,7 +40959,7 @@ const Calendar = ({
40957
40959
  )
40958
40960
  );
40959
40961
  if (topValue) {
40960
- if (i !== dates.length - 1) {
40962
+ if (i !== dates2.length - 1) {
40961
40963
  topValues2.push(
40962
40964
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
40963
40965
  TopPartOfCalendar,
@@ -40983,9 +40985,9 @@ const Calendar = ({
40983
40985
  const topValues2 = [];
40984
40986
  const bottomValues2 = [];
40985
40987
  const topDefaultHeight = headerHeight * 0.5;
40986
- const dates = dateSetup.dates;
40987
- for (let i = 0; i < dates.length; i++) {
40988
- const date2 = dates[i];
40988
+ const dates2 = dateSetup.dates;
40989
+ for (let i = 0; i < dates2.length; i++) {
40990
+ const date2 = dates2[i];
40989
40991
  const bottomValue = `${date2.getDate().toString()}`;
40990
40992
  bottomValues2.push(
40991
40993
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -40999,7 +41001,7 @@ const Calendar = ({
40999
41001
  date2.getTime()
41000
41002
  )
41001
41003
  );
41002
- if (i + 1 !== dates.length && date2.getMonth() !== dates[i + 1].getMonth()) {
41004
+ if (i + 1 !== dates2.length && date2.getMonth() !== dates2[i + 1].getMonth()) {
41003
41005
  const topValue = getLocaleMonth(date2, locale2);
41004
41006
  topValues2.push(
41005
41007
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -41024,9 +41026,9 @@ const Calendar = ({
41024
41026
  const bottomValues2 = [];
41025
41027
  const ticks = viewMode === ViewMode.HalfDay ? 2 : 4;
41026
41028
  const topDefaultHeight = headerHeight * 0.5;
41027
- const dates = dateSetup.dates;
41028
- for (let i = 0; i < dates.length; i++) {
41029
- const date2 = dates[i];
41029
+ const dates2 = dateSetup.dates;
41030
+ for (let i = 0; i < dates2.length; i++) {
41031
+ const date2 = dates2[i];
41030
41032
  const bottomValue = getCachedDateTimeFormat(locale2, {
41031
41033
  hour: "numeric"
41032
41034
  }).format(date2).replace("时", "");
@@ -41043,7 +41045,7 @@ const Calendar = ({
41043
41045
  date2.getTime()
41044
41046
  )
41045
41047
  );
41046
- if (i === 0 || date2.getDate() !== dates[i - 1].getDate()) {
41048
+ if (i === 0 || date2.getDate() !== dates2[i - 1].getDate()) {
41047
41049
  const topValue = `${getLocalDayOfWeek(date2, locale2, "short")}, ${date2.getDate()} ${getLocaleMonth(
41048
41050
  date2,
41049
41051
  locale2
@@ -41071,9 +41073,9 @@ const Calendar = ({
41071
41073
  const topValues2 = [];
41072
41074
  const bottomValues2 = [];
41073
41075
  const topDefaultHeight = headerHeight * 0.5;
41074
- const dates = dateSetup.dates;
41075
- for (let i = 0; i < dates.length; i++) {
41076
- const date2 = dates[i];
41076
+ const dates2 = dateSetup.dates;
41077
+ for (let i = 0; i < dates2.length; i++) {
41078
+ const date2 = dates2[i];
41077
41079
  const bottomValue = (_a = getCachedDateTimeFormat(locale2, {
41078
41080
  hour: "numeric"
41079
41081
  }).format(date2)) == null ? void 0 : _a.replace("时", "");
@@ -41090,8 +41092,8 @@ const Calendar = ({
41090
41092
  date2.getTime()
41091
41093
  )
41092
41094
  );
41093
- if (i !== 0 && date2.getDate() !== dates[i - 1].getDate()) {
41094
- const displayDate = dates[i - 1];
41095
+ if (i !== 0 && date2.getDate() !== dates2[i - 1].getDate()) {
41096
+ const displayDate = dates2[i - 1];
41095
41097
  const topValue = `${getLocalDayOfWeek(displayDate, locale2, "long")}, ${displayDate.getDate()} ${getLocaleMonth(
41096
41098
  displayDate,
41097
41099
  locale2
@@ -41183,7 +41185,7 @@ const useStyles$b = genStyleHook("nb-grid-body", (token) => {
41183
41185
  const empty = [{ id: (0, import_client.uid)() }, { id: (0, import_client.uid)() }, { id: (0, import_client.uid)() }];
41184
41186
  const GridBody = ({
41185
41187
  tasks,
41186
- dates,
41188
+ dates: dates2,
41187
41189
  rowHeight,
41188
41190
  svgWidth,
41189
41191
  columnWidth,
@@ -41231,14 +41233,14 @@ const GridBody = ({
41231
41233
  let tickX = 0;
41232
41234
  const ticks = [];
41233
41235
  let today = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {});
41234
- for (let i = 0; i < dates.length; i++) {
41235
- const date2 = dates[i];
41236
+ for (let i = 0; i < dates2.length; i++) {
41237
+ const date2 = dates2[i];
41236
41238
  ticks.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: tickX, y1: 0, x2: tickX, y2: y, className: (0, import_css.cx)("gridTick") }, date2.getTime()));
41237
- if (i + 1 !== dates.length && date2.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || // if current date is last
41238
- i !== 0 && i + 1 === dates.length && date2.getTime() < now.getTime() && addToDate(date2, date2.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
41239
+ if (i + 1 !== dates2.length && date2.getTime() < now.getTime() && dates2[i + 1].getTime() >= now.getTime() || // if current date is last
41240
+ i !== 0 && i + 1 === dates2.length && date2.getTime() < now.getTime() && addToDate(date2, date2.getTime() - dates2[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
41239
41241
  today = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: tickX, y: 0, width: columnWidth, height: y, fill: todayColor });
41240
41242
  }
41241
- if (rtl && i + 1 !== dates.length && date2.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
41243
+ if (rtl && i + 1 !== dates2.length && date2.getTime() >= now.getTime() && dates2[i + 1].getTime() < now.getTime()) {
41242
41244
  today = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: tickX + columnWidth, y: 0, width: columnWidth, height: y, fill: todayColor });
41243
41245
  }
41244
41246
  tickX += columnWidth;
@@ -41705,7 +41707,7 @@ let lastAction = null;
41705
41707
  let lastStart = null;
41706
41708
  const TaskGanttContent = ({
41707
41709
  tasks,
41708
- dates,
41710
+ dates: dates2,
41709
41711
  ganttEvent,
41710
41712
  selectedTask,
41711
41713
  rowHeight,
@@ -41734,10 +41736,10 @@ const TaskGanttContent = ({
41734
41736
  const [isMoving, setIsMoving] = (0, import_react2.useState)(false);
41735
41737
  (0, import_react2.useEffect)(() => {
41736
41738
  var _a2, _b, _c, _d;
41737
- const dateDelta = ((_a2 = dates[1]) == null ? void 0 : _a2.getTime()) - ((_b = dates[0]) == null ? void 0 : _b.getTime()) - ((_c = dates[1]) == null ? void 0 : _c.getTimezoneOffset()) * 60 * 1e3 + ((_d = dates[0]) == null ? void 0 : _d.getTimezoneOffset()) * 60 * 1e3;
41739
+ const dateDelta = ((_a2 = dates2[1]) == null ? void 0 : _a2.getTime()) - ((_b = dates2[0]) == null ? void 0 : _b.getTime()) - ((_c = dates2[1]) == null ? void 0 : _c.getTimezoneOffset()) * 60 * 1e3 + ((_d = dates2[0]) == null ? void 0 : _d.getTimezoneOffset()) * 60 * 1e3;
41738
41740
  const newXStep = timeStep * columnWidth / dateDelta;
41739
41741
  setXStep(newXStep);
41740
- }, [columnWidth, dates, timeStep]);
41742
+ }, [columnWidth, dates2, timeStep]);
41741
41743
  (0, import_react2.useEffect)(() => {
41742
41744
  const handleMouseMove = (event) => __async(void 0, null, function* () {
41743
41745
  var _a2;
@@ -42152,9 +42154,9 @@ const Gantt = (props) => {
42152
42154
  ]);
42153
42155
  (0, import_react2.useEffect)(() => {
42154
42156
  if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate == null ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
42155
- const dates = dateSetup.dates;
42156
- const index2 = dates.findIndex(
42157
- (d, i) => viewDate.valueOf() >= d.valueOf() && i + 1 !== dates.length && viewDate.valueOf() < dates[i + 1].valueOf()
42157
+ const dates2 = dateSetup.dates;
42158
+ const index2 = dates2.findIndex(
42159
+ (d, i) => viewDate.valueOf() >= d.valueOf() && i + 1 !== dates2.length && viewDate.valueOf() < dates2[i + 1].valueOf()
42158
42160
  );
42159
42161
  if (index2 === -1) {
42160
42162
  return;
@@ -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, {}),
@@ -66540,8 +66553,9 @@ const getProps = (app) => {
66540
66553
  if (app.ws.serverDown) {
66541
66554
  return {
66542
66555
  status: "error",
66543
- title: "App error",
66544
- subTitle: "The server is down"
66556
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DisconnectOutlined, {}),
66557
+ title: "You're offline",
66558
+ subTitle: "Please check the server status or network connection status"
66545
66559
  };
66546
66560
  }
66547
66561
  if (!app.error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.15.0-alpha.3",
3
+ "version": "0.15.0-alpha.5",
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.3",
29
- "@nocobase/sdk": "0.15.0-alpha.3",
30
- "@nocobase/utils": "0.15.0-alpha.3",
28
+ "@nocobase/evaluators": "0.15.0-alpha.5",
29
+ "@nocobase/sdk": "0.15.0-alpha.5",
30
+ "@nocobase/utils": "0.15.0-alpha.5",
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": "8f39868bd613a465efb20123094ebbc2390c1eef"
79
+ "gitHead": "4713b1a887dad4dadf27b65e3b3e2a46c6986cbf"
80
80
  }