vuetable-next 1.0.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.
Files changed (59) hide show
  1. package/.eslintignore +4 -0
  2. package/.idea/easycode.ignore +13 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. package/.idea/jsLinters/eslint.xml +6 -0
  5. package/.idea/material_theme_project_new.xml +13 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/.idea/vuetable-next.iml +12 -0
  9. package/.vscode/extensions.json +3 -0
  10. package/LICENSE +21 -0
  11. package/README.md +102 -0
  12. package/auto-imports.d.ts +21 -0
  13. package/dist/style.css +1 -0
  14. package/dist/vite.svg +1 -0
  15. package/dist/vuetable-next.js +6061 -0
  16. package/dist/vuetable-next.js.map +1 -0
  17. package/dist/vuetable-next.umd.cjs +36 -0
  18. package/dist/vuetable-next.umd.cjs.map +1 -0
  19. package/eslint.config.js +122 -0
  20. package/index.html +161 -0
  21. package/package.json +80 -0
  22. package/public/vite.svg +1 -0
  23. package/src/assets/vue.svg +1 -0
  24. package/src/components/Vuetable.vue +1212 -0
  25. package/src/components/VuetableColGroup.vue +66 -0
  26. package/src/components/VuetableColGutter.vue +25 -0
  27. package/src/components/VuetableCssSemanticUI.ts +36 -0
  28. package/src/components/VuetableFieldCheckbox.vue +87 -0
  29. package/src/components/VuetableFieldCheckboxMixin.vue +46 -0
  30. package/src/components/VuetableFieldHandle.vue +41 -0
  31. package/src/components/VuetableFieldMixin.vue +30 -0
  32. package/src/components/VuetableFieldSequence.vue +43 -0
  33. package/src/components/VuetablePagination.vue +119 -0
  34. package/src/components/VuetablePaginationDropdown.vue +88 -0
  35. package/src/components/VuetablePaginationInfo.vue +51 -0
  36. package/src/components/VuetablePaginationInfoMixin.vue +64 -0
  37. package/src/components/VuetablePaginationMixin.vue +107 -0
  38. package/src/components/VuetableRowHeader.vue +190 -0
  39. package/src/components/useVuetablePagination.ts +56 -0
  40. package/src/components/useVuetablePaginationInfo.ts +40 -0
  41. package/src/data/fields.ts +102 -0
  42. package/src/data/lang.ts +4 -0
  43. package/src/index.ts +59 -0
  44. package/src/main.ts +396 -0
  45. package/src/style.css +79 -0
  46. package/src/vite-env.d.ts +1 -0
  47. package/test/Vuetable.AJAX.test.ts +291 -0
  48. package/test/Vuetable.Composable.test.ts +151 -0
  49. package/test/Vuetable.Computed.test.ts +211 -0
  50. package/test/Vuetable.Features.test.ts +145 -0
  51. package/test/Vuetable.FieldsDefinition.test.ts +236 -0
  52. package/test/Vuetable.HTML.test.ts +16 -0
  53. package/test/Vuetable.Methods.test.ts +373 -0
  54. package/test/__snapshots__/Vuetable.HTML.test.ts.snap +85 -0
  55. package/tsconfig.app.json +32 -0
  56. package/tsconfig.json +16 -0
  57. package/tsconfig.node.json +13 -0
  58. package/vite.config.ts +29 -0
  59. package/vitest.config.ts +17 -0
