@yudaocode/univer-bases-ui 1.6.218 → 1.6.219

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.
package/lib/cjs/index.js CHANGED
@@ -39,9 +39,11 @@ var __decorateParam = (index, decorator) => (target, key) => decorator(target, k
39
39
  // src/index.ts
40
40
  var src_exports = {};
41
41
  __export(src_exports, {
42
+ AutomationBuilderModal: () => AutomationBuilderModal,
42
43
  BASE_ICON_MAP: () => BASE_ICON_MAP,
43
44
  BASE_INSPECTOR_COMPONENT_KEY: () => BASE_INSPECTOR_COMPONENT_KEY,
44
45
  BASE_INSPECTOR_SIDEBAR_ID: () => BASE_INSPECTOR_SIDEBAR_ID,
46
+ BaseBoltIcon: () => BaseBoltIcon,
45
47
  BaseCalendarIcon: () => BaseCalendarIcon,
46
48
  BaseCheckIcon: () => BaseCheckIcon,
47
49
  BaseChevronDownIcon: () => BaseChevronDownIcon,
@@ -49,8 +51,10 @@ __export(src_exports, {
49
51
  BaseChevronRightIcon: () => BaseChevronRightIcon,
50
52
  BaseCloseIcon: () => BaseCloseIcon,
51
53
  BaseColorIcon: () => BaseColorIcon,
54
+ BaseColumnsIcon: () => BaseColumnsIcon,
52
55
  BaseDashboardIcon: () => BaseDashboardIcon,
53
56
  BaseDownloadIcon: () => BaseDownloadIcon,
57
+ BaseEditIcon: () => BaseEditIcon,
54
58
  BaseExpandIcon: () => BaseExpandIcon,
55
59
  BaseFieldTypeIcon: () => BaseFieldTypeIcon,
56
60
  BaseFilterIcon: () => BaseFilterIcon,
@@ -59,9 +63,13 @@ __export(src_exports, {
59
63
  BaseGanttIcon: () => BaseGanttIcon,
60
64
  BaseGridIcon: () => BaseGridIcon,
61
65
  BaseGroupIcon: () => BaseGroupIcon,
66
+ BaseIndentIcon: () => BaseIndentIcon,
62
67
  BaseInspectorIcon: () => BaseInspectorIcon,
63
68
  BaseKanbanIcon: () => BaseKanbanIcon,
64
69
  BaseLinkIcon: () => BaseLinkIcon,
70
+ BaseListIcon: () => BaseListIcon,
71
+ BaseOutdentIcon: () => BaseOutdentIcon,
72
+ BasePlayIcon: () => BasePlayIcon,
65
73
  BasePlusIcon: () => BasePlusIcon,
66
74
  BaseSearchIcon: () => BaseSearchIcon,
67
75
  BaseSortIcon: () => BaseSortIcon,
@@ -88,6 +96,7 @@ __export(src_exports, {
88
96
  GridCellEditor: () => GridCellEditor,
89
97
  GridView: () => GridView,
90
98
  KanbanView: () => KanbanView,
99
+ ListView: () => ListView,
91
100
  LoadBasePresetOperation: () => LoadBasePresetOperation,
92
101
  OpenBaseModalOperation: () => OpenBaseModalOperation,
93
102
  RecordDetailDrawer: () => RecordDetailDrawer,
@@ -102,11 +111,11 @@ __export(src_exports, {
102
111
  module.exports = __toCommonJS(src_exports);
103
112
 
104
113
  // src/plugin.ts
105
- var import_core6 = require("@univerjs/core");
106
- var import_univer_bases20 = require("@yudaocode/univer-bases");
114
+ var import_core9 = require("@univerjs/core");
115
+ var import_univer_bases22 = require("@yudaocode/univer-bases");
107
116
 
108
117
  // src/controllers/bases-ui.controller.ts
109
- var import_core5 = require("@univerjs/core");
118
+ var import_core8 = require("@univerjs/core");
110
119
  var import_ui4 = require("@univerjs/ui");
111
120
 
112
121
  // src/icons/base-icons.tsx
@@ -184,6 +193,63 @@ var BaseFormIcon = createSvgIcon(
184
193
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 5.2H10.8M5.2 8H10.8M5.2 10.8H8.5", strokeWidth: "1.3", strokeLinecap: "round" })
185
194
  ] })
186
195
  );
196
+ var BaseListIcon = createSvgIcon(
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
198
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "3.2", cy: "4", r: "1", fill: "currentColor", stroke: "none" }),
199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.5 4H13.5", strokeWidth: "1.35", strokeLinecap: "round" }),
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.2 5.5V12H5.5", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
201
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.2 8.2H5.5", strokeWidth: "1.2", strokeLinecap: "round" }),
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7.2 8.2H13.5M7.2 12H13.5", strokeWidth: "1.35", strokeLinecap: "round" })
203
+ ] })
204
+ );
205
+ var BaseBoltIcon = createSvgIcon(
206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
207
+ "path",
208
+ {
209
+ d: "M8.8 1.8L3.6 8.6H7.8L7.2 14.2L12.4 7.4H8.2L8.8 1.8Z",
210
+ strokeWidth: "1.3",
211
+ strokeLinejoin: "round"
212
+ }
213
+ )
214
+ );
215
+ var BasePlayIcon = createSvgIcon(
216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
217
+ "path",
218
+ {
219
+ d: "M4.5 3.2L12.5 8L4.5 12.8V3.2Z",
220
+ strokeWidth: "1.35",
221
+ strokeLinejoin: "round"
222
+ }
223
+ )
224
+ );
225
+ var BaseEditIcon = createSvgIcon(
226
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
227
+ "path",
228
+ {
229
+ d: "M10.8 2.6L13.4 5.2L5.6 13H3V10.4L10.8 2.6Z",
230
+ strokeWidth: "1.3",
231
+ strokeLinejoin: "round"
232
+ }
233
+ )
234
+ );
235
+ var BaseColumnsIcon = createSvgIcon(
236
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
237
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.5", strokeWidth: "1.3" }),
238
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 2.5V13.5", strokeWidth: "1.3" })
239
+ ] })
240
+ );
241
+ var BaseIndentIcon = createSvgIcon(
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
243
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 3.5H13M8 7.5H13M8 11.5H13", strokeWidth: "1.35", strokeLinecap: "round" }),
244
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.8 6.5L5.6 9L2.8 11.5", strokeWidth: "1.35", strokeLinecap: "round", strokeLinejoin: "round" })
245
+ ] })
246
+ );
247
+ var BaseOutdentIcon = createSvgIcon(
248
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
249
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 3.5H13M8 7.5H13M8 11.5H13", strokeWidth: "1.35", strokeLinecap: "round" }),
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.6 6.5L2.8 9L5.6 11.5", strokeWidth: "1.35", strokeLinecap: "round", strokeLinejoin: "round" })
251
+ ] })
252
+ );
187
253
  var BaseDashboardIcon = createSvgIcon(
188
254
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
189
255
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.2", width: "5.3", height: "4.8", rx: "1", strokeWidth: "1.3" }),
@@ -282,6 +348,8 @@ var BaseStarSvg = ({
282
348
  );
283
349
  var BaseViewTypeIcon = ({ type }) => {
284
350
  switch (type) {
351
+ case "list":
352
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseListIcon, {});
285
353
  case "kanban":
286
354
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseKanbanIcon, {});
287
355
  case "calendar":
@@ -366,6 +434,8 @@ var BaseFieldTypeIcon = ({ type }) => {
366
434
  var BASE_ICON_MAP = {
367
435
  BaseTableIcon,
368
436
  BaseGridIcon,
437
+ BaseListIcon,
438
+ BaseBoltIcon,
369
439
  BaseKanbanIcon,
370
440
  BaseCalendarIcon,
371
441
  BaseGalleryIcon,
@@ -477,7 +547,7 @@ var LoadBasePresetOperation = {
477
547
  };
478
548
 
479
549
  // src/views/BasesMainView.tsx
480
- var import_univer_bases14 = require("@yudaocode/univer-bases");
550
+ var import_univer_bases15 = require("@yudaocode/univer-bases");
481
551
 
482
552
  // src/views/calendar/CalendarView.tsx
483
553
  var import_univer_bases3 = require("@yudaocode/univer-bases");
@@ -1054,17 +1124,82 @@ var DashboardView = () => {
1054
1124
  };
1055
1125
 
1056
1126
  // src/views/drawer/RecordDetailDrawer.tsx
1127
+ var import_core3 = require("@univerjs/core");
1057
1128
  var import_univer_bases5 = require("@yudaocode/univer-bases");
1129
+ var import_react3 = require("react");
1058
1130
  var import_jsx_runtime4 = require("react/jsx-runtime");
1059
1131
  var RecordDetailDrawer = () => {
1060
1132
  const { unit, snapshot, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
1133
+ const [creatingSection, setCreatingSection] = (0, import_react3.useState)(false);
1134
+ const [newSectionTitle, setNewSectionTitle] = (0, import_react3.useState)("");
1135
+ const [newSectionFieldIds, setNewSectionFieldIds] = (0, import_react3.useState)([]);
1061
1136
  const recordId = selectionState.activeRecordDrawerId;
1062
1137
  if (!unit || !snapshot || !recordId) return null;
1063
1138
  const table = unit.getActiveTable();
1139
+ const activeView = unit.getActiveView();
1064
1140
  const record = table?.records[recordId];
1065
1141
  if (!table || !record) return null;
1066
1142
  const unitId = unit.getUnitId();
1067
1143
  const fields = table.fieldOrder.map((fid) => table.fields[fid]).filter((f) => Boolean(f));
1144
+ const currentLayout = activeView?.detailLayout ?? table.detailLayout ?? {
1145
+ columns: 1
1146
+ };
1147
+ const resolvedLayout = (0, import_univer_bases5.resolveBaseDetailLayout)(table, activeView);
1148
+ const commitDetailLayout = (nextLayout) => {
1149
+ commandService.syncExecuteCommand(import_univer_bases5.UpdateBaseDetailLayoutCommand.id, {
1150
+ unitId,
1151
+ tableId: table.id,
1152
+ ...activeView?.detailLayout ? { viewId: activeView.id } : {},
1153
+ detailLayout: nextLayout
1154
+ });
1155
+ };
1156
+ const toggleSectionCollapsed = (sectionId) => {
1157
+ const existingSections = currentLayout.sections && currentLayout.sections.length > 0 ? currentLayout.sections : resolvedLayout.sections.map((s) => ({
1158
+ id: s.id,
1159
+ title: s.title,
1160
+ collapsed: s.collapsed,
1161
+ fieldIds: s.fields.map((f) => f.id)
1162
+ }));
1163
+ commitDetailLayout({
1164
+ ...currentLayout,
1165
+ sections: existingSections.map(
1166
+ (s) => s.id === sectionId ? { ...s, collapsed: !s.collapsed } : s
1167
+ )
1168
+ });
1169
+ };
1170
+ const handleCreateSection = () => {
1171
+ const title = newSectionTitle.trim() || `\u81EA\u5B9A\u4E49\u5206\u7EC4 ${(currentLayout.sections?.length ?? 0) + 1}`;
1172
+ const chosenFieldIds = newSectionFieldIds.length > 0 ? newSectionFieldIds : fields.slice(0, Math.min(3, fields.length)).map((f) => f.id);
1173
+ const prevSections = currentLayout.sections ?? [];
1174
+ const cleanedPrev = prevSections.map((sec) => ({
1175
+ ...sec,
1176
+ fieldIds: sec.fieldIds.filter((fid) => !chosenFieldIds.includes(fid))
1177
+ }));
1178
+ const nextSections = [
1179
+ ...cleanedPrev,
1180
+ {
1181
+ id: `sec_${(0, import_core3.generateRandomId)(5)}`,
1182
+ title,
1183
+ collapsed: false,
1184
+ fieldIds: chosenFieldIds
1185
+ }
1186
+ ];
1187
+ commitDetailLayout({
1188
+ ...currentLayout,
1189
+ sections: nextSections
1190
+ });
1191
+ setNewSectionTitle("");
1192
+ setNewSectionFieldIds([]);
1193
+ setCreatingSection(false);
1194
+ };
1195
+ const handleDeleteSection = (sectionId) => {
1196
+ if (!currentLayout.sections) return;
1197
+ const nextSections = currentLayout.sections.filter((s) => s.id !== sectionId);
1198
+ commitDetailLayout({
1199
+ ...currentLayout,
1200
+ sections: nextSections.length > 0 ? nextSections : void 0
1201
+ });
1202
+ };
1068
1203
  const updateCell = (fieldId, value) => {
1069
1204
  commandService.syncExecuteCommand(import_univer_bases5.UpdateBaseRecordCommand.id, {
1070
1205
  unitId,
@@ -1080,186 +1215,354 @@ var RecordDetailDrawer = () => {
1080
1215
  primaryField,
1081
1216
  (0, import_univer_bases5.resolveBaseCellValue)(snapshot, table.id, record, primaryField)
1082
1217
  ) : record.id;
1083
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-drawer-backdrop", onClick: () => selectionService.openRecordDrawer(null), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1084
- "aside",
1085
- {
1086
- className: "univer-bases-drawer",
1087
- "data-testid": "bases-record-detail-drawer",
1088
- onClick: (e) => e.stopPropagation(),
1089
- children: [
1090
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__header", children: [
1091
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1092
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "univer-bases-muted-key", children: [
1093
- table.name,
1094
- " \xB7 \u8BB0\u5F55\u8BE6\u60C5"
1095
- ] }),
1096
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "univer-bases-drawer__title", children: recordTitle || "\u672A\u547D\u540D\u8BB0\u5F55" })
1218
+ const renderFieldControl = (field) => {
1219
+ const val = (0, import_univer_bases5.resolveBaseCellValue)(snapshot, table.id, record, field);
1220
+ const disp = (0, import_univer_bases5.formatBaseCellValue)(snapshot, table.id, field, val);
1221
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1222
+ "div",
1223
+ {
1224
+ className: "univer-bases-drawer__field",
1225
+ "data-testid": `bases-detail-field-${field.id}`,
1226
+ children: [
1227
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-form-field-label", children: [
1228
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseFieldTypeIcon, { type: field.type }),
1229
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: field.name }),
1230
+ (0, import_univer_bases5.isComputedBaseField)(field.type) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "univer-bases-computed-badge", children: "\u81EA\u52A8\u8BA1\u7B97" })
1097
1231
  ] }),
1098
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-inline-flex", children: [
1099
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1100
- "button",
1101
- {
1102
- type: "button",
1103
- className: "univer-bases-btn univer-bases-btn--danger univer-bases-btn--sm",
1104
- onClick: () => {
1105
- commandService.syncExecuteCommand(import_univer_bases5.DeleteBaseRecordsCommand.id, {
1106
- unitId,
1107
- tableId: table.id,
1108
- recordIds: [record.id]
1109
- });
1110
- selectionService.openRecordDrawer(null);
1111
- },
1112
- children: [
1113
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseTrashIcon, {}),
1114
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5220\u9664" })
1115
- ]
1116
- }
1117
- ),
1232
+ (0, import_univer_bases5.isComputedBaseField)(field.type) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-drawer__readonly", children: disp || "\u2014" }) : field.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1118
1233
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1119
- "button",
1234
+ "input",
1120
1235
  {
1121
- type: "button",
1122
- className: "univer-bases-icon-btn",
1123
- onClick: () => selectionService.openRecordDrawer(null),
1124
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseCloseIcon, {})
1236
+ type: "checkbox",
1237
+ checked: Boolean(val),
1238
+ onChange: (e) => updateCell(field.id, e.target.checked)
1125
1239
  }
1126
- )
1127
- ] })
1128
- ] }),
1129
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-drawer__body", children: fields.map((field) => {
1130
- const val = (0, import_univer_bases5.resolveBaseCellValue)(snapshot, table.id, record, field);
1131
- const disp = (0, import_univer_bases5.formatBaseCellValue)(snapshot, table.id, field, val);
1132
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__field", children: [
1133
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-form-field-label", children: [
1134
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseFieldTypeIcon, { type: field.type }),
1135
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: field.name }),
1136
- (0, import_univer_bases5.isComputedBaseField)(field.type) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "univer-bases-computed-badge", children: "\u81EA\u52A8\u8BA1\u7B97" })
1137
- ] }),
1138
- (0, import_univer_bases5.isComputedBaseField)(field.type) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-drawer__readonly", children: disp || "\u2014" }) : field.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1240
+ ),
1241
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: val ? "\u5DF2\u52FE\u9009" : "\u672A\u52FE\u9009" })
1242
+ ] }) : field.type === "singleSelect" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1243
+ "select",
1244
+ {
1245
+ className: "univer-bases-select",
1246
+ value: String(val ?? ""),
1247
+ onChange: (e) => updateCell(field.id, e.target.value),
1248
+ children: [
1249
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: "-- \u672A\u9009\u62E9 --" }),
1250
+ (field.config?.options ?? []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: opt.name, children: opt.name }, opt.id))
1251
+ ]
1252
+ }
1253
+ ) : field.type === "multiSelect" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-tag-wrap", children: (field.config?.options ?? []).map((opt) => {
1254
+ const arr = Array.isArray(val) ? val.map(String) : [];
1255
+ const active = arr.includes(opt.name);
1256
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1139
1257
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1140
1258
  "input",
1141
1259
  {
1142
1260
  type: "checkbox",
1143
- checked: Boolean(val),
1144
- onChange: (e) => updateCell(field.id, e.target.checked)
1261
+ checked: active,
1262
+ onChange: () => {
1263
+ const next = active ? arr.filter((v) => v !== opt.name) : [...arr, opt.name];
1264
+ updateCell(field.id, next);
1265
+ }
1145
1266
  }
1146
1267
  ),
1147
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: val ? "\u5DF2\u52FE\u9009" : "\u672A\u52FE\u9009" })
1148
- ] }) : field.type === "singleSelect" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1149
- "select",
1268
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: opt.name })
1269
+ ] }, opt.id);
1270
+ }) }) : field.type === "rating" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-rating-stars", children: Array.from({ length: field.config?.maxRating ?? 5 }, (_, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1271
+ BaseStarSvg,
1272
+ {
1273
+ filled: idx + 1 <= Math.round((0, import_univer_bases5.toNumericValue)(val) ?? 0),
1274
+ onClick: () => updateCell(field.id, idx + 1)
1275
+ },
1276
+ idx
1277
+ )) }) : field.type === "link" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-link-cell", children: [
1278
+ (0, import_univer_bases5.resolveLinkedRecordItems)(snapshot, record, field).map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "univer-bases-link-chip", children: [
1279
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseLinkIcon, {}),
1280
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: item.title })
1281
+ ] }, item.id)),
1282
+ field.config?.linkedTableId && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1283
+ "button",
1150
1284
  {
1151
- className: "univer-bases-select",
1152
- value: String(val ?? ""),
1153
- onChange: (e) => updateCell(field.id, e.target.value),
1285
+ type: "button",
1286
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
1287
+ onClick: () => {
1288
+ selectionService.openLinkPicker({
1289
+ tableId: table.id,
1290
+ recordId: record.id,
1291
+ fieldId: field.id,
1292
+ linkedTableId: field.config.linkedTableId,
1293
+ allowMultiple: field.config?.allowMultiple !== false
1294
+ });
1295
+ },
1154
1296
  children: [
1155
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: "-- \u672A\u9009\u62E9 --" }),
1156
- (field.config?.options ?? []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: opt.name, children: opt.name }, opt.id))
1297
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasePlusIcon, {}),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u914D\u7F6E\u5173\u8054\u8BB0\u5F55" })
1157
1299
  ]
1158
1300
  }
1159
- ) : field.type === "multiSelect" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-tag-wrap", children: (field.config?.options ?? []).map((opt) => {
1160
- const arr = Array.isArray(val) ? val.map(String) : [];
1161
- const active = arr.includes(opt.name);
1162
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1163
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1164
- "input",
1301
+ )
1302
+ ] }) : field.type === "date" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1303
+ "input",
1304
+ {
1305
+ type: "date",
1306
+ className: "univer-bases-input",
1307
+ value: typeof val === "string" ? val.slice(0, 10) : "",
1308
+ onChange: (e) => updateCell(field.id, e.target.value)
1309
+ }
1310
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1311
+ "input",
1312
+ {
1313
+ type: "text",
1314
+ className: "univer-bases-input",
1315
+ value: disp,
1316
+ onChange: (e) => {
1317
+ const raw = e.target.value;
1318
+ if (field.type === "number" || field.type === "currency" || field.type === "percent") {
1319
+ updateCell(field.id, (0, import_univer_bases5.toNumericValue)(raw) ?? raw);
1320
+ } else {
1321
+ updateCell(field.id, raw);
1322
+ }
1323
+ }
1324
+ }
1325
+ )
1326
+ ]
1327
+ },
1328
+ field.id
1329
+ );
1330
+ };
1331
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1332
+ "div",
1333
+ {
1334
+ className: "univer-bases-drawer-backdrop",
1335
+ onClick: () => selectionService.openRecordDrawer(null),
1336
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1337
+ "aside",
1338
+ {
1339
+ className: `univer-bases-drawer ${resolvedLayout.columns === 2 ? "is-two-col" : ""}`,
1340
+ "data-testid": "bases-record-detail-drawer",
1341
+ "data-columns": resolvedLayout.columns,
1342
+ onClick: (e) => e.stopPropagation(),
1343
+ children: [
1344
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__header", children: [
1345
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
1346
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "univer-bases-muted-key", children: [
1347
+ table.name,
1348
+ " \xB7 \u8BB0\u5F55\u8BE6\u60C5"
1349
+ ] }),
1350
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "univer-bases-drawer__title", children: recordTitle || "\u672A\u547D\u540D\u8BB0\u5F55" })
1351
+ ] }),
1352
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-inline-flex", children: [
1353
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1354
+ "button",
1165
1355
  {
1166
- type: "checkbox",
1167
- checked: active,
1168
- onChange: () => {
1169
- const next = active ? arr.filter((v) => v !== opt.name) : [...arr, opt.name];
1170
- updateCell(field.id, next);
1171
- }
1356
+ type: "button",
1357
+ className: "univer-bases-btn univer-bases-btn--danger univer-bases-btn--sm",
1358
+ onClick: () => {
1359
+ commandService.syncExecuteCommand(import_univer_bases5.DeleteBaseRecordsCommand.id, {
1360
+ unitId,
1361
+ tableId: table.id,
1362
+ recordIds: [record.id]
1363
+ });
1364
+ selectionService.openRecordDrawer(null);
1365
+ },
1366
+ children: [
1367
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseTrashIcon, {}),
1368
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5220\u9664" })
1369
+ ]
1172
1370
  }
1173
1371
  ),
1174
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: opt.name })
1175
- ] }, opt.id);
1176
- }) }) : field.type === "rating" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-rating-stars", children: Array.from(
1177
- { length: field.config?.maxRating ?? 5 },
1178
- (_, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1179
- BaseStarSvg,
1180
- {
1181
- filled: idx + 1 <= Math.round((0, import_univer_bases5.toNumericValue)(val) ?? 0),
1182
- onClick: () => updateCell(field.id, idx + 1)
1183
- },
1184
- idx
1185
- )
1186
- ) }) : field.type === "link" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-link-cell", children: [
1187
- (0, import_univer_bases5.resolveLinkedRecordItems)(snapshot, record, field).map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "univer-bases-link-chip", children: [
1188
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseLinkIcon, {}),
1189
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: item.title })
1190
- ] }, item.id)),
1191
- field.config?.linkedTableId && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1372
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1373
+ "button",
1374
+ {
1375
+ type: "button",
1376
+ className: "univer-bases-icon-btn",
1377
+ onClick: () => selectionService.openRecordDrawer(null),
1378
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseCloseIcon, {})
1379
+ }
1380
+ )
1381
+ ] })
1382
+ ] }),
1383
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__layout-bar", "data-testid": "bases-detail-layout-bar", children: [
1384
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-inline-flex", children: [
1385
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseColumnsIcon, {}),
1386
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-segmented", role: "group", "aria-label": "\u5355\u680F\u53CC\u680F\u5207\u6362", children: [
1387
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1388
+ "button",
1389
+ {
1390
+ type: "button",
1391
+ className: `univer-bases-segmented__item ${resolvedLayout.columns === 1 ? "is-active" : ""}`,
1392
+ "data-testid": "bases-detail-col-1",
1393
+ onClick: () => commitDetailLayout({ ...currentLayout, columns: 1 }),
1394
+ children: "\u5355\u680F"
1395
+ }
1396
+ ),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1398
+ "button",
1399
+ {
1400
+ type: "button",
1401
+ className: `univer-bases-segmented__item ${resolvedLayout.columns === 2 ? "is-active" : ""}`,
1402
+ "data-testid": "bases-detail-col-2",
1403
+ onClick: () => commitDetailLayout({ ...currentLayout, columns: 2 }),
1404
+ children: "\u53CC\u680F"
1405
+ }
1406
+ )
1407
+ ] })
1408
+ ] }),
1409
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1192
1410
  "button",
1193
1411
  {
1194
1412
  type: "button",
1195
1413
  className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
1196
- onClick: () => {
1197
- selectionService.openLinkPicker({
1198
- tableId: table.id,
1199
- recordId: record.id,
1200
- fieldId: field.id,
1201
- linkedTableId: field.config.linkedTableId,
1202
- allowMultiple: field.config?.allowMultiple !== false
1203
- });
1204
- },
1414
+ "data-testid": "bases-detail-add-section-btn",
1415
+ onClick: () => setCreatingSection((prev) => !prev),
1205
1416
  children: [
1206
1417
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BasePlusIcon, {}),
1207
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u914D\u7F6E\u5173\u8054\u8BB0\u5F55" })
1418
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u65B0\u5EFA\u5B57\u6BB5\u5206\u7EC4" })
1208
1419
  ]
1209
1420
  }
1210
1421
  )
