@gravity-ui/querieskit 1.3.0 → 1.3.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/build/cjs/components/AttachmentListPlaceholder/AttachmentListPlaceholder.js +4 -4
- package/build/cjs/components/AttachmentListPlaceholder/AttachmentListPlaceholder.js.map +1 -1
- package/build/cjs/modules/HistoryLayout/HistoryLayout.d.ts +1 -1
- package/build/cjs/modules/HistoryLayout/HistoryLayout.js +1 -1
- package/build/cjs/modules/HistoryLayout/HistoryLayout.js.map +1 -1
- package/build/cjs/modules/RowsList/RowsList.css +4 -0
- package/build/cjs/modules/RowsList/RowsList.css.map +1 -1
- package/build/cjs/types/queryList.d.ts +1 -1
- package/build/cjs/types/queryList.js.map +1 -1
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.js +1 -2
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.js.map +1 -1
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.d.ts +1 -0
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.js +82 -1
- package/build/cjs/widgets/QueriesHistory/QueriesHistory.stories.js.map +1 -1
- package/build/cjs/widgets/SavedQueries/SavedQueries.stories.js.map +1 -1
- package/build/esm/components/AttachmentListPlaceholder/AttachmentListPlaceholder.js +4 -4
- package/build/esm/components/AttachmentListPlaceholder/AttachmentListPlaceholder.js.map +1 -1
- package/build/esm/modules/HistoryLayout/HistoryLayout.d.ts +1 -1
- package/build/esm/modules/HistoryLayout/HistoryLayout.js +1 -1
- package/build/esm/modules/HistoryLayout/HistoryLayout.js.map +1 -1
- package/build/esm/modules/RowsList/RowsList.css +4 -0
- package/build/esm/modules/RowsList/RowsList.css.map +1 -1
- package/build/esm/modules/RowsList/RowsList.scss +3 -0
- package/build/esm/types/queryList.d.ts +1 -1
- package/build/esm/types/queryList.js.map +1 -1
- package/build/esm/widgets/QueriesHistory/QueriesHistory.js +1 -2
- package/build/esm/widgets/QueriesHistory/QueriesHistory.js.map +1 -1
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.d.ts +1 -0
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.js +81 -0
- package/build/esm/widgets/QueriesHistory/QueriesHistory.stories.js.map +1 -1
- package/build/esm/widgets/SavedQueries/SavedQueries.stories.js.map +1 -1
- package/package.json +29 -2
- package/.agents/skills/code-review-checklist/SKILL.md +0 -94
- package/.agents/skills/github-pr-review/SKILL.md +0 -24
- package/.agents/skills/gravity-ui/SKILL.md +0 -175
- package/.agents/skills/gravity-ui/references/icons.md +0 -60
- package/.agents/skills/gravity-ui/references/layout.md +0 -366
- package/.agents/skills/gravity-ui/references/package-routing.md +0 -424
- package/.agents/skills/gravity-ui/references/theming.md +0 -309
- package/.agents/skills/gravity-ui/rules/hallucination-traps.md +0 -361
- package/.agents/skills/gravity-ui/scripts/icon-image-search.sh +0 -63
- package/.eslintignore +0 -3
- package/.github/workflows/ci.yml +0 -25
- package/.github/workflows/main-preview.yml +0 -31
- package/.github/workflows/pr-preview-build.yml +0 -13
- package/.github/workflows/pr-preview-deploy.yml +0 -22
- package/.github/workflows/pr-title.yml +0 -27
- package/.github/workflows/release.yml +0 -20
- package/.nvmrc +0 -1
- package/.prettierrc.js +0 -1
- package/.storybook/main.ts +0 -31
- package/.storybook/preview.tsx +0 -43
- package/.storybook/redefinition.css +0 -3
- package/.storybook/tsconfig.json +0 -9
- package/.stylelintrc +0 -9
- package/AGENTS.md +0 -129
- package/CHANGELOG.md +0 -103
- package/CODEOWNERS +0 -2
- package/CONTRIBUTING.md +0 -31
- package/NOTICES.md +0 -8
- package/app-builder.config.ts +0 -9
- package/commitlint.config.cjs +0 -6
- package/eslint.config.mjs +0 -53
- package/plans/i18n-rules.md +0 -116
- package/plans/navigation-architecture.md +0 -262
- package/plans/queries-history-structure.md +0 -143
- package/plans/queries-navigation-architecture-review.md +0 -217
- package/plans/styles-rules.md +0 -137
- package/skills-lock.json +0 -11
- package/src/components/AddChartButton/AddChartButton.scss +0 -12
- package/src/components/AddChartButton/AddChartButton.stories.tsx +0 -34
- package/src/components/AddChartButton/AddChartButton.tsx +0 -139
- package/src/components/AddChartButton/index.ts +0 -6
- package/src/components/AttachmentList/AttachmentList.scss +0 -25
- package/src/components/AttachmentList/AttachmentList.stories.tsx +0 -243
- package/src/components/AttachmentList/AttachmentList.tsx +0 -67
- package/src/components/AttachmentList/helpers/getIconByAttachmentName.ts +0 -36
- package/src/components/AttachmentList/helpers/objectLinkValidator.ts +0 -40
- package/src/components/AttachmentList/helpers/stringRequiredValidator.ts +0 -24
- package/src/components/AttachmentList/hooks/useKeyDownFormControl.ts +0 -22
- package/src/components/AttachmentList/hooks/useLabelRef.ts +0 -25
- package/src/components/AttachmentList/i18n/dicts.ts +0 -4
- package/src/components/AttachmentList/i18n/en.json +0 -10
- package/src/components/AttachmentList/i18n/index.ts +0 -5
- package/src/components/AttachmentList/i18n/ru.json +0 -10
- package/src/components/AttachmentList/index.ts +0 -4
- package/src/components/AttachmentList/internal/AttachmentItem/AttachmentItem.scss +0 -23
- package/src/components/AttachmentList/internal/AttachmentItem/AttachmentItem.tsx +0 -75
- package/src/components/AttachmentList/internal/AttachmentItem/index.ts +0 -2
- package/src/components/AttachmentList/internal/EditAttachmentItem/EditAttachmentItem.tsx +0 -21
- package/src/components/AttachmentList/internal/EditAttachmentItem/EditLinkItem.scss +0 -21
- package/src/components/AttachmentList/internal/EditAttachmentItem/EditLinkItem.tsx +0 -194
- package/src/components/AttachmentList/internal/EditAttachmentItem/FileEdit.tsx +0 -92
- package/src/components/AttachmentList/internal/EditAttachmentItem/index.ts +0 -4
- package/src/components/AttachmentListPlaceholder/AttachmentListPlaceholder.scss +0 -5
- package/src/components/AttachmentListPlaceholder/AttachmentListPlaceholder.stories.tsx +0 -30
- package/src/components/AttachmentListPlaceholder/AttachmentListPlaceholder.tsx +0 -72
- package/src/components/AttachmentListPlaceholder/assets/empty-attachments.svg +0 -14
- package/src/components/AttachmentListPlaceholder/i18n/dicts.ts +0 -4
- package/src/components/AttachmentListPlaceholder/i18n/en.json +0 -7
- package/src/components/AttachmentListPlaceholder/i18n/index.ts +0 -5
- package/src/components/AttachmentListPlaceholder/i18n/ru.json +0 -7
- package/src/components/AttachmentListPlaceholder/index.ts +0 -2
- package/src/components/Breadcrumbs/Breadcrumbs.scss +0 -25
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -114
- package/src/components/Breadcrumbs/helpers/parsePathSegments.ts +0 -16
- package/src/components/Breadcrumbs/i18n/dicts.ts +0 -4
- package/src/components/Breadcrumbs/i18n/en.json +0 -4
- package/src/components/Breadcrumbs/i18n/index.ts +0 -5
- package/src/components/Breadcrumbs/i18n/ru.json +0 -4
- package/src/components/Breadcrumbs/index.ts +0 -2
- package/src/components/Chart/Chart.scss +0 -40
- package/src/components/Chart/Chart.stories.tsx +0 -75
- package/src/components/Chart/Chart.tsx +0 -120
- package/src/components/Chart/i18n/dicts.ts +0 -4
- package/src/components/Chart/i18n/en.json +0 -6
- package/src/components/Chart/i18n/index.ts +0 -5
- package/src/components/Chart/i18n/ru.json +0 -6
- package/src/components/Chart/index.ts +0 -2
- package/src/components/ChartEditorForm/ChartEditorForm.scss +0 -20
- package/src/components/ChartEditorForm/ChartEditorForm.stories.tsx +0 -88
- package/src/components/ChartEditorForm/ChartEditorForm.tsx +0 -120
- package/src/components/ChartEditorForm/helpers/resolveLabels.ts +0 -17
- package/src/components/ChartEditorForm/i18n/dicts.ts +0 -4
- package/src/components/ChartEditorForm/i18n/en.json +0 -12
- package/src/components/ChartEditorForm/i18n/index.ts +0 -5
- package/src/components/ChartEditorForm/i18n/ru.json +0 -12
- package/src/components/ChartEditorForm/index.ts +0 -7
- package/src/components/ChartEditorForm/internal/Field.tsx +0 -11
- package/src/components/ChartEditorForm/types.ts +0 -44
- package/src/components/ClusterRow/ClusterRow.tsx +0 -34
- package/src/components/ClusterRow/index.ts +0 -2
- package/src/components/Dashboard/Dashboard.scss +0 -4
- package/src/components/Dashboard/Dashboard.stories.scss +0 -18
- package/src/components/Dashboard/Dashboard.stories.tsx +0 -248
- package/src/components/Dashboard/Dashboard.tsx +0 -51
- package/src/components/Dashboard/helpers/createDefaultLayout.ts +0 -43
- package/src/components/Dashboard/hooks/useDashboardConfig.ts +0 -63
- package/src/components/Dashboard/index.ts +0 -2
- package/src/components/Dashboard/internal/DashPlate.scss +0 -23
- package/src/components/Dashboard/internal/DashPlate.tsx +0 -35
- package/src/components/Dashboard/internal/DashboardProvider.tsx +0 -37
- package/src/components/Dashboard/types.ts +0 -21
- package/src/components/DataTable/DataTable.scss +0 -27
- package/src/components/DataTable/DataTable.stories.tsx +0 -65
- package/src/components/DataTable/DataTable.tsx +0 -100
- package/src/components/DataTable/index.ts +0 -1
- package/src/components/EditableRowTitle/EditableRowTitle.tsx +0 -67
- package/src/components/EditableRowTitle/index.ts +0 -2
- package/src/components/EmptyContent/EmptyContent.scss +0 -3
- package/src/components/EmptyContent/EmptyContent.tsx +0 -57
- package/src/components/EmptyContent/i18n/dicts.ts +0 -4
- package/src/components/EmptyContent/i18n/en.json +0 -7
- package/src/components/EmptyContent/i18n/index.ts +0 -5
- package/src/components/EmptyContent/i18n/ru.json +0 -7
- package/src/components/EmptyContent/index.ts +0 -1
- package/src/components/ErrorTree/ErrorTree.stories.tsx +0 -94
- package/src/components/ErrorTree/ErrorTree.tsx +0 -30
- package/src/components/ErrorTree/helpers/formatAttributes.ts +0 -9
- package/src/components/ErrorTree/helpers/getIntermediateChain.ts +0 -21
- package/src/components/ErrorTree/i18n/dicts.ts +0 -4
- package/src/components/ErrorTree/i18n/en.json +0 -11
- package/src/components/ErrorTree/i18n/index.ts +0 -5
- package/src/components/ErrorTree/i18n/ru.json +0 -13
- package/src/components/ErrorTree/index.ts +0 -1
- package/src/components/ErrorTree/internal/ErrorTreeChildren.scss +0 -5
- package/src/components/ErrorTree/internal/ErrorTreeChildren.tsx +0 -25
- package/src/components/ErrorTree/internal/ErrorTreeNode.scss +0 -95
- package/src/components/ErrorTree/internal/ErrorTreeNode.tsx +0 -178
- package/src/components/ErrorTree/internal/IntermediateMessages.scss +0 -13
- package/src/components/ErrorTree/internal/IntermediateMessages.tsx +0 -127
- package/src/components/FieldsSearchToolbar/FieldsSearchToolbar.tsx +0 -48
- package/src/components/FieldsSearchToolbar/index.ts +0 -2
- package/src/components/FieldsSelector/FieldsSelector.scss +0 -18
- package/src/components/FieldsSelector/FieldsSelector.stories.tsx +0 -48
- package/src/components/FieldsSelector/FieldsSelector.tsx +0 -92
- package/src/components/FieldsSelector/i18n/dicts.ts +0 -4
- package/src/components/FieldsSelector/i18n/en.json +0 -3
- package/src/components/FieldsSelector/i18n/index.ts +0 -5
- package/src/components/FieldsSelector/i18n/ru.json +0 -3
- package/src/components/FieldsSelector/index.ts +0 -2
- package/src/components/HistoryFilter/HistoryFilter.scss +0 -5
- package/src/components/HistoryFilter/HistoryFilter.stories.tsx +0 -69
- package/src/components/HistoryFilter/HistoryFilter.tsx +0 -64
- package/src/components/HistoryFilter/i18n/dicts.ts +0 -4
- package/src/components/HistoryFilter/i18n/en.json +0 -4
- package/src/components/HistoryFilter/i18n/index.ts +0 -5
- package/src/components/HistoryFilter/i18n/ru.json +0 -4
- package/src/components/HistoryFilter/index.ts +0 -1
- package/src/components/HistoryGroupHeader/HistoryGroupHeader.scss +0 -7
- package/src/components/HistoryGroupHeader/HistoryGroupHeader.tsx +0 -18
- package/src/components/HistoryGroupHeader/index.ts +0 -1
- package/src/components/HistoryPrivateIcon/HistoryPrivateIcon.scss +0 -7
- package/src/components/HistoryPrivateIcon/HistoryPrivateIcon.tsx +0 -22
- package/src/components/HistoryPrivateIcon/index.ts +0 -1
- package/src/components/Icons/LogoCPlusPlus.tsx +0 -34
- package/src/components/Icons/index.ts +0 -1
- package/src/components/LazyList/LazyList.scss +0 -13
- package/src/components/LazyList/LazyList.tsx +0 -97
- package/src/components/LazyList/index.ts +0 -2
- package/src/components/ListSpinner/ListSpinner.scss +0 -3
- package/src/components/ListSpinner/ListSpinner.tsx +0 -18
- package/src/components/ListSpinner/index.ts +0 -2
- package/src/components/MonacoEditor/MonacoEditor.tsx +0 -112
- package/src/components/MonacoEditor/MonacoEditorThemes.tsx +0 -73
- package/src/components/MonacoEditor/index.ts +0 -11
- package/src/components/MonacoEditor/monaco-yql-languages/_.contribution.ts +0 -193
- package/src/components/MonacoEditor/monaco-yql-languages/clickhouse/clickhouse.contribution.ts +0 -14
- package/src/components/MonacoEditor/monaco-yql-languages/clickhouse/clickhouse.keywords.ts +0 -146
- package/src/components/MonacoEditor/monaco-yql-languages/clickhouse/clickhouse.ts +0 -217
- package/src/components/MonacoEditor/monaco-yql-languages/constants.ts +0 -6
- package/src/components/MonacoEditor/monaco-yql-languages/fillers/monaco-editor-core.ts +0 -3
- package/src/components/MonacoEditor/monaco-yql-languages/index.ts +0 -1
- package/src/components/MonacoEditor/monaco-yql-languages/monaco.contribution.ts +0 -5
- package/src/components/MonacoEditor/monaco-yql-languages/s-expressions/s-expressions.contribution.ts +0 -14
- package/src/components/MonacoEditor/monaco-yql-languages/s-expressions/s-expressions.keywords.ts +0 -97
- package/src/components/MonacoEditor/monaco-yql-languages/s-expressions/s-expressions.ts +0 -170
- package/src/components/MonacoEditor/monaco-yql-languages/themes/themes.contribution.ts +0 -35
- package/src/components/MonacoEditor/monaco-yql-languages/yql/yql.contribution.ts +0 -14
- package/src/components/MonacoEditor/monaco-yql-languages/yql/yql.keywords.ts +0 -13
- package/src/components/MonacoEditor/monaco-yql-languages/yql/yql.ts +0 -178
- package/src/components/MonacoEditor/monaco-yql-languages/yql_ansi/yql_ansi.contribution.ts +0 -14
- package/src/components/MonacoEditor/monaco-yql-languages/yql_ansi/yql_ansi.keywords.ts +0 -45
- package/src/components/MonacoEditor/monaco-yql-languages/yql_ansi/yql_ansi.ts +0 -142
- package/src/components/NavigationActionButtons/NavigationActionButtons.tsx +0 -46
- package/src/components/NavigationActionButtons/index.ts +0 -2
- package/src/components/NavigationItemRow/NavigationItemRow.tsx +0 -28
- package/src/components/NavigationItemRow/index.ts +0 -2
- package/src/components/PathEditor/PathEditor.scss +0 -41
- package/src/components/PathEditor/PathEditor.stories.helpers.ts +0 -118
- package/src/components/PathEditor/PathEditor.stories.tsx +0 -57
- package/src/components/PathEditor/PathEditor.tsx +0 -380
- package/src/components/PathEditor/helpers/suggestions.ts +0 -40
- package/src/components/PathEditor/i18n/dicts.ts +0 -4
- package/src/components/PathEditor/i18n/en.json +0 -4
- package/src/components/PathEditor/i18n/index.ts +0 -5
- package/src/components/PathEditor/i18n/ru.json +0 -4
- package/src/components/PathEditor/index.ts +0 -2
- package/src/components/QueryDuration/QueryDuration.scss +0 -6
- package/src/components/QueryDuration/QueryDuration.stories.tsx +0 -40
- package/src/components/QueryDuration/QueryDuration.tsx +0 -21
- package/src/components/QueryDuration/index.ts +0 -1
- package/src/components/QueryDuration/useQueryDuration.ts +0 -34
- package/src/components/QueryResultsTable/QueryResultsTable.scss +0 -65
- package/src/components/QueryResultsTable/QueryResultsTable.tsx +0 -112
- package/src/components/QueryResultsTable/helpers/formatQueryResultType.ts +0 -76
- package/src/components/QueryResultsTable/helpers/formatQueryResultValue.ts +0 -38
- package/src/components/QueryResultsTable/i18n/dicts.ts +0 -4
- package/src/components/QueryResultsTable/i18n/en.json +0 -5
- package/src/components/QueryResultsTable/i18n/index.ts +0 -4
- package/src/components/QueryResultsTable/i18n/ru.json +0 -5
- package/src/components/QueryResultsTable/index.ts +0 -3
- package/src/components/QueryResultsTable/internal/QueryResultCell.tsx +0 -63
- package/src/components/QueryStatusIcon/QueryStatusIcon.scss +0 -17
- package/src/components/QueryStatusIcon/QueryStatusIcon.stories.tsx +0 -50
- package/src/components/QueryStatusIcon/QueryStatusIcon.tsx +0 -37
- package/src/components/QueryStatusIcon/index.ts +0 -1
- package/src/components/RowActionsMenu/RowActionsMenu.tsx +0 -47
- package/src/components/RowActionsMenu/index.ts +0 -2
- package/src/components/RowLink/RowLink.scss +0 -8
- package/src/components/RowLink/RowLink.tsx +0 -23
- package/src/components/RowLink/index.ts +0 -2
- package/src/components/SearchRowLayout/SearchRowLayout.scss +0 -18
- package/src/components/SearchRowLayout/SearchRowLayout.tsx +0 -45
- package/src/components/SearchRowLayout/helpers/fitQueryToVisibleLines.ts +0 -10
- package/src/components/SearchRowLayout/helpers/monacoConfig.ts +0 -25
- package/src/components/SearchRowLayout/index.ts +0 -2
- package/src/components/SearchWithButtons/SearchWithButtons.scss +0 -10
- package/src/components/SearchWithButtons/SearchWithButtons.stories.tsx +0 -107
- package/src/components/SearchWithButtons/SearchWithButtons.tsx +0 -56
- package/src/components/SearchWithButtons/index.ts +0 -2
- package/src/components/SimpleForm/CheckboxGroupField.tsx +0 -53
- package/src/components/SimpleForm/RangeDatePickerField.tsx +0 -50
- package/src/components/SimpleForm/SelectField.tsx +0 -24
- package/src/components/SimpleForm/SimpleForm.stories.tsx +0 -115
- package/src/components/SimpleForm/SimpleForm.tsx +0 -65
- package/src/components/SimpleForm/SwitchField.tsx +0 -23
- package/src/components/SimpleForm/helpers/controlsRegistry.ts +0 -24
- package/src/components/SimpleForm/helpers/getInitialValues.ts +0 -10
- package/src/components/SimpleForm/helpers/index.ts +0 -2
- package/src/components/SimpleForm/index.ts +0 -7
- package/src/components/SkeletonRows/SkeletonRows.tsx +0 -24
- package/src/components/SkeletonRows/index.ts +0 -2
- package/src/components/index.ts +0 -71
- package/src/constants/query.ts +0 -10
- package/src/constants/row.ts +0 -2
- package/src/helpers/buildColumnsFromKeys.ts +0 -17
- package/src/helpers/createUuid.ts +0 -3
- package/src/helpers/getDefaultNavigationIcon.ts +0 -33
- package/src/helpers/getListKey.ts +0 -12
- package/src/helpers/getParentPath.ts +0 -10
- package/src/helpers/isEmptyValue.ts +0 -2
- package/src/helpers/isFieldVisible.ts +0 -20
- package/src/helpers/isObjectEqual.ts +0 -15
- package/src/helpers/time.ts +0 -29
- package/src/helpers/useDebouncedValue.ts +0 -14
- package/src/helpers/useLoadMoreSentinel.ts +0 -31
- package/src/helpers/useToggle.ts +0 -11
- package/src/helpers/useVisibleColumns.ts +0 -26
- package/src/i18n/index.ts +0 -26
- package/src/index.ts +0 -12
- package/src/modules/Attachments/Attachments.scss +0 -10
- package/src/modules/Attachments/Attachments.stories.tsx +0 -112
- package/src/modules/Attachments/Attachments.tsx +0 -336
- package/src/modules/Attachments/i18n/dicts.ts +0 -4
- package/src/modules/Attachments/i18n/en.json +0 -5
- package/src/modules/Attachments/i18n/index.ts +0 -5
- package/src/modules/Attachments/i18n/ru.json +0 -5
- package/src/modules/Attachments/index.ts +0 -2
- package/src/modules/ChartEditor/ChartEditor.scss +0 -12
- package/src/modules/ChartEditor/ChartEditor.tsx +0 -116
- package/src/modules/ChartEditor/i18n/dicts.ts +0 -4
- package/src/modules/ChartEditor/i18n/en.json +0 -3
- package/src/modules/ChartEditor/i18n/index.ts +0 -5
- package/src/modules/ChartEditor/i18n/ru.json +0 -3
- package/src/modules/ChartEditor/index.ts +0 -2
- package/src/modules/ChartEditor/story/ChartEditor.stories.tsx +0 -186
- package/src/modules/ChartEditor/story/mockData.ts +0 -222
- package/src/modules/ChartEditor/types.ts +0 -18
- package/src/modules/ClustersList/ClustersList.scss +0 -11
- package/src/modules/ClustersList/ClustersList.tsx +0 -49
- package/src/modules/ClustersList/index.ts +0 -2
- package/src/modules/HistoryComparisonActions/HistoryComparisonActions.scss +0 -4
- package/src/modules/HistoryComparisonActions/HistoryComparisonActions.tsx +0 -42
- package/src/modules/HistoryComparisonActions/index.ts +0 -2
- package/src/modules/HistoryHeader/HistoryHeader.stories.tsx +0 -47
- package/src/modules/HistoryHeader/HistoryHeader.tsx +0 -58
- package/src/modules/HistoryHeader/index.ts +0 -1
- package/src/modules/HistoryHeader/internal/FullSearchToggleButton.tsx +0 -16
- package/src/modules/HistoryLayout/HistoryLayout.scss +0 -7
- package/src/modules/HistoryLayout/HistoryLayout.tsx +0 -43
- package/src/modules/HistoryLayout/index.ts +0 -2
- package/src/modules/HistoryRow/HistoryRow.scss +0 -32
- package/src/modules/HistoryRow/HistoryRow.stories.tsx +0 -91
- package/src/modules/HistoryRow/HistoryRow.tsx +0 -77
- package/src/modules/HistoryRow/index.ts +0 -1
- package/src/modules/HistorySearchRow/HistorySearchRow.scss +0 -13
- package/src/modules/HistorySearchRow/HistorySearchRow.stories.tsx +0 -52
- package/src/modules/HistorySearchRow/HistorySearchRow.tsx +0 -62
- package/src/modules/HistorySearchRow/helpers/resolveMonacoLanguage.ts +0 -19
- package/src/modules/HistorySearchRow/index.ts +0 -1
- package/src/modules/NavigationDetail/NavigationDetail.scss +0 -13
- package/src/modules/NavigationDetail/NavigationDetail.tsx +0 -121
- package/src/modules/NavigationDetail/helpers/getInitialTab.ts +0 -9
- package/src/modules/NavigationDetail/helpers/getVisibleTabs.ts +0 -5
- package/src/modules/NavigationDetail/index.ts +0 -2
- package/src/modules/NavigationDetail/internal/NavigationDetailTabs.tsx +0 -32
- package/src/modules/NavigationHeader/NavigationHeader.stories.tsx +0 -118
- package/src/modules/NavigationHeader/NavigationHeader.tsx +0 -33
- package/src/modules/NavigationHeader/index.ts +0 -2
- package/src/modules/NavigationItemsList/NavigationItemsList.scss +0 -65
- package/src/modules/NavigationItemsList/NavigationItemsList.tsx +0 -92
- package/src/modules/NavigationItemsList/index.ts +0 -2
- package/src/modules/NavigationItemsList/internal/NavigationItemsListEmptyState.tsx +0 -45
- package/src/modules/NavigationItemsList/internal/NavigationItemsListHeader.scss +0 -6
- package/src/modules/NavigationItemsList/internal/NavigationItemsListHeader.tsx +0 -54
- package/src/modules/NavigationItemsList/internal/useParentRow.ts +0 -23
- package/src/modules/NavigationMeta/NavigationMeta.scss +0 -25
- package/src/modules/NavigationMeta/NavigationMeta.tsx +0 -81
- package/src/modules/NavigationMeta/helpers/buildMetaGroups.tsx +0 -27
- package/src/modules/NavigationMeta/i18n/dicts.ts +0 -4
- package/src/modules/NavigationMeta/i18n/en.json +0 -4
- package/src/modules/NavigationMeta/i18n/index.ts +0 -5
- package/src/modules/NavigationMeta/i18n/ru.json +0 -4
- package/src/modules/NavigationMeta/index.ts +0 -3
- package/src/modules/NavigationMeta/story/NavigationMeta.stories.tsx +0 -80
- package/src/modules/NavigationMeta/story/mockData.ts +0 -22
- package/src/modules/NavigationPreview/NavigationPreview.scss +0 -32
- package/src/modules/NavigationPreview/NavigationPreview.tsx +0 -155
- package/src/modules/NavigationPreview/helpers/buildPreviewColumns.tsx +0 -11
- package/src/modules/NavigationPreview/helpers/filterPreviewRows.ts +0 -29
- package/src/modules/NavigationPreview/i18n/dicts.ts +0 -4
- package/src/modules/NavigationPreview/i18n/en.json +0 -3
- package/src/modules/NavigationPreview/i18n/index.ts +0 -5
- package/src/modules/NavigationPreview/i18n/ru.json +0 -3
- package/src/modules/NavigationPreview/index.ts +0 -4
- package/src/modules/NavigationPreview/story/NavigationPreview.stories.tsx +0 -123
- package/src/modules/NavigationPreview/story/mockData.ts +0 -14
- package/src/modules/NavigationSchema/NavigationSchema.scss +0 -24
- package/src/modules/NavigationSchema/NavigationSchema.tsx +0 -118
- package/src/modules/NavigationSchema/helpers/buildSchemaColumns.tsx +0 -54
- package/src/modules/NavigationSchema/helpers/filterSchema.ts +0 -18
- package/src/modules/NavigationSchema/i18n/dicts.ts +0 -4
- package/src/modules/NavigationSchema/i18n/en.json +0 -9
- package/src/modules/NavigationSchema/i18n/index.ts +0 -5
- package/src/modules/NavigationSchema/i18n/ru.json +0 -9
- package/src/modules/NavigationSchema/index.ts +0 -4
- package/src/modules/NavigationSchema/story/NavigationSchema.stories.tsx +0 -112
- package/src/modules/NavigationSchema/story/mockData.ts +0 -9
- package/src/modules/NavigationView/NavigationView.scss +0 -44
- package/src/modules/NavigationView/NavigationView.tsx +0 -60
- package/src/modules/NavigationView/helpers/buildViewColumns.tsx +0 -11
- package/src/modules/NavigationView/i18n/dicts.ts +0 -4
- package/src/modules/NavigationView/i18n/en.json +0 -3
- package/src/modules/NavigationView/i18n/index.ts +0 -5
- package/src/modules/NavigationView/i18n/ru.json +0 -3
- package/src/modules/NavigationView/index.ts +0 -3
- package/src/modules/NavigationView/internal/NavigationViewSectionItem.tsx +0 -70
- package/src/modules/NavigationView/story/NavigationView.stories.tsx +0 -110
- package/src/modules/NavigationView/story/mockData.ts +0 -35
- package/src/modules/QueriesList/QueriesList.scss +0 -10
- package/src/modules/QueriesList/QueriesList.tsx +0 -98
- package/src/modules/QueriesList/index.ts +0 -2
- package/src/modules/QueryStatistics/QueryStatistics.scss +0 -3
- package/src/modules/QueryStatistics/QueryStatistics.tsx +0 -125
- package/src/modules/QueryStatistics/helpers.ts +0 -96
- package/src/modules/QueryStatistics/i18n/dicts.ts +0 -4
- package/src/modules/QueryStatistics/i18n/en.json +0 -16
- package/src/modules/QueryStatistics/i18n/index.ts +0 -4
- package/src/modules/QueryStatistics/i18n/ru.json +0 -16
- package/src/modules/QueryStatistics/index.ts +0 -13
- package/src/modules/QueryStatistics/internal/MetricCell.scss +0 -12
- package/src/modules/QueryStatistics/internal/MetricCell.tsx +0 -99
- package/src/modules/QueryStatistics/internal/QueryStatisticsTable.scss +0 -8
- package/src/modules/QueryStatistics/internal/QueryStatisticsTable.tsx +0 -135
- package/src/modules/QueryStatistics/internal/QueryStatisticsToolbar.scss +0 -1
- package/src/modules/QueryStatistics/internal/QueryStatisticsToolbar.tsx +0 -61
- package/src/modules/QueryStatistics/story/QueryStatistics.stories.tsx +0 -71
- package/src/modules/RowsList/RowsList.scss +0 -5
- package/src/modules/RowsList/RowsList.tsx +0 -96
- package/src/modules/RowsList/helpers/prepareRowData.ts +0 -61
- package/src/modules/RowsList/index.ts +0 -2
- package/src/modules/SavedQueryRow/SavedQueryRow.scss +0 -20
- package/src/modules/SavedQueryRow/SavedQueryRow.tsx +0 -60
- package/src/modules/SavedQueryRow/index.ts +0 -2
- package/src/modules/SavedQuerySearchRow/SavedQuerySearchRow.scss +0 -15
- package/src/modules/SavedQuerySearchRow/SavedQuerySearchRow.tsx +0 -58
- package/src/modules/SavedQuerySearchRow/index.ts +0 -2
- package/src/modules/TutorialRow/TutorialRow.scss +0 -9
- package/src/modules/TutorialRow/TutorialRow.stories.tsx +0 -43
- package/src/modules/TutorialRow/TutorialRow.tsx +0 -25
- package/src/modules/TutorialRow/index.ts +0 -2
- package/src/modules/TutorialSearchRow/TutorialSearchRow.scss +0 -5
- package/src/modules/TutorialSearchRow/TutorialSearchRow.stories.tsx +0 -44
- package/src/modules/TutorialSearchRow/TutorialSearchRow.tsx +0 -33
- package/src/modules/TutorialSearchRow/index.ts +0 -2
- package/src/modules/index.ts +0 -50
- package/src/types/declarations.d.ts +0 -25
- package/src/types/errorTree.ts +0 -30
- package/src/types/forms.ts +0 -33
- package/src/types/history.ts +0 -12
- package/src/types/navigation.ts +0 -209
- package/src/types/pathEditor.ts +0 -29
- package/src/types/queryList.ts +0 -92
- package/src/types/queryResults.ts +0 -48
- package/src/types/queryStatistics.ts +0 -67
- package/src/types/savedQueries.ts +0 -7
- package/src/types/tutorial.ts +0 -3
- package/src/widgets/DashboardCharts/DashboardCharts.scss +0 -25
- package/src/widgets/DashboardCharts/DashboardCharts.tsx +0 -214
- package/src/widgets/DashboardCharts/helpers/chartTypeIcons.ts +0 -33
- package/src/widgets/DashboardCharts/i18n/dicts.ts +0 -4
- package/src/widgets/DashboardCharts/i18n/en.json +0 -7
- package/src/widgets/DashboardCharts/i18n/index.ts +0 -5
- package/src/widgets/DashboardCharts/i18n/ru.json +0 -7
- package/src/widgets/DashboardCharts/index.ts +0 -2
- package/src/widgets/DashboardCharts/internal/EmptyDashboardPlaceholder.tsx +0 -26
- package/src/widgets/DashboardCharts/story/DashboardCharts.stories.scss +0 -6
- package/src/widgets/DashboardCharts/story/DashboardCharts.stories.tsx +0 -77
- package/src/widgets/DashboardCharts/story/mockData.ts +0 -419
- package/src/widgets/DashboardCharts/types.ts +0 -30
- package/src/widgets/QueriesHistory/QueriesHistory.scss +0 -3
- package/src/widgets/QueriesHistory/QueriesHistory.stories.tsx +0 -276
- package/src/widgets/QueriesHistory/QueriesHistory.tsx +0 -71
- package/src/widgets/QueriesHistory/i18n/dicts.ts +0 -4
- package/src/widgets/QueriesHistory/i18n/en.json +0 -3
- package/src/widgets/QueriesHistory/i18n/index.ts +0 -5
- package/src/widgets/QueriesHistory/i18n/ru.json +0 -3
- package/src/widgets/QueriesHistory/index.ts +0 -2
- package/src/widgets/QueriesHistory/internal/HistoryRowContent.tsx +0 -22
- package/src/widgets/QueriesNavigation/QueriesNavigation.scss +0 -9
- package/src/widgets/QueriesNavigation/QueriesNavigation.stories.tsx +0 -409
- package/src/widgets/QueriesNavigation/QueriesNavigation.tsx +0 -195
- package/src/widgets/QueriesNavigation/helpers/createEmptyDetailConfig.tsx +0 -8
- package/src/widgets/QueriesNavigation/helpers/createNavigationDetailResolver.ts +0 -28
- package/src/widgets/QueriesNavigation/helpers/createTableDetailConfig.tsx +0 -127
- package/src/widgets/QueriesNavigation/i18n/dicts.ts +0 -4
- package/src/widgets/QueriesNavigation/i18n/en.json +0 -10
- package/src/widgets/QueriesNavigation/i18n/index.ts +0 -5
- package/src/widgets/QueriesNavigation/i18n/ru.json +0 -10
- package/src/widgets/QueriesNavigation/index.ts +0 -13
- package/src/widgets/QueryResults/QueryResults.scss +0 -25
- package/src/widgets/QueryResults/QueryResults.stories.tsx +0 -155
- package/src/widgets/QueryResults/QueryResults.tsx +0 -121
- package/src/widgets/QueryResults/i18n/dicts.ts +0 -4
- package/src/widgets/QueryResults/i18n/en.json +0 -10
- package/src/widgets/QueryResults/i18n/index.ts +0 -4
- package/src/widgets/QueryResults/i18n/ru.json +0 -12
- package/src/widgets/QueryResults/index.ts +0 -2
- package/src/widgets/QueryResults/internal/QueryResultsSchema.tsx +0 -41
- package/src/widgets/SavedQueries/SavedQueries.scss +0 -3
- package/src/widgets/SavedQueries/SavedQueries.stories.tsx +0 -192
- package/src/widgets/SavedQueries/SavedQueries.tsx +0 -77
- package/src/widgets/SavedQueries/SavedQueryRowContent.tsx +0 -26
- package/src/widgets/SavedQueries/i18n/dicts.ts +0 -4
- package/src/widgets/SavedQueries/i18n/en.json +0 -3
- package/src/widgets/SavedQueries/i18n/index.ts +0 -4
- package/src/widgets/SavedQueries/i18n/ru.json +0 -3
- package/src/widgets/SavedQueries/index.ts +0 -2
- package/src/widgets/TutorialsHistory/TutorialRowContent.tsx +0 -16
- package/src/widgets/TutorialsHistory/TutorialsHistory.scss +0 -3
- package/src/widgets/TutorialsHistory/TutorialsHistory.stories.tsx +0 -135
- package/src/widgets/TutorialsHistory/TutorialsHistory.tsx +0 -63
- package/src/widgets/TutorialsHistory/i18n/dicts.ts +0 -4
- package/src/widgets/TutorialsHistory/i18n/en.json +0 -3
- package/src/widgets/TutorialsHistory/i18n/index.ts +0 -5
- package/src/widgets/TutorialsHistory/i18n/ru.json +0 -3
- package/src/widgets/TutorialsHistory/index.ts +0 -2
- package/src/widgets/index.ts +0 -20
- package/tsconfig.json +0 -20
- package/tsconfig.publish.json +0 -11
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import type {Meta, StoryObj} from '@storybook/react';
|
|
3
|
-
import {Text} from '@gravity-ui/uikit';
|
|
4
|
-
import {EditAttachmentItem, EditLinkValues} from './internal/EditAttachmentItem';
|
|
5
|
-
import {fn} from 'storybook/test';
|
|
6
|
-
|
|
7
|
-
import {AttachmentList, type AttachmentListProps} from './AttachmentList';
|
|
8
|
-
|
|
9
|
-
const attachments: AttachmentListProps['attachments'] = [
|
|
10
|
-
{id: 'readme', name: 'README'},
|
|
11
|
-
{id: 'javascript', name: 'index.js'},
|
|
12
|
-
{id: 'python', name: 'main.py'},
|
|
13
|
-
{id: 'csv', name: 'sales.csv'},
|
|
14
|
-
{id: 'link-image', name: 'https://home/tutorial', link: 'https://home/tutorial'},
|
|
15
|
-
{id: 'excel', name: 'forecast.xlsx'},
|
|
16
|
-
{id: 'cpp', name: 'processor.cpp'},
|
|
17
|
-
{id: 'ql', name: 'analytics.ql'},
|
|
18
|
-
{id: 'yql', name: 'events.yql'},
|
|
19
|
-
{id: 'sql', name: 'report.sql'},
|
|
20
|
-
{id: 'link', name: 'link to file.cpp', link: 'link/to/file.cpp'},
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
const meta = {
|
|
24
|
-
title: 'Components/AttachmentList',
|
|
25
|
-
component: AttachmentList,
|
|
26
|
-
tags: ['autodocs'],
|
|
27
|
-
parameters: {
|
|
28
|
-
layout: 'padded',
|
|
29
|
-
},
|
|
30
|
-
decorators: [
|
|
31
|
-
(Story) => (
|
|
32
|
-
<div style={{width: 360, height: 360}}>
|
|
33
|
-
<Story />
|
|
34
|
-
</div>
|
|
35
|
-
),
|
|
36
|
-
],
|
|
37
|
-
args: {
|
|
38
|
-
attachments,
|
|
39
|
-
onDelete: fn(),
|
|
40
|
-
onEdit: fn(),
|
|
41
|
-
},
|
|
42
|
-
} satisfies Meta<typeof AttachmentList>;
|
|
43
|
-
|
|
44
|
-
export default meta;
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
/** Attachments with supported extensions use their corresponding icons. Row actions appear on hover. */
|
|
48
|
-
export const Default: Story = {};
|
|
49
|
-
|
|
50
|
-
/** `wasAddedIds` and `wasEditedIds` highlight attachments with their current change state. */
|
|
51
|
-
export const ChangeStates: Story = {
|
|
52
|
-
args: {
|
|
53
|
-
wasAddedIds: ['javascript', 'csv'],
|
|
54
|
-
wasEditedIds: ['python', 'sql'],
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** The inherited List filtering API can be enabled when a consumer needs local attachment search. */
|
|
59
|
-
export const Filterable: Story = {
|
|
60
|
-
args: {
|
|
61
|
-
filterable: true,
|
|
62
|
-
filterPlaceholder: 'Filter by attachment name',
|
|
63
|
-
filterItem: (filter) => (attachment) =>
|
|
64
|
-
(attachment as AttachmentListProps['attachments'][number]).name
|
|
65
|
-
.toLocaleLowerCase()
|
|
66
|
-
.includes(filter.toLocaleLowerCase()),
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const InteractiveAttachmentList = (props: AttachmentListProps) => {
|
|
71
|
-
const [currentAttachments, setCurrentAttachments] = useState(props.attachments);
|
|
72
|
-
const [editedIds, setEditedIds] = useState<string[]>([]);
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<AttachmentList
|
|
76
|
-
{...props}
|
|
77
|
-
attachments={currentAttachments}
|
|
78
|
-
wasEditedIds={editedIds}
|
|
79
|
-
onDelete={(attachment) => {
|
|
80
|
-
props.onDelete?.(attachment);
|
|
81
|
-
setCurrentAttachments((current) =>
|
|
82
|
-
current.filter((item) => item.id !== attachment.id),
|
|
83
|
-
);
|
|
84
|
-
setEditedIds((current) => current.filter((id) => id !== attachment.id));
|
|
85
|
-
}}
|
|
86
|
-
onEdit={(attachment) => {
|
|
87
|
-
props.onEdit?.(attachment);
|
|
88
|
-
setEditedIds((current) =>
|
|
89
|
-
current.includes(attachment.id)
|
|
90
|
-
? current.filter((id) => id !== attachment.id)
|
|
91
|
-
: [...current, attachment.id],
|
|
92
|
-
);
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/** Hover a row: edit toggles its edited state and delete removes it from the list. */
|
|
99
|
-
export const InteractiveActions: Story = {
|
|
100
|
-
render: (args) => <InteractiveAttachmentList {...args} />,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const EditableAttachmentList = (props: AttachmentListProps) => {
|
|
104
|
-
const [currentAttachments, setCurrentAttachments] = useState(props.attachments);
|
|
105
|
-
const [editingId, setEditingId] = useState<string>();
|
|
106
|
-
const [draftName, setDraftName] = useState('');
|
|
107
|
-
const [draftLink, setDraftLink] = useState<EditLinkValues>({
|
|
108
|
-
link: '',
|
|
109
|
-
token: '',
|
|
110
|
-
name: '',
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const handleAcceptDraft = () => {
|
|
114
|
-
setCurrentAttachments((prevState) => {
|
|
115
|
-
return prevState.map((attach) => {
|
|
116
|
-
if (attach.id === editingId && attach.link === undefined) {
|
|
117
|
-
return {
|
|
118
|
-
...attach,
|
|
119
|
-
name: draftName,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
if (attach.id === editingId && typeof attach.link === 'string') {
|
|
123
|
-
return {
|
|
124
|
-
...attach,
|
|
125
|
-
name: draftLink.name,
|
|
126
|
-
link: draftLink.link,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
return attach;
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
setDraftName('');
|
|
133
|
-
setEditingId('');
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<AttachmentList
|
|
138
|
-
{...props}
|
|
139
|
-
attachments={currentAttachments}
|
|
140
|
-
editingIds={editingId ? [editingId] : []}
|
|
141
|
-
onDelete={(attach) =>
|
|
142
|
-
setCurrentAttachments((list) => list.filter((l) => l.id !== attach.id))
|
|
143
|
-
}
|
|
144
|
-
onEdit={(attachment) => {
|
|
145
|
-
props.onEdit?.(attachment);
|
|
146
|
-
setEditingId(attachment.id);
|
|
147
|
-
setDraftName(attachment.name);
|
|
148
|
-
if (typeof attachment.link === 'string') {
|
|
149
|
-
setDraftLink({...draftLink, name: attachment.name, link: attachment.link});
|
|
150
|
-
}
|
|
151
|
-
}}
|
|
152
|
-
renderEditForm={(attachment) => {
|
|
153
|
-
const isLink = typeof attachment.link === 'string';
|
|
154
|
-
|
|
155
|
-
if (isLink) {
|
|
156
|
-
return (
|
|
157
|
-
<EditAttachmentItem
|
|
158
|
-
onCancel={() => setEditingId('')}
|
|
159
|
-
onAccept={handleAcceptDraft}
|
|
160
|
-
values={draftLink}
|
|
161
|
-
onChange={setDraftLink}
|
|
162
|
-
tokens={[
|
|
163
|
-
{value: 'default_database_logs', title: 'default_database_logs'},
|
|
164
|
-
{value: 'default_yt', title: 'default_yt'},
|
|
165
|
-
{value: 'default_yql', title: 'default_yql'},
|
|
166
|
-
{
|
|
167
|
-
value: 'default_long_token_title',
|
|
168
|
-
title: 'default_long_token_title',
|
|
169
|
-
},
|
|
170
|
-
]}
|
|
171
|
-
type={'link'}
|
|
172
|
-
/>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return (
|
|
177
|
-
<EditAttachmentItem
|
|
178
|
-
fileName={draftName}
|
|
179
|
-
onChangeFileName={setDraftName}
|
|
180
|
-
onCancel={() => setEditingId('')}
|
|
181
|
-
onAccept={handleAcceptDraft}
|
|
182
|
-
type={'file'}
|
|
183
|
-
/>
|
|
184
|
-
);
|
|
185
|
-
}}
|
|
186
|
-
/>
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/** Hover a row and click edit to replace it with a consumer-provided rename form. */
|
|
191
|
-
export const CustomEditForm: Story = {
|
|
192
|
-
render: (args) => <EditableAttachmentList {...args} />,
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const SortableAttachmentList = (props: AttachmentListProps) => {
|
|
196
|
-
const [orderedAttachments, setOrderedAttachments] = useState(props.attachments);
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<AttachmentList
|
|
200
|
-
{...props}
|
|
201
|
-
attachments={orderedAttachments}
|
|
202
|
-
onSortEnd={({oldIndex, newIndex}) => {
|
|
203
|
-
props.onSortEnd?.({oldIndex, newIndex});
|
|
204
|
-
setOrderedAttachments((current) => {
|
|
205
|
-
const next = [...current];
|
|
206
|
-
const [movedAttachment] = next.splice(oldIndex, 1);
|
|
207
|
-
|
|
208
|
-
if (movedAttachment) {
|
|
209
|
-
next.splice(newIndex, 0, movedAttachment);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return next;
|
|
213
|
-
});
|
|
214
|
-
}}
|
|
215
|
-
/>
|
|
216
|
-
);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
/** Drag attachments by the handle to reorder them using the inherited List sorting API. */
|
|
220
|
-
export const Sortable: Story = {
|
|
221
|
-
args: {
|
|
222
|
-
sortable: true,
|
|
223
|
-
sortHandleAlign: 'left',
|
|
224
|
-
onSortEnd: fn(),
|
|
225
|
-
},
|
|
226
|
-
render: (args) => <SortableAttachmentList {...args} />,
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
/** Consumer-provided content is displayed when the attachment array is empty. */
|
|
230
|
-
export const Empty: Story = {
|
|
231
|
-
args: {
|
|
232
|
-
attachments: [],
|
|
233
|
-
emptyPlaceholder: <Text color="secondary">No attachments yet</Text>,
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/** The inherited loading state can be used while the attachment collection is being fetched. */
|
|
238
|
-
export const Loading: Story = {
|
|
239
|
-
args: {
|
|
240
|
-
attachments: [],
|
|
241
|
-
loading: true,
|
|
242
|
-
},
|
|
243
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, {ReactNode, useMemo} from 'react';
|
|
2
|
-
import {Flex, List, ListProps} from '@gravity-ui/uikit';
|
|
3
|
-
import {AttachmentItem, AttachmentItemProps} from './internal/AttachmentItem/AttachmentItem';
|
|
4
|
-
import './AttachmentList.scss';
|
|
5
|
-
|
|
6
|
-
export type AttachmentListProps = Omit<ListProps, 'items' | 'selectedItemIndex' | 'virtualized'> & {
|
|
7
|
-
attachments: AttachmentItemProps['attachment'][];
|
|
8
|
-
className?: string;
|
|
9
|
-
onDelete?: (attachment: AttachmentItemProps['attachment']) => void;
|
|
10
|
-
onEdit?: (attachment: AttachmentItemProps['attachment']) => void;
|
|
11
|
-
onRevert?: (attachment: AttachmentItemProps['attachment']) => void;
|
|
12
|
-
|
|
13
|
-
renderEditForm?: (attachment: AttachmentItemProps['attachment']) => ReactNode;
|
|
14
|
-
|
|
15
|
-
wasAddedIds?: string[];
|
|
16
|
-
wasEditedIds?: string[];
|
|
17
|
-
|
|
18
|
-
editingIds?: string[];
|
|
19
|
-
|
|
20
|
-
isDeleted?: boolean;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const AttachmentList = ({
|
|
24
|
-
attachments,
|
|
25
|
-
onEdit,
|
|
26
|
-
onDelete,
|
|
27
|
-
onRevert,
|
|
28
|
-
wasAddedIds,
|
|
29
|
-
wasEditedIds,
|
|
30
|
-
editingIds,
|
|
31
|
-
renderEditForm,
|
|
32
|
-
className,
|
|
33
|
-
isDeleted,
|
|
34
|
-
...listProps
|
|
35
|
-
}: AttachmentListProps) => {
|
|
36
|
-
const addedIdsSet = useMemo(() => new Set(wasAddedIds), [wasAddedIds]);
|
|
37
|
-
const editedIdsSet = useMemo(() => new Set(wasEditedIds), [wasEditedIds]);
|
|
38
|
-
const editingIdsSet = useMemo(() => new Set(editingIds), [editingIds]);
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Flex className={className} width="100%" height="100%">
|
|
42
|
-
<List<AttachmentListProps['attachments'][number]>
|
|
43
|
-
filterable={false}
|
|
44
|
-
virtualized={false}
|
|
45
|
-
items={attachments}
|
|
46
|
-
renderItem={(attachment) => {
|
|
47
|
-
if (editingIdsSet.has(attachment.id)) {
|
|
48
|
-
return renderEditForm?.(attachment);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<AttachmentItem
|
|
53
|
-
attachment={attachment}
|
|
54
|
-
wasAdded={addedIdsSet.has(attachment.id)}
|
|
55
|
-
wasEdited={editedIdsSet.has(attachment.id)}
|
|
56
|
-
onEdit={onEdit}
|
|
57
|
-
onRevert={onRevert}
|
|
58
|
-
onDelete={onDelete}
|
|
59
|
-
isDeleted={isDeleted}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
}}
|
|
63
|
-
{...listProps}
|
|
64
|
-
/>
|
|
65
|
-
</Flex>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {AbbrQl, AbbrSql, FileCode, LayoutList, LogoNodejs, LogoPython} from '@gravity-ui/icons';
|
|
2
|
-
import {LogoCPlusPlus} from '../../Icons';
|
|
3
|
-
|
|
4
|
-
const iconMatcher = {
|
|
5
|
-
js: LogoNodejs,
|
|
6
|
-
ql: AbbrQl,
|
|
7
|
-
sql: AbbrSql,
|
|
8
|
-
yql: AbbrSql,
|
|
9
|
-
py: LogoPython,
|
|
10
|
-
csv: LayoutList,
|
|
11
|
-
xls: LayoutList,
|
|
12
|
-
xlsx: LayoutList,
|
|
13
|
-
cpp: LogoCPlusPlus,
|
|
14
|
-
unknown: FileCode,
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
export const getAttachmentExtension = (attachmentName: string) => {
|
|
18
|
-
const name = attachmentName.split('/').pop();
|
|
19
|
-
|
|
20
|
-
if (name === undefined) return 'unknown';
|
|
21
|
-
|
|
22
|
-
const index = name?.lastIndexOf('.');
|
|
23
|
-
|
|
24
|
-
if (index === undefined) return 'unknown';
|
|
25
|
-
|
|
26
|
-
const extension = index > 0 ? name.slice(index + 1) : '';
|
|
27
|
-
|
|
28
|
-
if (extension in iconMatcher) return extension as keyof typeof iconMatcher;
|
|
29
|
-
|
|
30
|
-
return 'unknown';
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getAttachmentIcon = (attachmentName: string) => {
|
|
34
|
-
const extension = getAttachmentExtension(attachmentName);
|
|
35
|
-
return iconMatcher[extension];
|
|
36
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {stringRequiredValidator} from './stringRequiredValidator';
|
|
2
|
-
|
|
3
|
-
export type EditLinkErrors = Partial<{
|
|
4
|
-
link: string;
|
|
5
|
-
token: string;
|
|
6
|
-
name: string;
|
|
7
|
-
}>;
|
|
8
|
-
|
|
9
|
-
export type ObjectLinkValidator = (
|
|
10
|
-
values: Record<string, unknown>,
|
|
11
|
-
isTokenRequired?: boolean,
|
|
12
|
-
) => EditLinkErrors | null;
|
|
13
|
-
|
|
14
|
-
export const objectLinkValidator = (values: Record<string, unknown>, isTokenRequired?: boolean) => {
|
|
15
|
-
const patchErrors: Partial<EditLinkErrors> = {};
|
|
16
|
-
|
|
17
|
-
const linkError = stringRequiredValidator(values.link);
|
|
18
|
-
|
|
19
|
-
if (linkError) {
|
|
20
|
-
patchErrors['link'] = linkError;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const tokenError = isTokenRequired ? stringRequiredValidator(values.token) : null;
|
|
24
|
-
|
|
25
|
-
if (tokenError) {
|
|
26
|
-
patchErrors['token'] = tokenError;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const nameError = stringRequiredValidator(values.name);
|
|
30
|
-
|
|
31
|
-
if (nameError) {
|
|
32
|
-
patchErrors['name'] = nameError;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (Object.keys(patchErrors).length === 0) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return patchErrors;
|
|
40
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import i18n from '../i18n';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_MAX_LENGTH = 256;
|
|
4
|
-
|
|
5
|
-
export type Validator = (value: unknown) => string | null;
|
|
6
|
-
|
|
7
|
-
export const stringRequiredValidator: Validator = (
|
|
8
|
-
value: unknown,
|
|
9
|
-
maxLength: number = DEFAULT_MAX_LENGTH,
|
|
10
|
-
) => {
|
|
11
|
-
if (typeof value !== 'string') {
|
|
12
|
-
return i18n('alert_value-must-be-string');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (!value.trim()) {
|
|
16
|
-
return i18n('alert_required-field');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (value.length > maxLength) {
|
|
20
|
-
return i18n('alert_max-length', {maxLength});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return null;
|
|
24
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const useKeyDownFormControl = (onAccept: () => void, onCancel: () => void) => {
|
|
2
|
-
const handleInputKeyDown = (
|
|
3
|
-
event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>,
|
|
4
|
-
) => {
|
|
5
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
|
6
|
-
event.preventDefault();
|
|
7
|
-
onAccept();
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const handleEditorKeyDown = (event: React.KeyboardEvent<'div'>) => {
|
|
12
|
-
if (event.key !== 'Escape' || event.nativeEvent.isComposing) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
event.preventDefault();
|
|
17
|
-
event.stopPropagation();
|
|
18
|
-
onCancel?.();
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return {handleInputKeyDown, handleEditorKeyDown};
|
|
22
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {useLayoutEffect, useRef, useState} from 'react';
|
|
2
|
-
|
|
3
|
-
export const useLabelRef = (labelText: string) => {
|
|
4
|
-
const labelRef = useRef<HTMLLabelElement>(null);
|
|
5
|
-
const [labelWidth, setLabelWidth] = useState(0);
|
|
6
|
-
|
|
7
|
-
useLayoutEffect(() => {
|
|
8
|
-
const label = labelRef.current;
|
|
9
|
-
|
|
10
|
-
if (!label) return undefined;
|
|
11
|
-
|
|
12
|
-
const updateLabelWidth = () => setLabelWidth(label.offsetWidth);
|
|
13
|
-
|
|
14
|
-
updateLabelWidth();
|
|
15
|
-
|
|
16
|
-
if (typeof ResizeObserver === 'undefined') return undefined;
|
|
17
|
-
|
|
18
|
-
const observer = new ResizeObserver(updateLabelWidth);
|
|
19
|
-
observer.observe(label);
|
|
20
|
-
|
|
21
|
-
return () => observer.disconnect();
|
|
22
|
-
}, [labelText]);
|
|
23
|
-
|
|
24
|
-
return {labelRef, labelWidth};
|
|
25
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"field_link": "Link:",
|
|
3
|
-
"field_token": "Token:",
|
|
4
|
-
"field_name": "Name:",
|
|
5
|
-
"action_save": "Save",
|
|
6
|
-
"action_cancel": "Cancel",
|
|
7
|
-
"alert_value-must-be-string": "Value must be a string",
|
|
8
|
-
"alert_required-field": "Required field",
|
|
9
|
-
"alert_max-length": "Maximum length is {{maxLength}}"
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"field_link": "Ссылка:",
|
|
3
|
-
"field_token": "Токен:",
|
|
4
|
-
"field_name": "Имя:",
|
|
5
|
-
"action_save": "Сохранить",
|
|
6
|
-
"action_cancel": "Отменить",
|
|
7
|
-
"alert_value-must-be-string": "Значение должно быть строкой",
|
|
8
|
-
"alert_required-field": "Обязательное поле",
|
|
9
|
-
"alert_max-length": "Максимальная длина — {{maxLength}}"
|
|
10
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
.qp-attachment-item {
|
|
2
|
-
&__info {
|
|
3
|
-
flex: 1;
|
|
4
|
-
min-width: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
&__actions {
|
|
8
|
-
flex-shrink: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&__attachment-name {
|
|
12
|
-
flex: 1;
|
|
13
|
-
min-width: 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&_wasAdded {
|
|
17
|
-
background-color: var(--g-color-base-positive-light);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&_wasEdited {
|
|
21
|
-
background-color: var(--g-color-base-info-light);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React, {useMemo, useState} from 'react';
|
|
2
|
-
import {Button, Flex, Icon, Text} from '@gravity-ui/uikit';
|
|
3
|
-
import {ArrowRotateLeft, Link, Pencil, TrashBin} from '@gravity-ui/icons';
|
|
4
|
-
import {getAttachmentIcon} from '../../helpers/getIconByAttachmentName';
|
|
5
|
-
import cn from 'bem-cn-lite';
|
|
6
|
-
import './AttachmentItem.scss';
|
|
7
|
-
|
|
8
|
-
export type AttachmentItemProps = {
|
|
9
|
-
attachment: {id: string; name: string; link?: string};
|
|
10
|
-
wasEdited?: boolean;
|
|
11
|
-
wasAdded?: boolean;
|
|
12
|
-
onEdit?: (attachment: AttachmentItemProps['attachment']) => void;
|
|
13
|
-
onDelete?: (attachment: AttachmentItemProps['attachment']) => void;
|
|
14
|
-
onRevert?: (attachment: AttachmentItemProps['attachment']) => void;
|
|
15
|
-
isDeleted?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const block = cn('qp-attachment-item');
|
|
19
|
-
|
|
20
|
-
export const AttachmentItem = ({
|
|
21
|
-
attachment,
|
|
22
|
-
wasAdded,
|
|
23
|
-
wasEdited,
|
|
24
|
-
onEdit,
|
|
25
|
-
onDelete,
|
|
26
|
-
onRevert,
|
|
27
|
-
isDeleted,
|
|
28
|
-
}: AttachmentItemProps) => {
|
|
29
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
30
|
-
|
|
31
|
-
const attachmentIcon = useMemo(() => {
|
|
32
|
-
if (typeof attachment.link === 'string') return Link;
|
|
33
|
-
return getAttachmentIcon(attachment.name);
|
|
34
|
-
}, [attachment.name, attachment.link]);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Flex
|
|
38
|
-
width="100%"
|
|
39
|
-
height="32px"
|
|
40
|
-
onMouseEnter={() => setIsHovered(true)}
|
|
41
|
-
onMouseLeave={() => setIsHovered(false)}
|
|
42
|
-
alignItems="center"
|
|
43
|
-
justifyContent="space-between"
|
|
44
|
-
spacing={{px: 4}}
|
|
45
|
-
className={block({wasEdited, wasAdded})}
|
|
46
|
-
>
|
|
47
|
-
<Flex gap={2} alignItems="center" className={block('info')}>
|
|
48
|
-
<Icon width={16} className={block('attachment-icon')} data={attachmentIcon} />
|
|
49
|
-
<Text variant="body-1" ellipsis className={block('attachment-name')}>
|
|
50
|
-
{attachment.name}
|
|
51
|
-
</Text>
|
|
52
|
-
</Flex>
|
|
53
|
-
|
|
54
|
-
{isHovered && !isDeleted && (
|
|
55
|
-
<Flex gap={1} className={block('actions')}>
|
|
56
|
-
<Button size="s" view="flat" onClick={() => onEdit?.(attachment)}>
|
|
57
|
-
<Icon data={Pencil} />
|
|
58
|
-
</Button>
|
|
59
|
-
|
|
60
|
-
<Button size="s" view="flat" onClick={() => onDelete?.(attachment)}>
|
|
61
|
-
<Icon data={TrashBin} />
|
|
62
|
-
</Button>
|
|
63
|
-
</Flex>
|
|
64
|
-
)}
|
|
65
|
-
|
|
66
|
-
{isHovered && isDeleted && (
|
|
67
|
-
<Flex gap={1} className={block('actions')}>
|
|
68
|
-
<Button size="s" view="flat" onClick={() => onRevert?.(attachment)}>
|
|
69
|
-
<Icon data={ArrowRotateLeft} />
|
|
70
|
-
</Button>
|
|
71
|
-
</Flex>
|
|
72
|
-
)}
|
|
73
|
-
</Flex>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {FileEdit} from './FileEdit';
|
|
3
|
-
import {EditLinkItem} from './EditLinkItem';
|
|
4
|
-
import type {EditFileItemProps} from './FileEdit';
|
|
5
|
-
import type {EditLinkItemProps} from './EditLinkItem';
|
|
6
|
-
|
|
7
|
-
export type EditAttachmentItemProps =
|
|
8
|
-
| (EditFileItemProps & {
|
|
9
|
-
type: 'file';
|
|
10
|
-
})
|
|
11
|
-
| (EditLinkItemProps & {
|
|
12
|
-
type: 'link';
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const EditAttachmentItem = ({...props}: EditAttachmentItemProps) => {
|
|
16
|
-
if (props.type === 'file') {
|
|
17
|
-
return <FileEdit {...props} />;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return <EditLinkItem {...props} />;
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.edit-link-item {
|
|
2
|
-
&__link-field-container {
|
|
3
|
-
padding: 1px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
&__link-field-label {
|
|
7
|
-
position: absolute;
|
|
8
|
-
z-index: 1;
|
|
9
|
-
inset-block-start: calc(var(--g-spacing-1) + 1px);
|
|
10
|
-
inset-inline-start: var(--g-spacing-2);
|
|
11
|
-
font-weight: 600;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.g-select {
|
|
15
|
-
padding: 1px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.g-text-input {
|
|
19
|
-
padding: 1px;
|
|
20
|
-
}
|
|
21
|
-
}
|