File tree Expand file tree Collapse file tree 8 files changed +123
-0
lines changed Expand file tree Collapse file tree 8 files changed +123
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Ui \Component ;
9
+
10
+ /**
11
+ * UrlFilterApplier component
12
+ */
13
+ class UrlFilterApplier extends AbstractComponent
14
+ {
15
+ const NAME = 'urlFilterApplier ' ;
16
+
17
+ /**
18
+ * @inheritdoc
19
+ */
20
+ public function prepare (): void
21
+ {
22
+ parent ::prepare ();
23
+ $ filters = is_array ($ this ->getContext ()->getRequestParam ('filters ' )) ?
24
+ $ this ->getContext ()->getRequestParam ('filters ' ) : null ;
25
+
26
+ $ this ->setData (
27
+ 'config ' ,
28
+ array_replace_recursive (
29
+ (array )$ this ->getData ('config ' ),
30
+ [
31
+ 'filters ' => $ filters ,
32
+ ]
33
+ )
34
+ );
35
+ }
36
+
37
+ /**
38
+ * @inheritdoc
39
+ */
40
+ public function getComponentName ()
41
+ {
42
+ return static ::NAME ;
43
+ }
44
+ }
Original file line number Diff line number Diff line change 62
62
<xs : include schemaLocation =" urn:magento:module:Magento_Ui:view/base/ui_component/etc/definition/exportButton.xsd" />
63
63
<xs : include schemaLocation =" urn:magento:module:Magento_Ui:view/base/ui_component/etc/definition/listingToolbar.xsd" />
64
64
<xs : include schemaLocation =" urn:magento:module:Magento_Ui:view/base/ui_component/etc/definition/dataProvider.xsd" />
65
+ <xs : include schemaLocation =" urn:magento:module:Magento_Ui:view/base/ui_component/etc/definition/urlFilterApplier.xsd" />
65
66
</xs : schema >
Original file line number Diff line number Diff line change 107
107
<xs : element ref =" text" maxOccurs =" unbounded" />
108
108
<xs : element ref =" textarea" maxOccurs =" unbounded" />
109
109
<xs : element ref =" wysiwyg" maxOccurs =" unbounded" />
110
+ <xs : element ref =" urlFilterApplier" maxOccurs =" unbounded" />
110
111
</xs : choice >
111
112
</xs : group >
112
113
<xs : group name =" fieldsetElements" >
206
207
<xs : element ref =" text" maxOccurs =" unbounded" />
207
208
<xs : element ref =" textarea" maxOccurs =" unbounded" />
208
209
<xs : element ref =" wysiwyg" maxOccurs =" unbounded" />
210
+ <xs : element ref =" urlFilterApplier" maxOccurs =" unbounded" />
209
211
</xs : choice >
210
212
</xs : group >
211
213
824
826
</xs : documentation >
825
827
</xs : annotation >
826
828
</xs : element >
829
+ <xs : element name =" urlFilterApplier" type =" componentUrlFilterApplier" >
830
+ <xs : annotation >
831
+ <xs : documentation >
832
+ The Url Filter Applier component retrieves the values from the "filters" GET parameter and applies it
833
+ to the grid.
834
+ </xs : documentation >
835
+ </xs : annotation >
836
+ </xs : element >
827
837
</xs : schema >
Original file line number Diff line number Diff line change 77
77
<xs : element name =" wysiwyg" type =" componentWysiwyg" />
78
78
<xs : element name =" inlineEditing" type =" componentInlineEditing" />
79
79
<xs : element name =" urlInput" type =" componentUrlInput" />
80
+ <xs : element name =" urlFilterApplier" type =" componentUrlFilterApplier" />
80
81
</xs : choice >
81
82
</xs : complexType >
82
83
</xs : schema >
Original file line number Diff line number Diff line change 499
499
</argument >
500
500
</schema >
501
501
</component >
502
+ <component name =" urlFilterApplier" include =" uiElementSettings" />
502
503
<component name =" filterSearch" include =" uiElementSettings" >
503
504
<schema name =" current" >
504
505
<argument name =" data" xsi : type =" array" >
Original file line number Diff line number Diff line change 284
284
</dynamicRows >
285
285
<htmlContent class =" Magento\Ui\Component\HtmlContent" component =" Magento_Ui/js/form/components/html" />
286
286
<button class =" Magento\Ui\Component\Container" component =" Magento_Ui/js/form/components/button" />
287
+ <urlFilterApplier class =" Magento\Ui\Component\UrlFilterApplier" component =" Magento_Ui/js/grid/url-filter-applier" />
287
288
</components >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <xs : schema xmlns : xs =" http://www.w3.org/2001/XMLSchema" elementFormDefault =" qualified" >
9
+ <!-- Include section -->
10
+ <xs : include schemaLocation =" urn:magento:module:Magento_Ui:view/base/ui_component/etc/definition/ui_component.xsd" />
11
+
12
+ <xs : complexType name =" componentUrlFilterApplier" >
13
+ <xs : sequence >
14
+ <xs : group ref =" configurable" minOccurs =" 0" maxOccurs =" unbounded" />
15
+ </xs : sequence >
16
+ <xs : attributeGroup ref =" ui_element_attributes" />
17
+ </xs : complexType >
18
+ </xs : schema >
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright © Magento, Inc. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+
6
+ define ( [
7
+ 'uiComponent' ,
8
+ 'underscore' ,
9
+ ] , function ( Component , _ ) {
10
+ 'use strict' ;
11
+
12
+ return Component . extend ( {
13
+ defaults : {
14
+ filterProvider : 'componentType = filters, ns = ${ $.ns }' ,
15
+ filters : null ,
16
+ modules : {
17
+ filterComponent : '${ $.filterProvider }' ,
18
+ }
19
+ } ,
20
+
21
+ /**
22
+ * Init component
23
+ *
24
+ * @return {exports }
25
+ */
26
+ initialize : function ( ) {
27
+ this . _super ( ) ;
28
+ this . apply ( ) ;
29
+
30
+ return this ;
31
+ } ,
32
+
33
+ /**
34
+ * Apply filter
35
+ */
36
+ apply : function ( ) {
37
+ if ( _ . isUndefined ( this . filterComponent ( ) ) ) {
38
+ setTimeout ( function ( ) { this . apply ( ) } . bind ( this ) , 100 ) ;
39
+ } else {
40
+ if ( ! _ . isNull ( this . filters ) ) {
41
+ this . filterComponent ( ) . setData ( this . filters , false ) ;
42
+ this . filterComponent ( ) . apply ( ) ;
43
+ }
44
+ }
45
+ }
46
+ } ) ;
47
+ } ) ;
You can’t perform that action at this time.
0 commit comments