@economic/taco 2.11.2 → 2.12.0
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/dist/components/Icon/components/EditSimple.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/ModeSwitch/ModeSwitch.d.ts +17 -0
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Provider/Localization.d.ts +0 -1
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +1 -0
- package/dist/components/Table3/hooks/useCssGrid.d.ts +1 -1
- package/dist/components/Table3/types.d.ts +0 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EditSimple.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/EditSimple.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +30 -0
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -2
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +10 -5
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/EditButton.js +9 -16
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/EditButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +18 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -0
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/taco.cjs.development.js +80 -26
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +13365 -11140
|
@@ -1287,6 +1287,21 @@ function IconESignature(props, svgRef) {
|
|
|
1287
1287
|
}
|
|
1288
1288
|
var ESignature = /*#__PURE__*/React.forwardRef(IconESignature);
|
|
1289
1289
|
|
|
1290
|
+
function IconEditSimple(props, svgRef) {
|
|
1291
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
1292
|
+
fill: "none",
|
|
1293
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1294
|
+
viewBox: "0 0 24 24",
|
|
1295
|
+
ref: svgRef
|
|
1296
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
1297
|
+
fillRule: "evenodd",
|
|
1298
|
+
clipRule: "evenodd",
|
|
1299
|
+
d: "M16.013 4.513a1.75 1.75 0 012.35-.114l.124.114 1.586 1.585a1.75 1.75 0 01.114 2.35l-.114.125L8.061 20.586H4v-4.06L16.013 4.512zm-1.514 3.633l-8.999 9v1.94h1.938l9-9.001-1.939-1.939zm2.928-2.573a.25.25 0 00-.3-.04l-.054.04-1.513 1.512 1.939 1.939 1.514-1.511a.25.25 0 00.065-.24l-.025-.06-.04-.054-1.586-1.586z",
|
|
1300
|
+
fill: "currentColor"
|
|
1301
|
+
}));
|
|
1302
|
+
}
|
|
1303
|
+
var EditSimple = /*#__PURE__*/React.forwardRef(IconEditSimple);
|
|
1304
|
+
|
|
1290
1305
|
function IconEdit(props, svgRef) {
|
|
1291
1306
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
1292
1307
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3349,6 +3364,7 @@ const icons = {
|
|
|
3349
3364
|
drag: Drag,
|
|
3350
3365
|
'e-copedia': ECopedia,
|
|
3351
3366
|
'e-signature': ESignature,
|
|
3367
|
+
'edit-simple': EditSimple,
|
|
3352
3368
|
edit: Edit,
|
|
3353
3369
|
'ellipsis-horizontal': EllipsisHorizontal,
|
|
3354
3370
|
'ellipsis-vertical': EllipsisVertical,
|
|
@@ -4358,8 +4374,7 @@ const defaultLocalisationTexts = {
|
|
|
4358
4374
|
},
|
|
4359
4375
|
buttons: {
|
|
4360
4376
|
edit: {
|
|
4361
|
-
|
|
4362
|
-
tooltip: 'Edit'
|
|
4377
|
+
tooltip: 'Edit table'
|
|
4363
4378
|
}
|
|
4364
4379
|
},
|
|
4365
4380
|
rowIndicator: {
|
|
@@ -7943,6 +7958,29 @@ Menu$1.Header = Header;
|
|
|
7943
7958
|
Menu$1.RadioGroup = RadioGroup$1;
|
|
7944
7959
|
Menu$1.SubMenu = SubMenu;
|
|
7945
7960
|
|
|
7961
|
+
const ModeSwitch = /*#__PURE__*/React.forwardRef(function ModeSwitch(props, ref) {
|
|
7962
|
+
const {
|
|
7963
|
+
onChange,
|
|
7964
|
+
...otherProps
|
|
7965
|
+
} = props;
|
|
7966
|
+
const className = cn('group w-14 h-8 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus p-1', {
|
|
7967
|
+
'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,
|
|
7968
|
+
'bg-grey-500 aria-checked:bg-blue-500 cursor-not-allowed opacity-50': props.disabled
|
|
7969
|
+
}, props.className);
|
|
7970
|
+
return /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, {
|
|
7971
|
+
className: className,
|
|
7972
|
+
"data-taco": "mode",
|
|
7973
|
+
onCheckedChange: onChange,
|
|
7974
|
+
ref: ref
|
|
7975
|
+
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
|
7976
|
+
className: "'will-change-transform flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
|
|
7977
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
7978
|
+
name: "edit-simple",
|
|
7979
|
+
className: "!h-5 !w-5"
|
|
7980
|
+
})));
|
|
7981
|
+
});
|
|
7982
|
+
ModeSwitch.displayName = 'ModeSwitch';
|
|
7983
|
+
|
|
7946
7984
|
const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
|
7947
7985
|
return /*#__PURE__*/React__default.createElement("a", Object.assign({}, props, {
|
|
7948
7986
|
ref: ref
|
|
@@ -16009,7 +16047,7 @@ function Menu$3(props) {
|
|
|
16009
16047
|
// we do this in the next tick, otherwise the menu closes and react throws a "state update on unmounted component" error
|
|
16010
16048
|
const handleClick = event => setTimeout(() => handleHide(event), 1);
|
|
16011
16049
|
menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
|
16012
|
-
icon: "
|
|
16050
|
+
icon: "eye-off",
|
|
16013
16051
|
onClick: handleClick
|
|
16014
16052
|
}, texts.table3.columns.menu.hideColumn));
|
|
16015
16053
|
}
|
|
@@ -16656,7 +16694,7 @@ const getInputAppearanceClassnames = () => {
|
|
|
16656
16694
|
return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
|
|
16657
16695
|
};
|
|
16658
16696
|
|
|
16659
|
-
const useCssGrid = (table, isPrintTable = false) => {
|
|
16697
|
+
const useCssGrid = (table, isPrintTable = false, actionsForRowLength = 0) => {
|
|
16660
16698
|
const allVisibleColumns = table.getVisibleLeafColumns();
|
|
16661
16699
|
const columnSizing = table.getState().columnSizing;
|
|
16662
16700
|
const rowsLength = table.getRowModel().rows.length;
|
|
@@ -16675,7 +16713,8 @@ const useCssGrid = (table, isPrintTable = false) => {
|
|
|
16675
16713
|
size = `minmax(${PRINT_MIN_COLUMN_SIZE}px, ${maxWidth})`;
|
|
16676
16714
|
} else if (isColumnInternal) {
|
|
16677
16715
|
if (column.id === COLUMN_ID) {
|
|
16678
|
-
|
|
16716
|
+
const minWidth = actionsForRowLength * 32 + 8 /* button margins l+r */ + 8; /* cell padding l+r */
|
|
16717
|
+
size = `minmax(${minWidth}px, auto)`;
|
|
16679
16718
|
} else {
|
|
16680
16719
|
// getSize method is used instead of columnSizing state because columnSizing state doesn't have
|
|
16681
16720
|
// sizes of internal columns.
|
|
@@ -16768,16 +16807,31 @@ function useCurrentRow(defaultCurrentRowIndex) {
|
|
|
16768
16807
|
// do it in the next tick, otherwise it prevents internal focus from working
|
|
16769
16808
|
// meaning you have to tab twice to get to the first focusable element
|
|
16770
16809
|
setTimeout(() => {
|
|
16771
|
-
setCurrentRowIndex(
|
|
16772
|
-
|
|
16810
|
+
setCurrentRowIndex(index => {
|
|
16811
|
+
if (index === undefined) {
|
|
16812
|
+
scrollToIndex(0);
|
|
16813
|
+
return 0;
|
|
16814
|
+
}
|
|
16815
|
+
return index;
|
|
16816
|
+
});
|
|
16773
16817
|
}, 1);
|
|
16774
16818
|
}
|
|
16775
16819
|
}, [currentRowIndex, length]);
|
|
16820
|
+
const onMouseCapture = React__default.useCallback((event, length) => {
|
|
16821
|
+
if (event.isDefaultPrevented()) {
|
|
16822
|
+
return;
|
|
16823
|
+
}
|
|
16824
|
+
if (currentRowIndex === undefined && length > 0) {
|
|
16825
|
+
event.preventDefault();
|
|
16826
|
+
event.stopPropagation();
|
|
16827
|
+
}
|
|
16828
|
+
}, [currentRowIndex, length]);
|
|
16776
16829
|
return {
|
|
16777
16830
|
currentRowIndex,
|
|
16778
16831
|
setCurrentRowIndex,
|
|
16779
16832
|
handleFocus: onFocus,
|
|
16780
|
-
handleKeyDown: onKeyDown
|
|
16833
|
+
handleKeyDown: onKeyDown,
|
|
16834
|
+
handleMouseCapture: onMouseCapture
|
|
16781
16835
|
};
|
|
16782
16836
|
}
|
|
16783
16837
|
const getNextIndex$2 = (direction, currentIndex, length) => {
|
|
@@ -20145,15 +20199,8 @@ function EditButton(props) {
|
|
|
20145
20199
|
texts
|
|
20146
20200
|
} = useLocalization();
|
|
20147
20201
|
const tableMeta = props.table.options.meta;
|
|
20148
|
-
|
|
20149
|
-
|
|
20150
|
-
});
|
|
20151
|
-
const handleClick = () => tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing);
|
|
20152
|
-
return /*#__PURE__*/React__default.createElement(Button$1, {
|
|
20153
|
-
"aria-pressed": tableMeta.editing.isEditing,
|
|
20154
|
-
className: className,
|
|
20155
|
-
onClick: handleClick,
|
|
20156
|
-
tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
20202
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
20203
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
20157
20204
|
className: "ml-2",
|
|
20158
20205
|
keys: {
|
|
20159
20206
|
key: 'e',
|
|
@@ -20161,10 +20208,11 @@ function EditButton(props) {
|
|
|
20161
20208
|
shift: false
|
|
20162
20209
|
}
|
|
20163
20210
|
}))
|
|
20164
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
20165
|
-
"aria-
|
|
20166
|
-
|
|
20167
|
-
|
|
20211
|
+
}, /*#__PURE__*/React__default.createElement(ModeSwitch, {
|
|
20212
|
+
"aria-pressed": tableMeta.editing.isEditing,
|
|
20213
|
+
checked: tableMeta.editing.isEditing,
|
|
20214
|
+
onChange: tableMeta.editing.toggleEditing
|
|
20215
|
+
}));
|
|
20168
20216
|
}
|
|
20169
20217
|
|
|
20170
20218
|
const PRINT_STYLES = `
|
|
@@ -21185,12 +21233,16 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
21185
21233
|
// scrollToIndex function changes when row count changes, so it is important to update handlers with new
|
|
21186
21234
|
// scrollToIndex function.
|
|
21187
21235
|
[scrollToIndex, tableMeta.editing.isEditing, internalRef.current]);
|
|
21188
|
-
const handleBlur = event => {
|
|
21236
|
+
const handleBlur = tableMeta.editing.isEnabled ? event => {
|
|
21189
21237
|
tableMeta.editing.handleBlur(event);
|
|
21190
|
-
};
|
|
21191
|
-
const handleFocus = event => {
|
|
21238
|
+
} : undefined;
|
|
21239
|
+
const handleFocus = tableMeta.currentRow.currentRowIndex === undefined ? event => {
|
|
21192
21240
|
tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);
|
|
21193
|
-
};
|
|
21241
|
+
} : undefined;
|
|
21242
|
+
// mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row
|
|
21243
|
+
const handleMouseCapture = tableMeta.currentRow.currentRowIndex === undefined ? event => {
|
|
21244
|
+
tableMeta.currentRow.handleMouseCapture(event, table.getRowModel().rows.length);
|
|
21245
|
+
} : undefined;
|
|
21194
21246
|
const handleScroll = function (event) {
|
|
21195
21247
|
try {
|
|
21196
21248
|
tableMeta.columnFreezing.handleScroll(event);
|
|
@@ -21208,7 +21260,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
21208
21260
|
// if the table is a print table or not.
|
|
21209
21261
|
const {
|
|
21210
21262
|
style: cssGridStyle
|
|
21211
|
-
} = useCssGrid(table, tableMeta.isPrinting);
|
|
21263
|
+
} = useCssGrid(table, tableMeta.isPrinting, tableMeta.rowActions.actionsForRowLength);
|
|
21212
21264
|
const {
|
|
21213
21265
|
style: cssVars
|
|
21214
21266
|
} = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);
|
|
@@ -21242,6 +21294,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
21242
21294
|
"data-taco": "table2",
|
|
21243
21295
|
onBlur: handleBlur,
|
|
21244
21296
|
onFocus: handleFocus,
|
|
21297
|
+
onMouseDownCapture: handleMouseCapture,
|
|
21245
21298
|
onScroll: handleScroll,
|
|
21246
21299
|
ref: internalRef,
|
|
21247
21300
|
role: "table",
|
|
@@ -22268,6 +22321,7 @@ exports.Listbox = Listbox;
|
|
|
22268
22321
|
exports.LocalizationContext = LocalizationContext;
|
|
22269
22322
|
exports.LocalizationProvider = LocalizationProvider;
|
|
22270
22323
|
exports.Menu = Menu$1;
|
|
22324
|
+
exports.ModeSwitch = ModeSwitch;
|
|
22271
22325
|
exports.MultiListbox = MultiListbox;
|
|
22272
22326
|
exports.Navigation = Navigation;
|
|
22273
22327
|
exports.Navigation2 = Navigation2;
|