tsgrid-ui 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.
- package/CHANGELOG.md +50 -0
- package/LICENSE +22 -0
- package/MIGRATION-FROM-W2UI.md +191 -0
- package/dist/tsgrid-ui.css +4264 -0
- package/dist/tsgrid-ui.d.ts +2432 -0
- package/dist/tsgrid-ui.es6.js +24236 -0
- package/dist/tsgrid-ui.js +24309 -0
- package/dist/tsgrid-ui.min.css +2 -0
- package/package.json +88 -0
- package/readme.md +107 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **TsGrid UI** will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] — Hard Fork from w2ui v2.1
|
|
6
|
+
|
|
7
|
+
This is the initial public release of **TsGrid UI**, a hard fork of [w2ui](https://github.com/vitmalina/w2ui) by Vit Malina. See [README — Acknowledgments](README.md#acknowledgments) for the relationship to upstream and [MIGRATION-FROM-W2UI.md](MIGRATION-FROM-W2UI.md) for the complete renaming map if you're coming from w2ui.
|
|
8
|
+
|
|
9
|
+
### Identity changes (vs upstream w2ui v2.x)
|
|
10
|
+
|
|
11
|
+
- **Package name**: `w2ui` → `tsgrid-ui` (npm public registry).
|
|
12
|
+
- **Version reset**: starts at 1.0.0 (this is project v1; upstream w2ui continues independently).
|
|
13
|
+
- **JS globals renamed**: `w2grid` → `TsGrid`, `w2form` → `TsForm`, `w2field` → `TsField`, `w2layout` → `TsLayout`, `w2sidebar` → `TsSidebar`, `w2tabs` → `TsTabs`, `w2toolbar` → `TsToolbar`, `w2tooltip` → `TsTooltip`, `w2popup` → `TsPopup`. Helpers: `w2alert`/`w2confirm`/`w2prompt`/`w2color`/`w2date`/`w2menu`/`Dialog`/`w2utils`/`w2base`/`w2event`/`w2locale` → `TsAlert`/`TsConfirm`/`TsPrompt`/`TsColor`/`TsDate`/`TsMenu`/`TsDialog`/`TsUtils`/`TsBase`/`TsEvent`/`TsLocale`. Registry `w2ui` → `TsUi`. `query` and `Tooltip` (class name) kept unchanged.
|
|
14
|
+
- **TypeScript types renamed**: all `W2*Foo` types → `TsFoo` (e.g. `W2GridColumn` → `TsGridColumn`, `W2GridCellSelection` → `TsGridCellSelection`). Brand types `RecId`, `LayoutPanelId`, `FieldName` are kept (semantic, not library-tied).
|
|
15
|
+
- **CSS class prefix**: `.w2ui-*` → `.tsg-*` (~1500 reemplazos across source and stylesheets).
|
|
16
|
+
- **iconfont**: family name `w2ui-font` → `tsgrid-font`; classes `w2ui-icon-*` → `tsg-icon-*`.
|
|
17
|
+
- **dist filenames**: `dist/w2ui.{js,es6.js,d.ts,css}` → `dist/tsgrid-ui.{js,es6.js,d.ts,css}` (and minified variants).
|
|
18
|
+
- **jQuery compatibility shim removed**: `w2compat.ts` was deleted. TsGrid is ESM-native and does not register `$.fn.w2grid` etc. If you need jQuery support, use upstream w2ui.
|
|
19
|
+
- **Repo cleanup**: `demos/`, `server/`, `baseline/`, `es6mods/`, `libs/` moved to `legacy/` (excluded from npm publish).
|
|
20
|
+
- **License**: dual copyright — preserves `(c) 2014 Vit Malina` per MIT terms, adds `(c) 2026 DaverSoGT` for the fork.
|
|
21
|
+
|
|
22
|
+
### Inherited from the w2ui v2.1 TypeScript port (pre-fork)
|
|
23
|
+
|
|
24
|
+
These changes were applied to the local v2.1 baseline before the fork; they are preserved verbatim in TsGrid v1.0:
|
|
25
|
+
|
|
26
|
+
- **Full TypeScript-native source**: 17 `.ts` files (14 widgets + 2 barrels + 1 types), zero `.js` in `src/`.
|
|
27
|
+
- **Strict mode**: `strict`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`, `noImplicitOverride`, `noPropertyAccessFromIndexSignature`. Zero `@ts-nocheck`.
|
|
28
|
+
- **Bundler**: tsup (esbuild) for JS — dual ESM + CJS + `.d.ts` rollup. Gulp retains Less + iconfont.
|
|
29
|
+
- **`.d.ts` rollup**: single file with all public exports.
|
|
30
|
+
- **Branded primitive types**: `RecId`, `LayoutPanelId`, `FieldName` (compile-only, zero runtime cost).
|
|
31
|
+
- **Discriminated `getSelection`**: `TsGrid.getSelectionRows()` + `TsGrid.getSelectionCells()` typed methods plus a back-compat wrapper that returns `RecId[] | number[] | TsGridCellSelection[]` (no longer `any[]`).
|
|
32
|
+
- **Vitest unit test suite**: 84 tests across `TsUtils` helpers, `TsBase` event system, and `types` brands.
|
|
33
|
+
- **Playwright smoke harness**: 38 tests across all widgets at three viewport sizes.
|
|
34
|
+
- **Consumer-smoke gate**: independent `tsc --noEmit` of the public API surface as a consumer would import it.
|
|
35
|
+
- **Bug fixes uncovered during the TS port**:
|
|
36
|
+
- `'fuction'` typo in `prepareParams()` (silently ignored custom-function `dataType`).
|
|
37
|
+
- Two `??` always-left branches in `w2form` and `w2grid` save error handlers.
|
|
38
|
+
- Type mismatch in `w2grid` line-number column fallback (`{ field: col_ind }` number → string).
|
|
39
|
+
- `w2sidebar.getNodeHTML()` referenced `window.self` instead of the local instance.
|
|
40
|
+
- **Behavioral notes preserved**:
|
|
41
|
+
- `TsForm` input/textarea handlers use delegated-event objects (`{ delegate: 'input, textarea' }`).
|
|
42
|
+
- `TsUtils.locale()` returns `Promise<{ file, data } | void>`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Pre-fork history (w2ui v2.x)
|
|
47
|
+
|
|
48
|
+
The pre-fork local commit chain (53 ts-port commits + 16 follow-up commits leading up to v2.1 final) is preserved in git history under the same `master` branch. See git log between the initial port commit and the F1 sealing commit (`d90c038e`) for detail.
|
|
49
|
+
|
|
50
|
+
For upstream w2ui releases (v1.x stable, v2.0 RC), refer to [vitmalina/w2ui releases](https://github.com/vitmalina/w2ui/releases).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Vit Malina <vitmalina@gmail.com>
|
|
4
|
+
Copyright (c) 2026 DaverSoGT <jodaniheso@gmail.com>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Migration Guide — w2ui v2.x → tsgrid-ui v1.0.0
|
|
2
|
+
|
|
3
|
+
This guide documents every renaming you need to apply when migrating an existing **w2ui** v2.0/v2.1 project to **tsgrid-ui** v1.0.0. The runtime API is **functionally identical** — every method, option, and event is preserved — but identifiers changed at every layer (package name, JS globals, TypeScript types, CSS classes, dist filenames).
|
|
4
|
+
|
|
5
|
+
> **Why fork?** TsGrid UI is a TypeScript-native, ESM-first redistribution of the original w2ui codebase by Vit Malina (2014, MIT). It removes the jQuery shim, modernizes the build pipeline (tsup + esbuild instead of Gulp regex concat), and ships a `.d.ts` rollup. The original project remains independently maintained at [vitmalina/w2ui](https://github.com/vitmalina/w2ui). License preserves the original copyright per MIT terms.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm remove w2ui
|
|
13
|
+
pnpm add tsgrid-ui
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```diff
|
|
17
|
+
- import { w2grid } from 'w2ui'
|
|
18
|
+
- import 'w2ui/css'
|
|
19
|
+
+ import { TsGrid } from 'tsgrid-ui'
|
|
20
|
+
+ import 'tsgrid-ui/css'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's the smallest possible diff. The rest of this guide enumerates the full rename map for `git grep` / sed / IDE find-replace flows.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. Package + dist filenames
|
|
28
|
+
|
|
29
|
+
| Before | After |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `w2ui` | `tsgrid-ui` |
|
|
32
|
+
| `dist/w2ui.js` | `dist/tsgrid-ui.js` |
|
|
33
|
+
| `dist/w2ui.es6.js` | `dist/tsgrid-ui.es6.js` |
|
|
34
|
+
| `dist/w2ui.d.ts` | `dist/tsgrid-ui.d.ts` |
|
|
35
|
+
| `dist/w2ui.css` | `dist/tsgrid-ui.css` |
|
|
36
|
+
| `dist/w2ui.min.css` | `dist/tsgrid-ui.min.css` |
|
|
37
|
+
|
|
38
|
+
ESM consumers benefit from the `exports` map — `import 'tsgrid-ui'` and `import 'tsgrid-ui/css'` both resolve. (The `/dark` subpath was advertised by upstream w2ui but never had a generated artifact; tsgrid-ui v1.0 drops it. A real dark theme can be added in a future minor.)
|
|
39
|
+
|
|
40
|
+
## 2. JavaScript globals (widget classes)
|
|
41
|
+
|
|
42
|
+
| Before | After |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `w2grid` | `TsGrid` |
|
|
45
|
+
| `w2form` | `TsForm` |
|
|
46
|
+
| `w2field` | `TsField` |
|
|
47
|
+
| `w2layout` | `TsLayout` |
|
|
48
|
+
| `w2sidebar` | `TsSidebar` |
|
|
49
|
+
| `w2tabs` | `TsTabs` |
|
|
50
|
+
| `w2toolbar` | `TsToolbar` |
|
|
51
|
+
| `w2tooltip` | `TsTooltip` |
|
|
52
|
+
| `w2popup` | `TsPopup` |
|
|
53
|
+
|
|
54
|
+
```diff
|
|
55
|
+
- const grid = new w2grid({ name: 'mygrid', columns, records })
|
|
56
|
+
+ const grid = new TsGrid({ name: 'mygrid', columns, records })
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 3. JavaScript globals (helpers + utilities)
|
|
60
|
+
|
|
61
|
+
| Before | After |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `w2alert` | `TsAlert` |
|
|
64
|
+
| `w2confirm` | `TsConfirm` |
|
|
65
|
+
| `w2prompt` | `TsPrompt` |
|
|
66
|
+
| `w2color` | `TsColor` |
|
|
67
|
+
| `w2date` | `TsDate` |
|
|
68
|
+
| `w2menu` | `TsMenu` |
|
|
69
|
+
| `Dialog` | `TsDialog` |
|
|
70
|
+
| `w2utils` | `TsUtils` |
|
|
71
|
+
| `w2locale` | `TsLocale` |
|
|
72
|
+
| `w2base` | `TsBase` |
|
|
73
|
+
| `w2event` | `TsEvent` |
|
|
74
|
+
| `w2ui` (instance registry) | `TsUi` |
|
|
75
|
+
|
|
76
|
+
**Unchanged**: `query` (the DOM helper) and `Tooltip` (class name) keep their identifiers.
|
|
77
|
+
|
|
78
|
+
```diff
|
|
79
|
+
- w2alert('Saved!')
|
|
80
|
+
+ TsAlert('Saved!')
|
|
81
|
+
|
|
82
|
+
- w2utils.isEmail(value)
|
|
83
|
+
+ TsUtils.isEmail(value)
|
|
84
|
+
|
|
85
|
+
- if (w2ui['mygrid']) w2ui['mygrid'].refresh()
|
|
86
|
+
+ if (TsUi['mygrid']) TsUi['mygrid'].refresh()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 4. TypeScript types
|
|
90
|
+
|
|
91
|
+
All `W2*` interfaces and types renamed to `Ts*`:
|
|
92
|
+
|
|
93
|
+
| Before | After |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `W2GridColumn` | `TsGridColumn` |
|
|
96
|
+
| `W2GridSearch` | `TsGridSearch` |
|
|
97
|
+
| `W2GridSelection` | `TsGridSelection` |
|
|
98
|
+
| `W2GridCellSelection` | `TsGridCellSelection` |
|
|
99
|
+
| `W2GridRange` | `TsGridRange` |
|
|
100
|
+
| `W2GridRangeEndpoint` | `TsGridRangeEndpoint` |
|
|
101
|
+
| `W2GridSearchFilter` | `TsGridSearchFilter` |
|
|
102
|
+
| `W2GridRecord` | `TsGridRecord` |
|
|
103
|
+
| `W2EventData` | `TsEventData` |
|
|
104
|
+
| `W2EventListener` | `TsEventListener` |
|
|
105
|
+
| `W2LayoutPanel` | `TsLayoutPanel` |
|
|
106
|
+
| `W2FieldElement` | `TsFieldElement` |
|
|
107
|
+
| `W2LockOptions` | `TsLockOptions` |
|
|
108
|
+
| `W2TimeResult` | `TsTimeResult` |
|
|
109
|
+
| `W2MessageProm` | `TsMessageProm` |
|
|
110
|
+
| `W2Color` | **`TsColorRgb`** (special case — disambig from `TsColor` helper) |
|
|
111
|
+
|
|
112
|
+
Plus all the `W2Field*` / `W2Sidebar*` / `W2Grid*` option interfaces (`W2FieldNumericOptions` → `TsFieldNumericOptions`, etc.). Find-replace `\bW2([A-Z])` → `Ts$1` covers all of them in one pass.
|
|
113
|
+
|
|
114
|
+
**Brand types unchanged** (semantic, not library-prefixed): `RecId`, `LayoutPanelId`, `FieldName`.
|
|
115
|
+
|
|
116
|
+
## 5. CSS classes
|
|
117
|
+
|
|
118
|
+
The `.w2ui-*` prefix becomes `.tsg-*` everywhere:
|
|
119
|
+
|
|
120
|
+
| Before | After |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `.w2ui-grid-data` | `.tsg-grid-data` |
|
|
123
|
+
| `.w2ui-form-field` | `.tsg-form-field` |
|
|
124
|
+
| `.w2ui-toolbar-btn` | `.tsg-toolbar-btn` |
|
|
125
|
+
| `.w2ui-icon-search` | `.tsg-icon-search` |
|
|
126
|
+
| `.w2ui-icon-arrow` | `.tsg-icon-arrow` |
|
|
127
|
+
| ... (all 1500+ classes) | replace prefix `w2ui-` → `tsg-` |
|
|
128
|
+
|
|
129
|
+
Sed/find-replace pattern: `s/\bw2ui-/tsg-/g`.
|
|
130
|
+
|
|
131
|
+
## 6. iconfont
|
|
132
|
+
|
|
133
|
+
Font family + class prefix:
|
|
134
|
+
|
|
135
|
+
| Before | After |
|
|
136
|
+
|---|---|
|
|
137
|
+
| `font-family: 'w2ui-font'` | `font-family: 'tsgrid-font'` |
|
|
138
|
+
| `<i class="w2ui-icon-search">` | `<i class="tsg-icon-search">` |
|
|
139
|
+
| `dist/w2ui-font.woff` (embedded base64) | `dist/tsgrid-font.woff` (embedded base64) |
|
|
140
|
+
|
|
141
|
+
The full set of icon names (`box`, `check`, `colors`, `columns`, `cross`, `drop`, `empty`, `eye-dropper`, `info`, `paste`, `pencil`, `plus`, `reload`, ...) is preserved — only the prefix changes.
|
|
142
|
+
|
|
143
|
+
## 7. jQuery support — REMOVED
|
|
144
|
+
|
|
145
|
+
The `w2compat.ts` shim that registered `$.fn.w2grid`, `$.fn.w2form`, `$.fn.w2render`, `$.fn.w2destroy`, `$.fn.w2tag`, `$.fn.w2overlay`, `$.fn.w2menu`, `$.fn.w2color`, `$.fn.w2popup`, `$.fn.w2marker`, `$.fn.w2field` is **gone**. tsgrid-ui is ESM-native.
|
|
146
|
+
|
|
147
|
+
```diff
|
|
148
|
+
- $('#my-grid').w2grid({ name: 'mygrid', columns, records })
|
|
149
|
+
+ const grid = new TsGrid({ name: 'mygrid', columns, records })
|
|
150
|
+
+ grid.render('#my-grid')
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
If you need jQuery plugin syntax, you can still use the original [vitmalina/w2ui](https://github.com/vitmalina/w2ui) project.
|
|
154
|
+
|
|
155
|
+
## 8. Globals registration (legacy `<script>` tag consumers)
|
|
156
|
+
|
|
157
|
+
The IIFE-wrapped CJS bundle (`dist/tsgrid-ui.js`) still attaches widgets to the global `window` for `<script>`-tag consumers:
|
|
158
|
+
|
|
159
|
+
```html
|
|
160
|
+
<script src="https://cdn.jsdelivr.net/npm/tsgrid-ui/dist/tsgrid-ui.js"></script>
|
|
161
|
+
<script>
|
|
162
|
+
// Globals available now: TsGrid, TsForm, TsField, TsLayout, TsSidebar,
|
|
163
|
+
// TsTabs, TsToolbar, TsTooltip, TsPopup, TsAlert, TsConfirm, TsPrompt,
|
|
164
|
+
// TsColor, TsDate, TsMenu, TsDialog, Tooltip, TsUtils, TsLocale,
|
|
165
|
+
// TsBase, TsEvent, TsUi, query
|
|
166
|
+
const grid = new TsGrid({ /* ... */ })
|
|
167
|
+
</script>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## 9. Things that DIDN'T change
|
|
171
|
+
|
|
172
|
+
- All widget options + methods + events (functional behavior is identical)
|
|
173
|
+
- All locale/i18n configuration via `TsUtils.locale(...)`
|
|
174
|
+
- All event handlers, `.on()` / `.off()` / `.trigger()` semantics
|
|
175
|
+
- Selectors API (`query()` is the same DOM helper, same chainable methods)
|
|
176
|
+
- IIFE bundle still exposes globals for legacy `<script>` consumers
|
|
177
|
+
- License: still MIT, with the original Vit Malina (2014) copyright preserved
|
|
178
|
+
|
|
179
|
+
## 10. New in tsgrid-ui v1.0 (vs upstream w2ui v2.x)
|
|
180
|
+
|
|
181
|
+
- Full TypeScript-native source (zero `.js` in `src/`)
|
|
182
|
+
- Strict mode active (`strict`, `noUncheckedIndexedAccess`, etc.) — zero `@ts-nocheck`
|
|
183
|
+
- `.d.ts` rollup with all 23 public exports
|
|
184
|
+
- Branded primitive types (`RecId`, `LayoutPanelId`, `FieldName`)
|
|
185
|
+
- Discriminated `getSelection()` API: prefer the typed split methods `TsGrid.getSelectionRows()` / `TsGrid.getSelectionCells()` over the union-returning legacy wrapper
|
|
186
|
+
- Vitest unit test suite (84 tests covering helpers, events, brands)
|
|
187
|
+
- Modern build via tsup (esbuild) instead of Gulp's regex concat
|
|
188
|
+
|
|
189
|
+
## Help / questions
|
|
190
|
+
|
|
191
|
+
Open an issue at [github.com/DaverSoGT/tsgrid-ui/issues](https://github.com/DaverSoGT/tsgrid-ui/issues). For upstream w2ui questions, use [vitmalina/w2ui/issues](https://github.com/vitmalina/w2ui/issues).
|