@univerjs/sheets-table-ui 1.0.0-alpha.8 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +342 -359
- package/lib/cjs/locale/ar-SA.js +1 -2
- package/lib/cjs/locale/ca-ES.js +4 -5
- package/lib/cjs/locale/de-DE.js +1 -2
- package/lib/cjs/locale/en-US.js +1 -2
- package/lib/cjs/locale/es-ES.js +1 -2
- package/lib/cjs/locale/fa-IR.js +1 -2
- package/lib/cjs/locale/fr-FR.js +1 -2
- package/lib/cjs/locale/id-ID.js +1 -2
- package/lib/cjs/locale/it-IT.js +1 -2
- package/lib/cjs/locale/ja-JP.js +1 -2
- package/lib/cjs/locale/ko-KR.js +1 -2
- package/lib/cjs/locale/pl-PL.js +1 -2
- package/lib/cjs/locale/pt-BR.js +1 -2
- package/lib/cjs/locale/ru-RU.js +1 -2
- package/lib/cjs/locale/sk-SK.js +1 -2
- package/lib/cjs/locale/vi-VN.js +1 -2
- package/lib/cjs/locale/zh-CN.js +1 -2
- package/lib/cjs/locale/zh-HK.js +14 -15
- package/lib/cjs/locale/zh-TW.js +14 -15
- package/lib/es/index.js +346 -363
- package/lib/es/locale/ar-SA.js +1 -2
- package/lib/es/locale/ca-ES.js +4 -5
- package/lib/es/locale/de-DE.js +1 -2
- package/lib/es/locale/en-US.js +1 -2
- package/lib/es/locale/es-ES.js +1 -2
- package/lib/es/locale/fa-IR.js +1 -2
- package/lib/es/locale/fr-FR.js +1 -2
- package/lib/es/locale/id-ID.js +1 -2
- package/lib/es/locale/it-IT.js +1 -2
- package/lib/es/locale/ja-JP.js +1 -2
- package/lib/es/locale/ko-KR.js +1 -2
- package/lib/es/locale/pl-PL.js +1 -2
- package/lib/es/locale/pt-BR.js +1 -2
- package/lib/es/locale/ru-RU.js +1 -2
- package/lib/es/locale/sk-SK.js +1 -2
- package/lib/es/locale/vi-VN.js +1 -2
- package/lib/es/locale/zh-CN.js +1 -2
- package/lib/es/locale/zh-HK.js +14 -15
- package/lib/es/locale/zh-TW.js +14 -15
- package/lib/index.css +187 -67
- package/lib/index.js +346 -363
- package/lib/locale/ar-SA.js +1 -2
- package/lib/locale/ca-ES.js +4 -5
- package/lib/locale/de-DE.js +1 -2
- package/lib/locale/en-US.js +1 -2
- package/lib/locale/es-ES.js +1 -2
- package/lib/locale/fa-IR.js +1 -2
- package/lib/locale/fr-FR.js +1 -2
- package/lib/locale/id-ID.js +1 -2
- package/lib/locale/it-IT.js +1 -2
- package/lib/locale/ja-JP.js +1 -2
- package/lib/locale/ko-KR.js +1 -2
- package/lib/locale/pl-PL.js +1 -2
- package/lib/locale/pt-BR.js +1 -2
- package/lib/locale/ru-RU.js +1 -2
- package/lib/locale/sk-SK.js +1 -2
- package/lib/locale/vi-VN.js +1 -2
- package/lib/locale/zh-CN.js +1 -2
- package/lib/locale/zh-HK.js +14 -15
- package/lib/locale/zh-TW.js +14 -15
- package/lib/types/const.d.ts +1 -0
- package/lib/types/controllers/sheet-table-controls-render.controller.d.ts +6 -2
- package/lib/types/locale/en-US.d.ts +1 -2
- package/lib/types/views/components/SheetTableMenu.d.ts +29 -0
- package/lib/types/views/widgets/table-controls-util.d.ts +1 -7
- package/lib/types/views/widgets/table-controls.shape.d.ts +1 -9
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +14 -14
package/lib/cjs/index.js
CHANGED
|
@@ -38,6 +38,7 @@ const SHEET_TABLE_RENAME_DIALOG = "SHEET_TABLE_RENAME_DIALOG";
|
|
|
38
38
|
const SHEET_TABLE_RENAME_DIALOG_ID = "SHEET_TABLE_RENAME_DIALOG_ID";
|
|
39
39
|
const SHEET_TABLE_THEME_PANEL_ID = "SHEET_TABLE_THEME_PANEL_ID";
|
|
40
40
|
const SHEET_TABLE_THEME_PANEL = "SHEET_TABLE_THEME_PANEL";
|
|
41
|
+
const SHEET_TABLE_MENU = "SHEET_TABLE_MENU";
|
|
41
42
|
const TABLE_CUSTOM_NAME_PREFIX = "table-custom-";
|
|
42
43
|
const TABLE_DEFAULT_NAME_PREFIX = "table-default-";
|
|
43
44
|
const TABLE_DEFAULT_BG_COLOR = "rgb(255, 255, 255)";
|
|
@@ -50,14 +51,13 @@ const OpenTableSelectorOperation = {
|
|
|
50
51
|
type: _univerjs_core.CommandType.OPERATION,
|
|
51
52
|
id: "sheet.operation.open-table-selector",
|
|
52
53
|
async handler(accessor) {
|
|
53
|
-
var _lastSelection$range;
|
|
54
54
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
55
55
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
56
56
|
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
57
57
|
if (!target) return false;
|
|
58
58
|
const { unitId, subUnitId, worksheet } = target;
|
|
59
59
|
const lastSelection = accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection();
|
|
60
|
-
const range = (
|
|
60
|
+
const range = (lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.range) ?? {
|
|
61
61
|
startRow: 0,
|
|
62
62
|
endRow: 0,
|
|
63
63
|
startColumn: 0,
|
|
@@ -249,7 +249,7 @@ const menuSchema = {
|
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region package.json
|
|
251
251
|
var name = "@univerjs/sheets-table-ui";
|
|
252
|
-
var version = "1.0.0-
|
|
252
|
+
var version = "1.0.0-beta.1";
|
|
253
253
|
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
@@ -900,7 +900,7 @@ function getInitConditionInfo(tableFilter) {
|
|
|
900
900
|
//#endregion
|
|
901
901
|
//#region src/views/components/SheetTableConditionPanel.tsx
|
|
902
902
|
const SheetTableConditionPanel = (props) => {
|
|
903
|
-
var _conditionInfo$info$d, _conditionInfo$info$d2, _conditionInfo$info$
|
|
903
|
+
var _conditionInfo$info$d, _conditionInfo$info$d2, _conditionInfo$info$n, _conditionInfo$info$n3;
|
|
904
904
|
const { conditionInfo, onChange } = props;
|
|
905
905
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
906
906
|
const [conditionVisible, setConditionVisible] = (0, react.useState)(false);
|
|
@@ -908,13 +908,12 @@ const SheetTableConditionPanel = (props) => {
|
|
|
908
908
|
const cascaderOptions = getCascaderListOptions(injector);
|
|
909
909
|
const handleConditionInfo = (info, type, compare) => {
|
|
910
910
|
onChange({
|
|
911
|
-
type: type
|
|
912
|
-
compare: compare
|
|
911
|
+
type: type ?? conditionInfo.type,
|
|
912
|
+
compare: compare ?? conditionInfo.compare,
|
|
913
913
|
info
|
|
914
914
|
});
|
|
915
915
|
};
|
|
916
916
|
const handleChange = (value) => {
|
|
917
|
-
var _ref;
|
|
918
917
|
const type = value[0];
|
|
919
918
|
const compare = value[1];
|
|
920
919
|
if (compare) setConditionVisible(false);
|
|
@@ -925,7 +924,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
925
924
|
else info.dateRange = [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()];
|
|
926
925
|
else if (type === _univerjs_sheets_table.TableConditionTypeEnum.Number) info.number = 0;
|
|
927
926
|
else if (type === _univerjs_sheets_table.TableConditionTypeEnum.String) info.string = "";
|
|
928
|
-
handleConditionInfo(info, value[0],
|
|
927
|
+
handleConditionInfo(info, value[0], value[1] ?? _univerjs_sheets_table.TableStringCompareTypeEnum.Equal);
|
|
929
928
|
};
|
|
930
929
|
const subComponentType = getSubComponentType(conditionInfo.type, conditionInfo.compare);
|
|
931
930
|
let selectType = "";
|
|
@@ -944,7 +943,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
944
943
|
wrapperClassName: "!univer-h-[150px]"
|
|
945
944
|
}),
|
|
946
945
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
947
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-
|
|
946
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-2 univer-text-sm univer-transition-colors univer-duration-200 hover:univer-border-primary-600 focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", _univerjs_design.borderClassName),
|
|
948
947
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selectType }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
|
|
949
948
|
})
|
|
950
949
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -952,7 +951,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
952
951
|
children: [
|
|
953
952
|
subComponentType === "Input" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: conditionInfo.type === _univerjs_sheets_table.TableConditionTypeEnum.String ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
954
953
|
className: "univer-w-full",
|
|
955
|
-
placeholder: "
|
|
954
|
+
placeholder: localeService.t("sheets-table-ui.filter.input-values-placeholder"),
|
|
956
955
|
value: conditionInfo.info.string,
|
|
957
956
|
onChange: (v) => handleConditionInfo({ string: v })
|
|
958
957
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
@@ -967,7 +966,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
967
966
|
id: "univer-table-date-picker-wrapper",
|
|
968
967
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DatePicker, {
|
|
969
968
|
className: "univer-w-full",
|
|
970
|
-
value:
|
|
969
|
+
value: conditionInfo.info.date ?? /* @__PURE__ */ new Date(),
|
|
971
970
|
onValueChange: (v) => handleConditionInfo({ date: v })
|
|
972
971
|
})
|
|
973
972
|
}),
|
|
@@ -975,7 +974,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
975
974
|
id: "univer-table-date-range-wrapper",
|
|
976
975
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DateRangePicker, {
|
|
977
976
|
className: "univer-w-full",
|
|
978
|
-
value: [(
|
|
977
|
+
value: [((_conditionInfo$info$d = conditionInfo.info.dateRange) === null || _conditionInfo$info$d === void 0 ? void 0 : _conditionInfo$info$d[0]) ?? /* @__PURE__ */ new Date(), ((_conditionInfo$info$d2 = conditionInfo.info.dateRange) === null || _conditionInfo$info$d2 === void 0 ? void 0 : _conditionInfo$info$d2[1]) ?? /* @__PURE__ */ new Date()],
|
|
979
978
|
onValueChange: (v) => {
|
|
980
979
|
if (v) handleConditionInfo({ dateRange: v });
|
|
981
980
|
else handleConditionInfo({});
|
|
@@ -1012,7 +1011,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
1012
1011
|
}),
|
|
1013
1012
|
!!(subComponentType === "Select") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
1014
1013
|
className: "univer-w-full",
|
|
1015
|
-
value:
|
|
1014
|
+
value: conditionInfo.info.dateSelect ?? conditionDateOptions[0].value,
|
|
1016
1015
|
options: conditionDateOptions,
|
|
1017
1016
|
onChange: (v) => handleConditionInfo({ dateSelect: v })
|
|
1018
1017
|
})
|
|
@@ -1025,8 +1024,7 @@ const SheetTableConditionPanel = (props) => {
|
|
|
1025
1024
|
const getCheckedItemCount = (map, checkedItemSet) => {
|
|
1026
1025
|
let count = 0;
|
|
1027
1026
|
checkedItemSet.forEach((item) => {
|
|
1028
|
-
|
|
1029
|
-
count += (_map$get = map.get(item)) !== null && _map$get !== void 0 ? _map$get : 0;
|
|
1027
|
+
count += map.get(item) ?? 0;
|
|
1030
1028
|
});
|
|
1031
1029
|
return count;
|
|
1032
1030
|
};
|
|
@@ -1278,14 +1276,14 @@ function SheetTableFilterPanel() {
|
|
|
1278
1276
|
};
|
|
1279
1277
|
const workbookEditableId = new _univerjs_sheets.WorkbookEditablePermission(unitId).id;
|
|
1280
1278
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1281
|
-
className: "univer-box-border univer-flex univer-w-[400px] univer-flex-col univer-rounded-[10px] univer-bg-
|
|
1279
|
+
className: "univer-box-border univer-flex univer-w-[400px] univer-flex-col univer-rounded-[10px] univer-bg-gray-0 univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
|
|
1282
1280
|
children: [
|
|
1283
1281
|
((_permissionService$ge = permissionService.getPermissionPoint(workbookEditableId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1284
1282
|
className: "-univer-mx-4 -univer-mt-2 univer-mb-3 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-py-1",
|
|
1285
1283
|
children: [
|
|
1286
1284
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1287
1285
|
type: "button",
|
|
1288
|
-
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-
|
|
1286
|
+
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600",
|
|
1289
1287
|
onClick: () => insertColumn("left"),
|
|
1290
1288
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LeftInsertColumnDoubleIcon, {
|
|
1291
1289
|
className: "univer-size-5",
|
|
@@ -1294,7 +1292,7 @@ function SheetTableFilterPanel() {
|
|
|
1294
1292
|
}),
|
|
1295
1293
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1296
1294
|
type: "button",
|
|
1297
|
-
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-
|
|
1295
|
+
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600",
|
|
1298
1296
|
onClick: () => insertColumn("right"),
|
|
1299
1297
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.RightInsertColumnDoubleIcon, {
|
|
1300
1298
|
className: "univer-size-5",
|
|
@@ -1303,7 +1301,7 @@ function SheetTableFilterPanel() {
|
|
|
1303
1301
|
}),
|
|
1304
1302
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1305
1303
|
type: "button",
|
|
1306
|
-
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-
|
|
1304
|
+
className: "univer-box-border univer-flex univer-h-10 univer-w-full univer-cursor-pointer univer-items-center univer-gap-3 univer-border-none univer-bg-transparent univer-px-4 univer-text-left univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 disabled:univer-cursor-not-allowed disabled:univer-text-gray-400 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-600",
|
|
1307
1305
|
disabled: !canDeleteColumn,
|
|
1308
1306
|
onClick: deleteColumn,
|
|
1309
1307
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteColumnDoubleIcon, {
|
|
@@ -1364,24 +1362,71 @@ function SheetTableFilterPanel() {
|
|
|
1364
1362
|
disabled: tableFilter === void 0,
|
|
1365
1363
|
onClick: onClearFilter,
|
|
1366
1364
|
children: localeService.t("sheets-table-ui.filter.clear-filter")
|
|
1367
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1368
|
-
className: "univer-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1365
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1366
|
+
className: "univer-flex univer-gap-x-2",
|
|
1367
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1368
|
+
onClick: onCancel,
|
|
1369
|
+
children: localeService.t("sheets-table-ui.filter.cancel")
|
|
1370
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1371
|
+
variant: "primary",
|
|
1372
|
+
onClick: onApply,
|
|
1373
|
+
children: localeService.t("sheets-table-ui.filter.confirm")
|
|
1374
|
+
})]
|
|
1375
|
+
})]
|
|
1376
1376
|
})
|
|
1377
1377
|
]
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
1381
|
+
//#endregion
|
|
1382
|
+
//#region src/views/components/SheetTableMenu.tsx
|
|
1383
|
+
function SheetTableMenu({ popup }) {
|
|
1384
|
+
const menu = popup.extraProps;
|
|
1385
|
+
if (!menu) return null;
|
|
1386
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.DropdownMenu, {
|
|
1387
|
+
align: "start",
|
|
1388
|
+
className: "univer-min-w-40",
|
|
1389
|
+
items: [
|
|
1390
|
+
{
|
|
1391
|
+
type: "item",
|
|
1392
|
+
children: menu.labels.rename,
|
|
1393
|
+
onSelect: () => menu.onSelect("rename")
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
type: "item",
|
|
1397
|
+
children: menu.labels["update-range"],
|
|
1398
|
+
onSelect: () => menu.onSelect("update-range")
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
type: "item",
|
|
1402
|
+
children: menu.labels["set-theme"],
|
|
1403
|
+
onSelect: () => menu.onSelect("set-theme")
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
type: "item",
|
|
1407
|
+
children: menu.labels.delete,
|
|
1408
|
+
variant: "destructive",
|
|
1409
|
+
onSelect: () => menu.onSelect("delete")
|
|
1410
|
+
}
|
|
1411
|
+
],
|
|
1412
|
+
open: true,
|
|
1413
|
+
sideOffset: 0,
|
|
1414
|
+
onOpenChange: (open) => {
|
|
1415
|
+
if (!open) menu.onClose();
|
|
1416
|
+
},
|
|
1417
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1418
|
+
type: "button",
|
|
1419
|
+
"aria-label": menu.tableName,
|
|
1420
|
+
className: "univer-block univer-h-px univer-opacity-0",
|
|
1421
|
+
style: { width: menu.anchorWidth },
|
|
1422
|
+
tabIndex: -1
|
|
1423
|
+
})
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1381
1427
|
//#endregion
|
|
1382
1428
|
//#region src/views/components/SheetTableRenameDialog.tsx
|
|
1383
1429
|
function SheetTableRenameDialog(props) {
|
|
1384
|
-
var _table$getDisplayName;
|
|
1385
1430
|
const { unitId, tableId, onClose } = props;
|
|
1386
1431
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
1387
1432
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
@@ -1389,7 +1434,7 @@ function SheetTableRenameDialog(props) {
|
|
|
1389
1434
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
1390
1435
|
const definedNamesService = (0, _univerjs_ui.useDependency)(_univerjs_engine_formula.IDefinedNamesService);
|
|
1391
1436
|
const table = tableManager.getTableById(unitId, tableId);
|
|
1392
|
-
const [value, setValue] = (0, react.useState)((
|
|
1437
|
+
const [value, setValue] = (0, react.useState)((table === null || table === void 0 ? void 0 : table.getDisplayName()) ?? "");
|
|
1393
1438
|
const [error, setError] = (0, react.useState)("");
|
|
1394
1439
|
const existingNames = (0, react.useMemo)(() => {
|
|
1395
1440
|
const names = (0, _univerjs_sheets_table.getExistingNamesSet)(unitId, {
|
|
@@ -1577,7 +1622,7 @@ SheetTableThemeUIController = __decorate([__decorateParam(0, (0, _univerjs_core.
|
|
|
1577
1622
|
//#endregion
|
|
1578
1623
|
//#region src/views/components/SheetTableThemePanel.tsx
|
|
1579
1624
|
const SheetTableThemePanel = (props) => {
|
|
1580
|
-
var _customStyle$getHeade, _customStyle$
|
|
1625
|
+
var _customStyle$getHeade, _customStyle$getFirst, _customStyle$getSecon, _customStyle$getLastR;
|
|
1581
1626
|
const { unitId, subUnitId, tableId } = props;
|
|
1582
1627
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
1583
1628
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
@@ -1602,11 +1647,11 @@ const SheetTableThemePanel = (props) => {
|
|
|
1602
1647
|
const customSelected = customRangeThemes.find((item) => item === selectedTheme);
|
|
1603
1648
|
const customStyleName = customSelected || customRangeThemes[0];
|
|
1604
1649
|
const customStyle = rangeThemeModel.getCustomRangeThemeStyle(unitId, customStyleName);
|
|
1605
|
-
const headerBg = (
|
|
1606
|
-
const firstRowBg = (
|
|
1607
|
-
const secondRowBg = (
|
|
1608
|
-
const lastRowBg = (
|
|
1609
|
-
const
|
|
1650
|
+
const headerBg = (customStyle === null || customStyle === void 0 || (_customStyle$getHeade = customStyle.getHeaderRowStyle()) === null || _customStyle$getHeade === void 0 || (_customStyle$getHeade = _customStyle$getHeade.bg) === null || _customStyle$getHeade === void 0 ? void 0 : _customStyle$getHeade.rgb) ?? "rgb(255, 255, 255)";
|
|
1651
|
+
const firstRowBg = (customStyle === null || customStyle === void 0 || (_customStyle$getFirst = customStyle.getFirstRowStyle()) === null || _customStyle$getFirst === void 0 || (_customStyle$getFirst = _customStyle$getFirst.bg) === null || _customStyle$getFirst === void 0 ? void 0 : _customStyle$getFirst.rgb) ?? "rgb(255, 255, 255)";
|
|
1652
|
+
const secondRowBg = (customStyle === null || customStyle === void 0 || (_customStyle$getSecon = customStyle.getSecondRowStyle()) === null || _customStyle$getSecon === void 0 || (_customStyle$getSecon = _customStyle$getSecon.bg) === null || _customStyle$getSecon === void 0 ? void 0 : _customStyle$getSecon.rgb) ?? "rgb(255, 255, 255)";
|
|
1653
|
+
const lastRowBg = (customStyle === null || customStyle === void 0 || (_customStyle$getLastR = customStyle.getLastRowStyle()) === null || _customStyle$getLastR === void 0 || (_customStyle$getLastR = _customStyle$getLastR.bg) === null || _customStyle$getLastR === void 0 ? void 0 : _customStyle$getLastR.rgb) ?? "rgb(255, 255, 255)";
|
|
1654
|
+
const direction = (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection());
|
|
1610
1655
|
const handleThemeChange = (theme) => {
|
|
1611
1656
|
commandService.executeCommand(_univerjs_sheets_table.SetSheetTableCommand.id, {
|
|
1612
1657
|
unitId,
|
|
@@ -1652,237 +1697,192 @@ const SheetTableThemePanel = (props) => {
|
|
|
1652
1697
|
const firstRowBgIsDark = new _univerjs_core.ColorKit(firstRowBg).isDark();
|
|
1653
1698
|
const secondRowBgIsDark = new _univerjs_core.ColorKit(secondRowBg).isDark();
|
|
1654
1699
|
const lastRowBgIsDark = new _univerjs_core.ColorKit(lastRowBg).isDark();
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1700
|
+
const customThemeRows = [
|
|
1701
|
+
{
|
|
1702
|
+
key: "header",
|
|
1703
|
+
label: localeService.t("sheets-table-ui.header"),
|
|
1704
|
+
background: headerBg,
|
|
1705
|
+
isDark: headerBgIsDark,
|
|
1706
|
+
onChange: (value) => {
|
|
1707
|
+
const headerRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("headerRowStyle", {
|
|
1708
|
+
bg: { rgb: value },
|
|
1709
|
+
cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
|
|
1710
|
+
});
|
|
1711
|
+
setCustomTheme(table.getTableStyleId(), { headerRowStyle });
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
{
|
|
1715
|
+
key: "first-row",
|
|
1716
|
+
label: localeService.t("sheets-table-ui.firstLine"),
|
|
1717
|
+
background: firstRowBg,
|
|
1718
|
+
isDark: firstRowBgIsDark,
|
|
1719
|
+
onChange: (value) => {
|
|
1720
|
+
setCustomTheme(table.getTableStyleId(), { firstRowStyle: {
|
|
1721
|
+
bg: { rgb: value },
|
|
1722
|
+
cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
|
|
1723
|
+
} });
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
key: "second-row",
|
|
1728
|
+
label: localeService.t("sheets-table-ui.secondLine"),
|
|
1729
|
+
background: secondRowBg,
|
|
1730
|
+
isDark: secondRowBgIsDark,
|
|
1731
|
+
onChange: (value) => {
|
|
1732
|
+
setCustomTheme(table.getTableStyleId(), { secondRowStyle: {
|
|
1733
|
+
bg: { rgb: value },
|
|
1734
|
+
cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
|
|
1735
|
+
} });
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
key: "last-row",
|
|
1740
|
+
label: localeService.t("sheets-table-ui.footer"),
|
|
1741
|
+
background: lastRowBg,
|
|
1742
|
+
isDark: lastRowBgIsDark,
|
|
1743
|
+
onChange: (value) => {
|
|
1744
|
+
const lastRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("lastRowStyle", {
|
|
1745
|
+
bg: { rgb: value },
|
|
1746
|
+
cl: { rgb: new _univerjs_core.ColorKit(value).isDark() ? "#fff" : "#000" }
|
|
1747
|
+
});
|
|
1748
|
+
setCustomTheme(table.getTableStyleId(), { lastRowStyle });
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
];
|
|
1752
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1753
|
+
dir: direction,
|
|
1754
|
+
className: "univer-flex univer-flex-col univer-gap-5 univer-pb-4",
|
|
1755
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1756
|
+
className: "univer-flex univer-flex-col univer-gap-2",
|
|
1757
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", {
|
|
1758
|
+
className: "univer-m-0 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300",
|
|
1759
|
+
children: localeService.t("sheets-table-ui.defaultStyle")
|
|
1760
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1761
|
+
className: "univer-grid univer-grid-cols-6 univer-gap-2",
|
|
1762
|
+
children: defaultRangeThemes.map((item) => {
|
|
1763
|
+
var _rangeThemeItem$getHe, _rangeThemeItem$getFi, _rangeThemeItem$getSe, _rangeThemeItem$getLa;
|
|
1764
|
+
const rangeThemeItem = rangeThemeModel.getDefaultRangeThemeStyle(item);
|
|
1765
|
+
const rowBackgrounds = [
|
|
1766
|
+
(rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getHe = rangeThemeItem.getHeaderRowStyle()) === null || _rangeThemeItem$getHe === void 0 || (_rangeThemeItem$getHe = _rangeThemeItem$getHe.bg) === null || _rangeThemeItem$getHe === void 0 ? void 0 : _rangeThemeItem$getHe.rgb) || "rgb(255, 255, 255)",
|
|
1767
|
+
(rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getFi = rangeThemeItem.getFirstRowStyle()) === null || _rangeThemeItem$getFi === void 0 || (_rangeThemeItem$getFi = _rangeThemeItem$getFi.bg) === null || _rangeThemeItem$getFi === void 0 ? void 0 : _rangeThemeItem$getFi.rgb) || "rgb(255, 255, 255)",
|
|
1768
|
+
(rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getSe = rangeThemeItem.getSecondRowStyle()) === null || _rangeThemeItem$getSe === void 0 || (_rangeThemeItem$getSe = _rangeThemeItem$getSe.bg) === null || _rangeThemeItem$getSe === void 0 ? void 0 : _rangeThemeItem$getSe.rgb) || "rgb(255, 255, 255)",
|
|
1769
|
+
(rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getLa = rangeThemeItem.getLastRowStyle()) === null || _rangeThemeItem$getLa === void 0 || (_rangeThemeItem$getLa = _rangeThemeItem$getLa.bg) === null || _rangeThemeItem$getLa === void 0 ? void 0 : _rangeThemeItem$getLa.rgb) || "rgb(255, 255, 255)"
|
|
1770
|
+
];
|
|
1771
|
+
const selected = item === themeConfig.theme;
|
|
1772
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1773
|
+
type: "button",
|
|
1774
|
+
title: item,
|
|
1775
|
+
"aria-label": item,
|
|
1776
|
+
"aria-pressed": selected,
|
|
1777
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-12 univer-w-full univer-cursor-pointer univer-flex-col univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-1 univer-shadow-sm univer-transition-all hover:univer-border-gray-400 hover:univer-shadow-md focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-bg-gray-800", _univerjs_design.borderClassName, { "!univer-border-primary-500 univer-ring-2 univer-ring-primary-100": selected }),
|
|
1708
1778
|
onClick: () => handleThemeChange(item),
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
border: `${headerRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
|
|
1717
|
-
}
|
|
1718
|
-
}),
|
|
1719
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1720
|
-
className: "univer-box-border univer-h-2.5",
|
|
1721
|
-
style: {
|
|
1722
|
-
background: firstRowBg !== null && firstRowBg !== void 0 ? firstRowBg : TABLE_BORDER_NONE,
|
|
1723
|
-
border: `${firstRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
|
|
1724
|
-
}
|
|
1725
|
-
}),
|
|
1726
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1727
|
-
className: "univer-box-border univer-h-2.5",
|
|
1728
|
-
style: {
|
|
1729
|
-
background: secondRowBg !== null && secondRowBg !== void 0 ? secondRowBg : TABLE_BORDER_NONE,
|
|
1730
|
-
border: `${secondRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
|
|
1731
|
-
}
|
|
1732
|
-
}),
|
|
1733
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1734
|
-
className: "univer-box-border univer-h-2.5",
|
|
1735
|
-
style: {
|
|
1736
|
-
background: lastRowBg !== null && lastRowBg !== void 0 ? lastRowBg : TABLE_BORDER_NONE,
|
|
1737
|
-
border: `${lastRowBg ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT}`
|
|
1738
|
-
}
|
|
1739
|
-
}),
|
|
1740
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1741
|
-
className: "univer-absolute univer-right-[-3px] univer-top-[-3px] univer-size-3 univer-rounded-md univer-bg-gray-200 univer-text-center univer-text-xs univer-leading-[10px]",
|
|
1742
|
-
style: { display: hoverCustomId === item ? "block" : "none" },
|
|
1743
|
-
onClick: (e) => {
|
|
1744
|
-
e.stopPropagation();
|
|
1745
|
-
removeCustomTheme(item);
|
|
1746
|
-
},
|
|
1747
|
-
children: "x"
|
|
1748
|
-
})
|
|
1749
|
-
]
|
|
1779
|
+
children: rowBackgrounds.map((background, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1780
|
+
className: "univer-min-h-0 univer-w-full univer-flex-1",
|
|
1781
|
+
style: {
|
|
1782
|
+
background,
|
|
1783
|
+
border: background ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT
|
|
1784
|
+
}
|
|
1785
|
+
}, index))
|
|
1750
1786
|
}, item);
|
|
1751
|
-
})
|
|
1752
|
-
})
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", _univerjs_design.borderClassName, {
|
|
1794
|
-
"univer-text-white": firstRowBgIsDark,
|
|
1795
|
-
"univer-text-gray-900": !firstRowBgIsDark
|
|
1796
|
-
}),
|
|
1797
|
-
style: { background: firstRowBg },
|
|
1798
|
-
children: localeService.t("sheets-table-ui.firstLine")
|
|
1799
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
1800
|
-
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1801
|
-
className: "univer-p-2",
|
|
1802
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
|
|
1803
|
-
value: firstRowBg,
|
|
1804
|
-
onChange: (val) => {
|
|
1805
|
-
setCustomTheme(table.getTableStyleId(), { firstRowStyle: {
|
|
1806
|
-
bg: { rgb: val },
|
|
1807
|
-
cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
|
|
1808
|
-
} });
|
|
1787
|
+
})
|
|
1788
|
+
})]
|
|
1789
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1790
|
+
className: "univer-flex univer-flex-col univer-gap-2",
|
|
1791
|
+
children: [
|
|
1792
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h5", {
|
|
1793
|
+
className: "univer-m-0 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300",
|
|
1794
|
+
children: localeService.t("sheets-table-ui.customStyle")
|
|
1795
|
+
}),
|
|
1796
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1797
|
+
className: "univer-grid univer-grid-cols-5 univer-gap-2 univer-rounded-lg univer-bg-gray-50 univer-p-2 dark:!univer-bg-gray-800",
|
|
1798
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1799
|
+
type: "button",
|
|
1800
|
+
"data-u-comp": "sheet-table-theme-add",
|
|
1801
|
+
"aria-label": localeService.t("sheets-table-ui.setTheme"),
|
|
1802
|
+
className: "univer-flex univer-h-12 univer-w-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-lg univer-border univer-border-dashed univer-border-gray-300 univer-bg-gray-0 univer-p-0 univer-text-gray-500 univer-transition-colors hover:univer-border-primary-500 hover:univer-text-primary-600 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-border-gray-600 dark:!univer-bg-gray-900 dark:!univer-text-gray-300",
|
|
1803
|
+
onClick: handleAddCustomTheme,
|
|
1804
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.IncreaseIcon, { className: "univer-size-4" })
|
|
1805
|
+
}), customRangeThemes.map((item) => {
|
|
1806
|
+
var _rangeThemeItem$getHe2, _rangeThemeItem$getFi2, _rangeThemeItem$getSe2, _rangeThemeItem$getLa2;
|
|
1807
|
+
const rangeThemeItem = rangeThemeModel.getCustomRangeThemeStyle(unitId, item);
|
|
1808
|
+
const rowBackgrounds = [
|
|
1809
|
+
rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getHe2 = rangeThemeItem.getHeaderRowStyle()) === null || _rangeThemeItem$getHe2 === void 0 || (_rangeThemeItem$getHe2 = _rangeThemeItem$getHe2.bg) === null || _rangeThemeItem$getHe2 === void 0 ? void 0 : _rangeThemeItem$getHe2.rgb,
|
|
1810
|
+
rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getFi2 = rangeThemeItem.getFirstRowStyle()) === null || _rangeThemeItem$getFi2 === void 0 || (_rangeThemeItem$getFi2 = _rangeThemeItem$getFi2.bg) === null || _rangeThemeItem$getFi2 === void 0 ? void 0 : _rangeThemeItem$getFi2.rgb,
|
|
1811
|
+
rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getSe2 = rangeThemeItem.getSecondRowStyle()) === null || _rangeThemeItem$getSe2 === void 0 || (_rangeThemeItem$getSe2 = _rangeThemeItem$getSe2.bg) === null || _rangeThemeItem$getSe2 === void 0 ? void 0 : _rangeThemeItem$getSe2.rgb,
|
|
1812
|
+
rangeThemeItem === null || rangeThemeItem === void 0 || (_rangeThemeItem$getLa2 = rangeThemeItem.getLastRowStyle()) === null || _rangeThemeItem$getLa2 === void 0 || (_rangeThemeItem$getLa2 = _rangeThemeItem$getLa2.bg) === null || _rangeThemeItem$getLa2 === void 0 ? void 0 : _rangeThemeItem$getLa2.rgb
|
|
1813
|
+
];
|
|
1814
|
+
const selected = item === themeConfig.theme;
|
|
1815
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1816
|
+
className: "univer-group univer-relative univer-h-12 univer-min-w-0",
|
|
1817
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1818
|
+
type: "button",
|
|
1819
|
+
title: item,
|
|
1820
|
+
"aria-label": item,
|
|
1821
|
+
"aria-pressed": selected,
|
|
1822
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-size-full univer-cursor-pointer univer-flex-col univer-overflow-hidden univer-rounded-lg univer-bg-gray-0 univer-p-1 univer-shadow-sm univer-transition-all hover:univer-border-gray-400 hover:univer-shadow-md focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-bg-gray-900", _univerjs_design.borderClassName, { "!univer-border-primary-500 univer-ring-2 univer-ring-primary-100": selected }),
|
|
1823
|
+
onClick: () => handleThemeChange(item),
|
|
1824
|
+
children: rowBackgrounds.map((background, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1825
|
+
className: "univer-min-h-0 univer-w-full univer-flex-1",
|
|
1826
|
+
style: {
|
|
1827
|
+
background: background ?? "none",
|
|
1828
|
+
border: background ? TABLE_BORDER_NONE : TABLE_BORDER_DEFAULT
|
|
1809
1829
|
}
|
|
1810
|
-
})
|
|
1811
|
-
}),
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1830
|
+
}, index))
|
|
1831
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1832
|
+
type: "button",
|
|
1833
|
+
"data-u-comp": "sheet-table-theme-remove",
|
|
1834
|
+
"aria-label": `${localeService.t("sheets-table-ui.customStyle")} ${item}`,
|
|
1835
|
+
className: (0, _univerjs_design.clsx)("univer-absolute univer-right-[-6px] univer-top-[-6px] univer-z-10 univer-flex univer-size-5 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 univer-p-0 univer-text-gray-500 univer-shadow-sm univer-transition-all hover:univer-border-red-200 hover:univer-bg-red-50 hover:univer-text-red-600 focus:univer-opacity-100 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 rtl:univer-left-[-6px] rtl:univer-right-auto dark:!univer-border-gray-600 dark:!univer-bg-gray-900", {
|
|
1836
|
+
"univer-opacity-100": selected,
|
|
1837
|
+
"univer-opacity-0 group-focus-within:univer-opacity-100 group-hover:univer-opacity-100": !selected
|
|
1838
|
+
}),
|
|
1839
|
+
onClick: (event) => {
|
|
1840
|
+
event.stopPropagation();
|
|
1841
|
+
removeCustomTheme(item);
|
|
1842
|
+
},
|
|
1843
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, { className: "univer-size-3" })
|
|
1844
|
+
})]
|
|
1845
|
+
}, item);
|
|
1846
|
+
})]
|
|
1847
|
+
}),
|
|
1848
|
+
customSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1849
|
+
className: "univer-flex univer-flex-col univer-gap-2 univer-rounded-lg univer-bg-gray-50 univer-p-3 dark:!univer-bg-gray-800",
|
|
1850
|
+
children: customThemeRows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1851
|
+
className: "univer-flex univer-h-10 univer-min-w-0 univer-gap-2",
|
|
1823
1852
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1824
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
1825
|
-
"univer-text-
|
|
1826
|
-
"univer-text-gray-900": !
|
|
1853
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-min-w-0 univer-flex-1 univer-items-center univer-rounded-md univer-px-3 univer-text-sm univer-font-medium rtl:univer-text-right", _univerjs_design.borderClassName, {
|
|
1854
|
+
"univer-text-gray-0": row.isDark,
|
|
1855
|
+
"univer-text-gray-900": !row.isDark
|
|
1827
1856
|
}),
|
|
1828
|
-
style: { background:
|
|
1829
|
-
children:
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
className: "univer-p-2",
|
|
1833
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
|
|
1834
|
-
value: secondRowBg,
|
|
1835
|
-
onChange: (val) => setCustomTheme(table.getTableStyleId(), { secondRowStyle: {
|
|
1836
|
-
bg: { rgb: val },
|
|
1837
|
-
cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
|
|
1838
|
-
} })
|
|
1839
|
-
})
|
|
1840
|
-
}),
|
|
1841
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1842
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-sm univer-bg-white univer-p-1", _univerjs_design.borderClassName),
|
|
1843
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1844
|
-
className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-lg univer-bg-gray-400", _univerjs_design.borderClassName),
|
|
1845
|
-
style: { background: secondRowBg }
|
|
1846
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-2" })]
|
|
1857
|
+
style: { background: row.background },
|
|
1858
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1859
|
+
className: "univer-truncate",
|
|
1860
|
+
children: row.label
|
|
1847
1861
|
})
|
|
1848
|
-
})]
|
|
1849
|
-
}),
|
|
1850
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1851
|
-
className: "univer-flex univer-h-9 univer-gap-2",
|
|
1852
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1853
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-full univer-w-52 univer-rounded-sm univer-text-center univer-leading-9", _univerjs_design.borderClassName, {
|
|
1854
|
-
"univer-text-white": lastRowBgIsDark,
|
|
1855
|
-
"univer-text-gray-900": !lastRowBgIsDark
|
|
1856
|
-
}),
|
|
1857
|
-
style: { background: lastRowBg },
|
|
1858
|
-
children: localeService.t("sheets-table-ui.footer")
|
|
1859
1862
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
1860
1863
|
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1864
|
+
dir: direction,
|
|
1861
1865
|
className: "univer-p-2",
|
|
1862
1866
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ColorPicker, {
|
|
1863
|
-
value:
|
|
1864
|
-
onChange:
|
|
1865
|
-
const lastRowStyle = (0, _univerjs_sheets_table.processStyleWithBorderStyle)("lastRowStyle", {
|
|
1866
|
-
bg: { rgb: val },
|
|
1867
|
-
cl: { rgb: new _univerjs_core.ColorKit(val).isDark() ? "#fff" : "#000" }
|
|
1868
|
-
});
|
|
1869
|
-
setCustomTheme(table.getTableStyleId(), { lastRowStyle });
|
|
1870
|
-
}
|
|
1867
|
+
value: new _univerjs_core.ColorKit(row.background).toHexString(),
|
|
1868
|
+
onChange: row.onChange
|
|
1871
1869
|
})
|
|
1872
1870
|
}),
|
|
1873
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1871
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1872
|
+
type: "button",
|
|
1873
|
+
"aria-label": `${row.label} ${localeService.t("sheets-table-ui.setTheme")}`,
|
|
1874
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-10 univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-md univer-bg-gray-0 univer-px-2 univer-text-gray-600 univer-transition-colors hover:univer-bg-gray-100 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-200 dark:!univer-bg-gray-900 dark:!univer-text-gray-300", _univerjs_design.borderClassName),
|
|
1875
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1876
|
+
className: (0, _univerjs_design.clsx)("univer-size-4 univer-rounded-full", _univerjs_design.borderClassName),
|
|
1877
|
+
style: { background: row.background }
|
|
1878
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: "univer-size-3" })]
|
|
1879
1879
|
})
|
|
1880
1880
|
})]
|
|
1881
|
-
})
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
})
|
|
1885
|
-
|
|
1881
|
+
}, row.key))
|
|
1882
|
+
})
|
|
1883
|
+
]
|
|
1884
|
+
})]
|
|
1885
|
+
});
|
|
1886
1886
|
};
|
|
1887
1887
|
|
|
1888
1888
|
//#endregion
|
|
@@ -1911,7 +1911,11 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
1911
1911
|
this._registerIcons();
|
|
1912
1912
|
}
|
|
1913
1913
|
_registerComponents() {
|
|
1914
|
-
[
|
|
1914
|
+
[
|
|
1915
|
+
[SHEETS_TABLE_FILTER_PANEL_OPENED_KEY, SheetTableFilterPanel],
|
|
1916
|
+
[SHEET_TABLE_MENU, SheetTableMenu],
|
|
1917
|
+
[SHEET_TABLE_RENAME_DIALOG, SheetTableRenameDialog]
|
|
1918
|
+
].forEach(([key, comp]) => {
|
|
1915
1919
|
this.disposeWithMe(this._componentManager.register(key, comp));
|
|
1916
1920
|
});
|
|
1917
1921
|
[[TABLE_SELECTOR_DIALOG, SheetTableSelector], [SHEET_TABLE_THEME_PANEL, SheetTableThemePanel]].forEach(([key, comp]) => {
|
|
@@ -1926,14 +1930,6 @@ ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)
|
|
|
1926
1930
|
|
|
1927
1931
|
//#endregion
|
|
1928
1932
|
//#region src/views/widgets/table-controls-util.ts
|
|
1929
|
-
const TABLE_CONTROL_MENU_WIDTH = 168;
|
|
1930
|
-
const TABLE_CONTROL_MENU_ITEM_HEIGHT = 32;
|
|
1931
|
-
const TABLE_CONTROL_MENU_ACTIONS = [
|
|
1932
|
-
"rename",
|
|
1933
|
-
"update-range",
|
|
1934
|
-
"set-theme",
|
|
1935
|
-
"delete"
|
|
1936
|
-
];
|
|
1937
1933
|
function isPointInTableControlRegion(region, x, y) {
|
|
1938
1934
|
return x >= region.left && x <= region.left + region.width && y >= region.top && y <= region.top + region.height;
|
|
1939
1935
|
}
|
|
@@ -1941,17 +1937,6 @@ function hitTestTableControl(regions, x, y) {
|
|
|
1941
1937
|
for (let i = regions.length - 1; i >= 0; i--) if (isPointInTableControlRegion(regions[i], x, y)) return regions[i];
|
|
1942
1938
|
return null;
|
|
1943
1939
|
}
|
|
1944
|
-
function buildTableMenuRegions(tableId, left, top) {
|
|
1945
|
-
return TABLE_CONTROL_MENU_ACTIONS.map((action, index) => ({
|
|
1946
|
-
type: "menu-item",
|
|
1947
|
-
tableId,
|
|
1948
|
-
action,
|
|
1949
|
-
left,
|
|
1950
|
-
top: top + index * 32,
|
|
1951
|
-
width: 168,
|
|
1952
|
-
height: 32
|
|
1953
|
-
}));
|
|
1954
|
-
}
|
|
1955
1940
|
function buildCenteredPlusSegments(centerX, centerY, size) {
|
|
1956
1941
|
const halfSize = size / 2;
|
|
1957
1942
|
return [{
|
|
@@ -1977,9 +1962,6 @@ const ANCHOR_OFFSET_Y = 0;
|
|
|
1977
1962
|
const ANCHOR_BORDER = "rgba(0, 0, 0, 0.22)";
|
|
1978
1963
|
const ANCHOR_DIVIDER = "rgba(0, 0, 0, 0.20)";
|
|
1979
1964
|
const ANCHOR_TOGGLE_BG_ACTIVE = "rgba(0, 0, 0, 0.12)";
|
|
1980
|
-
const MENU_RADIUS = 8;
|
|
1981
|
-
const MENU_BORDER = "#d9dee7";
|
|
1982
|
-
const MENU_HOVER_BG = "#f1f3f4";
|
|
1983
1965
|
const INSERT_BUTTON_VISUAL_SIZE = 18;
|
|
1984
1966
|
const INSERT_BUTTON_PLUS_SIZE = 8;
|
|
1985
1967
|
var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
@@ -1995,21 +1977,11 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
|
1995
1977
|
_defineProperty(this, "_openedMenuTableId", null);
|
|
1996
1978
|
_defineProperty(this, "_hoveredRegion", null);
|
|
1997
1979
|
_defineProperty(this, "_hoveredInsertRegion", null);
|
|
1998
|
-
_defineProperty(this, "_menuLabels", {
|
|
1999
|
-
rename: "Rename table",
|
|
2000
|
-
"update-range": "Update range",
|
|
2001
|
-
"set-theme": "Set theme",
|
|
2002
|
-
delete: "Remove table"
|
|
2003
|
-
});
|
|
2004
1980
|
}
|
|
2005
1981
|
setItems(items) {
|
|
2006
1982
|
this._items = items;
|
|
2007
1983
|
this.makeDirty(true);
|
|
2008
1984
|
}
|
|
2009
|
-
setMenuLabels(labels) {
|
|
2010
|
-
this._menuLabels = labels;
|
|
2011
|
-
this.makeDirty(true);
|
|
2012
|
-
}
|
|
2013
1985
|
setOpenedMenuTableId(tableId) {
|
|
2014
1986
|
if (this._openedMenuTableId === tableId) return;
|
|
2015
1987
|
this._openedMenuTableId = tableId;
|
|
@@ -2018,6 +1990,9 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
|
2018
1990
|
getOpenedMenuTableId() {
|
|
2019
1991
|
return this._openedMenuTableId;
|
|
2020
1992
|
}
|
|
1993
|
+
getAnchorRegion(tableId) {
|
|
1994
|
+
return this._regions.find((region) => region.type === "anchor-main" && region.tableId === tableId) ?? null;
|
|
1995
|
+
}
|
|
2021
1996
|
setHoveredRegion(region) {
|
|
2022
1997
|
if (this._hoveredRegion === region) return;
|
|
2023
1998
|
this._hoveredRegion = region;
|
|
@@ -2056,12 +2031,11 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
|
2056
2031
|
ctx.textBaseline = "middle";
|
|
2057
2032
|
for (const item of this._items) this._drawAnchor(ctx, skeleton, item);
|
|
2058
2033
|
if (this._hoveredInsertRegion) {
|
|
2059
|
-
var _item$fill;
|
|
2060
2034
|
const item = this._items.find((renderItem) => {
|
|
2061
2035
|
var _this$_hoveredInsertR;
|
|
2062
2036
|
return renderItem.tableId === ((_this$_hoveredInsertR = this._hoveredInsertRegion) === null || _this$_hoveredInsertR === void 0 ? void 0 : _this$_hoveredInsertR.tableId);
|
|
2063
2037
|
});
|
|
2064
|
-
this._drawInsertButton(ctx, this._hoveredInsertRegion, (
|
|
2038
|
+
this._drawInsertButton(ctx, this._hoveredInsertRegion, (item === null || item === void 0 ? void 0 : item.fill) ?? "#355bb7");
|
|
2065
2039
|
this._regions.push(this._hoveredInsertRegion);
|
|
2066
2040
|
}
|
|
2067
2041
|
ctx.restore();
|
|
@@ -2098,7 +2072,6 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
|
2098
2072
|
height: 28
|
|
2099
2073
|
});
|
|
2100
2074
|
this._regions.push(toggleRegion);
|
|
2101
|
-
if (this._openedMenuTableId === item.tableId) this._drawMenu(ctx, item.tableId, left, top + 28);
|
|
2102
2075
|
}
|
|
2103
2076
|
_drawAnchorToggle(ctx, anchorWidth, color, active) {
|
|
2104
2077
|
const toggleLeft = anchorWidth - ANCHOR_TOGGLE_WIDTH;
|
|
@@ -2159,34 +2132,6 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
|
2159
2132
|
ctx.fill();
|
|
2160
2133
|
ctx.restore();
|
|
2161
2134
|
}
|
|
2162
|
-
_drawMenu(ctx, tableId, left, top) {
|
|
2163
|
-
const regions = buildTableMenuRegions(tableId, left, top);
|
|
2164
|
-
ctx.save();
|
|
2165
|
-
ctx.translateWithPrecision(left, top);
|
|
2166
|
-
_univerjs_engine_render.Rect.drawWith(ctx, {
|
|
2167
|
-
width: 168,
|
|
2168
|
-
height: regions.length * 32,
|
|
2169
|
-
radius: MENU_RADIUS,
|
|
2170
|
-
fill: "#fff",
|
|
2171
|
-
stroke: MENU_BORDER
|
|
2172
|
-
});
|
|
2173
|
-
ctx.restore();
|
|
2174
|
-
for (const region of regions) {
|
|
2175
|
-
if (this._isSameRegion(this._hoveredRegion, region)) {
|
|
2176
|
-
ctx.save();
|
|
2177
|
-
ctx.fillStyle = MENU_HOVER_BG;
|
|
2178
|
-
ctx.fillRectByPrecision(region.left, region.top, region.width, region.height);
|
|
2179
|
-
ctx.restore();
|
|
2180
|
-
}
|
|
2181
|
-
ctx.save();
|
|
2182
|
-
ctx.font = `12px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
|
|
2183
|
-
ctx.fillStyle = region.action === "delete" ? "#d92d20" : "#344054";
|
|
2184
|
-
ctx.textAlign = "left";
|
|
2185
|
-
ctx.fillText(this._menuLabels[region.action], region.left + 12, region.top + region.height / 2);
|
|
2186
|
-
ctx.restore();
|
|
2187
|
-
}
|
|
2188
|
-
this._regions.push(...regions);
|
|
2189
|
-
}
|
|
2190
2135
|
_drawInsertButton(ctx, region, fill) {
|
|
2191
2136
|
const centerX = region.left + region.width / 2;
|
|
2192
2137
|
const centerY = region.top + region.height / 2;
|
|
@@ -2210,7 +2155,7 @@ var SheetTableControlsShape = class extends _univerjs_engine_render.Shape {
|
|
|
2210
2155
|
ctx.restore();
|
|
2211
2156
|
}
|
|
2212
2157
|
_isSameRegion(a, b) {
|
|
2213
|
-
return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.
|
|
2158
|
+
return Boolean(a && a.type === b.type && a.tableId === b.tableId && a.index === b.index);
|
|
2214
2159
|
}
|
|
2215
2160
|
};
|
|
2216
2161
|
|
|
@@ -2231,7 +2176,7 @@ function isSameTopGap(left, right) {
|
|
|
2231
2176
|
return left.size === right.size && left.color === right.color && left.stripeColor === right.stripeColor;
|
|
2232
2177
|
}
|
|
2233
2178
|
let SheetTableControlsRenderController = class SheetTableControlsRenderController extends _univerjs_core.Disposable {
|
|
2234
|
-
constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService) {
|
|
2179
|
+
constructor(_context, _injector, _sheetSkeletonManagerService, _commandService, _tableManager, _rangeThemeModel, _workbookPermissionService, _permissionService, _sheetsSelectionsService, _selectionRenderService, _sheetTableThemeUIController, _localeService, _dialogService, _sidebarService, _sheetCanvasPopupService) {
|
|
2235
2180
|
super();
|
|
2236
2181
|
this._context = _context;
|
|
2237
2182
|
this._injector = _injector;
|
|
@@ -2247,17 +2192,20 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2247
2192
|
this._localeService = _localeService;
|
|
2248
2193
|
this._dialogService = _dialogService;
|
|
2249
2194
|
this._sidebarService = _sidebarService;
|
|
2195
|
+
this._sheetCanvasPopupService = _sheetCanvasPopupService;
|
|
2250
2196
|
_defineProperty(this, "_shape", void 0);
|
|
2251
2197
|
_defineProperty(this, "_topGapBaseBySkeleton", /* @__PURE__ */ new WeakMap());
|
|
2198
|
+
_defineProperty(this, "_menuPopup", null);
|
|
2252
2199
|
this._shape = new SheetTableControlsShape("SheetTableControlsShape", () => this._sheetSkeletonManagerService.getCurrentSkeleton() || null);
|
|
2253
2200
|
this._initShape();
|
|
2254
2201
|
this._initRefresh();
|
|
2255
2202
|
this._refresh();
|
|
2256
2203
|
}
|
|
2257
2204
|
_initShape() {
|
|
2258
|
-
var _this$_context$compon
|
|
2205
|
+
var _this$_context$compon;
|
|
2259
2206
|
this._context.scene.addObjects([this._shape], TABLE_CONTROLS_LAYER_INDEX);
|
|
2260
2207
|
this.disposeWithMe((0, _univerjs_core.toDisposable)(() => {
|
|
2208
|
+
this._closeFloatingControls();
|
|
2261
2209
|
this._context.scene.removeObjects([this._shape]);
|
|
2262
2210
|
}));
|
|
2263
2211
|
this.disposeWithMe(this._shape.onPointerMove$.subscribeEvent((evt, state) => {
|
|
@@ -2269,11 +2217,11 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2269
2217
|
this.disposeWithMe(this._shape.onPointerDown$.subscribeEvent((evt, state) => {
|
|
2270
2218
|
this._handlePointerDown(evt, state);
|
|
2271
2219
|
}));
|
|
2272
|
-
this.disposeWithMe((_this$_context$compon =
|
|
2220
|
+
this.disposeWithMe(((_this$_context$compon = this._context.components.get(_univerjs_sheets_ui.SHEET_VIEW_KEY.MAIN)) === null || _this$_context$compon === void 0 ? void 0 : _this$_context$compon.onPointerMove$.subscribeEvent((evt) => {
|
|
2273
2221
|
const point = this._getLocalPoint(evt);
|
|
2274
2222
|
const insertRegion = this._getInsertRegionFromPoint(point.x, point.y);
|
|
2275
2223
|
this._shape.setHoveredInsertRegion(insertRegion);
|
|
2276
|
-
}))
|
|
2224
|
+
})) ?? (0, _univerjs_core.toDisposable)(() => {}));
|
|
2277
2225
|
}
|
|
2278
2226
|
_initRefresh() {
|
|
2279
2227
|
const commandExecuted$ = (0, _univerjs_core.fromCallback)(this._commandService.onCommandExecuted.bind(this._commandService)).pipe((0, rxjs.filter)(([command]) => {
|
|
@@ -2304,23 +2252,17 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2304
2252
|
return;
|
|
2305
2253
|
}
|
|
2306
2254
|
this._syncTopTableGap(skeleton);
|
|
2307
|
-
this._shape.setMenuLabels({
|
|
2308
|
-
rename: this._localeService.t("sheets-table-ui.rename"),
|
|
2309
|
-
"update-range": this._localeService.t("sheets-table-ui.updateRange"),
|
|
2310
|
-
"set-theme": this._localeService.t("sheets-table-ui.setTheme"),
|
|
2311
|
-
delete: this._localeService.t("sheets-table-ui.removeTable")
|
|
2312
|
-
});
|
|
2313
2255
|
const unitId = this._context.unit.getUnitId();
|
|
2314
2256
|
const subUnitId = worksheet.getSheetId();
|
|
2315
2257
|
const items = this._tableManager.getTablesBySubunitId(unitId, subUnitId).map((table) => {
|
|
2316
|
-
var _rangeTheme$getHeader, _rangeTheme$getHeader2
|
|
2258
|
+
var _rangeTheme$getHeader, _rangeTheme$getHeader2;
|
|
2317
2259
|
const rangeTheme = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId());
|
|
2318
2260
|
return {
|
|
2319
2261
|
tableId: table.getId(),
|
|
2320
2262
|
tableName: table.getDisplayName(),
|
|
2321
2263
|
range: table.getRange(),
|
|
2322
|
-
fill: (
|
|
2323
|
-
text: (
|
|
2264
|
+
fill: (rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader === void 0 || (_rangeTheme$getHeader = _rangeTheme$getHeader.bg) === null || _rangeTheme$getHeader === void 0 ? void 0 : _rangeTheme$getHeader.rgb) ?? "rgb(53,91,183)",
|
|
2265
|
+
text: (rangeTheme === null || rangeTheme === void 0 || (_rangeTheme$getHeader2 = rangeTheme.getHeaderRowStyle()) === null || _rangeTheme$getHeader2 === void 0 || (_rangeTheme$getHeader2 = _rangeTheme$getHeader2.cl) === null || _rangeTheme$getHeader2 === void 0 ? void 0 : _rangeTheme$getHeader2.rgb) ?? "rgb(255,255,255)"
|
|
2324
2266
|
};
|
|
2325
2267
|
});
|
|
2326
2268
|
this._shape.setItems(items);
|
|
@@ -2337,7 +2279,7 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2337
2279
|
const point = this._getLocalPoint(evt);
|
|
2338
2280
|
const hit = this._shape.hitTest(point.x, point.y);
|
|
2339
2281
|
const insertRegion = this._isInsertHit(hit) ? hit : hit ? null : this._getInsertRegionFromPoint(point.x, point.y);
|
|
2340
|
-
const activeHit = hit
|
|
2282
|
+
const activeHit = hit ?? insertRegion;
|
|
2341
2283
|
this._shape.setHoveredRegion(this._isInsertHit(hit) ? null : hit);
|
|
2342
2284
|
this._shape.setHoveredInsertRegion(insertRegion);
|
|
2343
2285
|
if (activeHit) {
|
|
@@ -2355,10 +2297,9 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2355
2297
|
this._context.scene.resetCursor();
|
|
2356
2298
|
}
|
|
2357
2299
|
_handlePointerDown(evt, state) {
|
|
2358
|
-
var _this$_shape$hitTest;
|
|
2359
2300
|
if (evt.button === 2) return;
|
|
2360
2301
|
const point = this._getLocalPoint(evt);
|
|
2361
|
-
const hit =
|
|
2302
|
+
const hit = this._shape.hitTest(point.x, point.y) ?? this._getInsertRegionFromPoint(point.x, point.y);
|
|
2362
2303
|
if (!hit) {
|
|
2363
2304
|
this._closeFloatingControls();
|
|
2364
2305
|
return;
|
|
@@ -2374,7 +2315,7 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2374
2315
|
const unitId = this._context.unit.getUnitId();
|
|
2375
2316
|
const subUnitId = worksheet.getSheetId();
|
|
2376
2317
|
if (hit.type === "anchor-menu-toggle" || hit.type === "anchor-main") {
|
|
2377
|
-
this.
|
|
2318
|
+
this._toggleTableMenu(unitId, subUnitId, hit.tableId);
|
|
2378
2319
|
return;
|
|
2379
2320
|
}
|
|
2380
2321
|
if (hit.type === "insert-row") {
|
|
@@ -2397,28 +2338,65 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2397
2338
|
count: 1
|
|
2398
2339
|
});
|
|
2399
2340
|
this._closeFloatingControls();
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
_toggleTableMenu(unitId, subUnitId, tableId) {
|
|
2344
|
+
if (this._shape.getOpenedMenuTableId() === tableId) {
|
|
2345
|
+
this._closeFloatingControls();
|
|
2400
2346
|
return;
|
|
2401
2347
|
}
|
|
2402
|
-
|
|
2403
|
-
|
|
2348
|
+
const table = this._tableManager.getTableById(unitId, tableId);
|
|
2349
|
+
const anchor = this._shape.getAnchorRegion(tableId);
|
|
2350
|
+
if (!table || !anchor) return;
|
|
2351
|
+
this._closeFloatingControls();
|
|
2352
|
+
this._shape.setOpenedMenuTableId(tableId);
|
|
2353
|
+
const range = table.getRange();
|
|
2354
|
+
this._menuPopup = this._sheetCanvasPopupService.attachPopupByPosition({
|
|
2355
|
+
left: anchor.left,
|
|
2356
|
+
right: anchor.left + anchor.width,
|
|
2357
|
+
top: anchor.top,
|
|
2358
|
+
bottom: anchor.top + anchor.height
|
|
2359
|
+
}, {
|
|
2360
|
+
componentKey: "SHEET_TABLE_MENU",
|
|
2361
|
+
direction: "bottom-left",
|
|
2362
|
+
extraProps: {
|
|
2363
|
+
anchorWidth: anchor.width,
|
|
2364
|
+
tableName: table.getDisplayName(),
|
|
2365
|
+
labels: {
|
|
2366
|
+
rename: this._localeService.t("sheets-table-ui.rename"),
|
|
2367
|
+
"update-range": this._localeService.t("sheets-table-ui.updateRange"),
|
|
2368
|
+
"set-theme": this._localeService.t("sheets-table-ui.setTheme"),
|
|
2369
|
+
delete: this._localeService.t("sheets-table-ui.removeTable")
|
|
2370
|
+
},
|
|
2371
|
+
onSelect: (action) => this._handleTableMenuAction(action, unitId, subUnitId, tableId),
|
|
2372
|
+
onClose: () => this._closeFloatingControls()
|
|
2373
|
+
}
|
|
2374
|
+
}, {
|
|
2375
|
+
unitId,
|
|
2376
|
+
subUnitId,
|
|
2377
|
+
row: range.startRow,
|
|
2378
|
+
col: range.startColumn
|
|
2379
|
+
}) ?? null;
|
|
2380
|
+
if (!this._menuPopup) this._shape.setOpenedMenuTableId(null);
|
|
2381
|
+
}
|
|
2382
|
+
_handleTableMenuAction(action, unitId, subUnitId, tableId) {
|
|
2383
|
+
this._closeFloatingControls();
|
|
2384
|
+
switch (action) {
|
|
2404
2385
|
case "rename":
|
|
2405
|
-
this._openRenameDialog(unitId,
|
|
2406
|
-
break;
|
|
2407
|
-
case "update-range":
|
|
2408
|
-
this._openRangeSelector(unitId, subUnitId, hit.tableId);
|
|
2386
|
+
this._openRenameDialog(unitId, tableId);
|
|
2409
2387
|
break;
|
|
2388
|
+
case "update-range": return this._openRangeSelector(unitId, subUnitId, tableId);
|
|
2410
2389
|
case "set-theme":
|
|
2411
|
-
this._openThemePanel(unitId, subUnitId,
|
|
2390
|
+
this._openThemePanel(unitId, subUnitId, tableId);
|
|
2412
2391
|
break;
|
|
2413
2392
|
case "delete":
|
|
2414
2393
|
this._commandService.executeCommand(_univerjs_sheets_table.DeleteSheetTableCommand.id, {
|
|
2415
|
-
tableId
|
|
2394
|
+
tableId,
|
|
2416
2395
|
subUnitId,
|
|
2417
2396
|
unitId
|
|
2418
2397
|
});
|
|
2419
2398
|
break;
|
|
2420
2399
|
}
|
|
2421
|
-
this._closeFloatingControls();
|
|
2422
2400
|
}
|
|
2423
2401
|
_openRenameDialog(unitId, tableId) {
|
|
2424
2402
|
this._dialogService.open({
|
|
@@ -2455,13 +2433,15 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2455
2433
|
this._sidebarService.open({
|
|
2456
2434
|
id: SHEET_TABLE_THEME_PANEL_ID,
|
|
2457
2435
|
header: { title: this._localeService.t("sheets-table-ui.tableStyle") },
|
|
2458
|
-
children: {
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2436
|
+
children: { label: {
|
|
2437
|
+
name: SHEET_TABLE_THEME_PANEL,
|
|
2438
|
+
props: {
|
|
2439
|
+
oldConfig: table.getTableConfig(),
|
|
2440
|
+
unitId,
|
|
2441
|
+
subUnitId,
|
|
2442
|
+
tableId
|
|
2443
|
+
}
|
|
2444
|
+
} },
|
|
2465
2445
|
width: 330
|
|
2466
2446
|
});
|
|
2467
2447
|
}
|
|
@@ -2515,12 +2495,11 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2515
2495
|
const previousTopGap = rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null;
|
|
2516
2496
|
let shouldSync = false;
|
|
2517
2497
|
if (hasTopTable) {
|
|
2518
|
-
var _baseGap$size;
|
|
2519
2498
|
if (!this._topGapBaseBySkeleton.has(skeleton)) this._topGapBaseBySkeleton.set(skeleton, rowGaps[TABLE_CONTROL_GAP_ROW] ? { ...rowGaps[TABLE_CONTROL_GAP_ROW] } : null);
|
|
2520
2499
|
const baseGap = this._topGapBaseBySkeleton.get(skeleton);
|
|
2521
2500
|
rowGaps[TABLE_CONTROL_GAP_ROW] = {
|
|
2522
|
-
...baseGap
|
|
2523
|
-
size: ((
|
|
2501
|
+
...baseGap ?? rowGaps[TABLE_CONTROL_GAP_ROW],
|
|
2502
|
+
size: ((baseGap === null || baseGap === void 0 ? void 0 : baseGap.size) ?? 0) + 32
|
|
2524
2503
|
};
|
|
2525
2504
|
shouldSync = true;
|
|
2526
2505
|
} else if (this._topGapBaseBySkeleton.has(skeleton)) {
|
|
@@ -2542,6 +2521,9 @@ let SheetTableControlsRenderController = class SheetTableControlsRenderControlle
|
|
|
2542
2521
|
this._selectionRenderService.resetSelectionsByModelData(this._sheetsSelectionsService.getCurrentSelections());
|
|
2543
2522
|
}
|
|
2544
2523
|
_closeFloatingControls() {
|
|
2524
|
+
const menuPopup = this._menuPopup;
|
|
2525
|
+
this._menuPopup = null;
|
|
2526
|
+
menuPopup === null || menuPopup === void 0 || menuPopup.dispose();
|
|
2545
2527
|
this._shape.setOpenedMenuTableId(null);
|
|
2546
2528
|
this._shape.setHoveredInsertRegion(null);
|
|
2547
2529
|
this._shape.setHoveredRegion(null);
|
|
@@ -2568,7 +2550,8 @@ SheetTableControlsRenderController = __decorate([
|
|
|
2568
2550
|
__decorateParam(10, (0, _univerjs_core.Inject)(SheetTableThemeUIController)),
|
|
2569
2551
|
__decorateParam(11, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
|
|
2570
2552
|
__decorateParam(12, _univerjs_ui.IDialogService),
|
|
2571
|
-
__decorateParam(13, _univerjs_ui.ISidebarService)
|
|
2553
|
+
__decorateParam(13, _univerjs_ui.ISidebarService),
|
|
2554
|
+
__decorateParam(14, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetCanvasPopManagerService))
|
|
2572
2555
|
], SheetTableControlsRenderController);
|
|
2573
2556
|
|
|
2574
2557
|
//#endregion
|
|
@@ -2741,12 +2724,12 @@ let SheetsTableFilterButtonRenderController = class SheetsTableFilterButtonRende
|
|
|
2741
2724
|
const worksheet = workbook.getSheetBySheetId(worksheetId);
|
|
2742
2725
|
if (!worksheet) return;
|
|
2743
2726
|
for (const { range, states, tableId } of tableFilterRanges) {
|
|
2744
|
-
var _this$_rangeThemeMode, _headerStyle$cl
|
|
2727
|
+
var _this$_rangeThemeMode, _headerStyle$cl, _headerStyle$bg;
|
|
2745
2728
|
const { startRow, startColumn, endColumn } = range;
|
|
2746
2729
|
const table = this._tableManager.getTableById(unitId, tableId);
|
|
2747
2730
|
const headerStyle = table ? (_this$_rangeThemeMode = this._rangeThemeModel.getRangeThemeStyle(unitId, table.getTableStyleId())) === null || _this$_rangeThemeMode === void 0 ? void 0 : _this$_rangeThemeMode.getHeaderRowStyle() : null;
|
|
2748
|
-
const iconColor = (
|
|
2749
|
-
const hoverIconColor = (
|
|
2731
|
+
const iconColor = (headerStyle === null || headerStyle === void 0 || (_headerStyle$cl = headerStyle.cl) === null || _headerStyle$cl === void 0 ? void 0 : _headerStyle$cl.rgb) ?? "#fff";
|
|
2732
|
+
const hoverIconColor = (headerStyle === null || headerStyle === void 0 || (_headerStyle$bg = headerStyle.bg) === null || _headerStyle$bg === void 0 ? void 0 : _headerStyle$bg.rgb) ?? "#202124";
|
|
2750
2733
|
this._interceptCellContent(unitId, worksheetId, range);
|
|
2751
2734
|
for (let col = startColumn; col <= endColumn; col++) {
|
|
2752
2735
|
const key = `sheets-table-filter-button-${startRow}-${col}`;
|
|
@@ -3017,7 +3000,7 @@ _defineProperty(UniverSheetsTableUIPlugin, "packageName", name);
|
|
|
3017
3000
|
_defineProperty(UniverSheetsTableUIPlugin, "version", version);
|
|
3018
3001
|
_defineProperty(UniverSheetsTableUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
3019
3002
|
UniverSheetsTableUIPlugin = __decorate([
|
|
3020
|
-
(0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin,
|
|
3003
|
+
(0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_sheets_table.UniverSheetsTablePlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin),
|
|
3021
3004
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
3022
3005
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
|
|
3023
3006
|
__decorateParam(3, _univerjs_core.IConfigService),
|