1211
- ] }) : field.type === "date" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1212
- "input",
1213
- {
1214
- type: "date",
1215
- className: "univer-bases-input",
1216
- value: typeof val === "string" ? val.slice(0, 10) : "",
1217
- onChange: (e) => updateCell(field.id, e.target.value)
1218
- }
1219
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1220
- "input",
1221
- {
1222
- type: "text",
1223
- className: "univer-bases-input",
1224
- value: disp,
1225
- onChange: (e) => {
1226
- const raw = e.target.value;
1227
- if (field.type === "number" || field.type === "currency" || field.type === "percent") {
1228
- updateCell(field.id, (0, import_univer_bases5.toNumericValue)(raw) ?? raw);
1229
- } else {
1230
- updateCell(field.id, raw);
1422
+ ] }),
1423
+ creatingSection && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__new-section", "data-testid": "bases-detail-new-section-box", children: [
1424
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-form-row", children: [
1425
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { children: "\u5206\u7EC4\u6807\u9898" }),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1427
+ "input",
1428
+ {
1429
+ type: "text",
1430
+ className: "univer-bases-input",
1431
+ placeholder: "\u4F8B\u5982\uFF1A\u6392\u671F\u4E0E\u9884\u7B97\u4FE1\u606F",
1432
+ value: newSectionTitle,
1433
+ onChange: (e) => setNewSectionTitle(e.target.value)
1231
1434
  }
1232
- }
1233
- }
1234
- )
1235
- ] }, field.id);
1236
- }) }),
1237
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__footer", children: [
1238
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1239
- "\u521B\u5EFA\u65F6\u95F4: ",
1240
- record.createdTime
1241
- ] }),
1242
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1243
- "\u6700\u540E\u66F4\u65B0: ",
1244
- record.lastModifiedTime
1245
- ] })
1246
- ] })
1247
- ]
1435
+ )
1436
+ ] }),
1437
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-form-row", children: [
1438
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { children: "\u9009\u62E9\u7EB3\u5165\u8BE5\u5206\u7EC4\u7684\u5B57\u6BB5" }),
1439
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-tag-wrap", children: fields.map((f) => {
1440
+ const checked = newSectionFieldIds.includes(f.id);
1441
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1442
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1443
+ "input",
1444
+ {
1445
+ type: "checkbox",
1446
+ checked,
1447
+ onChange: () => setNewSectionFieldIds(
1448
+ (prev) => checked ? prev.filter((id) => id !== f.id) : [...prev, f.id]
1449
+ )
1450
+ }
1451
+ ),
1452
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: f.name })
1453
+ ] }, f.id);
1454
+ }) })
1455
+ ] }),
1456
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-inline-flex", style: { justifyContent: "flex-end" }, children: [
1457
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1458
+ "button",
1459
+ {
1460
+ type: "button",
1461
+ className: "univer-bases-btn univer-bases-btn--ghost univer-bases-btn--sm",
1462
+ onClick: () => setCreatingSection(false),
1463
+ children: "\u53D6\u6D88"
1464
+ }
1465
+ ),
1466
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1467
+ "button",
1468
+ {
1469
+ type: "button",
1470
+ className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
1471
+ onClick: handleCreateSection,
1472
+ children: "\u521B\u5EFA\u5206\u7EC4"
1473
+ }
1474
+ )
1475
+ ] })
1476
+ ] }),
1477
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "univer-bases-drawer__body", children: resolvedLayout.sections.map((section) => {
1478
+ const isCustom = Boolean(
1479
+ currentLayout.sections?.some((s) => s.id === section.id)
1480
+ );
1481
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1482
+ "section",
1483
+ {
1484
+ className: "univer-bases-drawer__section",
1485
+ "data-testid": `bases-detail-section-${section.id}`,
1486
+ children: [
1487
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__section-header", children: [
1488
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1489
+ "button",
1490
+ {
1491
+ type: "button",
1492
+ className: "univer-bases-drawer__section-toggle",
1493
+ onClick: () => toggleSectionCollapsed(section.id),
1494
+ children: [
1495
+ section.collapsed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseChevronRightIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseChevronDownIcon, {}),
1496
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: section.title }),
1497
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "univer-bases-badge-count", children: section.fields.length })
1498
+ ]
1499
+ }
1500
+ ),
1501
+ isCustom && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1502
+ "button",
1503
+ {
1504
+ type: "button",
1505
+ className: "univer-bases-icon-btn",
1506
+ title: "\u79FB\u9664\u6B64\u5206\u7EC4\uFF08\u5B57\u6BB5\u81EA\u52A8\u5F52\u8FD8\uFF09",
1507
+ onClick: () => handleDeleteSection(section.id),
1508
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BaseTrashIcon, {})
1509
+ }
1510
+ )
1511
+ ] }),
1512
+ !section.collapsed && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1513
+ "div",
1514
+ {
1515
+ className: `univer-bases-drawer__fields-grid ${resolvedLayout.columns === 2 ? "is-two-columns" : "is-one-column"}`,
1516
+ "data-testid": `bases-detail-grid-${section.id}`,
1517
+ children: section.fields.map((field) => renderFieldControl(field))
1518
+ }
1519
+ )
1520
+ ]
1521
+ },
1522
+ section.id
1523
+ );
1524
+ }) }),
1525
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "univer-bases-drawer__footer", children: [
1526
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1527
+ "\u521B\u5EFA\u65F6\u95F4: ",
1528
+ record.createdTime
1529
+ ] }),
1530
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
1531
+ "\u6700\u540E\u66F4\u65B0: ",
1532
+ record.lastModifiedTime
1533
+ ] })
1534
+ ] })
1535
+ ]
1536
+ }
1537
+ )
1248
1538
  }
1249
- ) });
1539
+ );
1250
1540
  };
1251
1541
 
1252
1542
  // src/views/form/FormView.tsx
1543
+ var import_core4 = require("@univerjs/core");
1253
1544
  var import_univer_bases6 = require("@yudaocode/univer-bases");
1254
- var import_react3 = require("react");
1545
+ var import_react4 = require("react");
1255
1546
  var import_jsx_runtime5 = require("react/jsx-runtime");
1547
+ var CONDITION_OPERATORS = [
1548
+ { value: "is", label: "\u7B49\u4E8E" },
1549
+ { value: "isNot", label: "\u4E0D\u7B49\u4E8E" },
1550
+ { value: "contains", label: "\u5305\u542B" },
1551
+ { value: "notContains", label: "\u4E0D\u5305\u542B" },
1552
+ { value: "gt", label: "\u5927\u4E8E" },
1553
+ { value: "gte", label: "\u5927\u4E8E\u7B49\u4E8E" },
1554
+ { value: "lt", label: "\u5C0F\u4E8E" },
1555
+ { value: "lte", label: "\u5C0F\u4E8E\u7B49\u4E8E" },
1556
+ { value: "isEmpty", label: "\u4E3A\u7A7A" },
1557
+ { value: "isNotEmpty", label: "\u4E0D\u4E3A\u7A7A" }
1558
+ ];
1256
1559
  var FormView = ({ query }) => {
1257
- const { unit, commandService } = useActiveBaseWorkspace();
1258
- const [formMode, setFormMode] = (0, import_react3.useState)("fill");
1259
- const [values, setValues] = (0, import_react3.useState)({});
1260
- const [errorMsg, setErrorMsg] = (0, import_react3.useState)(null);
1261
- const [submittedRecordId, setSubmittedRecordId] = (0, import_react3.useState)(null);
1262
- if (!unit) return null;
1560
+ const { unit, snapshot, commandService } = useActiveBaseWorkspace();
1561
+ const [formMode, setFormMode] = (0, import_react4.useState)("fill");
1562
+ const [values, setValues] = (0, import_react4.useState)({});
1563
+ const [errorMsg, setErrorMsg] = (0, import_react4.useState)(null);
1564
+ const [submittedRecordId, setSubmittedRecordId] = (0, import_react4.useState)(null);
1565
+ if (!unit || !snapshot) return null;
1263
1566
  const unitId = unit.getUnitId();
1264
1567
  const { table, view, allFields } = query;
1265
1568
  const editableFields = allFields.filter(
@@ -1280,12 +1583,22 @@ var FormView = ({ query }) => {
1280
1583
  const configMap = new Map(resolvedConfig.fields.map((item) => [item.fieldId, item]));
1281
1584
  const mergedFormItems = editableFields.map((f) => {
1282
1585
  const existing = configMap.get(f.id);
1283
- return existing ?? {
1586
+ const ruleOverride = resolvedConfig.fieldRules?.[f.id];
1587
+ const baseItem = existing ?? {
1284
1588
  fieldId: f.id,
1285
1589
  visible: true,
1286
1590
  required: Boolean(f.isPrimary || f.required),
1287
1591
  label: f.name
1288
1592
  };
1593
+ if (ruleOverride && !baseItem.visibleWhen) {
1594
+ return {
1595
+ ...baseItem,
1596
+ visibleWhen: ruleOverride.visibleWhen,
1597
+ visibleWhenConjunction: ruleOverride.visibleWhenConjunction,
1598
+ conditionalRequired: baseItem.conditionalRequired ?? ruleOverride.conditionalRequired
1599
+ };
1600
+ }
1601
+ return baseItem;
1289
1602
  });
1290
1603
  const saveFormConfig = (nextConfig) => {
1291
1604
  commandService.syncExecuteCommand(import_univer_bases6.UpdateBaseViewCommand.id, {
@@ -1295,11 +1608,16 @@ var FormView = ({ query }) => {
1295
1608
  patch: { formConfig: nextConfig }
1296
1609
  });
1297
1610
  };
1611
+ const updateFieldItemAt = (idx, patch) => {
1612
+ const nextItems = mergedFormItems.map((it, i) => i === idx ? { ...it, ...patch } : it);
1613
+ saveFormConfig({ ...resolvedConfig, fields: nextItems });
1614
+ };
1298
1615
  const handleSubmit = (e) => {
1299
1616
  e.preventDefault();
1300
1617
  setErrorMsg(null);
1301
1618
  for (const item of mergedFormItems) {
1302
- if (!item.visible || !item.required) continue;
1619
+ if (!(0, import_univer_bases6.isFormFieldVisible)(item, values, table, snapshot, resolvedConfig)) continue;
1620
+ if (!(0, import_univer_bases6.isFormFieldRequired)(item, values, table, snapshot, resolvedConfig)) continue;
1303
1621
  const f = table.fields[item.fieldId];
1304
1622
  if (!f) continue;
1305
1623
  const v = values[f.id];
@@ -1326,6 +1644,9 @@ var FormView = ({ query }) => {
1326
1644
  setErrorMsg("\u8868\u5355\u6821\u9A8C\u672A\u901A\u8FC7\uFF0C\u8BF7\u68C0\u67E5\u5FC5\u586B\u9879\u540E\u91CD\u8BD5\u3002");
1327
1645
  }
1328
1646
  };
1647
+ const visibleFillItems = mergedFormItems.filter(
1648
+ (item) => (0, import_univer_bases6.isFormFieldVisible)(item, values, table, snapshot, resolvedConfig)
1649
+ );
1329
1650
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-form-view", "data-testid": "bases-form-view", children: [
1330
1651
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-bases-subbar", style: { justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-segmented", role: "tablist", children: [
1331
1652
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1388,62 +1709,201 @@ var FormView = ({ query }) => {
1388
1709
  )
1389
1710
  ] }),
1390
1711
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-form-design-list", children: [
1391
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "\u5B57\u6BB5\u663E\u9690\u4E0E\u5FC5\u586B\u914D\u7F6E" }),
1712
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "\u5B57\u6BB5\u663E\u9690\u3001\u5FC5\u586B\u4E0E\u6761\u4EF6\u8054\u52A8\u914D\u7F6E" }),
1392
1713
  mergedFormItems.map((item, idx) => {
1393
1714
  const field = table.fields[item.fieldId];
1394
1715
  if (!field) return null;
1395
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-form-design-item", children: [
1396
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-inline-flex", style: { flex: 1 }, children: [
1397
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BaseFieldTypeIcon, { type: field.type }),
1398
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1399
- "input",
1400
- {
1401
- type: "text",
1402
- className: "univer-bases-input",
1403
- value: item.label ?? field.name,
1404
- onChange: (e) => {
1405
- const nextItems = mergedFormItems.map(
1406
- (it, i) => i === idx ? { ...it, label: e.target.value } : it
1407
- );
1408
- saveFormConfig({ ...resolvedConfig, fields: nextItems });
1409
- }
1410
- }
1411
- )
1412
- ] }),
1413
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1414
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1415
- "input",
1416
- {
1417
- type: "checkbox",
1418
- checked: item.visible,
1419
- disabled: Boolean(field.isPrimary),
1420
- onChange: (e) => {
1421
- const nextItems = mergedFormItems.map(
1422
- (it, i) => i === idx ? { ...it, visible: e.target.checked } : it
1423
- );
1424
- saveFormConfig({ ...resolvedConfig, fields: nextItems });
1425
- }
1426
- }
1427
- ),
1428
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u663E\u793A" })
1429
- ] }),
1430
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1431
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1432
- "input",
1433
- {
1434
- type: "checkbox",
1435
- checked: Boolean(item.required),
1436
- onChange: (e) => {
1437
- const nextItems = mergedFormItems.map(
1438
- (it, i) => i === idx ? { ...it, required: e.target.checked } : it
1439
- );
1440
- saveFormConfig({ ...resolvedConfig, fields: nextItems });
1716
+ const condRules = item.visibleWhen ?? [];
1717
+ const candidateTriggerFields = editableFields.filter(
1718
+ (ef) => ef.id !== field.id
1719
+ );
1720
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1721
+ "div",
1722
+ {
1723
+ className: "univer-bases-form-design-block",
1724
+ "data-testid": `bases-form-design-item-${field.id}`,
1725
+ children: [
1726
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-form-design-item", children: [
1727
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-inline-flex", style: { flex: 1 }, children: [
1728
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BaseFieldTypeIcon, { type: field.type }),
1729
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1730
+ "input",
1731
+ {
1732
+ type: "text",
1733
+ className: "univer-bases-input",
1734
+ value: item.label ?? field.name,
1735
+ onChange: (e) => updateFieldItemAt(idx, { label: e.target.value })
1736
+ }
1737
+ )
1738
+ ] }),
1739
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1740
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1741
+ "input",
1742
+ {
1743
+ type: "checkbox",
1744
+ checked: item.visible,
1745
+ disabled: Boolean(field.isPrimary),
1746
+ onChange: (e) => updateFieldItemAt(idx, { visible: e.target.checked })
1747
+ }
1748
+ ),
1749
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u663E\u793A" })
1750
+ ] }),
1751
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1752
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1753
+ "input",
1754
+ {
1755
+ type: "checkbox",
1756
+ checked: Boolean(item.required),
1757
+ onChange: (e) => updateFieldItemAt(idx, { required: e.target.checked })
1758
+ }
1759
+ ),
1760
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5FC5\u586B" })
1761
+ ] }),
1762
+ !field.isPrimary && candidateTriggerFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1763
+ "button",
1764
+ {
1765
+ type: "button",
1766
+ className: `univer-bases-btn univer-bases-btn--sm ${condRules.length > 0 ? "is-tinted" : "univer-bases-btn--outline"}`,
1767
+ "data-testid": `bases-form-add-cond-${field.id}`,
1768
+ onClick: () => {
1769
+ const refField = candidateTriggerFields[0];
1770
+ const defaultVal = refField.type === "singleSelect" ? refField.config?.options?.[0]?.name ?? "" : "";
1771
+ const nextRule = {
1772
+ id: `fvis_${(0, import_core4.generateRandomId)(5)}`,
1773
+ fieldId: refField.id,
1774
+ operator: "is",
1775
+ value: defaultVal
1776
+ };
1777
+ updateFieldItemAt(idx, {
1778
+ visibleWhen: [...condRules, nextRule]
1779
+ });
1780
+ },
1781
+ children: [
1782
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BaseFilterIcon, {}),
1783
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
1784
+ "\u663E\u793A\u6761\u4EF6",
1785
+ condRules.length > 0 ? ` (${condRules.length})` : ""
1786
+ ] })
1787
+ ]
1788
+ }
1789
+ )
1790
+ ] }),
1791
+ condRules.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1792
+ "div",
1793
+ {
1794
+ className: "univer-bases-form-cond-box",
1795
+ "data-testid": `bases-form-cond-box-${field.id}`,
1796
+ children: [
1797
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-inline-flex", style: { justifyContent: "space-between", width: "100%" }, children: [
1798
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "univer-bases-muted-key", children: "\u663E\u793A\u6761\u4EF6\uFF08\u5982\uFF1A\u5F53 \u4EFB\u52A1\u72B6\u6001 = \u4EE3\u7801\u8BC4\u5BA1 \u65F6\u663E\u793A\uFF09" }),
1799
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1800
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1801
+ "input",
1802
+ {
1803
+ type: "checkbox",
1804
+ checked: Boolean(item.conditionalRequired),
1805
+ onChange: (e) => updateFieldItemAt(idx, {
1806
+ conditionalRequired: e.target.checked
1807
+ })
1808
+ }
1809
+ ),
1810
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u663E\u793A\u65F6\u8BBE\u4E3A\u5FC5\u586B" })
1811
+ ] })
1812
+ ] }),
1813
+ condRules.map((rule) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-rule-row", children: [
1814
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "univer-bases-muted-key", children: "\u5F53" }),
1815
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1816
+ "select",
1817
+ {
1818
+ className: "univer-bases-select",
1819
+ value: rule.fieldId,
1820
+ onChange: (e) => {
1821
+ const next = condRules.map(
1822
+ (r) => r.id === rule.id ? { ...r, fieldId: e.target.value } : r
1823
+ );
1824
+ updateFieldItemAt(idx, { visibleWhen: next });
1825
+ },
1826
+ children: candidateTriggerFields.map((tf) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: tf.id, children: tf.name }, tf.id))
1827
+ }
1828
+ ),
1829
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1830
+ "select",
1831
+ {
1832
+ className: "univer-bases-select univer-bases-select--xs",
1833
+ value: rule.operator,
1834
+ onChange: (e) => {
1835
+ const next = condRules.map(
1836
+ (r) => r.id === rule.id ? { ...r, operator: e.target.value } : r
1837
+ );
1838
+ updateFieldItemAt(idx, { visibleWhen: next });
1839
+ },
1840
+ children: CONDITION_OPERATORS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: op.value, children: op.label }, op.value))
1841
+ }
1842
+ ),
1843
+ rule.operator !== "isEmpty" && rule.operator !== "isNotEmpty" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1844
+ "input",
1845
+ {
1846
+ type: "text",
1847
+ className: "univer-bases-input",
1848
+ placeholder: "\u89E6\u53D1\u5339\u914D\u503C...",
1849
+ value: String(rule.value ?? ""),
1850
+ onChange: (e) => {
1851
+ const next = condRules.map(
1852
+ (r) => r.id === rule.id ? { ...r, value: e.target.value } : r
1853
+ );
1854
+ updateFieldItemAt(idx, { visibleWhen: next });
1855
+ }
1856
+ }
1857
+ ),
1858
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "univer-bases-muted-key", children: "\u65F6\u663E\u793A" }),
1859
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1860
+ "button",
1861
+ {
1862
+ type: "button",
1863
+ className: "univer-bases-icon-btn",
1864
+ onClick: () => {
1865
+ const next = condRules.filter((r) => r.id !== rule.id);
1866
+ updateFieldItemAt(idx, {
1867
+ visibleWhen: next.length > 0 ? next : void 0
1868
+ });
1869
+ },
1870
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BaseTrashIcon, {})
1871
+ }
1872
+ )
1873
+ ] }, rule.id)),
1874
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1875
+ "button",
1876
+ {
1877
+ type: "button",
1878
+ className: "univer-bases-btn univer-bases-btn--ghost univer-bases-btn--sm",
1879
+ onClick: () => {
1880
+ const refField = candidateTriggerFields[0];
1881
+ if (!refField) return;
1882
+ updateFieldItemAt(idx, {
1883
+ visibleWhen: [
1884
+ ...condRules,
1885
+ {
1886
+ id: `fvis_${(0, import_core4.generateRandomId)(5)}`,
1887
+ fieldId: refField.id,
1888
+ operator: "is",
1889
+ value: ""
1890
+ }
1891
+ ]
1892
+ });
1893
+ },
1894
+ children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BasePlusIcon, {}),
1896
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u8FFD\u52A0\u8054\u52A8\u6761\u4EF6" })
1897
+ ]
1898
+ }
1899
+ ) })
1900
+ ]
1441
1901
  }
1442
- }
1443
- ),
1444
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5FC5\u586B" })
1445
- ] })
1446
- ] }, item.fieldId);
1902
+ )
1903
+ ]
1904
+ },
1905
+ item.fieldId
1906
+ );
1447
1907
  })
1448
1908
  ] })
1449
1909
  ] })
@@ -1469,87 +1929,100 @@ var FormView = ({ query }) => {
1469
1929
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "univer-bases-form-title", children: resolvedConfig.title }),
1470
1930
  resolvedConfig.description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "univer-bases-form-desc", children: resolvedConfig.description }),
1471
1931
  errorMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-bases-alert-error", children: errorMsg }),
1472
- mergedFormItems.filter((it) => it.visible).map((item) => {
1932
+ visibleFillItems.map((item) => {
1473
1933
  const field = table.fields[item.fieldId];
1474
1934
  if (!field) return null;
1475
1935
  const curVal = values[field.id];
1476
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-bases-form-row", children: [
1477
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-form-field-label", children: [
1478
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BaseFieldTypeIcon, { type: field.type }),
1479
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: item.label || field.name }),
1480
- item.required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "univer-bases-required-dot", children: "*" })
1481
- ] }),
1482
- field.type === "singleSelect" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1483
- "select",
1484
- {
1485
- className: "univer-bases-select",
1486
- value: String(curVal ?? ""),
1487
- onChange: (e) => setValues((prev) => ({ ...prev, [field.id]: e.target.value })),
1488
- children: [
1489
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "\u8BF7\u9009\u62E9..." }),
1490
- (field.config?.options ?? []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: opt.name, children: opt.name }, opt.id))
1491
- ]
1492
- }
1493
- ) : field.type === "multiSelect" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-bases-tag-wrap", children: (field.config?.options ?? []).map((opt) => {
1494
- const arr = Array.isArray(curVal) ? curVal.map(String) : [];
1495
- const active = arr.includes(opt.name);
1496
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1497
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1936
+ const isReq = (0, import_univer_bases6.isFormFieldRequired)(item, values, table, snapshot, resolvedConfig);
1937
+ const hasCond = Boolean(
1938
+ item.visibleWhen && item.visibleWhen.length > 0 || resolvedConfig.fieldRules?.[field.id]?.visibleWhen?.length
1939
+ );
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1941
+ "div",
1942
+ {
1943
+ className: "univer-bases-form-row",
1944
+ "data-testid": `bases-form-field-${field.id}`,
1945
+ children: [
1946
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-form-field-label", children: [
1947
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BaseFieldTypeIcon, { type: field.type }),
1948
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: item.label || field.name }),
1949
+ isReq && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "univer-bases-required-dot", children: "*" }),
1950
+ hasCond && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "univer-bases-computed-badge", children: "\u6761\u4EF6\u8054\u52A8" })
1951
+ ] }),
1952
+ field.type === "singleSelect" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1953
+ "select",
1954
+ {
1955
+ className: "univer-bases-select",
1956
+ value: String(curVal ?? ""),
1957
+ onChange: (e) => setValues((prev) => ({ ...prev, [field.id]: e.target.value })),
1958
+ children: [
1959
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "\u8BF7\u9009\u62E9..." }),
1960
+ (field.config?.options ?? []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: opt.name, children: opt.name }, opt.id))
1961
+ ]
1962
+ }
1963
+ ) : field.type === "multiSelect" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-bases-tag-wrap", children: (field.config?.options ?? []).map((opt) => {
1964
+ const arr = Array.isArray(curVal) ? curVal.map(String) : [];
1965
+ const active = arr.includes(opt.name);
1966
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1967
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1968
+ "input",
1969
+ {
1970
+ type: "checkbox",
1971
+ checked: active,
1972
+ onChange: () => {
1973
+ const next = active ? arr.filter((v) => v !== opt.name) : [...arr, opt.name];
1974
+ setValues((prev) => ({ ...prev, [field.id]: next }));
1975
+ }
1976
+ }
1977
+ ),
1978
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: opt.name })
1979
+ ] }, opt.id);
1980
+ }) }) : field.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1981
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1982
+ "input",
1983
+ {
1984
+ type: "checkbox",
1985
+ checked: Boolean(curVal),
1986
+ onChange: (e) => setValues((prev) => ({ ...prev, [field.id]: e.target.checked }))
1987
+ }
1988
+ ),
1989
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u786E\u8BA4\u52FE\u9009" })
1990
+ ] }) : field.type === "rating" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-bases-rating-stars", children: Array.from(
1991
+ { length: field.config?.maxRating ?? 5 },
1992
+ (_, sIdx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1993
+ BaseStarSvg,
1994
+ {
1995
+ filled: sIdx + 1 <= Math.round((0, import_univer_bases6.toNumericValue)(curVal) ?? 0),
1996
+ onClick: () => setValues((prev) => ({ ...prev, [field.id]: sIdx + 1 }))
1997
+ },
1998
+ sIdx
1999
+ )
2000
+ ) }) : field.type === "date" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2001
+ "input",
2002
+ {
2003
+ type: "date",
2004
+ className: "univer-bases-input",
2005
+ value: String(curVal ?? ""),
2006
+ onChange: (e) => setValues((prev) => ({ ...prev, [field.id]: e.target.value }))
2007
+ }
2008
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1498
2009
  "input",
