22
33namespace Native \Laravel ;
44
5+ use Illuminate \Support \Traits \Conditionable ;
6+ use Illuminate \Support \Traits \Macroable ;
57use Native \Laravel \Client \Client ;
8+ use Native \Laravel \Facades \Window ;
69
710class Dialog
811{
12+ use Conditionable;
13+ use Macroable;
14+
915 protected $ title ;
1016
1117 protected $ defaultPath ;
@@ -18,6 +24,8 @@ class Dialog
1824
1925 protected $ filters = [];
2026
27+ protected $ windowReference ;
28+
2129 public function __construct (protected Client $ client )
2230 {
2331 }
@@ -69,6 +77,13 @@ public function singleFile()
6977 return $ this ;
7078 }
7179
80+ public function dontResolveSymlinks (): self
81+ {
82+ $ this ->properties [] = 'noResolveAliases ' ;
83+
84+ return $ this ;
85+ }
86+
7287 public function filter (string $ name , array $ extensions ): self
7388 {
7489 $ this ->filters [] = [
@@ -86,10 +101,22 @@ public function properties(array $properties): self
86101 return $ this ;
87102 }
88103
104+ public function asSheet (string $ windowId = null ): self
105+ {
106+ if (is_null ($ windowId )) {
107+ $ this ->windowReference = Window::current ()->id ;
108+ } else {
109+ $ this ->windowReference = $ windowId ;
110+ }
111+
112+ return $ this ;
113+ }
114+
89115 public function show ()
90116 {
91117 $ result = $ this ->client ->post ('dialog/open ' , [
92118 'title ' => $ this ->title ,
119+ 'windowReference ' => $ this ->windowReference ,
93120 'defaultPath ' => $ this ->defaultPath ,
94121 'filters ' => $ this ->filters ,
95122 'buttonLabel ' => $ this ->buttonLabel ,
@@ -107,6 +134,7 @@ public function save()
107134 {
108135 return $ this ->client ->post ('dialog/save ' , [
109136 'title ' => $ this ->title ,
137+ 'windowReference ' => $ this ->windowReference ,
110138 'defaultPath ' => $ this ->defaultPath ,
111139 'filters ' => $ this ->filters ,
112140 'buttonLabel ' => $ this ->buttonLabel ,
0 commit comments