Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Next #1060

Merged
merged 42 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3e15f31
PHP 8.0
radimvaculik Dec 27, 2022
1756a8c
Translator: switch from ITranslator to Translator (#973)
f3l1x Jan 24, 2023
49ba4aa
[7.x] Bootstrap 5 + PHP 8 + vanilla javascript (#1021)
f3l1x Jan 24, 2023
df18b43
[7.x] phpstan-deprecation-rules (#1061)
radimvaculik Jan 24, 2023
ab63252
Fix sort
radimvaculik Jan 24, 2023
5e7ffd6
Add method for setting custom Action href, v6.x (#853)
Gappa Jan 25, 2023
7f763b9
[7.x] Nextras ORM 4 support, closes #984
radimvaculik Jan 24, 2023
717305e
Fix ElasticsearchDataSource.php data source (#1041)
Creeperface01 Jan 27, 2023
76be005
Error: Typed property Ublaboo\DataGrid\InlineEdit\InlineEdit::$itemID…
emololftw Jan 31, 2023
df948eb
composer: allow-plugins: php-http/discovery
radimvaculik Feb 10, 2023
c8d24c6
ItemDetailForm: $httpPost: Typed property must not be accessed...
radimvaculik Feb 10, 2023
10bdca8
phpstan: revert --memory-limit=4G
radimvaculik Feb 10, 2023
0e83d37
NetteDatabaseSelectionHelper: Context -> Explorer, getSupplementalDri…
radimvaculik Feb 10, 2023
1aca86d
Update README.md
radimvaculik Mar 7, 2023
dcf66f3
Templates: fix variables
f3l1x Mar 7, 2023
d7bbdac
data-bs-toggle attribute for multiaction button (#1072)
wojtishek Mar 20, 2023
2112c09
dependabot.yml (#1078)
radimvaculik May 6, 2023
292aceb
Allow nette/utils:4.0 (#1077)
radimvaculik May 6, 2023
1be3303
Add onColumnShow and onColumnHide event methods (#1076)
jiriermis May 6, 2023
a8d7184
Return value of BackedEnum when reading Doctrine entity property. (#1…
juniwalk May 6, 2023
e37ca21
Return value of BackedEnum when reading array value (#1083)
juniwalk May 6, 2023
5160029
Added method to check if filter is on default values; Closes #1082 (#…
juniwalk May 6, 2023
158fe10
ublaboo -> contributte (#1067) (#1075)
lilianalillyy May 8, 2023
cf418bb
Delete dependabot.yml
radimvaculik May 10, 2023
fd8691c
Gitignore: remove compat.php
f3l1x Jun 7, 2023
dca24b4
Assets: rewrite to TS and plugin system
f3l1x Jun 7, 2023
b1ae431
Add missing phpdoc type (#1090)
vitkutny Jul 17, 2023
45203e5
fix: resolution name for datagrid -> attribute instead of class
to23mas Aug 2, 2023
2922ad7
Fix timeout utils.ts (#1091)
MartinKokesCz Aug 17, 2023
87acbdd
Typo fixes in docs (#1088)
RYUcze Aug 22, 2023
2e6986d
Housekeep: Fix cs & phpstan issues (#1097)
radimvaculik Aug 22, 2023
bd442ea
Fix: Github Actions: Coverage (#1098)
radimvaculik Aug 22, 2023
9b682ff
Using data-datagrid-name="<name>" instead if data-datagrid-<name>
paveljanda Oct 31, 2023
e33c3af
Fixed CSS: change .datagrid selector to [data-datagrid-name]
paveljanda Nov 2, 2023
bc19f86
Fixed inline edit plugin
paveljanda Nov 2, 2023
9a74127
phpstan fix
paveljanda Nov 3, 2023
bf9d57a
Minor CSS changes for the next verison of datagrid
KrisWav Oct 23, 2023
976291a
Merge branch 'master' into next
radimvaculik Mar 11, 2024
a135d53
Fix cs & phpstan
radimvaculik Mar 11, 2024
78878f3
Fix failing tests
radimvaculik Mar 11, 2024
ba360dc
PHP 8.1 is new minimal version
radimvaculik Mar 11, 2024
100c281
Fix phpstan
radimvaculik Mar 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .docs/actions.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
Table of contents

- [Actions](#actions)
- [Api](#api)
- [Parameters](#parameters)
- [Icon](#icon)
- [Class](#class)
- [Title](#title)
- [Confirmation](#confirmation)
- [Ajax](#ajax)
- [Redrawing the data](#redrawing-the-data)
- [Redrawing one row](#redrawing-one-row)
- [Sortable](#sortable)
- [Sorting handler](#sorting-handler)
- [MultiAction](#multiaction)
- [Item detail](#item-detail)
- [Item detail form](#item-detail-form)
- [Item detail template variables](#item-detail-template-variables)
- [Item detail render condition](#item-detail-render-condition)
- [ActionCallback](#actioncallback)
- [Toolbar button](#toolbar-button)
- [Api](#api)
- [Parameters](#parameters)
- [Icon](#icon)
- [Class](#class)
- [Title](#title)
- [Confirmation](#confirmation)
- [Ajax](#ajax)
- [Redrawing the data](#redrawing-the-data)
- [Redrawing one row](#redrawing-one-row)
- [Sortable](#sortable)
- [Sorting handler](#sorting-handler)
- [MultiAction](#multiaction)
- [Item detail](#item-detail)
- [Item detail form](#item-detail-form)
- [Item detail template variables](#item-detail-template-variables)
- [Item detail render condition](#item-detail-render-condition)
- [ActionCallback](#actioncallback)
- [Toolbar button](#toolbar-button)

# Actions

Expand Down Expand Up @@ -105,7 +105,7 @@ All links are by default not-ajax. Do you see the bold `ajax` class in previous
```php
public function handleDelete($id)
{
$this->connection->delete('ublaboo_example')
$this->connection->delete('example')
->where('id = ?', $id)
->execute();

Expand All @@ -127,7 +127,7 @@ When you are updating row data (i.e. status), you can send only one row as snipp
```php
public function handleSetStatus($id, $status)
{
$this->connection->update('ublaboo_example', ['status' => $satatus])
$this->connection->update('example', ['status' => $satatus])
->where('id = ?', $id)
->execute();

Expand Down Expand Up @@ -242,15 +242,15 @@ The name of the handler used for sorting can be changed:
$grid->setSortableHandler('foo!');
```

Also when you are using datagrid in component, you have to alter the name a bit:
Also, when you are using datagrid in component, you have to alter the name a bit:

```php
$grid->setSortableHandler('myComponent:sort!');
```

## MultiAction

Same as there is column status with pretty dropdown menu, ublaboo datagrid comes with similar dropdown menu for actions. It is called MultiAction:
Same as there is column status with pretty dropdown menu, the datagrid comes with similar dropdown menu for actions. It is called MultiAction:

```php
/**
Expand All @@ -261,7 +261,7 @@ $grid->addMultiAction('multi_action', 'MultiAction')
->addAction('blah2', 'Blahblah2', 'blah!', ['name']);
```

Sure you can alter multiaction class, icons, etc. Same you can change icon, class, etc of nested actions:
Sure you can alter multiaction class, icons, etc. Same you can change icon, class, etc. of nested actions:

```php
$grid->getAction('multi_blah')
Expand Down Expand Up @@ -312,7 +312,7 @@ $grid->setItemsDetailForm(function(Nette\Forms\Container $container) use ($grid,
});
```

DataGrid user template:
Datagrid user template:

```latte
{extends $originalTemplate}
Expand Down Expand Up @@ -361,7 +361,7 @@ $grid->addActionCallback('custom_callback', '')
};
```

You treat `ActionCallback` same as `Action`, except for some arguments passed to the `DataGrid::addActionCallback` method.
You treat `ActionCallback` same as `Action`, except for some arguments passed to the `Datagrid::addActionCallback` method.

## Toolbar button

Expand Down
185 changes: 86 additions & 99 deletions .docs/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,116 +6,103 @@ Table of contents

# Assets

DataGrid needs for its precise functionality some third party scripts and styles. Install all required assets with NPM.
There are prepare JS/TS and CSS files for precise functionality. The best way is to use some frontend bundler, for example [Vite](https://vitejs.dev).

**CSS (external)**
## Installation

- bootstrap
- bootstrap datepicker
- bootstrap select

**CSS**

- datagrid.css
- datagrid-spinners.css

**JS (external)**

- jquery
- nette forms
- nette ajax / naja
- bootstrap
- bootstrap datepicker
- bootstrap select

**JS**

- datagrid.js
- datagrid-instant-url-refresh.js
- datagrid-spinners.js

**Icons**

You will probably want to use some icon font, but that is in your command.
On this project website we use font awesome (you can change the icon prefix by setting new value to static property `DataGrid::$iconPrefix = 'fa fa-';`).

**Spinners**

As you can see, there is also a `datagrid-spinners.js` script in a datagrid repository. If you include this file within you project layout, there are some actions, that will show spinner/some other animation when waiting for ajax response. Actions, that has somehow animated spinner:

- Group actions
- Pagination
- Changing items per page
- Toggling item detail - loading the detail for the first time

## NPM

```
npm install --save ublaboo-datagrid
```

package.json:
You need to install datagrid's assets. For example this way.

```json
{
"dependencies": {
"bootstrap-datepicker": "^1.9",
"bootstrap-select": "^1.13",
"bootstrap": "^4.4.1",
"happy-inputs": "^2.0",
"jquery": "^3.4.1",
"jquery-ui-sortable": "^1.0",
"nette-forms": "^3.0",
"nette.ajax.js": "^2.3",
"popper.js": "^1.14.7",
"ublaboo-datagrid": "^6.2"
}
"dependencies": {
"@contributte/datagrid": "git+ssh://[email protected]:contributte/datagrid.git#next"
}
}
```

## Example html when not using NPM

```html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/src/happy.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-datepicker.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/assets/datagrid.css">

<!-- Use this css for ajax spinners -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/assets/datagrid-spinners.css">

<!-- Include this css when using FilterMultiSelect (silviomoreto.github.io/bootstrap-select) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-select.css">
##

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
</head>
## Demo

<body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/nomodule-es5-fallback.js"></script>
<script>
var happy = new Happy;
Full example of using bundler.

happy.init();
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-datepicker.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/nette.ajax.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/assets/datagrid.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/src/assets/netteForms.min.js"></script>
**package.json**

<!-- It is recommended to include this JS file with just a few bits. It refreshes URL on non ajax request -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/assets/datagrid-instant-url-refresh.js"></script>

<!-- Use this little extension for ajax spinners -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/assets/datagrid-spinners.js"></script>
```json
{
"dependencies": {
"@contributte/datagrid": "git+ssh://[email protected]:contributte/datagrid.git#next",
"@fortawesome/fontawesome-free": "^6.3.0",
"bootstrap": "^5.3.0-alpha3",
"naja": "^2.5.0",
"nette-forms": "^3.3.1",
"prismjs": "^1.29.0",
"sortablejs": "^1.15.0",
"tom-select": "^2.2.2",
"vanillajs-datepicker": "^1.3.1"
},
"devDependencies": {
"@types/bootstrap-select": "^1.13.4",
"@types/jquery": "^3.5.16",
"@types/jqueryui": "^1.12.16",
"@types/sortablejs": "^1.15.1",
"@types/vanillajs-datepicker": "^1.2.1",
"autoprefixer": "^10.4.0",
"typescript": "^4.9.5",
"vite": "^2.6.10"
},
"scripts": {
"watch": "vite build --watch --mode=development",
"build": "vite build --mode=production"
}
}
```

<!-- Include bootstrap-select.js when using FilterMultiSelect (silviomoreto.github.io/bootstrap-select) -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.js"></script>
</body>
</html>
**vite.config.js**

```js
import { defineConfig } from 'vite';
import { resolve } from 'path';

export default defineConfig(({ mode }) => {
const DEV = mode === 'development';

return {
publicDir: './assets/public',
resolve: {
alias: {
'@': resolve(__dirname, 'assets/js'),
'~': resolve(__dirname, 'node_modules'),
},
},
base: '/dist/',
server: {
open: false,
hmr: false,
},
css: {
postcss: [
"autoprefixer"
]
},
build: {
manifest: true,
assetsDir: '',
outDir: './www/dist/',
emptyOutDir: true,
minify: DEV ? false : 'esbuild',
rollupOptions: {
output: {
manualChunks: undefined,
chunkFileNames: '[name].js',
entryFileNames: '[name].js',
assetFileNames: '[name].[ext]',
},
input: {
app: './assets/js/main.js'
}
}
},
}
});
```
Loading
Loading