1499
2010
  {
1500
- type: "checkbox",
1501
- checked: active,
1502
- onChange: () => {
1503
- const next = active ? arr.filter((v) => v !== opt.name) : [...arr, opt.name];
1504
- setValues((prev) => ({ ...prev, [field.id]: next }));
2011
+ type: field.type === "number" || field.type === "currency" || field.type === "percent" ? "number" : field.type === "email" ? "email" : "text",
2012
+ className: "univer-bases-input",
2013
+ placeholder: item.placeholder || `\u8BF7\u8F93\u5165${item.label || field.name}...`,
2014
+ value: curVal === void 0 || curVal === null ? "" : String(curVal),
2015
+ onChange: (e) => {
2016
+ const raw = e.target.value;
2017
+ const parsed = field.type === "number" || field.type === "currency" || field.type === "percent" ? (0, import_univer_bases6.toNumericValue)(raw) ?? raw : raw;
2018
+ setValues((prev) => ({ ...prev, [field.id]: parsed }));
1505
2019
  }
1506
2020
  }
1507
- ),
1508
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: opt.name })
1509
- ] }, opt.id);
1510
- }) }) : field.type === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
1511
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1512
- "input",
1513
- {
1514
- type: "checkbox",
1515
- checked: Boolean(curVal),
1516
- onChange: (e) => setValues((prev) => ({ ...prev, [field.id]: e.target.checked }))
1517
- }
1518
- ),
1519
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u786E\u8BA4\u52FE\u9009" })
1520
- ] }) : field.type === "rating" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-bases-rating-stars", children: Array.from(
1521
- { length: field.config?.maxRating ?? 5 },
1522
- (_, sIdx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1523
- BaseStarSvg,
1524
- {
1525
- filled: sIdx + 1 <= Math.round((0, import_univer_bases6.toNumericValue)(curVal) ?? 0),
1526
- onClick: () => setValues((prev) => ({ ...prev, [field.id]: sIdx + 1 }))
1527
- },
1528
- sIdx
1529
- )
1530
- ) }) : field.type === "date" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1531
- "input",
1532
- {
1533
- type: "date",
1534
- className: "univer-bases-input",
1535
- value: String(curVal ?? ""),
1536
- onChange: (e) => setValues((prev) => ({ ...prev, [field.id]: e.target.value }))
1537
- }
1538
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1539
- "input",
1540
- {
1541
- type: field.type === "number" || field.type === "currency" || field.type === "percent" ? "number" : field.type === "email" ? "email" : "text",
1542
- className: "univer-bases-input",
1543
- placeholder: `\u8BF7\u8F93\u5165${item.label || field.name}...`,
1544
- value: curVal === void 0 || curVal === null ? "" : String(curVal),
1545
- onChange: (e) => {
1546
- const raw = e.target.value;
1547
- const parsed = field.type === "number" || field.type === "currency" || field.type === "percent" ? (0, import_univer_bases6.toNumericValue)(raw) ?? raw : raw;
1548
- setValues((prev) => ({ ...prev, [field.id]: parsed }));
1549
- }
1550
- }
1551
- )
1552
- ] }, field.id);
2021
+ )
2022
+ ]
2023
+ },
2024
+ field.id
2025
+ );
1553
2026
  }),
1554
2027
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginTop: 18 }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1555
2028
  "button",
@@ -1938,12 +2411,12 @@ var GanttTimelineView = ({ query, mode }) => {
1938
2411
 
1939
2412
  // src/views/grid/GridView.tsx
1940
2413
  var import_univer_bases11 = require("@yudaocode/univer-bases");
1941
- var import_react6 = __toESM(require("react"));
2414
+ var import_react7 = __toESM(require("react"));
1942
2415
 
1943
2416
  // src/views/grid/FieldConfigPopover.tsx
1944
- var import_core3 = require("@univerjs/core");
2417
+ var import_core5 = require("@univerjs/core");
1945
2418
  var import_univer_bases9 = require("@yudaocode/univer-bases");
1946
- var import_react4 = require("react");
2419
+ var import_react5 = require("react");
1947
2420
  var import_jsx_runtime8 = require("react/jsx-runtime");
1948
2421
  var FIELD_TYPE_LABELS = [
1949
2422
  { type: "text", label: "\u5355\u884C/\u591A\u884C\u6587\u672C (Text)", group: "\u57FA\u7840\u5B57\u6BB5" },
@@ -1975,38 +2448,38 @@ var FIELD_TYPE_LABELS = [
1975
2448
  { type: "lastModifiedBy", label: "\u6700\u540E\u4FEE\u6539\u4EBA (Modified By)", group: "\u7CFB\u7EDF\u81EA\u52A8\u5B57\u6BB5" }
1976
2449
  ];
1977
2450
  var FieldConfigPopover = ({ mode, unitData, table, field, onExecuteCommand, onClose }) => {
1978
- const [name, setName] = (0, import_react4.useState)(field?.name ?? "\u65B0\u5B57\u6BB5");
1979
- const [type, setType] = (0, import_react4.useState)(field?.type ?? "text");
1980
- const [currencySymbol, setCurrencySymbol] = (0, import_react4.useState)(field?.config?.currencySymbol ?? "\xA5");
1981
- const [precision, setPrecision] = (0, import_react4.useState)(field?.config?.precision ?? 2);
1982
- const [options, setOptions] = (0, import_react4.useState)(
2451
+ const [name, setName] = (0, import_react5.useState)(field?.name ?? "\u65B0\u5B57\u6BB5");
2452
+ const [type, setType] = (0, import_react5.useState)(field?.type ?? "text");
2453
+ const [currencySymbol, setCurrencySymbol] = (0, import_react5.useState)(field?.config?.currencySymbol ?? "\xA5");
2454
+ const [precision, setPrecision] = (0, import_react5.useState)(field?.config?.precision ?? 2);
2455
+ const [options, setOptions] = (0, import_react5.useState)(
1983
2456
  field?.config?.options ?? [
1984
2457
  { id: "opt_1", name: "\u5F85\u5904\u7406", color: import_univer_bases9.BASE_SELECT_PALETTE[0] },
1985
2458
  { id: "opt_2", name: "\u8FDB\u884C\u4E2D", color: import_univer_bases9.BASE_SELECT_PALETTE[1] },
1986
2459
  { id: "opt_3", name: "\u5DF2\u5B8C\u6210", color: import_univer_bases9.BASE_SELECT_PALETTE[2] }
1987
2460
  ]
1988
2461
  );
1989
- const [linkedTableId, setLinkedTableId] = (0, import_react4.useState)(
2462
+ const [linkedTableId, setLinkedTableId] = (0, import_react5.useState)(
1990
2463
  field?.config?.linkedTableId ?? unitData.tableOrder.find((tid) => tid !== table.id) ?? table.id
1991
2464
  );
1992
- const [createSymmetric, setCreateSymmetric] = (0, import_react4.useState)(true);
2465
+ const [createSymmetric, setCreateSymmetric] = (0, import_react5.useState)(true);
1993
2466
  const linkFieldsInTable = Object.values(table.fields).filter((f) => f.type === "link");
1994
- const [linkFieldId, setLinkFieldId] = (0, import_react4.useState)(
2467
+ const [linkFieldId, setLinkFieldId] = (0, import_react5.useState)(
1995
2468
  field?.config?.linkFieldId ?? linkFieldsInTable[0]?.id ?? ""
1996
2469
  );
1997
2470
  const selectedLinkField = table.fields[linkFieldId];
1998
2471
  const lookupTargetTable = selectedLinkField?.config?.linkedTableId ? unitData.tables[selectedLinkField.config.linkedTableId] : void 0;
1999
2472
  const lookupTargetFields = lookupTargetTable ? lookupTargetTable.fieldOrder.map((id) => lookupTargetTable.fields[id]).filter(Boolean) : [];
2000
- const [lookupFieldId, setLookupFieldId] = (0, import_react4.useState)(
2473
+ const [lookupFieldId, setLookupFieldId] = (0, import_react5.useState)(
2001
2474
  field?.config?.lookupFieldId ?? lookupTargetFields[0]?.id ?? ""
2002
2475
  );
2003
- const [rollupFunction, setRollupFunction] = (0, import_react4.useState)(
2476
+ const [rollupFunction, setRollupFunction] = (0, import_react5.useState)(
2004
2477
  field?.config?.rollupFunction ?? "sum"
2005
2478
  );
2006
- const [formula, setFormula] = (0, import_react4.useState)(
2479
+ const [formula, setFormula] = (0, import_react5.useState)(
2007
2480
  field?.config?.formula ?? 'IF({\u4EFB\u52A1\u72B6\u6001} = "\u5DF2\u5B8C\u6210", "\u8FBE\u6807", "\u8FDB\u884C\u4E2D")'
2008
2481
  );
2009
- const [buttonLabel, setButtonLabel] = (0, import_react4.useState)(field?.config?.buttonLabel ?? "\u89E6\u53D1\u6D41\u7A0B");
2482
+ const [buttonLabel, setButtonLabel] = (0, import_react5.useState)(field?.config?.buttonLabel ?? "\u89E6\u53D1\u6D41\u7A0B");
2010
2483
  const handleSave = () => {
2011
2484
  const config = { ...field?.config ?? {} };
2012
2485
  if (type === "singleSelect" || type === "multiSelect") {
@@ -2146,7 +2619,7 @@ var FieldConfigPopover = ({ mode, unitData, table, field, onExecuteCommand, onCl
2146
2619
  onClick: () => setOptions([
2147
2620
  ...options,
2148
2621
  {
2149
- id: `opt_${(0, import_core3.generateRandomId)(4)}`,
2622
+ id: `opt_${(0, import_core5.generateRandomId)(4)}`,
2150
2623
  name: `\u9009\u9879 ${options.length + 1}`,
2151
2624
  color: import_univer_bases9.BASE_SELECT_PALETTE[options.length % import_univer_bases9.BASE_SELECT_PALETTE.length]
2152
2625
  }
@@ -2324,7 +2797,7 @@ var FieldConfigPopover = ({ mode, unitData, table, field, onExecuteCommand, onCl
2324
2797
 
2325
2798
  // src/views/grid/GridCellEditor.tsx
2326
2799
  var import_univer_bases10 = require("@yudaocode/univer-bases");
2327
- var import_react5 = require("react");
2800
+ var import_react6 = require("react");
2328
2801
  var import_jsx_runtime9 = require("react/jsx-runtime");
2329
2802
  var GridCellEditor = ({
2330
2803
  unitData,
@@ -2335,8 +2808,8 @@ var GridCellEditor = ({
2335
2808
  onOpenLinkPicker,
2336
2809
  onTriggerButton
2337
2810
  }) => {
2338
- const [editing, setEditing] = (0, import_react5.useState)(false);
2339
- const [draft, setDraft] = (0, import_react5.useState)("");
2811
+ const [editing, setEditing] = (0, import_react6.useState)(false);
2812
+ const [draft, setDraft] = (0, import_react6.useState)("");
2340
2813
  const rawValue = row.values[field.id];
2341
2814
  const displayValue = row.displayValues[field.id] ?? "";
2342
2815
  if ((0, import_univer_bases10.isComputedBaseField)(field.type)) {
@@ -2623,9 +3096,9 @@ var SUMMARY_OPTIONS = [
2623
3096
  ];
2624
3097
  var GridView = ({ query }) => {
2625
3098
  const { unit, snapshot, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
2626
- const [configuringFieldId, setConfiguringFieldId] = (0, import_react6.useState)(null);
2627
- const [creatingFieldOpen, setCreatingFieldOpen] = (0, import_react6.useState)(false);
2628
- const [collapsedGroupKeys, setCollapsedGroupKeys] = (0, import_react6.useState)({});
3099
+ const [configuringFieldId, setConfiguringFieldId] = (0, import_react7.useState)(null);
3100
+ const [creatingFieldOpen, setCreatingFieldOpen] = (0, import_react7.useState)(false);
3101
+ const [collapsedGroupKeys, setCollapsedGroupKeys] = (0, import_react7.useState)({});
2629
3102
  if (!unit || !snapshot) return null;
2630
3103
  const unitId = unit.getUnitId();
2631
3104
  const { table, view, visibleFields, rows, groups, summaryByField } = query;
@@ -2714,7 +3187,7 @@ var GridView = ({ query }) => {
2714
3187
  const renderGroupNodes = (nodes) => {
2715
3188
  return nodes.map((group) => {
2716
3189
  const isCollapsed = collapsedGroupKeys[group.key] ?? group.collapsed;
2717
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react6.default.Fragment, { children: [
3190
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react7.default.Fragment, { children: [
2718
3191
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { className: "univer-bases-grid__group-row", "data-testid": "bases-grid-group-header", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { colSpan: visibleFields.length + 2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2719
3192
  "div",
2720
3193
  {
@@ -2932,12 +3405,12 @@ var GridView = ({ query }) => {
2932
3405
 
2933
3406
  // src/views/kanban/KanbanView.tsx
2934
3407
  var import_univer_bases12 = require("@yudaocode/univer-bases");
2935
- var import_react7 = require("react");
3408
+ var import_react8 = require("react");
2936
3409
  var import_jsx_runtime11 = require("react/jsx-runtime");
2937
3410
  var KanbanView = ({ query }) => {
2938
3411
  const { unit, commandService, selectionService } = useActiveBaseWorkspace();
2939
- const [draggingRecordId, setDraggingRecordId] = (0, import_react7.useState)(null);
2940
- const [dragOverColKey, setDragOverColKey] = (0, import_react7.useState)(null);
3412
+ const [draggingRecordId, setDraggingRecordId] = (0, import_react8.useState)(null);
3413
+ const [dragOverColKey, setDragOverColKey] = (0, import_react8.useState)(null);
2941
3414
  if (!unit) return null;
2942
3415
  const unitId = unit.getUnitId();
2943
3416
  const { table, view, allFields, rows } = query;
@@ -3202,125 +3675,467 @@ var KanbanView = ({ query }) => {
3202
3675
  ] });
3203
3676
  };
3204
3677
 
3205
- // src/views/toolbar/BasesViewToolbar.tsx
3206
- var import_core4 = require("@univerjs/core");
3678
+ // src/views/list/ListView.tsx
3207
3679
  var import_univer_bases13 = require("@yudaocode/univer-bases");
3208
- var import_react8 = require("react");
3209
3680
  var import_jsx_runtime12 = require("react/jsx-runtime");
3210
- var FILTER_OPERATOR_OPTIONS = [
3211
- { value: "is", label: "\u7B49\u4E8E" },
3212
- { value: "isNot", label: "\u4E0D\u7B49\u4E8E" },
3213
- { value: "contains", label: "\u5305\u542B" },
3214
- { value: "notContains", label: "\u4E0D\u5305\u542B" },
3215
- { value: "gt", label: "\u5927\u4E8E" },
3216
- { value: "gte", label: "\u5927\u4E8E\u7B49\u4E8E" },
3217
- { value: "lt", label: "\u5C0F\u4E8E" },
3218
- { value: "lte", label: "\u5C0F\u4E8E\u7B49\u4E8E" },
3219
- { value: "isEmpty", label: "\u4E3A\u7A7A" },
3220
- { value: "isNotEmpty", label: "\u4E0D\u4E3A\u7A7A" }
3221
- ];
3222
- var QUICK_VIEW_MODES = [
3223
- { type: "grid", label: "\u8868\u683C" },
3224
- { type: "kanban", label: "\u770B\u677F" },
3225
- { type: "calendar", label: "\u65E5\u5386" },
3226
- { type: "gallery", label: "\u753B\u5ECA" },
3227
- { type: "gantt", label: "\u7518\u7279\u56FE" },
3228
- { type: "timeline", label: "\u65F6\u95F4\u8F74" },
3229
- { type: "form", label: "\u8868\u5355" },
3230
- { type: "dashboard", label: "\u4EEA\u8868\u76D8" }
3231
- ];
3232
- var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3233
- const { unit, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
3234
- const [openPopover, setOpenPopover] = (0, import_react8.useState)(null);
3235
- const [newViewName, setNewViewName] = (0, import_react8.useState)("");
3236
- const [newViewType, setNewViewType] = (0, import_react8.useState)("grid");
3237
- if (!unit) return null;
3681
+ var ListView = ({ query }) => {
3682
+ const { unit, snapshot, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
3683
+ if (!unit || !snapshot) return null;
3238
3684
  const unitId = unit.getUnitId();
3239
- const fields = table.fieldOrder.map((fid) => table.fields[fid]).filter((f) => Boolean(f));
3240
- const filters = activeView.filters ?? [];
3241
- const sorts = activeView.sorts ?? [];
3242
- const groups = activeView.groups ?? [];
3243
- const colorRules = activeView.colorRules ?? [];
3244
- const conjunction = activeView.filterConjunction ?? "and";
3245
- const patchView = (patch) => {
3685
+ const { table, view, allFields } = query;
3686
+ const listResult = (0, import_univer_bases13.computeBaseHierarchicalList)(snapshot, table.id, view.id, {
3687
+ overrides: {
3688
+ searchQuery: selectionState.searchQuery || view.searchQuery
3689
+ }
3690
+ });
3691
+ const selfLinkFields = allFields.filter(
3692
+ (f) => f.type === "link" && f.config?.linkedTableId === table.id
3693
+ );
3694
+ const parentField = listResult.parentField;
3695
+ const primaryField = table.fields[table.primaryFieldId] ?? allFields[0];
3696
+ const statusField = allFields.find((f) => f.type === "singleSelect");
3697
+ const personField = allFields.find((f) => f.type === "person");
3698
+ const dateField = allFields.find((f) => f.type === "date");
3699
+ const progressField = allFields.find((f) => f.type === "percent");
3700
+ const nodeMap = /* @__PURE__ */ new Map();
3701
+ const walkRegister = (nodes) => {
3702
+ for (const n of nodes) {
3703
+ nodeMap.set(n.recordId, n);
3704
+ if (n.children.length > 0) walkRegister(n.children);
3705
+ }
3706
+ };
3707
+ walkRegister(listResult.roots);
3708
+ const ensureParentFieldId = () => {
3709
+ if (parentField) return parentField.id;
3710
+ let createdFieldId = null;
3711
+ commandService.syncExecuteCommand(import_univer_bases13.AddBaseFieldCommand.id, {
3712
+ unitId,
3713
+ tableId: table.id,
3714
+ name: "\u4E0A\u7EA7\u8BB0\u5F55",
3715
+ type: "link",
3716
+ config: { linkedTableId: table.id, allowMultiple: false },
3717
+ createSymmetric: false,
3718
+ onCreated: (fid) => {
3719
+ createdFieldId = fid;
3720
+ }
3721
+ });
3722
+ if (createdFieldId) {
3723
+ commandService.syncExecuteCommand(import_univer_bases13.UpdateBaseViewCommand.id, {
3724
+ unitId,
3725
+ tableId: table.id,
3726
+ viewId: view.id,
3727
+ patch: { listParentFieldId: createdFieldId }
3728
+ });
3729
+ }
3730
+ return createdFieldId;
3731
+ };
3732
+ const toggleNodeCollapsed = (recordId) => {
3733
+ const cur = view.listCollapsedRecordIds ?? [];
3734
+ const next = cur.includes(recordId) ? cur.filter((id) => id !== recordId) : [...cur, recordId];
3246
3735
  commandService.syncExecuteCommand(import_univer_bases13.UpdateBaseViewCommand.id, {
3247
3736
  unitId,
3248
3737
  tableId: table.id,
3249
- viewId: activeView.id,
3250
- patch
3738
+ viewId: view.id,
3739
+ patch: { listCollapsedRecordIds: next }
3251
3740
  });
3252
3741
  };
3253
- const togglePopover = (target) => {
3254
- setOpenPopover((prev) => prev === target ? null : target);
3742
+ const setAllCollapsed = (collapseAll) => {
3743
+ const parentRecordIds = [];
3744
+ if (collapseAll) {
3745
+ for (const n of nodeMap.values()) {
3746
+ if (n.children.length > 0) parentRecordIds.push(n.recordId);
3747
+ }
3748
+ }
3749
+ commandService.syncExecuteCommand(import_univer_bases13.UpdateBaseViewCommand.id, {
3750
+ unitId,
3751
+ tableId: table.id,
3752
+ viewId: view.id,
3753
+ patch: { listCollapsedRecordIds: parentRecordIds }
3754
+ });
3255
3755
  };
3256
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-toolbar", "data-testid": "bases-view-toolbar", children: [
3257
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-toolbar__tabs", children: [
3258
- table.viewOrder.map((vid) => {
3259
- const vw = table.views[vid];
3260
- if (!vw) return null;
3261
- const isActive = workspaceMode === "table" && activeView.id === vw.id;
3262
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3263
- "button",
3756
+ const handleAddChildRecord = (parentNode) => {
3757
+ const pFieldId = ensureParentFieldId();
3758
+ if (!pFieldId) return;
3759
+ if (parentNode.collapsed) {
3760
+ toggleNodeCollapsed(parentNode.recordId);
3761
+ }
3762
+ commandService.syncExecuteCommand(import_univer_bases13.AddBaseRecordCommand.id, {
3763
+ unitId,
3764
+ tableId: table.id,
3765
+ cells: {
3766
+ ...primaryField ? { [primaryField.id]: `${parentNode.title} \xB7 \u5B50\u4EFB\u52A1` } : {},
3767
+ [pFieldId]: [parentNode.recordId]
3768
+ }
3769
+ });
3770
+ };
3771
+ const handlePromoteNode = (node) => {
3772
+ if (!parentField || !node.parentId) return;
3773
+ const parentNode = nodeMap.get(node.parentId);
3774
+ const grandParentId = parentNode?.parentId ?? null;
3775
+ commandService.syncExecuteCommand(import_univer_bases13.UpdateBaseRecordCommand.id, {
3776
+ unitId,
3777
+ tableId: table.id,
3778
+ recordId: node.recordId,
3779
+ cells: {
3780
+ [parentField.id]: grandParentId ? [grandParentId] : []
3781
+ }
3782
+ });
3783
+ };
3784
+ const handleDemoteNode = (node) => {
3785
+ const pFieldId = ensureParentFieldId();
3786
+ if (!pFieldId) return;
3787
+ const siblings = node.parentId ? nodeMap.get(node.parentId)?.children ?? [] : listResult.roots;
3788
+ const idx = siblings.findIndex((s) => s.recordId === node.recordId);
3789
+ if (idx <= 0) return;
3790
+ const prevSibling = siblings[idx - 1];
3791
+ commandService.syncExecuteCommand(import_univer_bases13.UpdateBaseRecordCommand.id, {
3792
+ unitId,
3793
+ tableId: table.id,
3794
+ recordId: node.recordId,
3795
+ cells: {
3796
+ [pFieldId]: [prevSibling.recordId]
3797
+ }
3798
+ });
3799
+ };
3800
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-list-view", "data-testid": "bases-list-view", children: [
3801
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-subbar", children: [
3802
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-inline-flex", children: [
3803
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-subbar__label", children: "\u5C42\u7EA7\u6811\u7236\u8282\u70B9\u5B57\u6BB5:" }),
3804
+ selfLinkFields.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3805
+ "select",
3264
3806
  {
3265
- type: "button",
3266
- className: `univer-bases-view-tab ${isActive ? "is-active" : ""}`,
3267
- "data-testid": `bases-view-tab-${vw.type}`,
3268
- onClick: () => {
3269
- commandService.syncExecuteCommand(import_univer_bases13.SetActiveBaseViewCommand.id, {
3807
+ className: "univer-bases-select univer-bases-select--xs",
3808
+ "data-testid": "bases-list-parent-field-select",
3809
+ value: parentField?.id ?? "",
3810
+ onChange: (e) => {
3811
+ commandService.syncExecuteCommand(import_univer_bases13.UpdateBaseViewCommand.id, {
3270
3812
  unitId,
3271
3813
  tableId: table.id,
3272
- viewId: vw.id
3814
+ viewId: view.id,
3815
+ patch: { listParentFieldId: e.target.value || void 0 }
3273
3816
  });
3274
3817
  },
3275
- children: [
3276
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseViewTypeIcon, { type: vw.type }),
3277
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: vw.name })
3278
- ]
3279
- },
3280
- vw.id
3281
- );
3282
- }),
3283
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3284
- "button",
3285
- {
3286
- type: "button",
3287
- className: `univer-bases-view-tab ${workspaceMode === "dashboard" ? "is-active" : ""}`,
3288
- "data-testid": "bases-view-tab-dashboard",
3289
- onClick: () => {
3290
- commandService.syncExecuteCommand(import_univer_bases13.SetBaseWorkspaceModeCommand.id, {
3291
- unitId,
3292
- mode: "dashboard"
3293
- });
3294
- },
3295
- children: [
3296
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseViewTypeIcon, { type: "dashboard" }),
3297
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u6570\u636E\u4EEA\u8868\u76D8" })
3298
- ]
3299
- }
3300
- ),
3301
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-toolbar__quick-modes", "aria-label": "\u89C6\u56FE\u6A21\u5F0F\u5FEB\u6377\u5207\u6362", children: QUICK_VIEW_MODES.map((m) => {
3302
- const existsInTabs = m.type === "dashboard" || table.viewOrder.some((vid) => table.views[vid]?.type === m.type);
3303
- if (existsInTabs) return null;
3304
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3818
+ children: selfLinkFields.map((lf) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: lf.id, children: lf.name }, lf.id))
3819
+ }
3820
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3305
3821
  "button",
3306
3822
  {
3307
3823
  type: "button",
3308
- className: "univer-bases-view-tab is-ghost",
3309
- onClick: () => {
3310
- commandService.syncExecuteCommand(SwitchBaseViewTypeOperation.id, {
3311
- viewType: m.type
3312
- });
3313
- },
3824
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
3825
+ onClick: () => ensureParentFieldId(),
3314
3826
  children: [
3315
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseViewTypeIcon, { type: m.type }),
3316
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: m.label })
3827
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3828
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u521D\u59CB\u5316\u7236\u5B50\u5C42\u7EA7\u5B57\u6BB5" })
3317
3829
  ]
3318
- },
3319
- m.type
3830
+ }
3831
+ ),
3832
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "univer-bases-muted-key", children: [
3833
+ "\u5171 ",
3834
+ listResult.totalNodeCount,
3835
+ " \u9879 \xB7 \u6700\u5927\u6DF1\u5EA6 ",
3836
+ listResult.maxDepth + 1,
3837
+ " \u5C42"
3838
+ ] })
3839
+ ] }),
3840
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-inline-flex", children: [
3841
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3842
+ "button",
3843
+ {
3844
+ type: "button",
3845
+ className: "univer-bases-btn univer-bases-btn--ghost univer-bases-btn--sm",
3846
+ onClick: () => setAllCollapsed(false),
3847
+ children: "\u5168\u90E8\u5C55\u5F00"
3848
+ }
3849
+ ),
3850
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3851
+ "button",
3852
+ {
3853
+ type: "button",
3854
+ className: "univer-bases-btn univer-bases-btn--ghost univer-bases-btn--sm",
3855
+ onClick: () => setAllCollapsed(true),
3856
+ children: "\u5168\u90E8\u6298\u53E0"
3857
+ }
3858
+ ),
3859
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3860
+ "button",
3861
+ {
3862
+ type: "button",
3863
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
3864
+ "data-testid": "bases-list-add-root-btn",
3865
+ onClick: () => {
3866
+ commandService.syncExecuteCommand(import_univer_bases13.AddBaseRecordCommand.id, {
3867
+ unitId,
3868
+ tableId: table.id,
3869
+ cells: primaryField ? { [primaryField.id]: "\u65B0\u5EFA\u6839\u5C42\u7EA7\u8BB0\u5F55" } : {}
3870
+ });
3871
+ },
3872
+ children: [
3873
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3874
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u65B0\u589E\u9876\u5C42\u9879" })
3875
+ ]
3876
+ }
3877
+ )
3878
+ ] })
3879
+ ] }),
3880
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-list-scroll", children: [
3881
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-list-header", children: [
3882
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-list-col-title", children: "\u5C42\u7EA7\u7ED3\u6784\u4E0E\u8BB0\u5F55\u540D\u79F0" }),
3883
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-list-col-badges", children: "\u72B6\u6001 \xB7 \u8D1F\u8D23\u4EBA \xB7 \u6392\u671F\u4E0E\u8FDB\u5EA6" }),
3884
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-list-col-actions", children: "\u5FEB\u6377\u5C42\u7EA7\u64CD\u4F5C" })
3885
+ ] }),
3886
+ listResult.flattenedVisibleNodes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-empty-hint", children: "\u6682\u65E0\u5339\u914D\u8BB0\u5F55" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-list-rows", children: listResult.flattenedVisibleNodes.map((node) => {
3887
+ const siblings = node.parentId ? nodeMap.get(node.parentId)?.children ?? [] : listResult.roots;
3888
+ const siblingIdx = siblings.findIndex((s) => s.recordId === node.recordId);
3889
+ const canPromote = Boolean(parentField && node.parentId);
3890
+ const canDemote = siblingIdx > 0;
3891
+ const statusVal = statusField ? node.row.displayValues[statusField.id] : "";
3892
+ const statusOpt = statusField?.config?.options?.find(
3893
+ (o) => o.name === statusVal || o.id === node.row.values[statusField.id]
3894
+ );
3895
+ const rawPersons = personField ? node.row.values[personField.id] : void 0;
3896
+ const personNames = Array.isArray(rawPersons) ? rawPersons.map((p) => typeof p === "string" ? p : p.name).filter(Boolean).join(", ") : personField ? node.row.displayValues[personField.id] : "";
3897
+ const dateVal = dateField ? node.row.displayValues[dateField.id] : "";
3898
+ const progressVal = progressField ? node.row.displayValues[progressField.id] : "";
3899
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3900
+ "div",
3901
+ {
3902
+ className: "univer-bases-list-row",
3903
+ "data-testid": `bases-list-row-${node.recordId}`,
3904
+ "data-depth": node.depth,
3905
+ style: node.row.rowColor ? { backgroundColor: node.row.rowColor } : void 0,
3906
+ onClick: () => selectionService.openRecordDrawer(node.recordId),
3907
+ children: [
3908
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3909
+ "div",
3910
+ {
3911
+ className: "univer-bases-list-row__main",
3912
+ style: { paddingLeft: `${node.depth * 22 + 12}px` },
3913
+ children: [
3914
+ node.depth > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3915
+ "span",
3916
+ {
3917
+ className: "univer-bases-list-indent-guide",
3918
+ "aria-hidden": "true"
3919
+ }
3920
+ ),
3921
+ node.children.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3922
+ "button",
3923
+ {
3924
+ type: "button",
3925
+ className: "univer-bases-icon-btn univer-bases-list-chevron",
3926
+ "data-testid": `bases-list-toggle-${node.recordId}`,
3927
+ "aria-label": node.collapsed ? "\u5C55\u5F00\u5B50\u9879" : "\u6298\u53E0\u5B50\u9879",
3928
+ onClick: (e) => {
3929
+ e.stopPropagation();
3930
+ toggleNodeCollapsed(node.recordId);
3931
+ },
3932
+ children: node.collapsed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseChevronRightIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseChevronDownIcon, {})
3933
+ }
3934
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-list-leaf-dot", "aria-hidden": "true" }),
3935
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-list-row__title", children: node.title }),
3936
+ node.descendantCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "univer-bases-badge-count", children: [
3937
+ node.descendantCount,
3938
+ " \u5B50\u9879"
3939
+ ] }),
3940
+ node.cycleDetected && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-pill univer-bases-pill--neutral", children: "\u73AF\u8DEF\u4FDD\u62A4" })
3941
+ ]
3942
+ }
3943
+ ),
3944
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-list-row__badges", children: [
3945
+ statusVal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3946
+ "span",
3947
+ {
3948
+ className: "univer-bases-pill",
3949
+ style: {
3950
+ backgroundColor: statusOpt ? `${statusOpt.color}18` : "#f1f5f9",
3951
+ color: statusOpt?.color ?? "#334155",
3952
+ borderColor: statusOpt ? `${statusOpt.color}40` : "#e2e8f0"
3953
+ },
3954
+ children: statusVal
3955
+ }
3956
+ ),
3957
+ personNames && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-pill univer-bases-pill--neutral", children: personNames }),
3958
+ dateVal && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "univer-bases-inline-flex univer-bases-muted-key", children: [
3959
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCalendarIcon, {}),
3960
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: dateVal })
3961
+ ] }),
3962
+ progressVal && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "univer-bases-pill univer-bases-pill--neutral", children: progressVal })
3963
+ ] }),
3964
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3965
+ "div",
3966
+ {
3967
+ className: "univer-bases-list-row__actions",
3968
+ onClick: (e) => e.stopPropagation(),
3969
+ children: [
3970
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3971
+ "button",
3972
+ {
3973
+ type: "button",
3974
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
3975
+ "data-testid": `bases-list-add-child-${node.recordId}`,
3976
+ onClick: () => handleAddChildRecord(node),
3977
+ children: [
3978
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3979
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u5B50\u8BB0\u5F55" })
3980
+ ]
3981
+ }
3982
+ ),
3983
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3984
+ "button",
3985
+ {
3986
+ type: "button",
3987
+ className: "univer-bases-icon-btn",
3988
+ title: "\u63D0\u5347\u5C42\u7EA7 (\u5347\u7EA7\u4E3A\u4E0A\u7EA7\u8282\u70B9\u540C\u7EA7)",
3989
+ "data-testid": `bases-list-promote-${node.recordId}`,
3990
+ disabled: !canPromote,
3991
+ onClick: () => handlePromoteNode(node),
3992
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseOutdentIcon, {})
3993
+ }
3994
+ ),
3995
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3996
+ "button",
3997
+ {
3998
+ type: "button",
3999
+ className: "univer-bases-icon-btn",
4000
+ title: "\u964D\u4F4E\u5C42\u7EA7 (\u7F29\u8FDB\u4E3A\u4E0A\u4E00\u540C\u7EA7\u8282\u70B9\u7684\u5B50\u9879)",
4001
+ "data-testid": `bases-list-demote-${node.recordId}`,
4002
+ disabled: !canDemote,
4003
+ onClick: () => handleDemoteNode(node),
4004
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseIndentIcon, {})
4005
+ }
4006
+ )
4007
+ ]
4008
+ }
4009
+ )
4010
+ ]
4011
+ },
4012
+ node.recordId
4013
+ );
4014
+ }) })
4015
+ ] })
4016
+ ] });
4017
+ };
4018
+
4019
+ // src/views/toolbar/BasesViewToolbar.tsx
4020
+ var import_core6 = require("@univerjs/core");
4021
+ var import_univer_bases14 = require("@yudaocode/univer-bases");
4022
+ var import_react9 = require("react");
4023
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4024
+ var FILTER_OPERATOR_OPTIONS = [
4025
+ { value: "is", label: "\u7B49\u4E8E" },
4026
+ { value: "isNot", label: "\u4E0D\u7B49\u4E8E" },
4027
+ { value: "contains", label: "\u5305\u542B" },
4028
+ { value: "notContains", label: "\u4E0D\u5305\u542B" },
4029
+ { value: "gt", label: "\u5927\u4E8E" },
4030
+ { value: "gte", label: "\u5927\u4E8E\u7B49\u4E8E" },
4031
+ { value: "lt", label: "\u5C0F\u4E8E" },
4032
+ { value: "lte", label: "\u5C0F\u4E8E\u7B49\u4E8E" },
4033
+ { value: "isEmpty", label: "\u4E3A\u7A7A" },
4034
+ { value: "isNotEmpty", label: "\u4E0D\u4E3A\u7A7A" }
4035
+ ];
4036
+ var QUICK_VIEW_MODES = [
4037
+ { type: "grid", label: "\u8868\u683C\u89C6\u56FE" },
4038
+ { type: "list", label: "\u5217\u8868\u89C6\u56FE" },
4039
+ { type: "kanban", label: "\u770B\u677F" },
4040
+ { type: "calendar", label: "\u65E5\u5386" },
4041
+ { type: "gallery", label: "\u753B\u5ECA" },
4042
+ { type: "gantt", label: "\u7518\u7279\u56FE" },
4043
+ { type: "timeline", label: "\u65F6\u95F4\u8F74" },
4044
+ { type: "form", label: "\u8868\u5355" },
4045
+ { type: "dashboard", label: "\u4EEA\u8868\u76D8" }
4046
+ ];
4047
+ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
4048
+ const { unit, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
4049
+ const [openPopover, setOpenPopover] = (0, import_react9.useState)(null);
4050
+ const [newViewName, setNewViewName] = (0, import_react9.useState)("");
4051
+ const [newViewType, setNewViewType] = (0, import_react9.useState)("grid");
4052
+ if (!unit) return null;
4053
+ const unitId = unit.getUnitId();
4054
+ const fields = table.fieldOrder.map((fid) => table.fields[fid]).filter((f) => Boolean(f));
4055
+ const filters = activeView.filters ?? [];
4056
+ const sorts = activeView.sorts ?? [];
4057
+ const groups = activeView.groups ?? [];
4058
+ const colorRules = activeView.colorRules ?? [];
4059
+ const conjunction = activeView.filterConjunction ?? "and";
4060
+ const patchView = (patch) => {
4061
+ commandService.syncExecuteCommand(import_univer_bases14.UpdateBaseViewCommand.id, {
4062
+ unitId,
4063
+ tableId: table.id,
4064
+ viewId: activeView.id,
4065
+ patch
4066
+ });
4067
+ };
4068
+ const togglePopover = (target) => {
4069
+ setOpenPopover((prev) => prev === target ? null : target);
4070
+ };
4071
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-toolbar", "data-testid": "bases-view-toolbar", children: [
4072
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-toolbar__tabs", children: [
4073
+ table.viewOrder.map((vid) => {
4074
+ const vw = table.views[vid];
4075
+ if (!vw) return null;
4076
+ const isActive = workspaceMode === "table" && activeView.id === vw.id;
4077
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4078
+ "button",
4079
+ {
4080
+ type: "button",
4081
+ className: `univer-bases-view-tab ${isActive ? "is-active" : ""}`,
4082
+ "data-testid": `bases-view-tab-${vw.type}`,
4083
+ onClick: () => {
4084
+ commandService.syncExecuteCommand(import_univer_bases14.SetActiveBaseViewCommand.id, {
4085
+ unitId,
4086
+ tableId: table.id,
4087
+ viewId: vw.id
4088
+ });
4089
+ },
4090
+ children: [
4091
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseViewTypeIcon, { type: vw.type }),
4092
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: vw.name })
4093
+ ]
4094
+ },
4095
+ vw.id
4096
+ );
4097
+ }),
4098
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4099
+ "button",
4100
+ {
4101
+ type: "button",
4102
+ className: `univer-bases-view-tab ${workspaceMode === "dashboard" ? "is-active" : ""}`,
4103
+ "data-testid": "bases-view-tab-dashboard",
4104
+ onClick: () => {
4105
+ commandService.syncExecuteCommand(import_univer_bases14.SetBaseWorkspaceModeCommand.id, {
4106
+ unitId,
4107
+ mode: "dashboard"
4108
+ });
4109
+ },
4110
+ children: [
4111
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseViewTypeIcon, { type: "dashboard" }),
4112
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u6570\u636E\u4EEA\u8868\u76D8" })
4113
+ ]
4114
+ }
4115
+ ),
4116
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-toolbar__quick-modes", "aria-label": "\u89C6\u56FE\u6A21\u5F0F\u5FEB\u6377\u5207\u6362", children: QUICK_VIEW_MODES.map((m) => {
4117
+ const existsInTabs = m.type === "dashboard" || table.viewOrder.some((vid) => table.views[vid]?.type === m.type);
4118
+ if (existsInTabs) return null;
4119
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4120
+ "button",
4121
+ {
4122
+ type: "button",
4123
+ className: "univer-bases-view-tab is-ghost",
4124
+ onClick: () => {
4125
+ commandService.syncExecuteCommand(SwitchBaseViewTypeOperation.id, {
4126
+ viewType: m.type
4127
+ });
4128
+ },
4129
+ children: [
4130
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseViewTypeIcon, { type: m.type }),
4131
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: m.label })
4132
+ ]
4133
+ },
4134
+ m.type
3320
4135
  );