@@ -0,0 +1,122 @@
1
+ import globals from "globals";
2
+ import pluginJs from "@eslint/js";
3
+ import tseslint from "typescript-eslint";
4
+ import pluginVue from "eslint-plugin-vue";
5
+
6
+
7
+ export default [
8
+ {files: ["**/*.{js,mjs,cjs,ts,vue}"]},
9
+ {languageOptions: { globals: globals.browser }},
10
+ pluginJs.configs.recommended,
11
+ ...tseslint.configs.recommended,
12
+ ...pluginVue.configs["flat/essential"],
13
+ {files: ["**/*.vue"], languageOptions: {parserOptions: {parser: tseslint.parser}}},
14
+ {
15
+ files: ["**/*.ts", "**/*.vue"],
16
+ rules: {
17
+ "vue/multi-word-component-names": "off",
18
+ "no-console": ["warn", { allow: ["error", "debug"] }],
19
+ "vue/attribute-hyphenation": ["error", "always"],
20
+ "vue/valid-define-options": "error",
21
+ quotes: "off",
22
+ "@typescript-eslint/quotes": ["error", "double", { avoidEscape: true }],
23
+ semi: "off",
24
+ "@typescript-eslint/semi": "error",
25
+ "no-self-compare": "error",
26
+ "@typescript-eslint/consistent-type-imports": "error",
27
+ "no-unreachable-loop": "error",
28
+ "@typescript-eslint/no-var-requires": "error",
29
+ "space-before-function-paren": ["warn", "always"],
30
+ "key-spacing": "off",
31
+ "@typescript-eslint/key-spacing": ["error", { beforeColon: false }],
32
+ "keyword-spacing": "off",
33
+ "@typescript-eslint/keyword-spacing": "warn",
34
+ "@typescript-eslint/type-annotation-spacing": "error",
35
+ "@typescript-eslint/ban-ts-comment": "off",
36
+ "@typescript-eslint/no-explicit-any": ["off"],
37
+ "lines-between-class-members": ["error", "always"],
38
+ "@typescript-eslint/naming-convention": [
39
+ "error",
40
+ {
41
+ selector: "enumMember",
42
+ format: ["UPPER_CASE"]
43
+ },
44
+ {
45
+ selector: "enum",
46
+ format: ["PascalCase"],
47
+ suffix: ["Enum"]
48
+ }
49
+ ],
50
+ "@typescript-eslint/no-duplicate-enum-values": "error",
51
+ "vue/block-lang": [
52
+ "warn",
53
+ {
54
+ script: {
55
+ lang: "ts"
56
+ }
57
+ }
58
+ ],
59
+ "vue/v-bind-style": ["error", "shorthand"],
60
+ "vue/v-on-style": ["error", "shorthand"],
61
+ "require-await": "error",
62
+ "semi-spacing": [
63
+ "error",
64
+ {
65
+ before: false,
66
+ after: true
67
+ }
68
+ ],
69
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
70
+ "vue/html-closing-bracket-newline": ["error", {
71
+ "singleline": "never",
72
+ "multiline": "never"
73
+ }],
74
+ "vue/html-self-closing": ["error", {
75
+ "html": {
76
+ "void": "always",
77
+ "normal": "never",
78
+ "component": "never"
79
+ },
80
+ "svg": "always",
81
+ "math": "always"
82
+ }],
83
+ "vue/singleline-html-element-content-newline": ["error", {
84
+ "ignoreWhenNoAttributes": false,
85
+ "ignoreWhenEmpty": false,
86
+ "ignores": ["pre", "textarea"]
87
+ }],
88
+ "vue/html-indent": ["error", 2, {
89
+ "attribute": 1,
90
+ "baseIndent": 1,
91
+ "closeBracket": 0,
92
+ "alignAttributesVertically": true,
93
+ "ignores": []
94
+ }],
95
+ "vue/multiline-html-element-content-newline": ["error", {
96
+ "ignoreWhenEmpty": false,
97
+ "allowEmptyLines": true
98
+ }],
99
+ "vue/attributes-order": ["error", {
100
+ "order": [
101
+ "DEFINITION",
102
+ "CONDITIONALS",
103
+ ["UNIQUE", "SLOT"],
104
+ "TWO_WAY_BINDING",
105
+ ["OTHER_DIRECTIVES", "RENDER_MODIFIERS"],
106
+ "GLOBAL",
107
+ "LIST_RENDERING",
108
+ "ATTR_SHORTHAND_BOOL",
109
+ "ATTR_DYNAMIC",
110
+ "ATTR_STATIC",
111
+ "CONTENT",
112
+ "EVENTS",
113
+ ]
114
+ }],
115
+ "vue/require-explicit-emits": "error",
116
+ "indent": "off",
117
+ "@typescript-eslint/indent": ["error", 2],
118
+ "object-curly-spacing": ["error", "always"],
119
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "warn"
120
+ }
121
+ }
122
+ ];
package/index.html ADDED
@@ -0,0 +1,161 @@
1
+ <!doctype html>
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title>vue-demi</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css" media="screen" title="no title" charset="utf-8">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
9
+ <style type="text/css">
10
+ .ui.vertical.stripe h3 {
11
+ font-size: 2em;
12
+ }
13
+ .secondary.pointing.menu .toc.item {
14
+ display: none;
15
+ }
16
+ .vuetable {
17
+ margin-top: 1em !important;
18
+ }
19
+ .vuetable-wrapper.ui.basic.segment {
20
+ padding: 0em;
21
+ }
22
+ .vuetable button.ui.button {
23
+ padding: .5em .5em;
24
+ font-weight: 400;
25
+ }
26
+ .vuetable button.ui.button i.icon {
27
+ margin: 0;
28
+ }
29
+ .vuetable td i.handle-icon:hover {
30
+ cursor: pointer;
31
+ }
32
+ .vuetable-actions {
33
+ width: 15%;
34
+ padding: 12px 0px;
35
+ text-align: center;
36
+ }
37
+ .vuetable-pagination {
38
+ background: #f9fafb !important;
39
+ }
40
+ .vuetable-pagination-info {
41
+ margin-top: auto;
42
+ margin-bottom: auto;
43
+ }
44
+ .highlight {
45
+ background-color: yellow;
46
+ }
47
+ .vuetable-detail-row {
48
+ height: 200px;
49
+ }
50
+ .detail-row {
51
+ margin-left: 40px;
52
+ }
53
+ .expand-transition {
54
+ transition: all .5s ease;
55
+ }
56
+ .expand-enter, .expand-leave {
57
+ height: 0;
58
+ opacity: 0;
59
+ }
60
+ tr.odd {
61
+ background-color: #e6f5ff;
62
+ }
63
+ body {
64
+ overflow-y: scroll;
65
+ }
66
+ </style>
67
+
68
+ </head>
69
+ <body>
70
+
71
+ <div class="ui vertical segment">
72
+ <div class="ui container">
73
+
74
+ <div id="app" class="ui vertical stripe segment">
75
+
76
+ <div id="content" class="ui basic segment">
77
+
78
+ <h3 class="ui header">List of Users</h3>
79
+
80
+ <div class="ui grid">
81
+ <div class="ui left aligned nine wide column">
82
+ <div class="ui labeled icon input">
83
+ <div class="ui label">Search:</div>
84
+ <input v-model="searchFor" class="ui input" @keyup.enter="setFilter">
85
+ <i class="search icon"></i>
86
+ </div>
87
+ <button class="ui button primary" @click="setFilter">Go</button>
88
+ <button class="ui button" @click="resetFilter">Reset</button>
89
+ </div>
90
+ <div class="ui right aligned seven wide column">
91
+ <button class="ui basic button" id="settingsBtn" @click="showSettingsModal">
92
+ <i class="setting icon"></i>
93
+ Settings
94
+ </button>
95
+ </div>
96
+ </div><!-- ui grid -->
97
+
98
+ <div :class="[{'vuetable-wrapper ui basic segment': true}, loading]">
99
+
100
+ <vuetable ref="vuetable"
101
+ api-url="http://vuetable.ratiw.net/api/users"
102
+ :fields="fields"
103
+ :table-height="tableHeight"
104
+ :transform="transform"
105
+ pagination-path="pagination"
106
+ :sort-order="sortOrder"
107
+ :multi-sort="multiSort"
108
+ :per-page="perPage"
109
+ :append-params="moreParams"
110
+ detail-row-component="my-detail-row"
111
+ detail-row-transition="expand"
112
+ :row-class="rowClassCB"
113
+ @vuetable:pagination-data="onPaginationData"
114
+ @vuetable:load-success="onLoadSuccess"
115
+ @vuetable:loading="showLoader"
116
+ @vuetable:loaded="hideLoader"
117
+ @vuetable:cell-clicked="onCellClicked"
118
+ @vuetable:cell-dblclicked="onCellDoubleClicked"
119
+ @vuetable:cell-rightclicked="onCellRightClicked"
120
+ @vuetable:initialized="onInitialized"
121
+ @vuetable:data-reset="onDataReset"
122
+ @vuetable:field-event="onFieldEvent"
123
+ @vuetable:header-event="onHeaderEvent"
124
+ >
125
+ <template v-slot:slot-actions="props">
126
+ <div slot="slot-actions">
127
+ <button class="ui red button" @click="onActionClicked('view-item', props.rowData)"><i class="zoom icon"></i></button>
128
+ <button class="ui blue button" @click="onActionClicked('edit-item', props.rowData)"><i class="edit icon"></i></button>
129
+ <button class="ui green button" @click="onActionClicked('delete-item', props.rowData)"><i class="delete icon"></i></button>
130
+ </div>
131
+ </template>
132
+ </vuetable>
133
+ <div class="vuetable-pagination ui bottom attached segment grid">
134
+ <vuetable-pagination-info ref="paginationInfo"
135
+ :info-template="paginationInfoTemplate"
136
+ ></vuetable-pagination-info>
137
+ <component :is="paginationComponent" ref="pagination"
138
+ @vuetable-pagination:change-page="onChangePage"
139
+ ></component>
140
+ </div>
141
+
142
+ </div><!-- vuetable-wrapper -->
143
+
144
+ <settings-modal ref="settingsModal"
145
+ :vuetable-fields="vuetableFields"
146
+ :field-prefix="fieldPrefix"
147
+ ></settings-modal>
148
+
149
+ </div><!-- content -->
150
+
151
+ </div><!-- app -->
152
+ </div><!-- ui container -->
153
+
154
+ </div>
155
+
156
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js" charset="utf-8"></script>
157
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.js" charset="utf-8"></script>
158
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
159
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min.js"></script>
160
+ </body>
161
+ </html>
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "vuetable-next",
3
+ "description": "Simple table for displaying data.",
4
+ "version": "1.0.0",
5
+ "author": "Artem Alesenko",
6
+ "type": "module",
7
+ "private": false,
8
+ "PascalCasedName": "VuetableNext",
9
+ "main": "./dist/vuetable-next.umd.js",
10
+ "module": "./dist/vuetable-next.mjs",
11
+ "unpkg": "./dist/vuetable-next.umd.js",
12
+ "license": "MIT",
13
+ "keywords": [
14
+ "vue",
15
+ "vue-demi",
16
+ "component",
17
+ "table",
18
+ "datatable",
19
+ "pagination-components",
20
+ "vite",
21
+ "vitest",
22
+ "vuetable"
23
+ ],
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/vuetable-next.d.ts",
27
+ "import": "./dist/vuetable-next.mjs",
28
+ "require": "./dist/vuetable-next.umd.js"
29
+ },
30
+ "./*": "./*"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/Artles777/vuetable-next/issues"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/Artles777/vuetable-next.git"
38
+ },
39
+ "scripts": {
40
+ "dev": "vite",
41
+ "build": "vite build",
42
+ "preview": "vite preview",
43
+ "test": "vitest"
44
+ },
45
+ "dependencies": {
46
+ "@types/eslint__js": "^8.42.3",
47
+ "axios": "^1.7.7",
48
+ "mitt": "^3.0.1",
49
+ "sweetalert": "^2.1.2",
50
+ "vue-demi": "^0.14.10"
51
+ },
52
+ "peerDependencies": {
53
+ "@vue/composition-api": "^1.0.0-rc.1",
54
+ "vue": "^2.0.0 || >=3.0.0"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "@vue/composition-api": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "@eslint/js": "^8.57.0",
63
+ "@types/jquery": "^3.5.30",
64
+ "@vitejs/plugin-vue": "^5.1.3",
65
+ "@vue/test-utils": "^2.4.6",
66
+ "axios-mock-adapter": "^2.0.0",
67
+ "eslint": "^8.57.0",
68
+ "eslint-plugin-vue": "^9.27.0",
69
+ "globals": "^15.8.0",
70
+ "jsdom": "^25.0.0",
71
+ "promise-polyfill": "^8.3.0",
72
+ "typescript": "^5.5.4",
73
+ "typescript-eslint": "^7.17.0",
74
+ "unplugin-auto-import": "^0.18.2",
75
+ "vite": "^5.3.4",
76
+ "vitest": "^2.0.5",
77
+ "vue": "^3.5.3",
78
+ "vue-tsc": "^2.0.24"
79
+ }
80
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>