3321
4136
  }) }),
3322
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
3323
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4137
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
4138
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3324
4139
  "button",
3325
4140
  {
3326
4141
  type: "button",
@@ -3328,27 +4143,27 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3328
4143
  "data-testid": "bases-new-view-btn",
3329
4144
  onClick: () => togglePopover("newView"),
3330
4145
  children: [
3331
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3332
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u65B0\u5EFA\u89C6\u56FE" })
4146
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BasePlusIcon, {}),
4147
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u65B0\u5EFA\u89C6\u56FE" })
3333
4148
  ]
3334
4149
  }
3335
4150
  ),
3336
- openPopover === "newView" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover", "data-testid": "bases-new-view-popover", children: [
3337
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover__header", children: [
3338
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "\u65B0\u5EFA\u591A\u7EF4\u89C6\u56FE" }),
3339
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4151
+ openPopover === "newView" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover", "data-testid": "bases-new-view-popover", children: [
4152
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover__header", children: [
4153
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "\u65B0\u5EFA\u591A\u7EF4\u89C6\u56FE" }),
4154
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3340
4155
  "button",
3341
4156
  {
3342
4157
  type: "button",
3343
4158
  className: "univer-bases-icon-btn",
3344
4159
  onClick: () => setOpenPopover(null),
3345
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCloseIcon, {})
4160
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
3346
4161
  }
3347
4162
  )
3348
4163
  ] }),
3349
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-form-row", children: [
3350
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { children: "\u89C6\u56FE\u540D\u79F0" }),
3351
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4164
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-form-row", children: [
4165
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { children: "\u89C6\u56FE\u540D\u79F0" }),
4166
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3352
4167
  "input",
3353
4168
  {
3354
4169
  type: "text",
@@ -3359,33 +4174,34 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3359
4174
  }
3360
4175
  )
3361
4176
  ] }),
3362
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-form-row", children: [
3363
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { children: "\u89C6\u56FE\u7C7B\u578B" }),
3364
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4177
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-form-row", children: [
4178
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { children: "\u89C6\u56FE\u7C7B\u578B" }),
4179
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3365
4180
  "select",
3366
4181
  {
3367
4182
  className: "univer-bases-select",
3368
4183
  value: newViewType,
3369
4184
  onChange: (e) => setNewViewType(e.target.value),
3370
4185
  children: [
3371
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "grid", children: "\u8868\u683C\u89C6\u56FE (Grid)" }),
3372
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "kanban", children: "\u770B\u677F\u89C6\u56FE (Kanban)" }),
3373
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "calendar", children: "\u65E5\u5386\u89C6\u56FE (Calendar)" }),
3374
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "gallery", children: "\u753B\u5ECA\u89C6\u56FE (Gallery)" }),
3375
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "gantt", children: "\u7518\u7279\u56FE (Gantt)" }),
3376
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "timeline", children: "\u65F6\u95F4\u8F74 (Timeline)" }),
3377
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "form", children: "\u8868\u5355\u6536\u96C6 (Form)" })
4186
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "grid", children: "\u8868\u683C\u89C6\u56FE (Grid)" }),
4187
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "list", children: "\u5217\u8868\u89C6\u56FE (List)" }),
4188
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "kanban", children: "\u770B\u677F\u89C6\u56FE (Kanban)" }),
4189
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "calendar", children: "\u65E5\u5386\u89C6\u56FE (Calendar)" }),
4190
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "gallery", children: "\u753B\u5ECA\u89C6\u56FE (Gallery)" }),
4191
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "gantt", children: "\u7518\u7279\u56FE (Gantt)" }),
4192
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "timeline", children: "\u65F6\u95F4\u8F74 (Timeline)" }),
4193
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "form", children: "\u8868\u5355\u6536\u96C6 (Form)" })
3378
4194
  ]
3379
4195
  }
3380
4196
  )
3381
4197
  ] }),
3382
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4198
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3383
4199
  "button",
3384
4200
  {
3385
4201
  type: "button",
3386
4202
  className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
3387
4203
  onClick: () => {
3388
- commandService.syncExecuteCommand(import_univer_bases13.AddBaseViewCommand.id, {
4204
+ commandService.syncExecuteCommand(import_univer_bases14.AddBaseViewCommand.id, {
3389
4205
  unitId,
3390
4206
  tableId: table.id,
3391
4207
  name: newViewName.trim() || void 0,
@@ -3401,16 +4217,16 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3401
4217
  ] })
3402
4218
  ] })
3403
4219
  ] }),
3404
- workspaceMode === "table" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-toolbar__actions", children: [
3405
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-toolbar__left", children: [
3406
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4220
+ workspaceMode === "table" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-toolbar__actions", children: [
4221
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-toolbar__left", children: [
4222
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3407
4223
  "button",
3408
4224
  {
3409
4225
  type: "button",
3410
4226
  className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
3411
4227
  "data-testid": "bases-toolbar-add-record",
3412
4228
  onClick: () => {
3413
- commandService.syncExecuteCommand(import_univer_bases13.AddBaseRecordCommand.id, {
4229
+ commandService.syncExecuteCommand(import_univer_bases14.AddBaseRecordCommand.id, {
3414
4230
  unitId,
3415
4231
  tableId: table.id,
3416
4232
  cells: { [table.primaryFieldId]: "\u65B0\u8BB0\u5F55" },
@@ -3418,13 +4234,13 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3418
4234
  });
3419
4235
  },
3420
4236
  children: [
3421
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3422
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u65B0\u589E\u8BB0\u5F55" })
4237
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BasePlusIcon, {}),
4238
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u65B0\u589E\u8BB0\u5F55" })
3423
4239
  ]
3424
4240
  }
3425
4241
  ),
3426
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
3427
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4242
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
4243
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3428
4244
  "button",
3429
4245
  {
3430
4246
  type: "button",
@@ -3432,43 +4248,43 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3432
4248
  "data-testid": "bases-filter-btn",
3433
4249
  onClick: () => togglePopover("filter"),
3434
4250
  children: [
3435
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseFilterIcon, {}),
3436
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
4251
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseFilterIcon, {}),
4252
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
3437
4253
  "\u7B5B\u9009",
3438
4254
  filters.length > 0 ? ` (${filters.length})` : ""
3439
4255
  ] })
3440
4256
  ]
3441
4257
  }
3442
4258
  ),
3443
- openPopover === "filter" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover univer-bases-popover--wide", "data-testid": "bases-filter-popover", children: [
3444
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover__header", children: [
3445
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-inline-flex", children: [
3446
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "\u7B5B\u9009\u6761\u4EF6" }),
3447
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4259
+ openPopover === "filter" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover univer-bases-popover--wide", "data-testid": "bases-filter-popover", children: [
4260
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover__header", children: [
4261
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-inline-flex", children: [
4262
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "\u7B5B\u9009\u6761\u4EF6" }),
4263
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3448
4264
  "select",
3449
4265
  {
3450
4266
  className: "univer-bases-select univer-bases-select--xs",
3451
4267
  value: conjunction,
3452
4268
  onChange: (e) => patchView({ filterConjunction: e.target.value }),
3453
4269
  children: [
3454
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "and", children: "\u6EE1\u8DB3\u5168\u90E8 (AND)" }),
3455
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "or", children: "\u6EE1\u8DB3\u4EFB\u4E00 (OR)" })
4270
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "and", children: "\u6EE1\u8DB3\u5168\u90E8 (AND)" }),
4271
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "or", children: "\u6EE1\u8DB3\u4EFB\u4E00 (OR)" })
3456
4272
  ]
3457
4273
  }
3458
4274
  )
3459
4275
  ] }),
3460
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4276
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3461
4277
  "button",
3462
4278
  {
3463
4279
  type: "button",
3464
4280
  className: "univer-bases-icon-btn",
3465
4281
  onClick: () => setOpenPopover(null),
3466
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCloseIcon, {})
4282
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
3467
4283
  }
3468
4284
  )
3469
4285
  ] }),
3470
- filters.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-empty-hint", children: "\u6682\u65E0\u7B5B\u9009\u89C4\u5219\uFF0C\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u6DFB\u52A0\u6761\u4EF6" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-rule-list", children: filters.map((rule) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-rule-row", children: [
3471
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4286
+ filters.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-empty-hint", children: "\u6682\u65E0\u7B5B\u9009\u89C4\u5219\uFF0C\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\u6DFB\u52A0\u6761\u4EF6" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-rule-list", children: filters.map((rule) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-rule-row", children: [
4287
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3472
4288
  "select",
3473
4289
  {
3474
4290
  className: "univer-bases-select",
@@ -3479,10 +4295,10 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3479
4295
  );
3480
4296
  patchView({ filters: next });
3481
4297
  },
3482
- children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: f.id, children: f.name }, f.id))
4298
+ children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: f.id, children: f.name }, f.id))
3483
4299
  }
3484
4300
  ),
3485
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4301
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3486
4302
  "select",
3487
4303
  {
3488
4304
  className: "univer-bases-select",
@@ -3493,10 +4309,10 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3493
4309
  );
3494
4310
  patchView({ filters: next });
3495
4311
  },
3496
- children: FILTER_OPERATOR_OPTIONS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: op.value, children: op.label }, op.value))
4312
+ children: FILTER_OPERATOR_OPTIONS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: op.value, children: op.label }, op.value))
3497
4313
  }
3498
4314
  ),
3499
- rule.operator !== "isEmpty" && rule.operator !== "isNotEmpty" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4315
+ rule.operator !== "isEmpty" && rule.operator !== "isNotEmpty" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3500
4316
  "input",
3501
4317
  {
3502
4318
  type: "text",
@@ -3511,17 +4327,17 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3511
4327
  }
3512
4328
  }
3513
4329
  ),
3514
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4330
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3515
4331
  "button",
3516
4332
  {
3517
4333
  type: "button",
3518
4334
  className: "univer-bases-icon-btn",
3519
4335
  onClick: () => patchView({ filters: filters.filter((r) => r.id !== rule.id) }),
3520
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseTrashIcon, {})
4336
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseTrashIcon, {})
3521
4337
  }
3522
4338
  )
3523
4339
  ] }, rule.id)) }),
3524
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4340
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3525
4341
  "button",
3526
4342
  {
3527
4343
  type: "button",
@@ -3533,7 +4349,7 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3533
4349
  filters: [
3534
4350
  ...filters,
3535
4351
  {
3536
- id: `flt_${(0, import_core4.generateRandomId)(5)}`,
4352
+ id: `flt_${(0, import_core6.generateRandomId)(5)}`,
3537
4353
  fieldId: firstField.id,
3538
4354
  operator: "contains",
3539
4355
  value: ""
@@ -3542,15 +4358,15 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3542
4358
  });
3543
4359
  },
3544
4360
  children: [
3545
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3546
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u6DFB\u52A0\u7B5B\u9009\u6761\u4EF6" })
4361
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BasePlusIcon, {}),
4362
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u6DFB\u52A0\u7B5B\u9009\u6761\u4EF6" })
3547
4363
  ]
3548
4364
  }
3549
4365
  ) })
3550
4366
  ] })
3551
4367
  ] }),
3552
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
3553
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4368
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
4369
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3554
4370
  "button",
3555
4371
  {
3556
4372
  type: "button",
@@ -3558,29 +4374,29 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3558
4374
  "data-testid": "bases-sort-btn",
3559
4375
  onClick: () => togglePopover("sort"),
3560
4376
  children: [
3561
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseSortIcon, {}),
3562
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
4377
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseSortIcon, {}),
4378
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
3563
4379
  "\u6392\u5E8F",
3564
4380
  sorts.length > 0 ? ` (${sorts.length})` : ""
3565
4381
  ] })
3566
4382
  ]
3567
4383
  }
3568
4384
  ),
3569
- openPopover === "sort" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover univer-bases-popover--wide", "data-testid": "bases-sort-popover", children: [
3570
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover__header", children: [
3571
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "\u591A\u5217\u6392\u5E8F\u89C4\u5219" }),
3572
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4385
+ openPopover === "sort" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover univer-bases-popover--wide", "data-testid": "bases-sort-popover", children: [
4386
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover__header", children: [
4387
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "\u591A\u5217\u6392\u5E8F\u89C4\u5219" }),
4388
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3573
4389
  "button",
3574
4390
  {
3575
4391
  type: "button",
3576
4392
  className: "univer-bases-icon-btn",
3577
4393
  onClick: () => setOpenPopover(null),
3578
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCloseIcon, {})
4394
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
3579
4395
  }
3580
4396
  )
3581
4397
  ] }),
3582
- sorts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-empty-hint", children: "\u5F53\u524D\u6309\u9ED8\u8BA4\u8BB0\u5F55\u987A\u5E8F\u6392\u5217" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-rule-list", children: sorts.map((sr) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-rule-row", children: [
3583
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4398
+ sorts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-empty-hint", children: "\u5F53\u524D\u6309\u9ED8\u8BA4\u8BB0\u5F55\u987A\u5E8F\u6392\u5217" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-rule-list", children: sorts.map((sr) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-rule-row", children: [
4399
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3584
4400
  "select",
3585
4401
  {
3586
4402
  className: "univer-bases-select",
@@ -3591,10 +4407,10 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3591
4407
  );
3592
4408
  patchView({ sorts: next });
3593
4409
  },
3594
- children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: f.id, children: f.name }, f.id))
4410
+ children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: f.id, children: f.name }, f.id))
3595
4411
  }
3596
4412
  ),
3597
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4413
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3598
4414
  "select",
3599
4415
  {
3600
4416
  className: "univer-bases-select",
@@ -3606,22 +4422,22 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3606
4422
  patchView({ sorts: next });
3607
4423
  },
3608
4424
  children: [
3609
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "asc", children: "\u5347\u5E8F (A \u2192 Z / 0 \u2192 9)" }),
3610
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "desc", children: "\u964D\u5E8F (Z \u2192 A / 9 \u2192 0)" })
4425
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "asc", children: "\u5347\u5E8F (A \u2192 Z / 0 \u2192 9)" }),
4426
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: "desc", children: "\u964D\u5E8F (Z \u2192 A / 9 \u2192 0)" })
3611
4427
  ]
3612
4428
  }
3613
4429
  ),
3614
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4430
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3615
4431
  "button",
3616
4432
  {
3617
4433
  type: "button",
3618
4434
  className: "univer-bases-icon-btn",
3619
4435
  onClick: () => patchView({ sorts: sorts.filter((s) => s.id !== sr.id) }),
3620
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseTrashIcon, {})
4436
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseTrashIcon, {})
3621
4437
  }
3622
4438
  )
3623
4439
  ] }, sr.id)) }),
3624
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4440
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3625
4441
  "button",
3626
4442
  {
3627
4443
  type: "button",
@@ -3633,7 +4449,7 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3633
4449
  sorts: [
3634
4450
  ...sorts,
3635
4451
  {
3636
- id: `srt_${(0, import_core4.generateRandomId)(5)}`,
4452
+ id: `srt_${(0, import_core6.generateRandomId)(5)}`,
3637
4453
  fieldId: firstField.id,
3638
4454
  direction: "asc"
3639
4455
  }
@@ -3641,15 +4457,15 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3641
4457
  });
3642
4458
  },
3643
4459
  children: [
3644
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3645
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u6DFB\u52A0\u6392\u5E8F\u5B57\u6BB5" })
4460
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BasePlusIcon, {}),
4461
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u6DFB\u52A0\u6392\u5E8F\u5B57\u6BB5" })
3646
4462
  ]
3647
4463
  }
3648
4464
  ) })
3649
4465
  ] })
3650
4466
  ] }),
3651
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
3652
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4467
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
4468
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3653
4469
  "button",
3654
4470
  {
3655
4471
  type: "button",
@@ -3657,29 +4473,29 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3657
4473
  "data-testid": "bases-group-btn",
3658
4474
  onClick: () => togglePopover("group"),
3659
4475
  children: [
3660
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseGroupIcon, {}),
3661
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
4476
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseGroupIcon, {}),
4477
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
3662
4478
  "\u5206\u7EC4",
3663
4479
  groups.length > 0 ? ` (${groups.length})` : ""
3664
4480
  ] })
3665
4481
  ]
3666
4482
  }
3667
4483
  ),
3668
- openPopover === "group" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover", "data-testid": "bases-group-popover", children: [
3669
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover__header", children: [
3670
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "\u5C42\u7EA7\u5206\u7EC4\u8BBE\u7F6E" }),
3671
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4484
+ openPopover === "group" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover", "data-testid": "bases-group-popover", children: [
4485
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover__header", children: [
4486
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "\u5C42\u7EA7\u5206\u7EC4\u8BBE\u7F6E" }),
4487
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3672
4488
  "button",
3673
4489
  {
3674
4490
  type: "button",
3675
4491
  className: "univer-bases-icon-btn",
3676
4492
  onClick: () => setOpenPopover(null),
3677
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCloseIcon, {})
4493
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
3678
4494
  }
3679
4495
  )
3680
4496
  ] }),
3681
- groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-empty-hint", children: "\u672A\u542F\u7528\u5206\u7EC4\uFF0C\u652F\u6301\u591A\u7EA7\u5B57\u6BB5\u5D4C\u5957\u5206\u7EC4" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-rule-list", children: groups.map((gr, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-rule-row", children: [
3682
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4497
+ groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-empty-hint", children: "\u672A\u542F\u7528\u5206\u7EC4\uFF0C\u652F\u6301\u591A\u7EA7\u5B57\u6BB5\u5D4C\u5957\u5206\u7EC4" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-rule-list", children: groups.map((gr, idx) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-rule-row", children: [
4498
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3683
4499
  "select",
3684
4500
  {
3685
4501
  className: "univer-bases-select",
@@ -3690,20 +4506,20 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3690
4506
  );
3691
4507
  patchView({ groups: next });
3692
4508
  },
3693
- children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: f.id, children: f.name }, f.id))
4509
+ children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: f.id, children: f.name }, f.id))
3694
4510
  }
3695
4511
  ),
3696
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4512
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3697
4513
  "button",
3698
4514
  {
3699
4515
  type: "button",
3700
4516
  className: "univer-bases-icon-btn",
3701
4517
  onClick: () => patchView({ groups: groups.filter((_, i) => i !== idx) }),
3702
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseTrashIcon, {})
4518
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseTrashIcon, {})
3703
4519
  }
3704
4520
  )
3705
4521
  ] }, `${gr.fieldId}-${idx}`)) }),
3706
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4522
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3707
4523
  "button",
3708
4524
  {
3709
4525
  type: "button",
@@ -3719,15 +4535,15 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3719
4535
  });
3720
4536
  },
3721
4537
  children: [
3722
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3723
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u6DFB\u52A0\u5206\u7EC4\u5C42\u7EA7" })
4538
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BasePlusIcon, {}),
4539
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u6DFB\u52A0\u5206\u7EC4\u5C42\u7EA7" })
3724
4540
  ]
3725
4541
  }
3726
4542
  ) })
3727
4543
  ] })
3728
4544
  ] }),
3729
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
3730
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4545
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover-anchor", children: [
4546
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3731
4547
  "button",
3732
4548
  {
3733
4549
  type: "button",
@@ -3735,29 +4551,29 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3735
4551
  "data-testid": "bases-color-btn",
3736
4552
  onClick: () => togglePopover("color"),
3737
4553
  children: [
3738
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseColorIcon, {}),
3739
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
4554
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseColorIcon, {}),
4555
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
3740
4556
  "\u6761\u4EF6\u7740\u8272",
3741
4557
  colorRules.length > 0 ? ` (${colorRules.length})` : ""
3742
4558
  ] })
3743
4559
  ]
3744
4560
  }
3745
4561
  ),
3746
- openPopover === "color" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover univer-bases-popover--wide", "data-testid": "bases-color-popover", children: [
3747
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-popover__header", children: [
3748
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "\u6761\u4EF6\u884C\u7740\u8272\u89C4\u5219" }),
3749
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4562
+ openPopover === "color" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover univer-bases-popover--wide", "data-testid": "bases-color-popover", children: [
4563
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-popover__header", children: [
4564
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "\u6761\u4EF6\u884C\u7740\u8272\u89C4\u5219" }),
4565
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3750
4566
  "button",
3751
4567
  {
3752
4568
  type: "button",
3753
4569
  className: "univer-bases-icon-btn",
3754
4570
  onClick: () => setOpenPopover(null),
3755
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCloseIcon, {})
4571
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
3756
4572
  }
3757
4573
  )
3758
4574
  ] }),
3759
- colorRules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-empty-hint", children: "\u6309\u5B57\u6BB5\u6761\u4EF6\u81EA\u52A8\u9AD8\u4EAE\u6574\u884C\u80CC\u666F\u8272" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-rule-list", children: colorRules.map((cr) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-rule-row", children: [
3760
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4575
+ colorRules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-empty-hint", children: "\u6309\u5B57\u6BB5\u6761\u4EF6\u81EA\u52A8\u9AD8\u4EAE\u6574\u884C\u80CC\u666F\u8272" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-rule-list", children: colorRules.map((cr) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-rule-row", children: [
4576
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3761
4577
  "select",
3762
4578
  {
3763
4579
  className: "univer-bases-select univer-bases-select--xs",
@@ -3769,10 +4585,10 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3769
4585
  );
3770
4586
  patchView({ colorRules: next });
3771
4587
  },
3772
- children: import_univer_bases13.BASE_ROW_COLOR_PALETTE.map((sw) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: sw.color, children: sw.label }, sw.color))
4588
+ children: import_univer_bases14.BASE_ROW_COLOR_PALETTE.map((sw) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: sw.color, children: sw.label }, sw.color))
3773
4589
  }
3774
4590
  ),
3775
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4591
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3776
4592
  "select",
3777
4593
  {
3778
4594
  className: "univer-bases-select",
@@ -3783,10 +4599,10 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3783
4599
  );
3784
4600
  patchView({ colorRules: next });
3785
4601
  },
3786
- children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: f.id, children: f.name }, f.id))
4602
+ children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: f.id, children: f.name }, f.id))
3787
4603
  }
3788
4604
  ),
3789
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4605
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3790
4606
  "select",
3791
4607
  {
3792
4608
  className: "univer-bases-select univer-bases-select--xs",
@@ -3797,10 +4613,10 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3797
4613
  );
3798
4614
  patchView({ colorRules: next });
3799
4615
  },
3800
- children: FILTER_OPERATOR_OPTIONS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: op.value, children: op.label }, op.value))
4616
+ children: FILTER_OPERATOR_OPTIONS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: op.value, children: op.label }, op.value))
3801
4617
  }
3802
4618
  ),
3803
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4619
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3804
4620
  "input",
3805
4621
  {
3806
4622
  type: "text",
@@ -3815,17 +4631,17 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3815
4631
  }
3816
4632
  }
3817
4633
  ),
3818
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4634
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3819
4635
  "button",
3820
4636
  {
3821
4637
  type: "button",
3822
4638
  className: "univer-bases-icon-btn",
3823
4639
  onClick: () => patchView({ colorRules: colorRules.filter((c) => c.id !== cr.id) }),
3824
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseTrashIcon, {})
4640
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseTrashIcon, {})
3825
4641
  }
3826
4642
  )
3827
4643
  ] }, cr.id)) }),
3828
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4644
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3829
4645
  "button",
3830
4646
  {
3831
4647
  type: "button",
@@ -3837,28 +4653,28 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3837
4653
  colorRules: [
3838
4654
  ...colorRules,
3839
4655
  {
3840
- id: `clr_${(0, import_core4.generateRandomId)(5)}`,
4656
+ id: `clr_${(0, import_core6.generateRandomId)(5)}`,
3841
4657
  fieldId: firstField.id,
3842
4658
  operator: "contains",
3843
4659
  value: "",
3844
- color: import_univer_bases13.BASE_ROW_COLOR_PALETTE[0].color
4660
+ color: import_univer_bases14.BASE_ROW_COLOR_PALETTE[0].color
3845
4661
  }
3846
4662
  ]
3847
4663
  });
3848
4664
  },
3849
4665
  children: [
3850
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BasePlusIcon, {}),
3851
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u6DFB\u52A0\u7740\u8272\u6761\u4EF6" })
4666
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BasePlusIcon, {}),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u6DFB\u52A0\u7740\u8272\u6761\u4EF6" })
3852
4668
  ]
3853
4669
  }
3854
4670
  ) })
3855
4671
  ] })
3856
4672
  ] })
3857
4673
  ] }),
3858
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-toolbar__right", children: [
3859
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "univer-bases-search-box", children: [
3860
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseSearchIcon, {}),
3861
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4674
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-toolbar__right", children: [
4675
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-search-box", children: [
4676
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseSearchIcon, {}),
4677
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3862
4678
  "input",
3863
4679
  {
3864
4680
  type: "text",
@@ -3868,17 +4684,17 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3868
4684
  onChange: (e) => selectionService.setSearchQuery(e.target.value)
3869
4685
  }
3870
4686
  ),
3871
- selectionState.searchQuery && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4687
+ selectionState.searchQuery && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3872
4688
  "button",
3873
4689
  {
3874
4690
  type: "button",
3875
4691
  className: "univer-bases-icon-btn",
3876
4692
  onClick: () => selectionService.setSearchQuery(""),
3877
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseCloseIcon, {})
4693
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
3878
4694
  }
3879
4695
  )
3880
4696
  ] }),
3881
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4697
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3882
4698
  "button",
3883
4699
  {
3884
4700
  type: "button",
@@ -3886,12 +4702,12 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3886
4702
  "data-testid": "bases-import-btn",
3887
4703
  onClick: () => selectionService.openModal("import"),
3888
4704
  children: [
3889
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseUploadIcon, {}),
3890
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u5BFC\u5165" })
4705
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseUploadIcon, {}),
4706
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u5BFC\u5165" })
3891
4707
  ]
3892
4708
  }
3893
4709
  ),
3894
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4710
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3895
4711
  "button",
3896
4712
  {
3897
4713
  type: "button",
@@ -3899,8 +4715,8 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3899
4715
  "data-testid": "bases-export-btn",
3900
4716
  onClick: () => selectionService.openModal("export"),
3901
4717
  children: [
3902
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BaseDownloadIcon, {}),
3903
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: "\u5BFC\u51FA" })
4718
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseDownloadIcon, {}),
4719
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "\u5BFC\u51FA" })
3904
4720
  ]
3905
4721
  }
3906
4722
  )
@@ -3910,11 +4726,11 @@ var BasesViewToolbar = ({ table, activeView, workspaceMode }) => {
3910
4726
  };
3911
4727
 
3912
4728
  // src/views/BasesMainView.tsx
3913
- var import_jsx_runtime13 = require("react/jsx-runtime");
4729
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3914
4730
  var BasesMainView = () => {
3915
4731
  const { unit, snapshot, selectionState, selectionService } = useActiveBaseWorkspace();
3916
4732
  if (!unit || !snapshot) {
3917
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-empty-workspace", "data-testid": "bases-empty-workspace", children: "\u672A\u6302\u8F7D\u591A\u7EF4\u6570\u636E\u8868\u5355\u5143 (UNIVER_BASE)" });
4733
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "univer-bases-empty-workspace", "data-testid": "bases-empty-workspace", children: "\u672A\u6302\u8F7D\u591A\u7EF4\u6570\u636E\u8868\u5355\u5143 (UNIVER_BASE)" });
3918
4734
  }
3919
4735
  const activeTable = unit.getActiveTable();
3920
4736
  const activeView = unit.getActiveView();
@@ -3922,33 +4738,35 @@ var BasesMainView = () => {
3922
4738
  return null;
3923
4739
  }
3924
4740
  const workspaceMode = snapshot.workspaceMode ?? "table";
3925
- const query = (0, import_univer_bases14.queryBaseTableView)(snapshot, activeTable.id, activeView.id, {
4741
+ const query = (0, import_univer_bases15.queryBaseTableView)(snapshot, activeTable.id, activeView.id, {
3926
4742
  searchQuery: selectionState.searchQuery || activeView.searchQuery
3927
4743
  });
3928
4744
  const renderActiveContent = () => {
3929
4745
  if (workspaceMode === "dashboard") {
3930
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DashboardView, {});
4746
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DashboardView, {});
3931
4747
  }
3932
4748
  switch (activeView.type) {
4749
+ case "list":
4750
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ListView, { query });
3933
4751
  case "kanban":
3934
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(KanbanView, { query });
4752
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(KanbanView, { query });
3935
4753
  case "calendar":
3936
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CalendarView, { query });
4754
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CalendarView, { query });
3937
4755
  case "gallery":
3938
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GalleryView, { query });
4756
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GalleryView, { query });
3939
4757
  case "gantt":
3940
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GanttTimelineView, { query, mode: "gantt" });
4758
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GanttTimelineView, { query, mode: "gantt" });
3941
4759
  case "timeline":
3942
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GanttTimelineView, { query, mode: "timeline" });
4760
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GanttTimelineView, { query, mode: "timeline" });
3943
4761
  case "form":
3944
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FormView, { query });
4762
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormView, { query });
3945
4763
  case "grid":
3946
4764
  default:
3947
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GridView, { query });
4765
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GridView, { query });
3948
4766
  }
3949
4767
  };
3950
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-main", "data-testid": "bases-main-view", children: [
3951
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4768
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "univer-bases-main", "data-testid": "bases-main-view", children: [
4769
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3952
4770
  BasesViewToolbar,
3953
4771
  {
3954
4772
  table: activeTable,
@@ -3956,26 +4774,26 @@ var BasesMainView = () => {
3956
4774
  workspaceMode
3957
4775
  }
3958
4776
  ),
3959
- selectionState.lastToastMessage && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "univer-bases-toast", role: "status", children: [
3960
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: selectionState.lastToastMessage }),
3961
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4777
+ selectionState.lastToastMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "univer-bases-toast", role: "status", children: [
4778
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: selectionState.lastToastMessage }),
4779
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3962
4780
  "button",
3963
4781
  {
3964
4782
  type: "button",
3965
4783
  className: "univer-bases-icon-btn",
3966
4784
  onClick: () => selectionService.notifyToast(null),
3967
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BaseCloseIcon, {})
4785
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BaseCloseIcon, {})
3968
4786
  }
3969
4787
  )
3970
4788
  ] }),
3971
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "univer-bases-main__viewport", children: renderActiveContent() }),
3972
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RecordDetailDrawer, {})
4789
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "univer-bases-main__viewport", children: renderActiveContent() }),
4790
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RecordDetailDrawer, {})
3973
4791
  ] });
3974
4792
  };
3975
4793
 
3976
4794
  // src/views/footer/BasesStatusBar.tsx
3977
- var import_univer_bases15 = require("@yudaocode/univer-bases");
3978
- var import_jsx_runtime14 = require("react/jsx-runtime");
4795
+ var import_univer_bases16 = require("@yudaocode/univer-bases");
4796
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3979
4797
  var BasesStatusBar = () => {
3980
4798
  const { unit, snapshot, selectionState } = useActiveBaseWorkspace();
3981
4799
  if (!unit || !snapshot) return null;
@@ -3983,42 +4801,42 @@ var BasesStatusBar = () => {
3983
4801
  const activeView = unit.getActiveView();
3984
4802
  if (!activeTable || !activeView) return null;
3985
4803
  const workspaceMode = snapshot.workspaceMode ?? "table";
3986
- const query = (0, import_univer_bases15.queryBaseTableView)(snapshot, activeTable.id, activeView.id, {
4804
+ const query = (0, import_univer_bases16.queryBaseTableView)(snapshot, activeTable.id, activeView.id, {
3987
4805
  searchQuery: selectionState.searchQuery || activeView.searchQuery
3988
4806
  });
3989
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("footer", { className: "univer-bases-statusbar", "data-testid": "bases-status-bar", children: [
3990
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "univer-bases-statusbar__left", children: [
3991
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "univer-bases-statusbar__chip", children: [
3992
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BaseTableIcon, {}),
3993
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: activeTable.name })
4807
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("footer", { className: "univer-bases-statusbar", "data-testid": "bases-status-bar", children: [
4808
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-statusbar__left", children: [
4809
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-statusbar__chip", children: [
4810
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BaseTableIcon, {}),
4811
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: activeTable.name })
3994
4812
  ] }),
3995
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "univer-bases-statusbar__chip", children: [
3996
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4813
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-statusbar__chip", children: [
4814
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3997
4815
  BaseViewTypeIcon,
3998
4816
  {
3999
4817
  type: workspaceMode === "dashboard" ? "dashboard" : activeView.type
4000
4818
  }
4001
4819
  ),
4002
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: workspaceMode === "dashboard" ? "\u6570\u636E\u4EEA\u8868\u76D8" : activeView.name })
4820
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: workspaceMode === "dashboard" ? "\u6570\u636E\u4EEA\u8868\u76D8" : activeView.name })
4003
4821
  ] }),
4004
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "univer-bases-statusbar__meta", children: [
4822
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-statusbar__meta", children: [
4005
4823
  "\u663E\u793A ",
4006
4824
  query.filteredRecordCount,
4007
4825
  " / \u5171 ",
4008
4826
  query.totalRecordCount,
4009
4827
  " \u6761\u8BB0\u5F55"
4010
4828
  ] }),
4011
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "univer-bases-statusbar__meta", children: [
4829
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-statusbar__meta", children: [
4012
4830
  query.visibleFields.length,
4013
4831
  " \u4E2A\u53EF\u89C1\u5B57\u6BB5"
4014
4832
  ] }),
4015
- selectionState.selectedRecordIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "univer-bases-statusbar__selected", children: [
4833
+ selectionState.selectedRecordIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-statusbar__selected", children: [
4016
4834
  "\u5DF2\u9009\u4E2D ",
4017
4835
  selectionState.selectedRecordIds.length,
4018
4836
  " \u6761"
4019
4837
  ] })
4020
4838
  ] }),
4021
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "univer-bases-statusbar__right", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "univer-bases-statusbar__meta", children: [
4839
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "univer-bases-statusbar__right", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-statusbar__meta", children: [
4022
4840
  "\u5171 ",
4023
4841
  snapshot.tableOrder.length,
4024
4842
  " \u5F20\u5173\u8054\u6570\u636E\u8868 \xB7 \u7248\u672C r",
@@ -4028,28 +4846,30 @@ var BasesStatusBar = () => {
4028
4846
  };
4029
4847
 
4030
4848
  // src/views/inspector/BasesInspectorPanel.tsx
4031
- var import_univer_bases16 = require("@yudaocode/univer-bases");
4032
- var import_jsx_runtime15 = require("react/jsx-runtime");
4849
+ var import_univer_bases17 = require("@yudaocode/univer-bases");
4850
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4033
4851
  var BasesInspectorPanel = () => {
4034
- const { unit, snapshot, commandService } = useActiveBaseWorkspace();
4852
+ const { unit, snapshot, commandService, selectionService } = useActiveBaseWorkspace();
4035
4853
  if (!unit || !snapshot) return null;
4036
4854
  const activeTable = unit.getActiveTable();
4037
4855
  if (!activeTable) return null;
4038
4856
  const unitId = unit.getUnitId();
4039
4857
  const fields = activeTable.fieldOrder.map((fid) => activeTable.fields[fid]).filter((f) => Boolean(f));
4040
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-inspector", "data-testid": "bases-inspector-panel", children: [
4041
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: "univer-bases-inspector__section", children: [
4042
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { children: "\u5F53\u524D\u6570\u636E\u8868\u5C5E\u6027" }),
4043
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-form-row", children: [
4044
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { children: "\u6570\u636E\u8868\u540D\u79F0" }),
4045
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4858
+ const rules = snapshot.automations ?? [];
4859
+ const recentLogs = [...snapshot.automationLogs ?? []].reverse().slice(0, 8);
4860
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inspector", "data-testid": "bases-inspector-panel", children: [
4861
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "univer-bases-inspector__section", children: [
4862
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { children: "\u5F53\u524D\u6570\u636E\u8868\u5C5E\u6027" }),
4863
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-form-row", children: [
4864
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { children: "\u6570\u636E\u8868\u540D\u79F0" }),
4865
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4046
4866
  "input",
4047
4867
  {
4048
4868
  type: "text",
4049
4869
  className: "univer-bases-input",
4050
4870
  value: activeTable.name,
4051
4871
  onChange: (e) => {
4052
- commandService.syncExecuteCommand(import_univer_bases16.UpdateBaseTableCommand.id, {
4872
+ commandService.syncExecuteCommand(import_univer_bases17.UpdateBaseTableCommand.id, {
4053
4873
  unitId,
4054
4874
  tableId: activeTable.id,
4055
4875
  patch: { name: e.target.value }
@@ -4058,16 +4878,16 @@ var BasesInspectorPanel = () => {
4058
4878
  }
4059
4879
  )
4060
4880
  ] }),
4061
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-form-row", children: [
4062
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { children: "\u4E1A\u52A1\u63CF\u8FF0" }),
4063
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4881
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-form-row", children: [
4882
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { children: "\u4E1A\u52A1\u63CF\u8FF0" }),
4883
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4064
4884
  "textarea",
4065
4885
  {
4066
4886
  className: "univer-bases-textarea",
4067
4887
  rows: 2,
4068
4888
  value: activeTable.description ?? "",
4069
4889
  onChange: (e) => {
4070
- commandService.syncExecuteCommand(import_univer_bases16.UpdateBaseTableCommand.id, {
4890
+ commandService.syncExecuteCommand(import_univer_bases17.UpdateBaseTableCommand.id, {
4071
4891
  unitId,
4072
4892
  tableId: activeTable.id,
4073
4893
  patch: { description: e.target.value }
@@ -4077,84 +4897,235 @@ var BasesInspectorPanel = () => {
4077
4897
  )
4078
4898
  ] })
4079
4899
  ] }),
4080
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: "univer-bases-inspector__section", children: [
4081
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h4", { children: [
4900
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "univer-bases-inspector__section", children: [
4901
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h4", { children: [
4082
4902
  "\u5B57\u6BB5\u6A21\u578B\u6E05\u5355 (",
4083
4903
  fields.length,
4084
4904
  ")"
4085
4905
  ] }),
4086
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "univer-bases-inspector__field-list", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-inspector__field-item", children: [
4087
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-inline-flex", children: [
4088
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BaseFieldTypeIcon, { type: f.type }),
4089
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: f.name })
4906
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-inspector__field-list", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inspector__field-item", children: [
4907
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inline-flex", children: [
4908
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseFieldTypeIcon, { type: f.type }),
4909
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: f.name })
4090
4910
  ] }),
4091
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "univer-bases-pill univer-bases-pill--neutral", children: f.type })
4911
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "univer-bases-pill univer-bases-pill--neutral", children: f.type })
4092
4912
  ] }, f.id)) })
4093
4913
  ] }),
4094
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { className: "univer-bases-inspector__section", children: [
4095
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h4", { children: [
4096
- "\u81EA\u52A8\u5316\u89E6\u53D1\u89C4\u5219 (",
4097
- snapshot.automations?.length ?? 0,
4098
- ")"
4099
- ] }),
4100
- (snapshot.automations ?? []).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "univer-bases-muted-key", children: "\u6682\u65E0\u81EA\u52A8\u5316\u89C4\u5219" }) : (snapshot.automations ?? []).map((rule) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "univer-bases-inspector__auto-card", children: [
4101
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: rule.name }),
4102
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "univer-bases-muted-key", children: [
4103
- "\u89E6\u53D1\u5668: ",
4104
- rule.trigger,
4105
- " \u2192 \u52A8\u4F5C: ",
4106
- rule.action
4107
- ] })
4108
- ] }, rule.id))
4109
- ] })
4110
- ] });
4111
- };
4112
-
4113
- // src/views/left-sidebar/BasesLeftSidebar.tsx
4114
- var import_univer_bases17 = require("@yudaocode/univer-bases");
4115
- var import_react9 = require("react");
4116
- var import_jsx_runtime16 = require("react/jsx-runtime");
4117
- var BasesLeftSidebar = () => {
4118
- const { unit, snapshot, commandService, selectionService } = useActiveBaseWorkspace();
4119
- const [creatingTable, setCreatingTable] = (0, import_react9.useState)(false);
4120
- const [newTableName, setNewTableName] = (0, import_react9.useState)("");
4121
- if (!unit || !snapshot) return null;
4122
- const unitId = unit.getUnitId();
4123
- const workspaceMode = snapshot.workspaceMode ?? "table";
4124
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("aside", { className: "univer-bases-left-sidebar", "data-testid": "bases-left-sidebar", children: [
4125
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-sidebar-section", children: [
4126
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-sidebar-section__header", children: [
4127
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u6570\u636E\u8868\u76EE\u5F55" }),
4128
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4129
- "button",
4130
- {
4131
- type: "button",
4132
- className: "univer-bases-icon-btn",
4133
- title: "\u65B0\u5EFA\u6570\u636E\u8868",
4134
- "data-testid": "bases-sidebar-add-table",
4135
- onClick: () => setCreatingTable((v) => !v),
4136
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BasePlusIcon, {})
4137
- }
4138
- )
4139
- ] }),
4140
- creatingTable && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-sidebar-create-box", children: [
4141
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4142
- "input",
4914
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "univer-bases-inspector__section", children: [
4915
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4916
+ "div",
4917
+ {
4918
+ className: "univer-bases-inline-flex",
4919
+ style: { justifyContent: "space-between", width: "100%", marginBottom: 8 },
4920
+ children: [
4921
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h4", { style: { margin: 0 }, children: [
4922
+ "\u81EA\u52A8\u5316\u89E6\u53D1\u89C4\u5219 (",
4923
+ rules.length,
4924
+ ")"
4925
+ ] }),
4926
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4927
+ "button",
4928
+ {
4929
+ type: "button",
4930
+ className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
4931
+ "data-testid": "bases-new-automation-btn",
4932
+ onClick: () => selectionService.openAutomationBuilder(null),
4933
+ children: [
4934
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BasePlusIcon, {}),
4935
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u65B0\u5EFA\u81EA\u52A8\u5316\u6D41\u7A0B" })
4936
+ ]
4937
+ }
4938
+ )
4939
+ ]
4940
+ }
4941
+ ),
4942
+ rules.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "univer-bases-muted-key", children: "\u6682\u65E0\u81EA\u52A8\u5316\u89C4\u5219" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-inspector__field-list", children: rules.map((rule) => {
4943
+ const stepCount = (0, import_univer_bases17.normalizeAutomationSteps)(rule).length;
4944
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4945
+ "div",
4143
4946
  {
4144
- type: "text",
4145
- className: "univer-bases-input",
4146
- placeholder: "\u8F93\u5165\u65B0\u6570\u636E\u8868\u540D\u79F0...",
4147
- value: newTableName,
4947
+ className: "univer-bases-inspector__auto-card",
4948
+ "data-testid": `bases-inspector-auto-${rule.id}`,
4949
+ children: [
4950
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4951
+ "div",
4952
+ {
4953
+ className: "univer-bases-inline-flex",
4954
+ style: { justifyContent: "space-between", width: "100%" },
4955
+ children: [
4956
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inline-flex", children: [
4957
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseBoltIcon, {}),
4958
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: rule.name })
4959
+ ] }),
4960
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
4961
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4962
+ "input",
4963
+ {
4964
+ type: "checkbox",
4965
+ checked: rule.enabled,
4966
+ onChange: (e) => {
4967
+ commandService.syncExecuteCommand(
4968
+ import_univer_bases17.ToggleBaseAutomationRuleCommand.id,
4969
+ {
4970
+ unitId,
4971
+ ruleId: rule.id,
4972
+ enabled: e.target.checked
4973
+ }
4974
+ );
4975
+ }
4976
+ }
4977
+ ),
4978
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: rule.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528" })
4979
+ ] })
4980
+ ]
4981
+ }
4982
+ ),
4983
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "univer-bases-muted-key", children: [
4984
+ "\u89E6\u53D1\u5668: ",
4985
+ rule.trigger,
4986
+ " \u2192 \u5171 ",
4987
+ stepCount,
4988
+ " \u4E2A\u52A8\u4F5C\u6B65\u9AA4"
4989
+ ] }),
4990
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inline-flex", style: { marginTop: 4 }, children: [
4991
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4992
+ "button",
4993
+ {
4994
+ type: "button",
4995
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
4996
+ onClick: () => selectionService.openAutomationBuilder(rule.id),
4997
+ children: [
4998
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseEditIcon, {}),
4999
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u7F16\u8F91" })
5000
+ ]
5001
+ }
5002
+ ),
5003
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5004
+ "button",
5005
+ {
5006
+ type: "button",
5007
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5008
+ onClick: () => {
5009
+ commandService.syncExecuteCommand(
5010
+ import_univer_bases17.TriggerBaseAutomationCommand.id,
5011
+ {
5012
+ unitId,
5013
+ ruleId: rule.id,
5014
+ tableId: rule.tableId,
5015
+ onExecuted: (logs) => {
5016
+ const latest = logs[logs.length - 1];
5017
+ selectionService.notifyToast(
5018
+ latest ? `\u8BD5\u8FD0\u884C [${rule.name}]\uFF1A${latest.summary}` : `\u5DF2\u89E6\u53D1\u8BD5\u8FD0\u884C [${rule.name}]`
5019
+ );
5020
+ }
5021
+ }
5022
+ );
5023
+ },
5024
+ children: [
5025
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BasePlayIcon, {}),
5026
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u7ACB\u5373\u8BD5\u8FD0\u884C" })
5027
+ ]
5028
+ }
5029
+ ),
5030
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5031
+ "button",
5032
+ {
5033
+ type: "button",
5034
+ className: "univer-bases-icon-btn",
5035
+ title: "\u5220\u9664\u81EA\u52A8\u5316\u89C4\u5219",
5036
+ onClick: () => {
5037
+ commandService.syncExecuteCommand(
5038
+ import_univer_bases17.DeleteBaseAutomationRuleCommand.id,
5039
+ {
5040
+ unitId,
5041
+ ruleId: rule.id
5042
+ }
5043
+ );
5044
+ },
5045
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseTrashIcon, {})
5046
+ }
5047
+ )
5048
+ ] })
5049
+ ]
5050
+ },
5051
+ rule.id
5052
+ );
5053
+ }) })
5054
+ ] }),
5055
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "univer-bases-inspector__section", "data-testid": "bases-inspector-logs", children: [
5056
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h4", { children: [
5057
+ "\u6267\u884C\u65E5\u5FD7 (",
5058
+ snapshot.automationLogs?.length ?? 0,
5059
+ ")"
5060
+ ] }),
5061
+ recentLogs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "univer-bases-muted-key", children: "\u6682\u65E0\u6267\u884C\u8BB0\u5F55" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-inspector__field-list", children: recentLogs.map((log) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inspector__auto-card", children: [
5062
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5063
+ "div",
5064
+ {
5065
+ className: "univer-bases-inline-flex",
5066
+ style: { justifyContent: "space-between", width: "100%" },
5067
+ children: [
5068
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: log.ruleName }),
5069
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "univer-bases-pill univer-bases-pill--neutral", children: [
5070
+ log.status,
5071
+ " \xB7 ",
5072
+ log.executedSteps,
5073
+ "\u6B65"
5074
+ ] })
5075
+ ]
5076
+ }
5077
+ ),
5078
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "univer-bases-muted-key", children: log.summary })
5079
+ ] }, log.id)) })
5080
+ ] })
5081
+ ] });
5082
+ };
5083
+
5084
+ // src/views/left-sidebar/BasesLeftSidebar.tsx
5085
+ var import_univer_bases18 = require("@yudaocode/univer-bases");
5086
+ var import_react10 = require("react");
5087
+ var import_jsx_runtime17 = require("react/jsx-runtime");
5088
+ var BasesLeftSidebar = () => {
5089
+ const { unit, snapshot, commandService, selectionService } = useActiveBaseWorkspace();
5090
+ const [creatingTable, setCreatingTable] = (0, import_react10.useState)(false);
5091
+ const [newTableName, setNewTableName] = (0, import_react10.useState)("");
5092
+ if (!unit || !snapshot) return null;
5093
+ const unitId = unit.getUnitId();
5094
+ const workspaceMode = snapshot.workspaceMode ?? "table";
5095
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("aside", { className: "univer-bases-left-sidebar", "data-testid": "bases-left-sidebar", children: [
5096
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-sidebar-section", children: [
5097
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-sidebar-section__header", children: [
5098
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u6570\u636E\u8868\u76EE\u5F55" }),
5099
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5100
+ "button",
5101
+ {
5102
+ type: "button",
5103
+ className: "univer-bases-icon-btn",
5104
+ title: "\u65B0\u5EFA\u6570\u636E\u8868",
5105
+ "data-testid": "bases-sidebar-add-table",
5106
+ onClick: () => setCreatingTable((v) => !v),
5107
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BasePlusIcon, {})
5108
+ }
5109
+ )
5110
+ ] }),
5111
+ creatingTable && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-sidebar-create-box", children: [
5112
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5113
+ "input",
5114
+ {
5115
+ type: "text",
5116
+ className: "univer-bases-input",
5117
+ placeholder: "\u8F93\u5165\u65B0\u6570\u636E\u8868\u540D\u79F0...",
5118
+ value: newTableName,
4148
5119
  onChange: (e) => setNewTableName(e.target.value)
4149
5120
  }
4150
5121
  ),
4151
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5122
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4152
5123
  "button",
4153
5124
  {
4154
5125
  type: "button",
4155
5126
  className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
4156
5127
  onClick: () => {
4157
- commandService.syncExecuteCommand(import_univer_bases17.AddBaseTableCommand.id, {
5128
+ commandService.syncExecuteCommand(import_univer_bases18.AddBaseTableCommand.id, {
4158
5129
  unitId,
4159
5130
  name: newTableName.trim() || void 0,
4160
5131
  makeActive: true
@@ -4166,11 +5137,11 @@ var BasesLeftSidebar = () => {
4166
5137
  }
4167
5138
  )
4168
5139
  ] }),
4169
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-sidebar-list", children: snapshot.tableOrder.map((tid) => {
5140
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-sidebar-list", children: snapshot.tableOrder.map((tid) => {
4170
5141
  const tbl = snapshot.tables[tid];
4171
5142
  if (!tbl) return null;
4172
5143
  const isActive = workspaceMode === "table" && snapshot.activeTableId === tid;
4173
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5144
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4174
5145
  "div",
4175
5146
  {
4176
5147
  className: `univer-bases-sidebar-item ${isActive ? "is-active" : ""}`,
@@ -4178,19 +5149,19 @@ var BasesLeftSidebar = () => {
4178
5149
  onClick: () => {
4179
5150
  selectionService.clearSelection();
4180
5151
  selectionService.openRecordDrawer(null);
4181
- commandService.syncExecuteCommand(import_univer_bases17.SetActiveBaseTableCommand.id, {
5152
+ commandService.syncExecuteCommand(import_univer_bases18.SetActiveBaseTableCommand.id, {
4182
5153
  unitId,
4183
5154
  tableId: tid
4184
5155
  });
4185
5156
  },
4186
5157
  children: [
4187
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inline-flex", style: { overflow: "hidden" }, children: [
4188
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseTableIcon, {}),
4189
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "univer-bases-sidebar-item__name", children: tbl.name })
5158
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-inline-flex", style: { overflow: "hidden" }, children: [
5159
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseTableIcon, {}),
5160
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "univer-bases-sidebar-item__name", children: tbl.name })
4190
5161
  ] }),
4191
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inline-flex", children: [
4192
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "univer-bases-badge-count", children: tbl.recordOrder.length }),
4193
- snapshot.tableOrder.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5162
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5163
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "univer-bases-badge-count", children: tbl.recordOrder.length }),
5164
+ snapshot.tableOrder.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4194
5165
  "button",
4195
5166
  {
4196
5167
  type: "button",
@@ -4198,12 +5169,12 @@ var BasesLeftSidebar = () => {
4198
5169
  title: "\u5220\u9664\u8BE5\u6570\u636E\u8868",
4199
5170
  onClick: (e) => {
4200
5171
  e.stopPropagation();
4201
- commandService.syncExecuteCommand(import_univer_bases17.DeleteBaseTableCommand.id, {
5172
+ commandService.syncExecuteCommand(import_univer_bases18.DeleteBaseTableCommand.id, {
4202
5173
  unitId,
4203
5174
  tableId: tid
4204
5175
  });
4205
5176
  },
4206
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseTrashIcon, {})
5177
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseTrashIcon, {})
4207
5178
  }
4208
5179
  )
4209
5180
  ] })
@@ -4213,38 +5184,38 @@ var BasesLeftSidebar = () => {
4213
5184
  );
4214
5185
  }) })
4215
5186
  ] }),
4216
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-sidebar-section", children: [
4217
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-sidebar-section__header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u6570\u636E\u5168\u666F\u4EEA\u8868\u76D8" }) }),
4218
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-sidebar-list", children: (snapshot.dashboards ?? []).map((dash) => {
5187
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-sidebar-section", children: [
5188
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-sidebar-section__header", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u6570\u636E\u5168\u666F\u4EEA\u8868\u76D8" }) }),
5189
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-sidebar-list", children: (snapshot.dashboards ?? []).map((dash) => {
4219
5190
  const isActive = workspaceMode === "dashboard" && (snapshot.activeDashboardId ?? snapshot.dashboards?.[0]?.id) === dash.id;
4220
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5191
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
4221
5192
  "div",
4222
5193
  {
4223
5194
  className: `univer-bases-sidebar-item ${isActive ? "is-active" : ""}`,
4224
5195
  "data-testid": `bases-sidebar-dashboard-${dash.id}`,
4225
5196
  onClick: () => {
4226
- commandService.syncExecuteCommand(import_univer_bases17.SetBaseWorkspaceModeCommand.id, {
5197
+ commandService.syncExecuteCommand(import_univer_bases18.SetBaseWorkspaceModeCommand.id, {
4227
5198
  unitId,
4228
5199
  mode: "dashboard",
4229
5200
  dashboardId: dash.id
4230
5201
  });
4231
5202
  },
4232
5203
  children: [
4233
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-inline-flex", children: [
4234
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BaseDashboardIcon, {}),
4235
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "univer-bases-sidebar-item__name", children: dash.name })
5204
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5205
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseDashboardIcon, {}),
5206
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "univer-bases-sidebar-item__name", children: dash.name })
4236
5207
  ] }),
4237
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "univer-bases-badge-count", children: dash.widgets.length })
5208
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "univer-bases-badge-count", children: dash.widgets.length })
4238
5209
  ]
4239
5210
  },
4240
5211
  dash.id
4241
5212
  );
4242
5213
  }) })
4243
5214
  ] }),
4244
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-sidebar-section", children: [
4245
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "univer-bases-sidebar-section__header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u4F01\u4E1A\u5185\u7F6E\u793A\u4F8B\u5E93" }) }),
4246
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "univer-bases-sidebar-presets", children: [
4247
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5215
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-sidebar-section", children: [
5216
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-sidebar-section__header", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u4F01\u4E1A\u5185\u7F6E\u793A\u4F8B\u5E93" }) }),
5217
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-sidebar-presets", children: [
5218
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4248
5219
  "button",
4249
5220
  {
4250
5221
  type: "button",
@@ -4255,7 +5226,7 @@ var BasesLeftSidebar = () => {
4255
5226
  children: "\u7814\u53D1\u9879\u76EE\u4E0E\u51B2\u523A\u534F\u540C\u5E93"
4256
5227
  }
4257
5228
  ),
4258
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5229
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4259
5230
  "button",
4260
5231
  {
4261
5232
  type: "button",
@@ -4272,9 +5243,741 @@ var BasesLeftSidebar = () => {
4272
5243
  };
4273
5244
 
4274
5245
  // src/views/modals/BasesModalsHost.tsx
4275
- var import_univer_bases18 = require("@yudaocode/univer-bases");
4276
- var import_react10 = require("react");
4277
- var import_jsx_runtime17 = require("react/jsx-runtime");
5246
+ var import_univer_bases20 = require("@yudaocode/univer-bases");
5247
+ var import_react12 = require("react");
5248
+
5249
+ // src/views/modals/AutomationBuilderModal.tsx
5250
+ var import_core7 = require("@univerjs/core");
5251
+ var import_univer_bases19 = require("@yudaocode/univer-bases");
5252
+ var import_react11 = require("react");
5253
+ var import_jsx_runtime18 = require("react/jsx-runtime");
5254
+ var TRIGGER_OPTIONS = [
5255
+ { value: "recordCreated", label: "\u5F53\u65B0\u5EFA\u8BB0\u5F55\u65F6 (recordCreated)" },
5256
+ { value: "recordUpdated", label: "\u5F53\u8BB0\u5F55\u66F4\u65B0\u65F6 (recordUpdated)" },
5257
+ { value: "fieldChanged", label: "\u5F53\u6307\u5B9A\u5B57\u6BB5\u53D8\u66F4\u65F6 (fieldChanged)" },
5258
+ { value: "conditionMatched", label: "\u5F53\u8BB0\u5F55\u6EE1\u8DB3\u6761\u4EF6\u65F6 (conditionMatched)" },
5259
+ { value: "scheduled", label: "\u5B9A\u65F6\u5468\u671F\u89E6\u53D1 (scheduled)" },
5260
+ { value: "webhookReceived", label: "\u6536\u5230\u5916\u90E8 Webhook \u56DE\u8C03\u65F6 (webhookReceived)" }
5261
+ ];
5262
+ var OPERATOR_OPTIONS = [
5263
+ { value: "is", label: "\u7B49\u4E8E" },
5264
+ { value: "isNot", label: "\u4E0D\u7B49\u4E8E" },
5265
+ { value: "contains", label: "\u5305\u542B" },
5266
+ { value: "notContains", label: "\u4E0D\u5305\u542B" },
5267
+ { value: "gt", label: "\u5927\u4E8E" },
5268
+ { value: "gte", label: "\u5927\u4E8E\u7B49\u4E8E" },
5269
+ { value: "lt", label: "\u5C0F\u4E8E" },
5270
+ { value: "lte", label: "\u5C0F\u4E8E\u7B49\u4E8E" },
5271
+ { value: "isEmpty", label: "\u4E3A\u7A7A" },
5272
+ { value: "isNotEmpty", label: "\u4E0D\u4E3A\u7A7A" }
5273
+ ];
5274
+ var STEP_TYPE_LABELS = {
5275
+ updateRecord: "\u4FEE\u6539\u8BB0\u5F55",
5276
+ createLinkedRecord: "\u65B0\u5EFA\u5173\u8054\u8BB0\u5F55",
5277
+ ifElse: "If/Else \u6761\u4EF6\u5206\u652F",
5278
+ loopRecords: "\u5FAA\u73AF\u5904\u7406\u8BB0\u5F55",
5279
+ httpWebhook: "\u53D1\u9001 Webhook",
5280
+ notify: "\u53D1\u9001\u6D88\u606F\u901A\u77E5"
5281
+ };
5282
+ var AutomationBuilderModal = () => {
5283
+ const { unit, snapshot, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
5284
+ if (!unit || !snapshot) return null;
5285
+ const unitId = unit.getUnitId();
5286
+ const activeTable = unit.getActiveTable();
5287
+ const tables = snapshot.tableOrder.map((tid) => snapshot.tables[tid]).filter((t) => Boolean(t));
5288
+ const editingRule = selectionState.editingAutomationRuleId ? (snapshot.automations ?? []).find((r) => r.id === selectionState.editingAutomationRuleId) : void 0;
5289
+ const defaultTableId = editingRule?.tableId ?? activeTable?.id ?? tables[0]?.id ?? "";
5290
+ const initialDefaultFieldId = snapshot.tables[defaultTableId]?.fieldOrder[0] ?? "";
5291
+ const [activeTab, setActiveTab] = (0, import_react11.useState)("pipeline");
5292
+ const [name, setName] = (0, import_react11.useState)(editingRule?.name ?? "\u591A\u6B65\u4E1A\u52A1\u81EA\u52A8\u5316\u6D41\u6C34\u7EBF");
5293
+ const [tableId, setTableId] = (0, import_react11.useState)(defaultTableId);
5294
+ const [enabled, setEnabled] = (0, import_react11.useState)(editingRule?.enabled ?? true);
5295
+ const [trigger, setTrigger] = (0, import_react11.useState)(
5296
+ editingRule?.trigger === "fieldMatches" ? "fieldChanged" : editingRule?.trigger ?? "recordCreated"
5297
+ );
5298
+ const [triggerFieldIds, setTriggerFieldIds] = (0, import_react11.useState)(
5299
+ editingRule?.triggerFieldIds ?? (editingRule?.triggerFieldId ? [editingRule.triggerFieldId] : [])
5300
+ );
5301
+ const [scheduleCron, setScheduleCron] = (0, import_react11.useState)(editingRule?.scheduleCron ?? "0 9 * * 1-5");
5302
+ const [conditionConjunction, setConditionConjunction] = (0, import_react11.useState)(
5303
+ editingRule?.conditionConjunction ?? "and"
5304
+ );
5305
+ const [conditions, setConditions] = (0, import_react11.useState)(
5306
+ editingRule?.conditions ?? []
5307
+ );
5308
+ const [steps, setSteps] = (0, import_react11.useState)(() => {
5309
+ if (editingRule) {
5310
+ const normalized = (0, import_univer_bases19.normalizeAutomationSteps)(editingRule);
5311
+ if (normalized.length > 0) return normalized;
5312
+ }
5313
+ return [
5314
+ {
5315
+ id: `stp_${(0, import_core7.generateRandomId)(5)}`,
5316
+ type: "updateRecord",
5317
+ fieldUpdates: initialDefaultFieldId ? { [initialDefaultFieldId]: "{" + (snapshot.tables[defaultTableId]?.fields[initialDefaultFieldId]?.name ?? "\u6807\u9898") + "}" } : {}
5318
+ }
5319
+ ];
5320
+ });
5321
+ const currentTable = snapshot.tables[tableId] ?? tables[0];
5322
+ const currentFields = currentTable ? currentTable.fieldOrder.map((fid) => currentTable.fields[fid]).filter((f) => Boolean(f)) : [];
5323
+ const closeModal = () => {
5324
+ selectionService.openModal(null);
5325
+ };
5326
+ const addStep = (type) => {
5327
+ const firstFid = currentFields[0]?.id ?? "";
5328
+ const otherTable = tables.find((t) => t.id !== tableId) ?? currentTable;
5329
+ const otherPrimaryFid = otherTable?.primaryFieldId ?? "";
5330
+ let newStep;
5331
+ switch (type) {
5332
+ case "updateRecord":
5333
+ newStep = {
5334
+ id: `stp_${(0, import_core7.generateRandomId)(5)}`,
5335
+ type: "updateRecord",
5336
+ fieldUpdates: firstFid ? { [firstFid]: "\u5DF2\u81EA\u52A8\u5904\u7406" } : {}
5337
+ };
5338
+ break;
5339
+ case "createLinkedRecord":
5340
+ newStep = {
5341
+ id: `stp_${(0, import_core7.generateRandomId)(5)}`,
5342
+ type: "createLinkedRecord",
5343
+ targetTableId: otherTable?.id ?? tableId,
5344
+ recordCells: otherPrimaryFid ? { [otherPrimaryFid]: `[\u81EA\u52A8\u5173\u8054] {${currentFields[0]?.name ?? "\u6807\u9898"}}` } : {}
5345
+ };
5346
+ break;
5347
+ case "ifElse":
5348
+ newStep = {
5349
+ id: `stp_${(0, import_core7.generateRandomId)(5)}`,
5350
+ type: "ifElse",
5351
+ conditions: firstFid ? [{ id: `cnd_${(0, import_core7.generateRandomId)(4)}`, fieldId: firstFid, operator: "isNotEmpty" }] : [],
5352
+ thenSteps: [
5353
+ {
5354
+ id: `stp_${(0, import_core7.generateRandomId)(4)}`,
5355
+ type: "updateRecord",
5356
+ fieldUpdates: firstFid ? { [firstFid]: "\u5206\u652F\u901A\u8FC7" } : {}
5357
+ }
5358
+ ],
5359
+ elseSteps: []
5360
+ };
5361
+ break;
5362
+ case "loopRecords":
5363
+ newStep = {
5364
+ id: `stp_${(0, import_core7.generateRandomId)(5)}`,
5365
+ type: "loopRecords",
5366
+ loopTableId: tableId,
5367
+ loopConditions: [],
5368
+ loopSteps: [
5369
+ {
5370
+ id: `stp_${(0, import_core7.generateRandomId)(4)}`,
5371
+ type: "updateRecord",
5372
+ fieldUpdates: firstFid ? { [firstFid]: "\u6279\u91CF\u66F4\u65B0\u9879" } : {}
5373
+ }
5374
+ ]
5375
+ };
5376
+ break;
5377
+ case "httpWebhook":
5378
+ default:
5379
+ newStep = {
5380
+ id: `stp_${(0, import_core7.generateRandomId)(5)}`,
5381
+ type: "httpWebhook",
5382
+ webhookMethod: "POST",
5383
+ webhookUrl: "https://api.example.com/webhooks/bases-sync",
5384
+ webhookBodyTemplate: `{"recordId": "{recordId}", "title": "{${currentFields[0]?.name ?? "\u6807\u9898"}}"}`
5385
+ };
5386
+ break;
5387
+ }
5388
+ setSteps((prev) => [...prev, newStep]);
5389
+ };
5390
+ const updateStepAt = (idx, patch) => {
5391
+ setSteps((prev) => prev.map((s, i) => i === idx ? { ...s, ...patch } : s));
5392
+ };
5393
+ const buildRulePayload = () => ({
5394
+ ...editingRule?.id ? { id: editingRule.id } : {},
5395
+ name: name.trim() || "\u672A\u547D\u540D\u81EA\u52A8\u5316\u6D41\u7A0B",
5396
+ tableId,
5397
+ enabled,
5398
+ trigger,
5399
+ triggerFieldIds: trigger === "fieldChanged" ? triggerFieldIds : void 0,
5400
+ scheduleCron: trigger === "scheduled" ? scheduleCron : void 0,
5401
+ conditionConjunction,
5402
+ conditions,
5403
+ steps
5404
+ });
5405
+ const handleSave = () => {
5406
+ commandService.syncExecuteCommand(import_univer_bases19.SaveBaseAutomationRuleCommand.id, {
5407
+ unitId,
5408
+ rule: buildRulePayload(),
5409
+ onSaved: () => {
5410
+ selectionService.notifyToast(`\u5DF2\u4FDD\u5B58\u81EA\u52A8\u5316\u6D41\u7A0B\u300C${name.trim() || "\u672A\u547D\u540D\u6D41\u7A0B"}\u300D`);
5411
+ }
5412
+ });
5413
+ closeModal();
5414
+ };
5415
+ const handleSaveAndDryRun = () => {
5416
+ let savedId = editingRule?.id ?? "";
5417
+ const ok = commandService.syncExecuteCommand(import_univer_bases19.SaveBaseAutomationRuleCommand.id, {
5418
+ unitId,
5419
+ rule: buildRulePayload(),
5420
+ onSaved: (rid) => {
5421
+ savedId = rid;
5422
+ }
5423
+ });
5424
+ if (ok && savedId) {
5425
+ commandService.syncExecuteCommand(import_univer_bases19.TriggerBaseAutomationCommand.id, {
5426
+ unitId,
5427
+ ruleId: savedId,
5428
+ tableId,
5429
+ onExecuted: (logs2) => {
5430
+ const latest = logs2[logs2.length - 1];
5431
+ selectionService.notifyToast(
5432
+ latest ? `\u8BD5\u8FD0\u884C\u5B8C\u6210 [${latest.status}]\uFF1A${latest.summary}` : "\u8BD5\u8FD0\u884C\u5DF2\u6267\u884C"
5433
+ );
5434
+ }
5435
+ });
5436
+ setActiveTab("logs");
5437
+ }
5438
+ };
5439
+ const logs = [...snapshot.automationLogs ?? []].reverse();
5440
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5441
+ "div",
5442
+ {
5443
+ className: "univer-bases-modal univer-bases-modal--automation",
5444
+ "data-testid": "bases-automation-builder-modal",
5445
+ onClick: (e) => e.stopPropagation(),
5446
+ children: [
5447
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-popover__header", children: [
5448
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5449
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BaseBoltIcon, {}),
5450
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: editingRule ? `\u7F16\u8F91\u81EA\u52A8\u5316\u6D41\u7A0B \xB7 ${editingRule.name}` : "\u65B0\u5EFA\u53EF\u89C6\u5316\u591A\u6B65\u81EA\u52A8\u5316\u6D41\u7A0B" })
5451
+ ] }),
5452
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5453
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-segmented", role: "tablist", children: [
5454
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5455
+ "button",
5456
+ {
5457
+ type: "button",
5458
+ className: `univer-bases-segmented__item ${activeTab === "pipeline" ? "is-active" : ""}`,
5459
+ onClick: () => setActiveTab("pipeline"),
5460
+ children: "\u6D41\u7A0B\u7F16\u6392"
5461
+ }
5462
+ ),
5463
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5464
+ "button",
5465
+ {
5466
+ type: "button",
5467
+ className: `univer-bases-segmented__item ${activeTab === "logs" ? "is-active" : ""}`,
5468
+ "data-testid": "bases-auto-modal-logs-tab",
5469
+ onClick: () => setActiveTab("logs"),
5470
+ children: [
5471
+ "\u6267\u884C\u65E5\u5FD7 (",
5472
+ logs.length,
5473
+ ")"
5474
+ ]
5475
+ }
5476
+ )
5477
+ ] }),
5478
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BaseCloseIcon, {}) })
5479
+ ] })
5480
+ ] }),
5481
+ activeTab === "logs" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-auto-logs-panel", "data-testid": "bases-auto-modal-logs-list", children: logs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-empty-hint", children: "\u6682\u65E0\u81EA\u52A8\u5316\u8FD0\u884C\u65E5\u5FD7\uFF0C\u53EF\u70B9\u51FB\u4E0B\u65B9\u300C\u7ACB\u5373\u8BD5\u8FD0\u884C\u300D\u9A8C\u8BC1\u6D41\u6C34\u7EBF\u6548\u679C" }) : logs.map((log) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-log-item", children: [
5482
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", style: { justifyContent: "space-between", width: "100%" }, children: [
5483
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5484
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5485
+ "span",
5486
+ {
5487
+ className: `univer-bases-pill ${log.status === "success" ? "univer-bases-auto-status--success" : log.status === "error" ? "univer-bases-auto-status--error" : "univer-bases-pill--neutral"}`,
5488
+ children: log.status === "success" ? "\u6210\u529F" : log.status === "error" ? "\u5F02\u5E38" : "\u5DF2\u8DF3\u8FC7"
5489
+ }
5490
+ ),
5491
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: log.ruleName }),
5492
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "univer-bases-muted-key", children: [
5493
+ "\u6267\u884C ",
5494
+ log.executedSteps,
5495
+ " \u6B65"
5496
+ ] })
5497
+ ] }),
5498
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "univer-bases-muted-key", children: log.timestamp })
5499
+ ] }),
5500
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-muted-key", children: log.summary })
5501
+ ] }, log.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-builder-body", children: [
5502
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-grid-2", children: [
5503
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-form-row", children: [
5504
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { children: "\u81EA\u52A8\u5316\u6D41\u7A0B\u540D\u79F0" }),
5505
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5506
+ "input",
5507
+ {
5508
+ type: "text",
5509
+ className: "univer-bases-input",
5510
+ "data-testid": "bases-auto-name-input",
5511
+ value: name,
5512
+ onChange: (e) => setName(e.target.value)
5513
+ }
5514
+ )
5515
+ ] }),
5516
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-form-row", children: [
5517
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { children: "\u76D1\u542C\u76EE\u6807\u6570\u636E\u8868" }),
5518
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5519
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5520
+ "select",
5521
+ {
5522
+ className: "univer-bases-select",
5523
+ value: tableId,
5524
+ onChange: (e) => {
5525
+ setTableId(e.target.value);
5526
+ setTriggerFieldIds([]);
5527
+ },
5528
+ children: tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: t.id, children: t.name }, t.id))
5529
+ }
5530
+ ),
5531
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
5532
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5533
+ "input",
5534
+ {
5535
+ type: "checkbox",
5536
+ checked: enabled,
5537
+ onChange: (e) => setEnabled(e.target.checked)
5538
+ }
5539
+ ),
5540
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u542F\u7528" })
5541
+ ] })
5542
+ ] })
5543
+ ] })
5544
+ ] }),
5545
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-stage-card", children: [
5546
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-auto-stage-title", children: "1. \u89E6\u53D1\u5668 (Trigger)" }),
5547
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-form-row", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5548
+ "select",
5549
+ {
5550
+ className: "univer-bases-select",
5551
+ "data-testid": "bases-auto-trigger-select",
5552
+ value: trigger,
5553
+ onChange: (e) => setTrigger(e.target.value),
5554
+ children: TRIGGER_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
5555
+ }
5556
+ ) }),
5557
+ trigger === "fieldChanged" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-form-row", style: { marginTop: 8 }, children: [
5558
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { children: "\u9009\u62E9\u76D1\u542C\u53D8\u66F4\u7684\u5B57\u6BB5\uFF08\u4E0D\u9009\u5219\u4EFB\u610F\u5B57\u6BB5\u53D8\u66F4\u5747\u89E6\u53D1\uFF09" }),
5559
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-tag-wrap", children: currentFields.map((f) => {
5560
+ const checked = triggerFieldIds.includes(f.id);
5561
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "univer-bases-checkbox-label", children: [
5562
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5563
+ "input",
5564
+ {
5565
+ type: "checkbox",
5566
+ checked,
5567
+ onChange: () => {
5568
+ setTriggerFieldIds(
5569
+ (prev) => checked ? prev.filter((id) => id !== f.id) : [...prev, f.id]
5570
+ );
5571
+ }
5572
+ }
5573
+ ),
5574
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: f.name })
5575
+ ] }, f.id);
5576
+ }) })
5577
+ ] }),
5578
+ trigger === "scheduled" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-form-row", style: { marginTop: 8 }, children: [
5579
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { children: "Cron \u5468\u671F\u8868\u8FBE\u5F0F" }),
5580
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5581
+ "input",
5582
+ {
5583
+ type: "text",
5584
+ className: "univer-bases-input",
5585
+ value: scheduleCron,
5586
+ onChange: (e) => setScheduleCron(e.target.value)
5587
+ }
5588
+ )
5589
+ ] })
5590
+ ] }),
5591
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-stage-card", children: [
5592
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", style: { justifyContent: "space-between", width: "100%" }, children: [
5593
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "univer-bases-auto-stage-title", children: "2. \u89E6\u53D1\u51C6\u5165\u6761\u4EF6 (Conditions)" }),
5594
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5595
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5596
+ "select",
5597
+ {
5598
+ className: "univer-bases-select univer-bases-select--xs",
5599
+ value: conditionConjunction,
5600
+ onChange: (e) => setConditionConjunction(e.target.value),
5601
+ children: [
5602
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "and", children: "\u6EE1\u8DB3\u5168\u90E8 (AND)" }),
5603
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "or", children: "\u6EE1\u8DB3\u4EFB\u4E00 (OR)" })
5604
+ ]
5605
+ }
5606
+ ),
5607
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5608
+ "button",
5609
+ {
5610
+ type: "button",
5611
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5612
+ onClick: () => {
5613
+ const f0 = currentFields[0];
5614
+ if (!f0) return;
5615
+ setConditions((prev) => [
5616
+ ...prev,
5617
+ {
5618
+ id: `acnd_${(0, import_core7.generateRandomId)(5)}`,
5619
+ fieldId: f0.id,
5620
+ operator: "is",
5621
+ value: ""
5622
+ }
5623
+ ]);
5624
+ },
5625
+ children: [
5626
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasePlusIcon, {}),
5627
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u6DFB\u52A0\u6761\u4EF6" })
5628
+ ]
5629
+ }
5630
+ )
5631
+ ] })
5632
+ ] }),
5633
+ conditions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-rule-list", style: { marginTop: 8 }, children: conditions.map((cnd) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-row", children: [
5634
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5635
+ "select",
5636
+ {
5637
+ className: "univer-bases-select",
5638
+ value: cnd.fieldId,
5639
+ onChange: (e) => setConditions(
5640
+ (prev) => prev.map(
5641
+ (c) => c.id === cnd.id ? { ...c, fieldId: e.target.value } : c
5642
+ )
5643
+ ),
5644
+ children: currentFields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: f.id, children: f.name }, f.id))
5645
+ }
5646
+ ),
5647
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5648
+ "select",
5649
+ {
5650
+ className: "univer-bases-select univer-bases-select--xs",
5651
+ value: cnd.operator,
5652
+ onChange: (e) => setConditions(
5653
+ (prev) => prev.map(
5654
+ (c) => c.id === cnd.id ? { ...c, operator: e.target.value } : c
5655
+ )
5656
+ ),
5657
+ children: OPERATOR_OPTIONS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: op.value, children: op.label }, op.value))
5658
+ }
5659
+ ),
5660
+ cnd.operator !== "isEmpty" && cnd.operator !== "isNotEmpty" && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5661
+ "input",
5662
+ {
5663
+ type: "text",
5664
+ className: "univer-bases-input",
5665
+ placeholder: "\u6761\u4EF6\u503C...",
5666
+ value: String(cnd.value ?? ""),
5667
+ onChange: (e) => setConditions(
5668
+ (prev) => prev.map(
5669
+ (c) => c.id === cnd.id ? { ...c, value: e.target.value } : c
5670
+ )
5671
+ )
5672
+ }
5673
+ ),
5674
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5675
+ "button",
5676
+ {
5677
+ type: "button",
5678
+ className: "univer-bases-icon-btn",
5679
+ onClick: () => setConditions((prev) => prev.filter((c) => c.id !== cnd.id)),
5680
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BaseTrashIcon, {})
5681
+ }
5682
+ )
5683
+ ] }, cnd.id)) })
5684
+ ] }),
5685
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-stage-card", children: [
5686
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-auto-stage-title", children: [
5687
+ "3. \u591A\u6B65\u6267\u884C\u52A8\u4F5C\u6D41\u6C34\u7EBF (",
5688
+ steps.length,
5689
+ " \u4E2A\u6B65\u9AA4)"
5690
+ ] }),
5691
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "univer-bases-auto-step-list", children: steps.map((step, idx) => {
5692
+ const targetTbl = step.targetTableId ? snapshot.tables[step.targetTableId] : currentTable;
5693
+ const targetTblFields = targetTbl ? targetTbl.fieldOrder.map((fid) => targetTbl.fields[fid]).filter(Boolean) : [];
5694
+ const updateEntries = Object.entries(step.fieldUpdates ?? {});
5695
+ const firstUpdateFid = updateEntries[0]?.[0] ?? currentFields[0]?.id ?? "";
5696
+ const firstUpdateVal = String(updateEntries[0]?.[1] ?? "");
5697
+ const createEntries = Object.entries(step.recordCells ?? {});
5698
+ const firstCreateFid = createEntries[0]?.[0] ?? targetTblFields[0]?.id ?? "";
5699
+ const firstCreateVal = String(createEntries[0]?.[1] ?? "");
5700
+ const ifCond = step.conditions?.[0];
5701
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5702
+ "div",
5703
+ {
5704
+ className: "univer-bases-auto-step-card",
5705
+ "data-testid": `bases-auto-step-${idx}`,
5706
+ children: [
5707
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", style: { justifyContent: "space-between", width: "100%" }, children: [
5708
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", children: [
5709
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "univer-bases-badge-count", children: idx + 1 }),
5710
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: STEP_TYPE_LABELS[step.type] ?? step.type })
5711
+ ] }),
5712
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5713
+ "button",
5714
+ {
5715
+ type: "button",
5716
+ className: "univer-bases-icon-btn",
5717
+ onClick: () => setSteps((prev) => prev.filter((_, i) => i !== idx)),
5718
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BaseTrashIcon, {})
5719
+ }
5720
+ )
5721
+ ] }),
5722
+ step.type === "updateRecord" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-row", style: { marginTop: 6 }, children: [
5723
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5724
+ "select",
5725
+ {
5726
+ className: "univer-bases-select",
5727
+ value: firstUpdateFid,
5728
+ onChange: (e) => updateStepAt(idx, {
5729
+ fieldUpdates: { [e.target.value]: firstUpdateVal }
5730
+ }),
5731
+ children: currentFields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: f.id, children: f.name }, f.id))
5732
+ }
5733
+ ),
5734
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5735
+ "input",
5736
+ {
5737
+ type: "text",
5738
+ className: "univer-bases-input",
5739
+ placeholder: "\u5199\u5165\u503C\uFF0C\u652F\u6301 {\u5B57\u6BB5\u540D} \u6216 =\u516C\u5F0F...",
5740
+ value: firstUpdateVal,
5741
+ onChange: (e) => updateStepAt(idx, {
5742
+ fieldUpdates: { [firstUpdateFid]: e.target.value }
5743
+ })
5744
+ }
5745
+ )
5746
+ ] }),
5747
+ step.type === "createLinkedRecord" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-list", style: { marginTop: 6 }, children: [
5748
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-row", children: [
5749
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "univer-bases-muted-key", children: "\u76EE\u6807\u8868:" }),
5750
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5751
+ "select",
5752
+ {
5753
+ className: "univer-bases-select",
5754
+ value: step.targetTableId ?? "",
5755
+ onChange: (e) => updateStepAt(idx, { targetTableId: e.target.value }),
5756
+ children: tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: t.id, children: t.name }, t.id))
5757
+ }
5758
+ )
5759
+ ] }),
5760
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-row", children: [
5761
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5762
+ "select",
5763
+ {
5764
+ className: "univer-bases-select",
5765
+ value: firstCreateFid,
5766
+ onChange: (e) => updateStepAt(idx, {
5767
+ recordCells: { [e.target.value]: firstCreateVal }
5768
+ }),
5769
+ children: targetTblFields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: f.id, children: f.name }, f.id))
5770
+ }
5771
+ ),
5772
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5773
+ "input",
5774
+ {
5775
+ type: "text",
5776
+ className: "univer-bases-input",
5777
+ placeholder: "\u5173\u8054\u65B0\u8BB0\u5F55\u6807\u9898/\u6A21\u677F\uFF0C\u5982 {\u4EFB\u52A1\u6807\u9898}...",
5778
+ value: firstCreateVal,
5779
+ onChange: (e) => updateStepAt(idx, {
5780
+ recordCells: { [firstCreateFid]: e.target.value }
5781
+ })
5782
+ }
5783
+ )
5784
+ ] })
5785
+ ] }),
5786
+ step.type === "ifElse" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-list", style: { marginTop: 6 }, children: [
5787
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-row", children: [
5788
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "univer-bases-muted-key", children: "\u82E5:" }),
5789
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5790
+ "select",
5791
+ {
5792
+ className: "univer-bases-select",
5793
+ value: ifCond?.fieldId ?? currentFields[0]?.id ?? "",
5794
+ onChange: (e) => updateStepAt(idx, {
5795
+ conditions: [
5796
+ {
5797
+ id: ifCond?.id ?? `ifc_${(0, import_core7.generateRandomId)(4)}`,
5798
+ fieldId: e.target.value,
5799
+ operator: ifCond?.operator ?? "is",
5800
+ value: ifCond?.value ?? ""
5801
+ }
5802
+ ]
5803
+ }),
5804
+ children: currentFields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: f.id, children: f.name }, f.id))
5805
+ }
5806
+ ),
5807
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5808
+ "select",
5809
+ {
5810
+ className: "univer-bases-select univer-bases-select--xs",
5811
+ value: ifCond?.operator ?? "is",
5812
+ onChange: (e) => updateStepAt(idx, {
5813
+ conditions: [
5814
+ {
5815
+ id: ifCond?.id ?? `ifc_${(0, import_core7.generateRandomId)(4)}`,
5816
+ fieldId: ifCond?.fieldId ?? currentFields[0]?.id ?? "",
5817
+ operator: e.target.value,
5818
+ value: ifCond?.value ?? ""
5819
+ }
5820
+ ]
5821
+ }),
5822
+ children: OPERATOR_OPTIONS.map((op) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: op.value, children: op.label }, op.value))
5823
+ }
5824
+ ),
5825
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5826
+ "input",
5827
+ {
5828
+ type: "text",
5829
+ className: "univer-bases-input",
5830
+ placeholder: "\u6BD4\u8F83\u503C...",
5831
+ value: String(ifCond?.value ?? ""),
5832
+ onChange: (e) => updateStepAt(idx, {
5833
+ conditions: [
5834
+ {
5835
+ id: ifCond?.id ?? `ifc_${(0, import_core7.generateRandomId)(4)}`,
5836
+ fieldId: ifCond?.fieldId ?? currentFields[0]?.id ?? "",
5837
+ operator: ifCond?.operator ?? "is",
5838
+ value: e.target.value
5839
+ }
5840
+ ]
5841
+ })
5842
+ }
5843
+ )
5844
+ ] }),
5845
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-muted-key", children: [
5846
+ "\u6EE1\u8DB3\u6761\u4EF6\u6267\u884C Then \u5206\u652F (",
5847
+ step.thenSteps?.length ?? 0,
5848
+ " \u6B65) / \u5426\u5219\u6267\u884C Else \u5206\u652F (",
5849
+ step.elseSteps?.length ?? 0,
5850
+ " \u6B65)"
5851
+ ] })
5852
+ ] }),
5853
+ step.type === "httpWebhook" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-list", style: { marginTop: 6 }, children: [
5854
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-rule-row", children: [
5855
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5856
+ "select",
5857
+ {
5858
+ className: "univer-bases-select univer-bases-select--xs",
5859
+ value: step.webhookMethod ?? "POST",
5860
+ onChange: (e) => updateStepAt(idx, {
5861
+ webhookMethod: e.target.value
5862
+ }),
5863
+ children: [
5864
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "POST", children: "POST" }),
5865
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "PUT", children: "PUT" }),
5866
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "GET", children: "GET" })
5867
+ ]
5868
+ }
5869
+ ),
5870
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5871
+ "input",
5872
+ {
5873
+ type: "text",
5874
+ className: "univer-bases-input",
5875
+ placeholder: "https://api.example.com/webhook",
5876
+ value: step.webhookUrl ?? "",
5877
+ onChange: (e) => updateStepAt(idx, { webhookUrl: e.target.value })
5878
+ }
5879
+ )
5880
+ ] }),
5881
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5882
+ "textarea",
5883
+ {
5884
+ className: "univer-bases-textarea",
5885
+ rows: 2,
5886
+ placeholder: "JSON \u8BF7\u6C42\u4F53\u6A21\u677F\uFF0C\u652F\u6301 {\u5B57\u6BB5\u540D} \u53D8\u91CF",
5887
+ value: typeof step.webhookBodyTemplate === "string" ? step.webhookBodyTemplate : JSON.stringify(step.webhookBodyTemplate ?? {}),
5888
+ onChange: (e) => updateStepAt(idx, { webhookBodyTemplate: e.target.value })
5889
+ }
5890
+ )
5891
+ ] })
5892
+ ]
5893
+ },
5894
+ step.id
5895
+ );
5896
+ }) }),
5897
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-inline-flex", style: { marginTop: 10, flexWrap: "wrap" }, children: [
5898
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5899
+ "button",
5900
+ {
5901
+ type: "button",
5902
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5903
+ onClick: () => addStep("updateRecord"),
5904
+ children: [
5905
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasePlusIcon, {}),
5906
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u4FEE\u6539\u8BB0\u5F55" })
5907
+ ]
5908
+ }
5909
+ ),
5910
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5911
+ "button",
5912
+ {
5913
+ type: "button",
5914
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5915
+ onClick: () => addStep("createLinkedRecord"),
5916
+ children: [
5917
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasePlusIcon, {}),
5918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u65B0\u5EFA\u5173\u8054\u8BB0\u5F55" })
5919
+ ]
5920
+ }
5921
+ ),
5922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5923
+ "button",
5924
+ {
5925
+ type: "button",
5926
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5927
+ onClick: () => addStep("ifElse"),
5928
+ children: [
5929
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasePlusIcon, {}),
5930
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "If/Else \u5206\u652F" })
5931
+ ]
5932
+ }
5933
+ ),
5934
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5935
+ "button",
5936
+ {
5937
+ type: "button",
5938
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5939
+ onClick: () => addStep("httpWebhook"),
5940
+ children: [
5941
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasePlusIcon, {}),
5942
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u53D1\u9001 Webhook" })
5943
+ ]
5944
+ }
5945
+ )
5946
+ ] })
5947
+ ] })
5948
+ ] }),
5949
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "univer-bases-popover__footer", children: [
5950
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
5951
+ "button",
5952
+ {
5953
+ type: "button",
5954
+ className: "univer-bases-btn univer-bases-btn--outline univer-bases-btn--sm",
5955
+ "data-testid": "bases-auto-dry-run-btn",
5956
+ onClick: handleSaveAndDryRun,
5957
+ children: [
5958
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BasePlayIcon, {}),
5959
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u7ACB\u5373\u8BD5\u8FD0\u884C" })
5960
+ ]
5961
+ }
5962
+ ),
5963
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
5964
+ "button",
5965
+ {
5966
+ type: "button",
5967
+ className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
5968
+ "data-testid": "bases-auto-save-btn",
5969
+ onClick: handleSave,
5970
+ children: "\u4FDD\u5B58\u81EA\u52A8\u5316\u6D41\u7A0B"
5971
+ }
5972
+ )
5973
+ ] })
5974
+ ]
5975
+ }
5976
+ ) });
5977
+ };
5978
+
5979
+ // src/views/modals/BasesModalsHost.tsx
5980
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4278
5981
  function triggerBrowserDownload(content, fileName, mimeType) {
4279
5982
  if (typeof window === "undefined" || typeof document === "undefined") return;
4280
5983
  const blob = typeof content === "string" ? new Blob([content], { type: mimeType }) : new Blob([content], { type: mimeType });
@@ -4289,9 +5992,9 @@ function triggerBrowserDownload(content, fileName, mimeType) {
4289
5992
  }
4290
5993
  var BasesModalsHost = () => {
4291
5994
  const { unit, snapshot, commandService, selectionService, selectionState } = useActiveBaseWorkspace();
4292
- const [csvPasteText, setCsvPasteText] = (0, import_react10.useState)("");
4293
- const [pickerSearch, setPickerSearch] = (0, import_react10.useState)("");
4294
- const [importError, setImportError] = (0, import_react10.useState)(null);
5995
+ const [csvPasteText, setCsvPasteText] = (0, import_react12.useState)("");
5996
+ const [pickerSearch, setPickerSearch] = (0, import_react12.useState)("");
5997
+ const [importError, setImportError] = (0, import_react12.useState)(null);
4295
5998
  if (!unit || !snapshot || !selectionState.activeModal) return null;
4296
5999
  const unitId = unit.getUnitId();
4297
6000
  const activeTable = unit.getActiveTable();
@@ -4305,15 +6008,15 @@ var BasesModalsHost = () => {
4305
6008
  const sourceRecord = sourceTable?.records[session.recordId];
4306
6009
  const targetTable = snapshot.tables[session.linkedTableId];
4307
6010
  if (!sourceTable || !sourceRecord || !targetTable) return null;
4308
- const currentIds = (0, import_univer_bases18.normalizeLinkIds)(sourceRecord.cells[session.fieldId]);
6011
+ const currentIds = (0, import_univer_bases20.normalizeLinkIds)(sourceRecord.cells[session.fieldId]);
4309
6012
  const primaryField = targetTable.fields[targetTable.primaryFieldId] ?? Object.values(targetTable.fields)[0];
4310
6013
  const keyword = pickerSearch.trim().toLowerCase();
4311
6014
  const candidateRecords = targetTable.recordOrder.map((rid) => targetTable.records[rid]).filter(Boolean).map((rec) => {
4312
- const title = primaryField ? (0, import_univer_bases18.formatBaseCellValue)(
6015
+ const title = primaryField ? (0, import_univer_bases20.formatBaseCellValue)(
4313
6016
  snapshot,
4314
6017
  targetTable.id,
4315
6018
  primaryField,
4316
- (0, import_univer_bases18.resolveBaseCellValue)(snapshot, targetTable.id, rec, primaryField)
6019
+ (0, import_univer_bases20.resolveBaseCellValue)(snapshot, targetTable.id, rec, primaryField)
4317
6020
  ) : rec.id;
4318
6021
  return { id: rec.id, title: title || rec.id };
4319
6022
  }).filter((item) => !keyword || item.title.toLowerCase().includes(keyword));
@@ -4325,7 +6028,7 @@ var BasesModalsHost = () => {
4325
6028
  } else {
4326
6029
  nextIds = exists ? [] : [targetRecId];
4327
6030
  }
4328
- commandService.syncExecuteCommand(import_univer_bases18.UpdateBaseRecordCommand.id, {
6031
+ commandService.syncExecuteCommand(import_univer_bases20.UpdateBaseRecordCommand.id, {
4329
6032
  unitId,
4330
6033
  tableId: session.tableId,
4331
6034
  recordId: session.recordId,
@@ -4335,23 +6038,23 @@ var BasesModalsHost = () => {
4335
6038
  closeModal();
4336
6039
  }
4337
6040
  };
4338
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6041
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4339
6042
  "div",
4340
6043
  {
4341
6044
  className: "univer-bases-modal",
4342
6045
  "data-testid": "bases-link-picker-modal",
4343
6046
  onClick: (e) => e.stopPropagation(),
4344
6047
  children: [
4345
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-popover__header", children: [
4346
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { children: [
6048
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "univer-bases-popover__header", children: [
6049
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("strong", { children: [
4347
6050
  "\u9009\u62E9\u5173\u8054\u8BB0\u5F55 \xB7 ",
4348
6051
  targetTable.name
4349
6052
  ] }),
4350
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseCloseIcon, {}) })
6053
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseCloseIcon, {}) })
4351
6054
  ] }),
4352
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-search-box", style: { marginBottom: 10 }, children: [
4353
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseSearchIcon, {}),
4354
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6055
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "univer-bases-search-box", style: { marginBottom: 10 }, children: [
6056
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseSearchIcon, {}),
6057
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4355
6058
  "input",
4356
6059
  {
4357
6060
  type: "text",
@@ -4361,16 +6064,16 @@ var BasesModalsHost = () => {
4361
6064
  }
4362
6065
  )
4363
6066
  ] }),
4364
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-picker-list", children: candidateRecords.map((item) => {
6067
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "univer-bases-picker-list", children: candidateRecords.map((item) => {
4365
6068
  const selected = currentIds.includes(item.id);
4366
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6069
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4367
6070
  "div",
4368
6071
  {
4369
6072
  className: `univer-bases-picker-item ${selected ? "is-selected" : ""}`,
4370
6073
  onClick: () => toggleTargetRecord(item.id),
4371
6074
  children: [
4372
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: item.title }),
4373
- selected && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseCheckIcon, {})
6075
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: item.title }),
6076
+ selected && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseCheckIcon, {})
4374
6077
  ]
4375
6078
  },
4376
6079
  item.id
@@ -4387,11 +6090,11 @@ var BasesModalsHost = () => {
4387
6090
  const lower = file.name.toLowerCase();
4388
6091
  if (lower.endsWith(".xlsx")) {
4389
6092
  const buf = new Uint8Array(await file.arrayBuffer());
4390
- const importedUnit = (0, import_univer_bases18.importXlsxBytesToBase)(buf, {
6093
+ const importedUnit = (0, import_univer_bases20.importXlsxBytesToBase)(buf, {
4391
6094
  id: unitId,
4392
6095
  name: file.name.replace(/\.xlsx$/i, "")
4393
6096
  });
4394
- commandService.syncExecuteCommand(import_univer_bases18.ReplaceBaseSnapshotCommand.id, {
6097
+ commandService.syncExecuteCommand(import_univer_bases20.ReplaceBaseSnapshotCommand.id, {
4395
6098
  unitId,
4396
6099
  snapshot: importedUnit
4397
6100
  });
@@ -4400,7 +6103,7 @@ var BasesModalsHost = () => {
4400
6103
  }
4401
6104
  const text = await file.text();
4402
6105
  const delimiter = lower.endsWith(".tsv") ? " " : ",";
4403
- const importedTbl = (0, import_univer_bases18.importCsvToBaseTable)(text, {
6106
+ const importedTbl = (0, import_univer_bases20.importCsvToBaseTable)(text, {
4404
6107
  tableName: file.name.replace(/\.(csv|tsv)$/i, ""),
4405
6108
  delimiter
4406
6109
  });
@@ -4414,7 +6117,7 @@ var BasesModalsHost = () => {
4414
6117
  [importedTbl.id]: importedTbl
4415
6118
  }
4416
6119
  };
4417
- commandService.syncExecuteCommand(import_univer_bases18.ReplaceBaseSnapshotCommand.id, {
6120
+ commandService.syncExecuteCommand(import_univer_bases20.ReplaceBaseSnapshotCommand.id, {
4418
6121
  unitId,
4419
6122
  snapshot: nextSnap
4420
6123
  });
@@ -4423,22 +6126,22 @@ var BasesModalsHost = () => {
4423
6126
  setImportError(err instanceof Error ? err.message : "\u5BFC\u5165\u6587\u4EF6\u89E3\u6790\u5931\u8D25");
4424
6127
  }
4425
6128
  };
4426
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6129
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4427
6130
  "div",
4428
6131
  {
4429
6132
  className: "univer-bases-modal",
4430
6133
  "data-testid": "bases-import-modal",
4431
6134
  onClick: (e) => e.stopPropagation(),
4432
6135
  children: [
4433
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-popover__header", children: [
4434
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "\u5BFC\u5165\u591A\u7EF4\u6570\u636E\u8868 (.xlsx / .csv / .tsv)" }),
4435
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseCloseIcon, {}) })
6136
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "univer-bases-popover__header", children: [
6137
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: "\u5BFC\u5165\u591A\u7EF4\u6570\u636E\u8868 (.xlsx / .csv / .tsv)" }),
6138
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseCloseIcon, {}) })
4436
6139
  ] }),
4437
- importError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-alert-error", children: importError }),
4438
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "univer-bases-upload-dropzone", children: [
4439
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseUploadIcon, {}),
4440
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u70B9\u51FB\u9009\u62E9\u672C\u5730 .xlsx \u5DE5\u4F5C\u7C3F\u6216 .csv/.tsv \u8868\u683C\u6587\u4EF6" }),
4441
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6140
+ importError && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "univer-bases-alert-error", children: importError }),
6141
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "univer-bases-upload-dropzone", children: [
6142
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseUploadIcon, {}),
6143
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u70B9\u51FB\u9009\u62E9\u672C\u5730 .xlsx \u5DE5\u4F5C\u7C3F\u6216 .csv/.tsv \u8868\u683C\u6587\u4EF6" }),
6144
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4442
6145
  "input",
4443
6146
  {
4444
6147
  type: "file",
@@ -4451,9 +6154,9 @@ var BasesModalsHost = () => {
4451
6154
  }
4452
6155
  )
4453
6156
  ] }),
4454
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-form-row", style: { marginTop: 12 }, children: [
4455
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { children: "\u6216\u76F4\u63A5\u7C98\u8D34 CSV \u6587\u672C\u5FEB\u901F\u5EFA\u8868" }),
4456
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6157
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "univer-bases-form-row", style: { marginTop: 12 }, children: [
6158
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { children: "\u6216\u76F4\u63A5\u7C98\u8D34 CSV \u6587\u672C\u5FEB\u901F\u5EFA\u8868" }),
6159
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4457
6160
  "textarea",
4458
6161
  {
4459
6162
  className: "univer-bases-textarea",
@@ -4464,17 +6167,17 @@ var BasesModalsHost = () => {
4464
6167
  }
4465
6168
  )
4466
6169
  ] }),
4467
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6170
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "univer-bases-popover__footer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4468
6171
  "button",
4469
6172
  {
4470
6173
  type: "button",
4471
6174
  className: "univer-bases-btn univer-bases-btn--primary univer-bases-btn--sm",
4472
6175
  disabled: !csvPasteText.trim(),
4473
6176
  onClick: () => {
4474
- const tbl = (0, import_univer_bases18.importCsvToBaseTable)(csvPasteText, {
6177
+ const tbl = (0, import_univer_bases20.importCsvToBaseTable)(csvPasteText, {
4475
6178
  tableName: "CSV\u7C98\u8D34\u5BFC\u5165\u8868"
4476
6179
  });
4477
- commandService.syncExecuteCommand(import_univer_bases18.ReplaceBaseSnapshotCommand.id, {
6180
+ commandService.syncExecuteCommand(import_univer_bases20.ReplaceBaseSnapshotCommand.id, {
4478
6181
  unitId,
4479
6182
  snapshot: {
4480
6183
  ...snapshot,
@@ -4495,25 +6198,25 @@ var BasesModalsHost = () => {
4495
6198
  ) });
4496
6199
  }
4497
6200
  if (selectionState.activeModal === "export") {
4498
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6201
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "univer-bases-modal-backdrop", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4499
6202
  "div",
4500
6203
  {
4501
6204
  className: "univer-bases-modal",
4502
6205
  "data-testid": "bases-export-modal",
4503
6206
  onClick: (e) => e.stopPropagation(),
4504
6207
  children: [
4505
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-popover__header", children: [
4506
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "\u5BFC\u51FA\u591A\u7EF4\u6570\u636E\u8868" }),
4507
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseCloseIcon, {}) })
6208
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "univer-bases-popover__header", children: [
6209
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: "\u5BFC\u51FA\u591A\u7EF4\u6570\u636E\u8868" }),
6210
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "univer-bases-icon-btn", onClick: closeModal, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseCloseIcon, {}) })
4508
6211
  ] }),
4509
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "univer-bases-export-options", children: [
4510
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6212
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "univer-bases-export-options", children: [
6213
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4511
6214
  "button",
4512
6215
  {
4513
6216
  type: "button",
4514
6217
  className: "univer-bases-export-card",
4515
6218
  onClick: () => {
4516
- const bytes = (0, import_univer_bases18.exportBaseToXlsxBytes)(snapshot);
6219
+ const bytes = (0, import_univer_bases20.exportBaseToXlsxBytes)(snapshot);
4517
6220
  triggerBrowserDownload(
4518
6221
  bytes,
4519
6222
  `${snapshot.name || "univer-base"}.xlsx`,
@@ -4522,10 +6225,10 @@ var BasesModalsHost = () => {
4522
6225
  closeModal();
4523
6226
  },
4524
6227
  children: [
4525
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseDownloadIcon, {}),
4526
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
4527
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "\u5BFC\u51FA\u5168\u5E93\u4E3A\u591A\u5DE5\u4F5C\u8868 Excel (.xlsx)" }),
4528
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { children: [
6228
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseDownloadIcon, {}),
6229
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
6230
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: "\u5BFC\u51FA\u5168\u5E93\u4E3A\u591A\u5DE5\u4F5C\u8868 Excel (.xlsx)" }),
6231
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { children: [
4529
6232
  "\u5C06\u5168\u90E8 ",
4530
6233
  snapshot.tableOrder.length,
4531
6234
  " \u5F20\u5173\u8054\u6570\u636E\u8868\u5BFC\u51FA\u4E3A\u5E26\u8868\u5934\u6837\u5F0F\u7684\u6807\u51C6 OpenXML \u5DE5\u4F5C\u7C3F"
@@ -4534,13 +6237,13 @@ var BasesModalsHost = () => {
4534
6237
  ]
4535
6238
  }
4536
6239
  ),
4537
- activeTable && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6240
+ activeTable && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4538
6241
  "button",
4539
6242
  {
4540
6243
  type: "button",
4541
6244
  className: "univer-bases-export-card",
4542
6245
  onClick: () => {
4543
- const csv = (0, import_univer_bases18.exportBaseTableToCsv)(snapshot, activeTable.id, {
6246
+ const csv = (0, import_univer_bases20.exportBaseTableToCsv)(snapshot, activeTable.id, {
4544
6247
  includeBom: true
4545
6248
  });
4546
6249
  triggerBrowserDownload(
@@ -4551,14 +6254,14 @@ var BasesModalsHost = () => {
4551
6254
  closeModal();
4552
6255
  },
4553
6256
  children: [
4554
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BaseDownloadIcon, {}),
4555
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
4556
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("strong", { children: [
6257
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseDownloadIcon, {}),
6258
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
6259
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("strong", { children: [
4557
6260
  "\u5BFC\u51FA\u5F53\u524D\u8868\u300C",
4558
6261
  activeTable.name,
4559
6262
  "\u300D\u4E3A CSV (.csv)"
4560
6263
  ] }),
4561
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: "\u9075\u5FAA RFC-4180 \u6807\u51C6\uFF0C\u5305\u542B UTF-8 BOM \u4EE5\u517C\u5BB9\u684C\u9762\u8868\u683C\u8F6F\u4EF6" })
6264
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: "\u9075\u5FAA RFC-4180 \u6807\u51C6\uFF0C\u5305\u542B UTF-8 BOM \u4EE5\u517C\u5BB9\u684C\u9762\u8868\u683C\u8F6F\u4EF6" })
4562
6265
  ] })
4563
6266
  ]
4564
6267
  }
@@ -4568,12 +6271,15 @@ var BasesModalsHost = () => {
4568
6271
  }
4569
6272
  ) });
4570
6273
  }
6274
+ if (selectionState.activeModal === "automationBuilder") {
6275
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AutomationBuilderModal, {});
6276
+ }
4571
6277
  return null;
4572
6278
  };
4573
6279
 
4574
6280
  // src/controllers/menu.schema.ts
4575
6281
  var import_ui3 = require("@univerjs/ui");
4576
- var import_univer_bases19 = require("@yudaocode/univer-bases");
6282
+ var import_univer_bases21 = require("@yudaocode/univer-bases");
4577
6283
  function createMenuButton(config) {
4578
6284
  return () => ({
4579
6285
  id: config.id,
@@ -4592,7 +6298,7 @@ var basesMenuSchema = {
4592
6298
  order: 1,
4593
6299
  menuItemFactory: createMenuButton({
4594
6300
  id: "bases-ui.menu.add-record",
4595
- commandId: import_univer_bases19.AddBaseRecordCommand.id,
6301
+ commandId: import_univer_bases21.AddBaseRecordCommand.id,
4596
6302
  title: "bases.ribbon.addRecord",
4597
6303
  label: "bases.ribbon.addRecord",
4598
6304
  icon: "BasePlusIcon"
@@ -4602,7 +6308,7 @@ var basesMenuSchema = {
4602
6308
  order: 2,
4603
6309
  menuItemFactory: createMenuButton({
4604
6310
  id: "bases-ui.menu.add-field",
4605
- commandId: import_univer_bases19.AddBaseFieldCommand.id,
6311
+ commandId: import_univer_bases21.AddBaseFieldCommand.id,
4606
6312
  title: "bases.ribbon.addField",
4607
6313
  label: "bases.ribbon.addField",
4608
6314
  icon: "BaseTableIcon",
@@ -4613,7 +6319,7 @@ var basesMenuSchema = {
4613
6319
  order: 3,
4614
6320
  menuItemFactory: createMenuButton({
4615
6321
  id: "bases-ui.menu.add-table",
4616
- commandId: import_univer_bases19.AddBaseTableCommand.id,
6322
+ commandId: import_univer_bases21.AddBaseTableCommand.id,
4617
6323
  title: "bases.ribbon.addTable",
4618
6324
  label: "bases.ribbon.addTable",
4619
6325
  icon: "BaseTableIcon"
@@ -4658,7 +6364,7 @@ var basesMenuSchema = {
4658
6364
  order: 1,
4659
6365
  menuItemFactory: createMenuButton({
4660
6366
  id: "bases-ui.menu.insert-record",
4661
- commandId: import_univer_bases19.AddBaseRecordCommand.id,
6367
+ commandId: import_univer_bases21.AddBaseRecordCommand.id,
4662
6368
  title: "bases.ribbon.addRecord",
4663
6369
  label: "bases.ribbon.addRecord",
4664
6370
  icon: "BasePlusIcon"
@@ -4668,7 +6374,7 @@ var basesMenuSchema = {
4668
6374
  order: 2,
4669
6375
  menuItemFactory: createMenuButton({
4670
6376
  id: "bases-ui.menu.insert-table",
4671
- commandId: import_univer_bases19.AddBaseTableCommand.id,
6377
+ commandId: import_univer_bases21.AddBaseTableCommand.id,
4672
6378
  title: "bases.ribbon.addTable",
4673
6379
  label: "bases.ribbon.addTable",
4674
6380
  icon: "BaseTableIcon"
@@ -4686,6 +6392,16 @@ var basesMenuSchema = {
4686
6392
  params: { viewType: "grid" }
4687
6393
  })
4688
6394
  },
6395
+ ["bases-ui.menu.view-list"]: {
6396
+ order: 1.5,
6397
+ menuItemFactory: createMenuButton({
6398
+ id: "bases-ui.menu.view-list",
6399
+ commandId: SwitchBaseViewTypeOperation.id,
6400
+ title: "bases.ribbon.listView",
6401
+ icon: "BaseListIcon",
6402
+ params: { viewType: "list" }
6403
+ })
6404
+ },
4689
6405
  ["bases-ui.menu.view-kanban"]: {
4690
6406
  order: 2,
4691
6407
  menuItemFactory: createMenuButton({
@@ -4760,7 +6476,7 @@ var basesMenuSchema = {
4760
6476
  };
4761
6477
 
4762
6478
  // src/controllers/bases-ui.controller.ts
4763
- var BasesUIController = class extends import_core5.Disposable {
6479
+ var BasesUIController = class extends import_core8.Disposable {
4764
6480
  constructor(_config, _commandService, _menuManagerService, _uiPartsService, _sidebarService, _componentManager, _iconManager) {
4765
6481
  super();
4766
6482
  this._config = _config;
@@ -4784,7 +6500,7 @@ var BasesUIController = class extends import_core5.Disposable {
4784
6500
  }
4785
6501
  }, 100);
4786
6502
  this.disposeWithMe(
4787
- (0, import_core5.toDisposable)(() => {
6503
+ (0, import_core8.toDisposable)(() => {
4788
6504
  if (this._openInspectorTimer !== null) {
4789
6505
  clearTimeout(this._openInspectorTimer);
4790
6506
  this._openInspectorTimer = null;
@@ -4831,12 +6547,12 @@ var BasesUIController = class extends import_core5.Disposable {
4831
6547
  }
4832
6548
  };
4833
6549
  BasesUIController = __decorateClass([
4834
- __decorateParam(1, import_core5.ICommandService),
6550
+ __decorateParam(1, import_core8.ICommandService),
4835
6551
  __decorateParam(2, import_ui4.IMenuManagerService),
4836
6552
  __decorateParam(3, import_ui4.IUIPartsService),
4837
6553
  __decorateParam(4, import_ui4.ISidebarService),
4838
- __decorateParam(5, (0, import_core5.Inject)(import_ui4.ComponentManager)),
4839
- __decorateParam(6, (0, import_core5.Inject)(import_ui4.IconManager))
6554
+ __decorateParam(5, (0, import_core8.Inject)(import_ui4.ComponentManager)),
6555
+ __decorateParam(6, (0, import_core8.Inject)(import_ui4.IconManager))
4840
6556
  ], BasesUIController);
4841
6557
 
4842
6558
  // src/locale/en-US.ts
@@ -4847,6 +6563,7 @@ var locale = {
4847
6563
  addField: "Add Field",
4848
6564
  addTable: "New Table",
4849
6565
  gridView: "Grid View",
6566
+ listView: "List View",
4850
6567
  kanbanView: "Kanban View",
4851
6568
  calendarView: "Calendar View",
4852
6569
  galleryView: "Gallery View",
@@ -4869,6 +6586,7 @@ var locale = {
4869
6586
  },
4870
6587
  views: {
4871
6588
  grid: "Grid",
6589
+ list: "List",
4872
6590
  kanban: "Kanban",
4873
6591
  calendar: "Calendar",
4874
6592
  gallery: "Gallery",
@@ -4906,6 +6624,7 @@ var locale2 = {
4906
6624
  addField: "\u65B0\u589E\u5B57\u6BB5",
4907
6625
  addTable: "\u65B0\u5EFA\u6570\u636E\u8868",
4908
6626
  gridView: "\u8868\u683C\u89C6\u56FE",
6627
+ listView: "\u5217\u8868\u89C6\u56FE",
4909
6628
  kanbanView: "\u770B\u677F\u89C6\u56FE",
4910
6629
  calendarView: "\u65E5\u5386\u89C6\u56FE",
4911
6630
  galleryView: "\u753B\u5ECA\u89C6\u56FE",
@@ -4928,6 +6647,7 @@ var locale2 = {
4928
6647
  },
4929
6648
  views: {
4930
6649
  grid: "\u8868\u683C",
6650
+ list: "\u5217\u8868",
4931
6651
  kanban: "\u770B\u677F",
4932
6652
  calendar: "\u65E5\u5386",
4933
6653
  gallery: "\u753B\u5ECA",
@@ -4959,17 +6679,17 @@ var zh_CN_default = locale2;
4959
6679
 
4960
6680
  // src/plugin.ts
4961
6681
  var UNIVER_BASES_UI_PLUGIN_NAME = "UNIVER_BASES_UI_PLUGIN";
4962
- var UniverBasesUIPlugin = class extends import_core6.Plugin {
6682
+ var UniverBasesUIPlugin = class extends import_core9.Plugin {
4963
6683
  constructor(_config = {}, _injector) {
4964
6684
  super();
4965
6685
  this._config = _config;
4966
6686
  this._injector = _injector;
4967
6687
  }
4968
6688
  onStarting() {
4969
- if (this._injector.has(import_core6.LocaleService)) {
4970
- this._injector.get(import_core6.LocaleService).load({
4971
- [import_core6.LocaleType.ZH_CN]: zh_CN_default,
4972
- [import_core6.LocaleType.EN_US]: en_US_default
6689
+ if (this._injector.has(import_core9.LocaleService)) {
6690
+ this._injector.get(import_core9.LocaleService).load({
6691
+ [import_core9.LocaleType.ZH_CN]: zh_CN_default,
6692
+ [import_core9.LocaleType.EN_US]: en_US_default
4973
6693
  });
4974
6694
  }
4975
6695
  this._injector.add([
@@ -4983,19 +6703,21 @@ var UniverBasesUIPlugin = class extends import_core6.Plugin {
4983
6703
  };
4984
6704
  UniverBasesUIPlugin.pluginName = UNIVER_BASES_UI_PLUGIN_NAME;
4985
6705
  UniverBasesUIPlugin.packageName = "@yudaocode/univer-bases-ui";
4986
- UniverBasesUIPlugin.type = import_core6.UniverInstanceType.UNIVER_BASE;
6706
+ UniverBasesUIPlugin.type = import_core9.UniverInstanceType.UNIVER_BASE;
4987
6707
  UniverBasesUIPlugin = __decorateClass([
4988
- (0, import_core6.DependentOn)(import_univer_bases20.UniverBasesPlugin),
4989
- __decorateParam(1, (0, import_core6.Inject)(import_core6.Injector))
6708
+ (0, import_core9.DependentOn)(import_univer_bases22.UniverBasesPlugin),
6709
+ __decorateParam(1, (0, import_core9.Inject)(import_core9.Injector))
4990
6710
  ], UniverBasesUIPlugin);
4991
6711
 
4992
6712
  // src/index.ts
4993
- var VERSION = "1.6.218";
6713
+ var VERSION = "1.6.219";
4994
6714
  // Annotate the CommonJS export names for ESM import in node:
4995
6715
  0 && (module.exports = {
6716
+ AutomationBuilderModal,
4996
6717
  BASE_ICON_MAP,
4997
6718
  BASE_INSPECTOR_COMPONENT_KEY,
4998
6719
  BASE_INSPECTOR_SIDEBAR_ID,
6720
+ BaseBoltIcon,
4999
6721
  BaseCalendarIcon,
5000
6722
  BaseCheckIcon,
5001
6723
  BaseChevronDownIcon,
@@ -5003,8 +6725,10 @@ var VERSION = "1.6.218";
5003
6725
  BaseChevronRightIcon,
5004
6726
  BaseCloseIcon,
5005
6727
  BaseColorIcon,
6728
+ BaseColumnsIcon,
5006
6729
  BaseDashboardIcon,
5007
6730
  BaseDownloadIcon,
6731
+ BaseEditIcon,
5008
6732
  BaseExpandIcon,
5009
6733
  BaseFieldTypeIcon,
5010
6734
  BaseFilterIcon,
@@ -5013,9 +6737,13 @@ var VERSION = "1.6.218";
5013
6737
  BaseGanttIcon,
5014
6738
  BaseGridIcon,
5015
6739
  BaseGroupIcon,
6740
+ BaseIndentIcon,
5016
6741
  BaseInspectorIcon,
5017
6742
  BaseKanbanIcon,
5018
6743
  BaseLinkIcon,
6744
+ BaseListIcon,
6745
+ BaseOutdentIcon,
6746
+ BasePlayIcon,
5019
6747
  BasePlusIcon,
5020
6748
  BaseSearchIcon,
5021
6749
  BaseSortIcon,
@@ -5042,6 +6770,7 @@ var VERSION = "1.6.218";
5042
6770
  GridCellEditor,
5043
6771
  GridView,
5044
6772
  KanbanView,
6773
+ ListView,
5045
6774
  LoadBasePresetOperation,
5046
6775
  OpenBaseModalOperation,
5047
6776
  RecordDetailDrawer,