isite 2025.7.2 → 2025.8.1

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.
@@ -1,1543 +1,1544 @@
1
1
  app.directive('iControl', function () {
2
- return {
3
- restrict: 'E',
4
- require: 'ngModel',
5
- scope: {
6
- v: '@',
7
- id2: '@',
8
- label: '@',
9
- type: '@',
10
- class2: '@',
11
- disabled: '@',
12
- ngModel: '=',
13
- ngChange: '&',
14
- ngKeydown: '&',
15
- },
16
- link: function ($scope, element, attrs, ctrl) {
17
- attrs.type = attrs.type || 'text';
18
- $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
19
- $scope.v = $scope.v || '';
20
- $scope.requird = '';
21
- if ($scope.v.like('*r*')) {
22
- $scope.requird = '*';
23
- }
24
- if (typeof attrs.disabled !== 'undefined') {
25
- attrs.disabled = 'disabled';
26
- } else {
27
- attrs.disabled = '';
28
- }
29
- $scope.class2 = $scope.class2 || '';
30
- },
31
- template: `/*##client-side/directive/i-control.html*/`,
32
- };
2
+ return {
3
+ restrict: 'E',
4
+ require: 'ngModel',
5
+ scope: {
6
+ v: '@',
7
+ id2: '@',
8
+ label: '@',
9
+ type: '@',
10
+ class2: '@',
11
+ disabled: '@',
12
+ ngModel: '=',
13
+ ngChange: '&',
14
+ ngKeydown: '&',
15
+ },
16
+ link: function ($scope, element, attrs, ctrl) {
17
+ attrs.type = attrs.type || 'text';
18
+ $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
19
+ $scope.v = $scope.v || '';
20
+ $scope.requird = '';
21
+ if ($scope.v.like('*r*')) {
22
+ $scope.requird = '*';
23
+ }
24
+ if (typeof attrs.disabled !== 'undefined') {
25
+ attrs.disabled = 'disabled';
26
+ } else {
27
+ attrs.disabled = '';
28
+ }
29
+ $scope.class2 = $scope.class2 || '';
30
+ },
31
+ template: `/*##client-side/directive/i-control.html*/`,
32
+ };
33
33
  });
34
34
 
35
35
  app.directive('iTextarea', function () {
36
- return {
37
- restrict: 'E',
38
- require: 'ngModel',
39
- scope: {
40
- v: '@',
41
- label: '@',
42
- id2: '@',
43
- disabled: '@',
44
- rows: '@',
45
- ngModel: '=',
46
- ngChange: '&',
47
- },
48
- link: function ($scope, element, attrs, ctrl) {
49
- if (typeof attrs.disabled !== 'undefined') {
50
- attrs.disabled = 'disabled';
51
- } else {
52
- attrs.disabled = '';
53
- }
54
- $scope.rows = $scope.rows || 10;
55
- $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
56
- $(element)
57
- .find('textarea')
58
- .focus(() => {
59
- $('.popup').hide();
60
- });
61
- },
62
- template: `/*##client-side/directive/i-textarea.html*/`,
63
- };
36
+ return {
37
+ restrict: 'E',
38
+ require: 'ngModel',
39
+ scope: {
40
+ v: '@',
41
+ label: '@',
42
+ id2: '@',
43
+ disabled: '@',
44
+ rows: '@',
45
+ ngModel: '=',
46
+ ngChange: '&',
47
+ },
48
+ link: function ($scope, element, attrs, ctrl) {
49
+ if (typeof attrs.disabled !== 'undefined') {
50
+ attrs.disabled = 'disabled';
51
+ } else {
52
+ attrs.disabled = '';
53
+ }
54
+ $scope.rows = $scope.rows || 10;
55
+ $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
56
+ $(element)
57
+ .find('textarea')
58
+ .focus(() => {
59
+ $('.popup').hide();
60
+ });
61
+ },
62
+ template: `/*##client-side/directive/i-textarea.html*/`,
63
+ };
64
64
  });
65
65
  app.directive('iContent', function ($timeout, $interval) {
66
- return {
67
- restrict: 'E',
68
- scope: {
69
- v: '@',
70
- label: '@',
71
- id2: '@',
72
- disabled: '@',
73
- rows: '@',
74
- ngModel: '=',
75
- ngChange: '&',
76
- },
77
- link: function ($scope, element, attrs, ctrl) {
78
- if (typeof attrs.disabled !== 'undefined') {
79
- attrs.disabled = 'disabled';
80
- } else {
81
- attrs.disabled = '';
82
- }
83
- $scope.stopReading = false;
84
- $scope.rows = $scope.rows || 10;
85
- $scope.id2 = $scope.id2 || 'textarea_' + Math.random().toString().replace('0.', '');
86
- $(element).find('textarea').id = $scope.id2;
87
- $(element)
88
- .find('textarea')
89
- .focus(() => {
90
- $('.popup').hide();
91
- });
92
- $scope.handelContentElement = function () {
93
- if (!document.querySelector('#' + $scope.id2)) {
94
- $timeout(() => {
95
- $scope.handelContentElement();
96
- }, 1000);
97
- return false;
98
- }
99
- window['content_' + $scope.id2] = WebShareEditor.create($scope.id2, {
100
- toolbarItem: [
101
- ['undo', 'redo'],
102
- ['font', 'fontSize', 'formatBlock'],
103
- ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
104
- ['removeFormat'],
105
- ['fontColor', 'hiliteColor'],
106
- ['outdent', 'indent'],
107
- ['align', 'horizontalRule', 'list', 'table'],
108
- ['link', 'image', 'video'],
109
- ['preview', 'print'],
110
- /* ['fullScreen', 'showBlocks', 'codeView'],
111
- ['save', 'template'],*/
112
- ],
113
- width: '100%',
114
- minHeight: '300px',
115
- });
116
- if (window['content_' + $scope.id2]) {
117
- window['content_' + $scope.id2].setContents($scope.ngModel || '');
118
- }
119
- $scope.readingNow();
120
- };
121
-
122
- $scope.readingNow = function () {
123
- $scope.intravalReading = $interval(() => {
124
- if (window['content_' + $scope.id2]) {
125
- $scope.ngModel2 = window['content_' + $scope.id2].getContents();
126
- if ($scope.ngModel !== $scope.ngModel2) {
127
- $scope.ngModel = $scope.ngModel2;
128
- $scope.changed();
66
+ return {
67
+ restrict: 'E',
68
+ scope: {
69
+ v: '@',
70
+ label: '@',
71
+ id2: '@',
72
+ disabled: '@',
73
+ rows: '@',
74
+ ngModel: '=',
75
+ ngChange: '&',
76
+ },
77
+ link: function ($scope, element, attrs, ctrl) {
78
+ if (typeof attrs.disabled !== 'undefined') {
79
+ attrs.disabled = 'disabled';
80
+ } else {
81
+ attrs.disabled = '';
129
82
  }
130
- }
131
- }, 1000);
132
- };
133
- $scope.handelContentElement();
134
-
135
- $scope.changed = function () {
136
- $timeout(() => {
137
- if ($scope.ngChange) {
138
- $scope.ngChange();
139
- }
140
- }, 100);
141
- };
142
-
143
- $scope.$watch('ngModel', (ngModel) => {
144
- clearInterval($scope.intravalReading);
145
-
146
- if (window['content_' + $scope.id2]) {
147
- if ($scope.ngModel2 && $scope.ngModel !== $scope.ngModel2) {
148
- $scope.ngModel = ngModel;
149
- window['content_' + $scope.id2].setContents($scope.ngModel || '');
150
- }
151
- }
152
- $scope.readingNow();
153
- });
154
- },
155
- template: `/*##client-side/directive/i-content.html*/`,
156
- };
83
+ $scope.stopReading = false;
84
+ $scope.rows = $scope.rows || 10;
85
+ $scope.id2 = $scope.id2 || 'textarea_' + Math.random().toString().replace('0.', '');
86
+ $(element).find('textarea').id = $scope.id2;
87
+ $(element)
88
+ .find('textarea')
89
+ .focus(() => {
90
+ $('.popup').hide();
91
+ });
92
+ $scope.handelContentElement = function () {
93
+ if (!document.querySelector('#' + $scope.id2)) {
94
+ $timeout(() => {
95
+ $scope.handelContentElement();
96
+ }, 1000);
97
+ return false;
98
+ }
99
+ window['content_' + $scope.id2] = WebShareEditor.create($scope.id2, {
100
+ toolbarItem: [
101
+ ['undo', 'redo'],
102
+ ['font', 'fontSize', 'formatBlock'],
103
+ ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
104
+ ['removeFormat'],
105
+ ['fontColor', 'hiliteColor'],
106
+ ['outdent', 'indent'],
107
+ ['align', 'horizontalRule', 'list', 'table'],
108
+ ['link', 'image', 'video'],
109
+ ['preview', 'print'],
110
+ ['codeView'],
111
+ /* ['fullScreen', 'showBlocks', 'codeView'],
112
+ ['save', 'template'],*/
113
+ ],
114
+ width: '100%',
115
+ minHeight: '300px',
116
+ });
117
+ if (window['content_' + $scope.id2]) {
118
+ window['content_' + $scope.id2].setContents($scope.ngModel || '');
119
+ }
120
+ $scope.readingNow();
121
+ };
122
+
123
+ $scope.readingNow = function () {
124
+ $scope.intravalReading = $interval(() => {
125
+ if (window['content_' + $scope.id2]) {
126
+ $scope.ngModel2 = window['content_' + $scope.id2].getContents();
127
+ if ($scope.ngModel !== $scope.ngModel2) {
128
+ $scope.ngModel = $scope.ngModel2;
129
+ $scope.changed();
130
+ }
131
+ }
132
+ }, 1000);
133
+ };
134
+ $scope.handelContentElement();
135
+
136
+ $scope.changed = function () {
137
+ $timeout(() => {
138
+ if ($scope.ngChange) {
139
+ $scope.ngChange();
140
+ }
141
+ }, 100);
142
+ };
143
+
144
+ $scope.$watch('ngModel', (ngModel) => {
145
+ clearInterval($scope.intravalReading);
146
+
147
+ if (window['content_' + $scope.id2]) {
148
+ if ($scope.ngModel2 && $scope.ngModel !== $scope.ngModel2) {
149
+ $scope.ngModel = ngModel;
150
+ window['content_' + $scope.id2].setContents($scope.ngModel || '');
151
+ }
152
+ }
153
+ $scope.readingNow();
154
+ });
155
+ },
156
+ template: `/*##client-side/directive/i-content.html*/`,
157
+ };
157
158
  });
158
159
 
159
160
  app.directive('iCheckbox', function ($timeout) {
160
- return {
161
- restrict: 'E',
162
- require: 'ngModel',
163
- scope: {
164
- label: '@',
165
- id2: '@',
166
- ngDisabled: '@',
167
- ngModel: '=',
168
- ngChange: '&',
169
- },
170
- link: function ($scope, element, attrs, ctrl) {
171
- $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
172
- $scope.changed = function () {
173
- $timeout(() => {
174
- if ($scope.ngChange) {
175
- $scope.ngChange();
176
- }
177
- }, 100);
178
- };
179
- },
180
- template: `/*##client-side/directive/i-checkbox.html*/`,
181
- };
161
+ return {
162
+ restrict: 'E',
163
+ require: 'ngModel',
164
+ scope: {
165
+ label: '@',
166
+ id2: '@',
167
+ ngDisabled: '@',
168
+ ngModel: '=',
169
+ ngChange: '&',
170
+ },
171
+ link: function ($scope, element, attrs, ctrl) {
172
+ $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
173
+ $scope.changed = function () {
174
+ $timeout(() => {
175
+ if ($scope.ngChange) {
176
+ $scope.ngChange();
177
+ }
178
+ }, 100);
179
+ };
180
+ },
181
+ template: `/*##client-side/directive/i-checkbox.html*/`,
182
+ };
182
183
  });
183
184
 
184
185
  app.directive('iRadio', function ($timeout) {
185
- return {
186
- restrict: 'E',
187
- require: 'ngModel',
188
- scope: {
189
- label: '@',
190
- group: '@',
191
- id2: '@',
192
- ngValue: '@',
193
- ngModel: '=',
194
- ngChange: '&',
195
- },
196
- link: function ($scope, element, attrs, ctrl) {
197
- if (typeof attrs.disabled !== 'undefined') {
198
- attrs.disabled = 'disabled';
199
- } else {
200
- attrs.disabled = '';
201
- }
202
-
203
- $scope.group = $scope.group || attrs.ngModel.replaceAll('.', '_');
204
- $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
205
- $scope.changed = function () {
206
- $timeout(() => {
207
- if ($scope.ngChange) {
208
- $scope.ngChange();
209
- }
210
- }, 100);
211
- };
212
- },
213
- template: `/*##client-side/directive/i-radio.html*/`,
214
- };
186
+ return {
187
+ restrict: 'E',
188
+ require: 'ngModel',
189
+ scope: {
190
+ label: '@',
191
+ group: '@',
192
+ id2: '@',
193
+ ngValue: '@',
194
+ ngModel: '=',
195
+ ngChange: '&',
196
+ },
197
+ link: function ($scope, element, attrs, ctrl) {
198
+ if (typeof attrs.disabled !== 'undefined') {
199
+ attrs.disabled = 'disabled';
200
+ } else {
201
+ attrs.disabled = '';
202
+ }
203
+
204
+ $scope.group = $scope.group || attrs.ngModel.replaceAll('.', '_');
205
+ $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
206
+ $scope.changed = function () {
207
+ $timeout(() => {
208
+ if ($scope.ngChange) {
209
+ $scope.ngChange();
210
+ }
211
+ }, 100);
212
+ };
213
+ },
214
+ template: `/*##client-side/directive/i-radio.html*/`,
215
+ };
215
216
  });
216
217
 
217
218
  app.directive('iButton', [
218
- '$interval',
219
- '$timeout',
220
- function ($interval, $timeout) {
221
- return {
222
- restrict: 'E',
223
- scope: {
224
- label: '@',
225
- type: '@',
226
- class2: '@',
227
- loading: '@',
228
- click: '&',
229
- fa: '@',
230
- },
231
- link: function ($scope, element, attrs, ctrl) {
232
- $scope.type = $scope.type || '';
233
- $scope.class = $scope.class = 'btn-light';
234
- $scope.fa = $scope.fa || $scope.label ? '' : 'fas fa-mouse-pointer';
235
-
236
- if ($scope.type.like('*add*|*new*')) {
237
- $scope.fa = 'fas fa-plus';
238
- $scope.class = 'btn-primary';
239
- } else if ($scope.type.like('*update*|*edit*')) {
240
- $scope.fa = 'fas fa-edit';
241
- $scope.class = 'btn-warning';
242
- } else if ($scope.type.like('*save*')) {
243
- $scope.fa = 'fas fa-save';
244
- $scope.class = 'btn-success';
245
- } else if ($scope.type.like('*list*')) {
246
- $scope.fa = 'fas fa-list';
247
- $scope.class = 'btn-info';
248
- } else if ($scope.type.like('unapprove')) {
249
- $scope.fa = 'fas fa-eject';
250
- $scope.class = 'btn-danger';
251
- } else if ($scope.type.like('approve')) {
252
- $scope.fa = 'fas fa-check-double';
253
- $scope.class = 'btn-primary';
254
- } else if ($scope.type.like('*view*|*details*|*show*')) {
255
- $scope.fa = 'fas fa-eye';
256
- $scope.class = 'btn-info';
257
- } else if ($scope.type.like('*delete*|*remove*|*clear*')) {
258
- $scope.fa = 'fas fa-trash';
259
- $scope.class = 'btn-danger';
260
- } else if ($scope.type.like('*exit*|*close*')) {
261
- $scope.fa = 'fas fa-times-circle';
262
- $scope.class = 'btn-danger';
263
- } else if ($scope.type.like('*print*')) {
264
- $scope.fa = 'fas fa-print';
265
- $scope.class = 'btn-secondary';
266
- } else if ($scope.type.like('*export*|*excel*')) {
267
- $scope.fa = 'fas fa-file-export';
268
- $scope.class = 'btn-light';
269
- } else if ($scope.type.like('*import*')) {
270
- $scope.fa = 'fas fa-file-upload';
271
- $scope.class = 'btn-light';
272
- } else if ($scope.type.like('*search*|*find*')) {
273
- $scope.fa = 'fas fa-search';
274
- $scope.class = 'btn-light';
275
- } else if ($scope.type.like('*login*|*signin*')) {
276
- $scope.fa = 'fas fa-sign-in-alt';
277
- $scope.class = 'btn-light';
278
- } else if ($scope.type.like('*logout*|*signout*')) {
279
- $scope.fa = 'fas fa-sign-out-alt';
280
- $scope.class = 'btn-light';
281
- } else if ($scope.type.like('*push*')) {
282
- $scope.fa = 'fas fa-plus-circle';
283
- $scope.class = 'btn-primary';
284
- } else if ($scope.type.like('*cancel*')) {
285
- $scope.fa = 'fas fa-minus-circle';
286
- $scope.class = 'btn-danger';
287
- } else if ($scope.type.like('*upload*')) {
288
- $scope.fa = 'fas fa-upload';
289
- $scope.class = 'btn-light';
290
- } else if ($scope.type.like('*up*')) {
291
- $scope.fa = 'fas fa-long-arrow-alt-up';
292
- $scope.class = 'btn-light';
293
- } else if ($scope.type.like('*down*')) {
294
- $scope.fa = 'fas fa-long-arrow-alt-down';
295
- $scope.class = 'btn-light';
296
- } else if ($scope.type.like('*reset*')) {
297
- $scope.fa = 'fas fa-sync-alt';
298
- $scope.class = 'btn-light';
299
- } else if ($scope.type.like('*stop*')) {
300
- $scope.fa = 'fas fa-stop';
301
- $scope.class = 'btn-light';
302
- } else if ($scope.type.like('*play*')) {
303
- $scope.fa = 'far fa-play-circle';
304
- $scope.class = 'btn-light';
305
- } else if ($scope.type.like('*copy*')) {
306
- $scope.fa = 'fas fa-copy';
307
- $scope.class = 'btn-light';
308
- }
309
- if ($scope.type.like('*default*')) {
310
- $scope.class = '';
311
- }
312
- if ($scope.class2) {
313
- $scope.class = $scope.class2;
314
- }
315
- $scope.onclick = function () {
316
- $scope.clickBusy = true;
317
- $timeout(() => {
318
- $scope.clickBusy = false;
319
- }, 250);
219
+ '$interval',
220
+ '$timeout',
221
+ function ($interval, $timeout) {
222
+ return {
223
+ restrict: 'E',
224
+ scope: {
225
+ label: '@',
226
+ type: '@',
227
+ class2: '@',
228
+ loading: '@',
229
+ click: '&',
230
+ fa: '@',
231
+ },
232
+ link: function ($scope, element, attrs, ctrl) {
233
+ $scope.type = $scope.type || '';
234
+ $scope.class = $scope.class = 'btn-light';
235
+ $scope.fa = $scope.fa || $scope.label ? '' : 'fas fa-mouse-pointer';
236
+
237
+ if ($scope.type.like('*add*|*new*')) {
238
+ $scope.fa = 'fas fa-plus';
239
+ $scope.class = 'btn-primary';
240
+ } else if ($scope.type.like('*update*|*edit*')) {
241
+ $scope.fa = 'fas fa-edit';
242
+ $scope.class = 'btn-warning';
243
+ } else if ($scope.type.like('*save*')) {
244
+ $scope.fa = 'fas fa-save';
245
+ $scope.class = 'btn-success';
246
+ } else if ($scope.type.like('*list*')) {
247
+ $scope.fa = 'fas fa-list';
248
+ $scope.class = 'btn-info';
249
+ } else if ($scope.type.like('unapprove')) {
250
+ $scope.fa = 'fas fa-eject';
251
+ $scope.class = 'btn-danger';
252
+ } else if ($scope.type.like('approve')) {
253
+ $scope.fa = 'fas fa-check-double';
254
+ $scope.class = 'btn-primary';
255
+ } else if ($scope.type.like('*view*|*details*|*show*')) {
256
+ $scope.fa = 'fas fa-eye';
257
+ $scope.class = 'btn-info';
258
+ } else if ($scope.type.like('*delete*|*remove*|*clear*')) {
259
+ $scope.fa = 'fas fa-trash';
260
+ $scope.class = 'btn-danger';
261
+ } else if ($scope.type.like('*exit*|*close*')) {
262
+ $scope.fa = 'fas fa-times-circle';
263
+ $scope.class = 'btn-danger';
264
+ } else if ($scope.type.like('*print*')) {
265
+ $scope.fa = 'fas fa-print';
266
+ $scope.class = 'btn-secondary';
267
+ } else if ($scope.type.like('*export*|*excel*')) {
268
+ $scope.fa = 'fas fa-file-export';
269
+ $scope.class = 'btn-light';
270
+ } else if ($scope.type.like('*import*')) {
271
+ $scope.fa = 'fas fa-file-upload';
272
+ $scope.class = 'btn-light';
273
+ } else if ($scope.type.like('*search*|*find*')) {
274
+ $scope.fa = 'fas fa-search';
275
+ $scope.class = 'btn-light';
276
+ } else if ($scope.type.like('*login*|*signin*')) {
277
+ $scope.fa = 'fas fa-sign-in-alt';
278
+ $scope.class = 'btn-light';
279
+ } else if ($scope.type.like('*logout*|*signout*')) {
280
+ $scope.fa = 'fas fa-sign-out-alt';
281
+ $scope.class = 'btn-light';
282
+ } else if ($scope.type.like('*push*')) {
283
+ $scope.fa = 'fas fa-plus-circle';
284
+ $scope.class = 'btn-primary';
285
+ } else if ($scope.type.like('*cancel*')) {
286
+ $scope.fa = 'fas fa-minus-circle';
287
+ $scope.class = 'btn-danger';
288
+ } else if ($scope.type.like('*upload*')) {
289
+ $scope.fa = 'fas fa-upload';
290
+ $scope.class = 'btn-light';
291
+ } else if ($scope.type.like('*up*')) {
292
+ $scope.fa = 'fas fa-long-arrow-alt-up';
293
+ $scope.class = 'btn-light';
294
+ } else if ($scope.type.like('*down*')) {
295
+ $scope.fa = 'fas fa-long-arrow-alt-down';
296
+ $scope.class = 'btn-light';
297
+ } else if ($scope.type.like('*reset*')) {
298
+ $scope.fa = 'fas fa-sync-alt';
299
+ $scope.class = 'btn-light';
300
+ } else if ($scope.type.like('*stop*')) {
301
+ $scope.fa = 'fas fa-stop';
302
+ $scope.class = 'btn-light';
303
+ } else if ($scope.type.like('*play*')) {
304
+ $scope.fa = 'far fa-play-circle';
305
+ $scope.class = 'btn-light';
306
+ } else if ($scope.type.like('*copy*')) {
307
+ $scope.fa = 'fas fa-copy';
308
+ $scope.class = 'btn-light';
309
+ }
310
+ if ($scope.type.like('*default*')) {
311
+ $scope.class = '';
312
+ }
313
+ if ($scope.class2) {
314
+ $scope.class = $scope.class2;
315
+ }
316
+ $scope.onclick = function () {
317
+ $scope.clickBusy = true;
318
+ $timeout(() => {
319
+ $scope.clickBusy = false;
320
+ }, 250);
321
+ };
322
+ $scope.$watch('loading', (loading) => {
323
+ if (loading === 'true') {
324
+ $scope.busy = true;
325
+ } else {
326
+ $scope.busy = false;
327
+ }
328
+ });
329
+ },
330
+ template: `/*##client-side/directive/i-button.html*/`,
320
331
  };
321
- $scope.$watch('loading', (loading) => {
322
- if (loading === 'true') {
323
- $scope.busy = true;
324
- } else {
325
- $scope.busy = false;
326
- }
327
- });
328
- },
329
- template: `/*##client-side/directive/i-button.html*/`,
330
- };
331
- },
332
+ },
332
333
  ]);
333
334
  app.directive('iList', [
334
- '$interval',
335
- '$timeout',
336
- 'isite',
337
- function ($interval, $timeout, isite) {
338
- return {
339
- restrict: 'E',
340
- require: 'ngModel',
341
- scope: {
342
- v: '@',
343
- label: '@',
344
- display: '@',
345
- display2: '@',
346
- disabled: '@',
347
- css: '@',
348
- space: '@',
349
- primary: '@',
350
- ngValue: '@',
351
- ngModel: '=',
352
- ngSearch: '=',
353
- ngChange: '&',
354
- ngGet: '&',
355
- ngAdd: '&',
356
- items: '=',
357
- activeValue: '=',
358
- },
359
- link: function ($scope, element, attrs, ctrl) {
360
- $scope.primary = $scope.primary || 'id';
361
- $scope.display = $scope.display || 'name';
362
- $scope.display2 = $scope.display2 || '';
363
- $scope.space = $scope.space || ' - ';
364
- attrs.ngValue = attrs.ngValue || '';
365
- $scope.v = $scope.v || '';
366
- $scope.requird = '';
367
- if ($scope.v.like('*r*')) {
368
- $scope.requird = '*';
369
- }
370
- $(element).on('click', (e) => {
371
- e.stopPropagation();
372
- e.preventDefault();
373
- });
374
- $scope.searchElement = $(element).find('.dropdown .search input');
375
- $scope.popupElement = $(element).find('.dropdown .dropdown-content');
376
- let input = $(element).find('input.dropdown-text');
377
- $(input).click((ev) => {
378
- $scope.popupElement.css('display', 'block');
379
- });
380
- $scope.hide = function () {
381
- $scope.popupElement.css('display', 'none');
382
- };
383
- $scope.focus = function () {
384
- $('.dropdown-content').css('display', 'none');
385
- $scope.popupElement.css('display', 'block');
386
- $scope.searchElement.focus();
387
- };
388
- if (typeof attrs.disabled !== 'undefined') {
389
- attrs.disabled = 'disabled';
390
- } else {
391
- attrs.disabled = '';
392
- }
393
-
394
- if (typeof attrs.ngAdd == 'undefined') {
395
- $scope.fa_add = 'fa-search';
396
- } else {
397
- $scope.fa_add = 'fa-plus';
398
- }
399
- $scope.showSearch = false;
400
-
401
- if (typeof attrs.ngSearch == 'undefined') {
402
- $scope.showSearch = !1;
403
- } else {
404
- $scope.showSearch = !0;
405
- }
406
-
407
- if (typeof attrs.ngSearch !== 'undefined' && attrs.ngSearch) {
408
- $scope.showSearch = !0;
409
- }
410
- if (typeof attrs.ngGet !== 'undefined' && attrs.ngGet) {
411
- $scope.showSearch = !0;
412
- }
413
-
414
- $scope.getValue = function (item) {
415
- let v = isite.getValue(item, $scope.display);
416
- return v || '';
417
- };
335
+ '$interval',
336
+ '$timeout',
337
+ 'isite',
338
+ function ($interval, $timeout, isite) {
339
+ return {
340
+ restrict: 'E',
341
+ require: 'ngModel',
342
+ scope: {
343
+ v: '@',
344
+ label: '@',
345
+ display: '@',
346
+ display2: '@',
347
+ disabled: '@',
348
+ css: '@',
349
+ space: '@',
350
+ primary: '@',
351
+ ngValue: '@',
352
+ ngModel: '=',
353
+ ngSearch: '=',
354
+ ngChange: '&',
355
+ ngGet: '&',
356
+ ngAdd: '&',
357
+ items: '=',
358
+ activeValue: '=',
359
+ },
360
+ link: function ($scope, element, attrs, ctrl) {
361
+ $scope.primary = $scope.primary || 'id';
362
+ $scope.display = $scope.display || 'name';
363
+ $scope.display2 = $scope.display2 || '';
364
+ $scope.space = $scope.space || ' - ';
365
+ attrs.ngValue = attrs.ngValue || '';
366
+ $scope.v = $scope.v || '';
367
+ $scope.requird = '';
368
+ if ($scope.v.like('*r*')) {
369
+ $scope.requird = '*';
370
+ }
371
+ $(element).on('click', (e) => {
372
+ e.stopPropagation();
373
+ e.preventDefault();
374
+ });
375
+ $scope.searchElement = $(element).find('.dropdown .search input');
376
+ $scope.popupElement = $(element).find('.dropdown .dropdown-content');
377
+ let input = $(element).find('input.dropdown-text');
378
+ $(input).click((ev) => {
379
+ $scope.popupElement.css('display', 'block');
380
+ });
381
+ $scope.hide = function () {
382
+ $scope.popupElement.css('display', 'none');
383
+ };
384
+ $scope.focus = function () {
385
+ $('.dropdown-content').css('display', 'none');
386
+ $scope.popupElement.css('display', 'block');
387
+ $scope.searchElement.focus();
388
+ };
389
+ if (typeof attrs.disabled !== 'undefined') {
390
+ attrs.disabled = 'disabled';
391
+ } else {
392
+ attrs.disabled = '';
393
+ }
418
394
 
419
- $scope.getValue2 = function (item) {
420
- if ($scope.display2) {
421
- return isite.getValue(item, $scope.display2) || '';
422
- }
423
- return '';
424
- };
395
+ if (typeof attrs.ngAdd == 'undefined') {
396
+ $scope.fa_add = 'fa-search';
397
+ } else {
398
+ $scope.fa_add = 'fa-plus';
399
+ }
400
+ $scope.showSearch = false;
425
401
 
426
- $scope.getNgModelValue = function (ngModel) {
427
- if (ngModel && $scope.display && $scope.ngValue) {
428
- return isite.getValue(ngModel, $scope.display.replace($scope.ngValue + '.', '')) || '';
429
- } else if (ngModel && $scope.display) {
430
- return isite.getValue(ngModel, $scope.display) || '';
431
- }
432
- return '';
433
- };
402
+ if (typeof attrs.ngSearch == 'undefined') {
403
+ $scope.showSearch = !1;
404
+ } else {
405
+ $scope.showSearch = !0;
406
+ }
407
+
408
+ if (typeof attrs.ngSearch !== 'undefined' && attrs.ngSearch) {
409
+ $scope.showSearch = !0;
410
+ }
411
+ if (typeof attrs.ngGet !== 'undefined' && attrs.ngGet) {
412
+ $scope.showSearch = !0;
413
+ }
414
+
415
+ $scope.getValue = function (item) {
416
+ let v = isite.getValue(item, $scope.display);
417
+ return v || '';
418
+ };
419
+
420
+ $scope.getValue2 = function (item) {
421
+ if ($scope.display2) {
422
+ return isite.getValue(item, $scope.display2) || '';
423
+ }
424
+ return '';
425
+ };
426
+
427
+ $scope.getNgModelValue = function (ngModel) {
428
+ if (ngModel && $scope.display && $scope.ngValue) {
429
+ return isite.getValue(ngModel, $scope.display.replace($scope.ngValue + '.', '')) || '';
430
+ } else if (ngModel && $scope.display) {
431
+ return isite.getValue(ngModel, $scope.display) || '';
432
+ }
433
+ return '';
434
+ };
435
+
436
+ $scope.getNgModelValue2 = function (ngModel) {
437
+ if (ngModel && $scope.display2 && $scope.ngValue) {
438
+ return isite.getValue(ngModel, $scope.display2.replace($scope.ngValue + '.', '')) || '';
439
+ } else if (ngModel && $scope.display2) {
440
+ return isite.getValue(ngModel, $scope.display2) || '';
441
+ }
442
+ return '';
443
+ };
444
+
445
+ $scope.getNgValue = function (item) {
446
+ if (item && $scope.ngValue) {
447
+ return isite.getValue(item, $scope.ngValue);
448
+ }
449
+ return item;
450
+ };
451
+
452
+ $scope.$watch('items', (items) => {
453
+ input.val('');
454
+
455
+ if (items) {
456
+ items.forEach((item) => {
457
+ item.$selected = false;
458
+ if ($scope.display2) {
459
+ let val = $scope.getValue(item);
460
+ if (val) {
461
+ val = val + $scope.space;
462
+ }
463
+ val = val + $scope.getValue2(item);
464
+ item.$display = val;
465
+ } else {
466
+ item.$display = $scope.getValue(item);
467
+ }
468
+ });
469
+ }
470
+
471
+ if (items && $scope.ngModel) {
472
+ items.forEach((item) => {
473
+ if (isite.getValue(item, $scope.primary) == isite.getValue($scope.ngModel, $scope.primary)) {
474
+ item.$selected = true;
475
+ $scope.ngModel = item;
476
+ if ($scope.display2) {
477
+ let val = $scope.getValue(item);
478
+ if (val) {
479
+ val = val + $scope.space;
480
+ }
481
+ val = val + $scope.getValue2(item);
482
+ item.$display = val;
483
+ } else {
484
+ item.$display = $scope.getValue(item);
485
+ }
486
+
487
+ input.val(item.$display);
488
+ } else {
489
+ item.$selected = false;
490
+ }
491
+ });
492
+ }
493
+ });
434
494
 
435
- $scope.getNgModelValue2 = function (ngModel) {
436
- if (ngModel && $scope.display2 && $scope.ngValue) {
437
- return isite.getValue(ngModel, $scope.display2.replace($scope.ngValue + '.', '')) || '';
438
- } else if (ngModel && $scope.display2) {
439
- return isite.getValue(ngModel, $scope.display2) || '';
440
- }
441
- return '';
495
+ $scope.$watch('ngModel', (ngModel) => {
496
+ input.val('');
497
+
498
+ $scope.ngModel = ngModel;
499
+
500
+ if (ngModel) {
501
+ if ($scope.display2) {
502
+ let val = $scope.getNgModelValue(ngModel);
503
+ if (val) {
504
+ val = val + $scope.space;
505
+ }
506
+ val = val + $scope.getNgModelValue2(ngModel);
507
+ input.val(val);
508
+ } else {
509
+ input.val($scope.getNgModelValue(ngModel));
510
+ }
511
+ }
512
+ });
513
+
514
+ $scope.searchElement.on('input', () => {
515
+ $timeout(() => {
516
+ if (attrs.ngGet) {
517
+ $scope.ngGet({ $search: $scope.searchElement.val() });
518
+ } else {
519
+ $scope.$filter = $scope.searchElement.val();
520
+ }
521
+ }, 100);
522
+ });
523
+
524
+ $scope.updateModel = function (item) {
525
+ if (item) {
526
+ $scope.items.forEach((_item) => {
527
+ _item.$selected = false;
528
+ });
529
+ item.$selected = true;
530
+ $scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
531
+ if ($scope.display2) {
532
+ let val = $scope.getNgModelValue($scope.ngModel);
533
+ if (val) {
534
+ val = val + $scope.space;
535
+ }
536
+ val = val + $scope.getNgModelValue2($scope.ngModel);
537
+ input.val(val);
538
+ } else {
539
+ input.val($scope.getNgModelValue($scope.ngModel));
540
+ }
541
+ } else {
542
+ $scope.ngModel = null;
543
+ input.val('');
544
+ }
545
+
546
+ $timeout(() => {
547
+ if ($scope.ngChange) {
548
+ $scope.ngChange();
549
+ }
550
+ }, 100);
551
+ $scope.hide();
552
+ };
553
+ },
554
+ template: `/*##client-side/directive/i-list.html*/`,
442
555
  };
556
+ },
557
+ ]);
558
+ app.directive('iChecklist', [
559
+ '$interval',
560
+ '$timeout',
561
+ function ($interval, $timeout) {
562
+ return {
563
+ restrict: 'E',
564
+ required: 'ngModel',
565
+ scope: {
566
+ label: '@',
567
+ primary: '@',
568
+ display: '@',
569
+ class2: '@',
570
+ ngModel: '=',
571
+ items: '=',
572
+ like: '&',
573
+ ngChange: '&',
574
+ },
575
+ link: function ($scope, element, attrs, ctrl) {
576
+ $scope.primary = $scope.primary || 'id';
577
+ $scope.display = $scope.display || 'name';
578
+ $scope.class2 = $scope.class2 || 'col3';
579
+ $scope.selectedItems = [];
580
+
581
+ $scope.$watch('ngModel', (ngModel) => {
582
+ $scope.reload();
583
+ });
584
+ $scope.$watch('items', (ngModel) => {
585
+ $scope.reload();
586
+ });
587
+ $scope.reload = function () {
588
+ $scope.selectedItems = [];
589
+
590
+ if ($scope.ngModel) {
591
+ $scope.ngModel.forEach((mitem) => {
592
+ $scope.selectedItems.push(mitem);
593
+ });
594
+
595
+ if ($scope.items) {
596
+ $scope.items.forEach((mitem) => {
597
+ let exist = !1;
598
+ $scope.selectedItems.forEach((sitem) => {
599
+ if (mitem[$scope.primary] === sitem[$scope.primary]) {
600
+ exist = !0;
601
+ }
602
+ });
603
+ if (exist) {
604
+ mitem.$selected = !0;
605
+ } else {
606
+ mitem.$selected = !1;
607
+ }
608
+ });
609
+ }
610
+ }
611
+ if (!$scope.ngModel) {
612
+ $scope.selectedItems = [];
613
+ if ($scope.items) {
614
+ $scope.items.forEach((mitem) => {
615
+ mitem.$selected = !1;
616
+ });
617
+ }
618
+ }
619
+ };
620
+
621
+ $scope.change = function (item) {
622
+ if (item.$selected) {
623
+ let exsits = !1;
624
+ $scope.selectedItems.forEach((sitem) => {
625
+ if (sitem[$scope.primary] === item[$scope.primary]) {
626
+ exsits = !0;
627
+ }
628
+ });
629
+ if (!exsits) {
630
+ let nitem = { ...item };
631
+ delete nitem.$selected;
632
+ delete nitem.$$hashKey;
633
+ $scope.selectedItems.push(nitem);
634
+ }
635
+ } else {
636
+ $scope.selectedItems.forEach((sitem, index) => {
637
+ if (sitem[$scope.primary] === item[$scope.primary]) {
638
+ $scope.selectedItems.splice(index, 1);
639
+ }
640
+ });
641
+ }
443
642
 
444
- $scope.getNgValue = function (item) {
445
- if (item && $scope.ngValue) {
446
- return isite.getValue(item, $scope.ngValue);
447
- }
448
- return item;
643
+ $scope.ngModel = $scope.selectedItems;
644
+ $timeout(() => {
645
+ if ($scope.ngChange) {
646
+ $scope.ngChange();
647
+ }
648
+ }, 100);
649
+ };
650
+ },
651
+ template: `/*##client-side/directive/i-checklist.html*/`,
449
652
  };
653
+ },
654
+ ]);
450
655
 
451
- $scope.$watch('items', (items) => {
452
- input.val('');
656
+ app.directive('iTime', [
657
+ '$interval',
658
+ '$timeout',
659
+ function ($interval, $timeout) {
660
+ return {
661
+ restrict: 'E',
662
+ required: 'ngModel',
663
+ scope: {
664
+ label: '@',
665
+ primary: '@',
666
+ display: '@',
667
+ class2: '@',
668
+ ngModel: '=',
669
+ items: '=',
670
+ like: '&',
671
+ ngChange: '&',
672
+ },
673
+ link: function ($scope, element, attrs, ctrl) {
674
+ $scope.hourList = [];
675
+ $scope.minuteList = [];
453
676
 
454
- if (items) {
455
- items.forEach((item) => {
456
- item.$selected = false;
457
- if ($scope.display2) {
458
- let val = $scope.getValue(item);
459
- if (val) {
460
- val = val + $scope.space;
677
+ for (let index = 0; index < 24; index++) {
678
+ $scope.hourList.push({ id: index, name: site.addZero(index, 2).toString() });
461
679
  }
462
- val = val + $scope.getValue2(item);
463
- item.$display = val;
464
- } else {
465
- item.$display = $scope.getValue(item);
466
- }
467
- });
468
- }
469
-
470
- if (items && $scope.ngModel) {
471
- items.forEach((item) => {
472
- if (isite.getValue(item, $scope.primary) == isite.getValue($scope.ngModel, $scope.primary)) {
473
- item.$selected = true;
474
- $scope.ngModel = item;
475
- if ($scope.display2) {
476
- let val = $scope.getValue(item);
477
- if (val) {
478
- val = val + $scope.space;
479
- }
480
- val = val + $scope.getValue2(item);
481
- item.$display = val;
482
- } else {
483
- item.$display = $scope.getValue(item);
680
+ $scope.hour = $scope.hourList[0];
681
+ for (let index = 0; index < 60; index++) {
682
+ $scope.minuteList.push({ id: index, name: site.addZero(index, 2).toString() });
484
683
  }
684
+ $scope.minute = $scope.minuteList[0];
485
685
 
486
- input.val(item.$display);
487
- } else {
488
- item.$selected = false;
489
- }
490
- });
491
- }
492
- });
493
-
494
- $scope.$watch('ngModel', (ngModel) => {
495
- input.val('');
496
-
497
- $scope.ngModel = ngModel;
498
-
499
- if (ngModel) {
500
- if ($scope.display2) {
501
- let val = $scope.getNgModelValue(ngModel);
502
- if (val) {
503
- val = val + $scope.space;
504
- }
505
- val = val + $scope.getNgModelValue2(ngModel);
506
- input.val(val);
507
- } else {
508
- input.val($scope.getNgModelValue(ngModel));
509
- }
510
- }
511
- });
686
+ $scope.$watch('ngModel', (ngModel) => {
687
+ console.log(ngModel);
688
+ if (ngModel && typeof ngModel.h !== 'undefined') {
689
+ $scope.hour = $scope.hourList.find((h) => h.id == ngModel.h) || $scope.hourList[0];
690
+ }
691
+ if (ngModel && typeof ngModel.m !== 'undefined') {
692
+ $scope.minute = $scope.minuteList.find((m) => m.id == ngModel.m) || $scope.minuteList[0];
693
+ }
694
+ });
512
695
 
513
- $scope.searchElement.on('input', () => {
514
- $timeout(() => {
515
- if (attrs.ngGet) {
516
- $scope.ngGet({ $search: $scope.searchElement.val() });
517
- } else {
518
- $scope.$filter = $scope.searchElement.val();
519
- }
520
- }, 100);
521
- });
696
+ $scope.change = function () {
697
+ $scope.ngModel = { h: $scope.hour.id || 0, m: $scope.minute.id || 0 };
698
+ console.log($scope.ngModel);
699
+ $timeout(() => {
700
+ if ($scope.ngChange) {
701
+ $scope.ngChange();
702
+ }
703
+ }, 100);
704
+ };
705
+ },
706
+ template: `/*##client-side/directive/i-time.html*/`,
707
+ };
708
+ },
709
+ ]);
522
710
 
523
- $scope.updateModel = function (item) {
524
- if (item) {
525
- $scope.items.forEach((_item) => {
526
- _item.$selected = false;
527
- });
528
- item.$selected = true;
529
- $scope.ngModel = $scope.getNgValue(item, $scope.ngValue);
530
- if ($scope.display2) {
531
- let val = $scope.getNgModelValue($scope.ngModel);
532
- if (val) {
533
- val = val + $scope.space;
534
- }
535
- val = val + $scope.getNgModelValue2($scope.ngModel);
536
- input.val(val);
711
+ app.directive('iDate', function ($timeout) {
712
+ return {
713
+ restrict: 'E',
714
+ required: 'ngModel',
715
+ scope: {
716
+ v: '@',
717
+ id2: '@',
718
+ label: '@',
719
+ type: '@',
720
+ class2: '@',
721
+ disabled: '@',
722
+ ngModel: '=',
723
+ ngChange: '&',
724
+ ngKeydown: '&',
725
+ },
726
+ link: function ($scope, element, attrs) {
727
+ $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
728
+ $scope.v = $scope.v || '';
729
+ $scope.requird = '';
730
+ if ($scope.v.like('*r*')) {
731
+ $scope.requird = '*';
732
+ }
733
+ if (typeof attrs.disabled !== 'undefined') {
734
+ attrs.disabled = 'disabled';
537
735
  } else {
538
- input.val($scope.getNgModelValue($scope.ngModel));
736
+ attrs.disabled = '';
539
737
  }
540
- } else {
541
- $scope.ngModel = null;
542
- input.val('');
543
- }
544
-
545
- $timeout(() => {
546
- if ($scope.ngChange) {
547
- $scope.ngChange();
738
+ $scope.class2 = $scope.class2 || '';
739
+
740
+ $scope.model = {};
741
+
742
+ $scope.lang = site.session ? site.session.language.id : 'En';
743
+ if ($scope.lang.contains('ar')) {
744
+ $scope.monthes = [
745
+ { id: 0, name: 'يناير' },
746
+ { id: 1, name: 'فبراير' },
747
+ { id: 2, name: 'مارس' },
748
+ { id: 3, name: 'ابريل' },
749
+ { id: 4, name: 'مايو' },
750
+ { id: 5, name: 'يونيو' },
751
+ { id: 6, name: 'يوليو' },
752
+ { id: 7, name: 'اغسطس' },
753
+ { id: 8, name: 'سبتمبر' },
754
+ { id: 9, name: 'اكتوبر' },
755
+ { id: 10, name: 'نوفمبر' },
756
+ { id: 11, name: 'ديسمبر' },
757
+ ];
758
+ } else {
759
+ $scope.monthes = [
760
+ { id: 0, name: 'January' },
761
+ { id: 1, name: 'February' },
762
+ { id: 2, name: 'March' },
763
+ { id: 3, name: 'April' },
764
+ { id: 4, name: 'May' },
765
+ { id: 5, name: 'June' },
766
+ { id: 6, name: 'July' },
767
+ { id: 7, name: 'August' },
768
+ { id: 8, name: 'September' },
769
+ { id: 9, name: 'October' },
770
+ { id: 10, name: 'November' },
771
+ { id: 11, name: 'December' },
772
+ ];
548
773
  }
549
- }, 100);
550
- $scope.hide();
551
- };
552
- },
553
- template: `/*##client-side/directive/i-list.html*/`,
554
- };
555
- },
556
- ]);
557
- app.directive('iChecklist', [
558
- '$interval',
559
- '$timeout',
560
- function ($interval, $timeout) {
561
- return {
562
- restrict: 'E',
563
- required: 'ngModel',
564
- scope: {
565
- label: '@',
566
- primary: '@',
567
- display: '@',
568
- class2: '@',
569
- ngModel: '=',
570
- items: '=',
571
- like: '&',
572
- ngChange: '&',
573
- },
574
- link: function ($scope, element, attrs, ctrl) {
575
- $scope.primary = $scope.primary || 'id';
576
- $scope.display = $scope.display || 'name';
577
- $scope.class2 = $scope.class2 || 'col3';
578
- $scope.selectedItems = [];
579
-
580
- $scope.$watch('ngModel', (ngModel) => {
581
- $scope.reload();
582
- });
583
- $scope.$watch('items', (ngModel) => {
584
- $scope.reload();
585
- });
586
- $scope.reload = function () {
587
- $scope.selectedItems = [];
588
-
589
- if ($scope.ngModel) {
590
- $scope.ngModel.forEach((mitem) => {
591
- $scope.selectedItems.push(mitem);
592
- });
593
774
 
594
- if ($scope.items) {
595
- $scope.items.forEach((mitem) => {
596
- let exist = !1;
597
- $scope.selectedItems.forEach((sitem) => {
598
- if (mitem[$scope.primary] === sitem[$scope.primary]) {
599
- exist = !0;
600
- }
601
- });
602
- if (exist) {
603
- mitem.$selected = !0;
775
+ $scope.$watch('ngModel', function (ngModel) {
776
+ if (ngModel) {
777
+ ngModel = new Date(ngModel);
778
+ $scope.model = $scope.model || {};
779
+ $scope.model.selectedDay = site.addZero(ngModel.getDate(), 2);
780
+ $scope.model.selectedMonth = $scope.monthes.find((m) => m.id == ngModel.getMonth());
781
+ $scope.model.selectedYear = ngModel.getFullYear();
782
+ $(element).attr('value', ngModel.getTime());
783
+ $scope.ngModel1 = new Date(ngModel);
604
784
  } else {
605
- mitem.$selected = !1;
785
+ $scope.model = $scope.model || {};
786
+ $scope.model.selectedDay = null;
787
+ $scope.model.selectedMonth = null;
788
+ $scope.model.selectedYear = null;
789
+ $(element).attr('value', '');
606
790
  }
607
- });
608
- }
609
- }
610
- if (!$scope.ngModel) {
611
- $scope.selectedItems = [];
612
- if ($scope.items) {
613
- $scope.items.forEach((mitem) => {
614
- mitem.$selected = !1;
615
- });
616
- }
617
- }
618
- };
619
-
620
- $scope.change = function (item) {
621
- if (item.$selected) {
622
- let exsits = !1;
623
- $scope.selectedItems.forEach((sitem) => {
624
- if (sitem[$scope.primary] === item[$scope.primary]) {
625
- exsits = !0;
626
- }
627
791
  });
628
- if (!exsits) {
629
- let nitem = { ...item };
630
- delete nitem.$selected;
631
- delete nitem.$$hashKey;
632
- $scope.selectedItems.push(nitem);
633
- }
634
- } else {
635
- $scope.selectedItems.forEach((sitem, index) => {
636
- if (sitem[$scope.primary] === item[$scope.primary]) {
637
- $scope.selectedItems.splice(index, 1);
638
- }
639
- });
640
- }
641
792
 
642
- $scope.ngModel = $scope.selectedItems;
643
- $timeout(() => {
644
- if ($scope.ngChange) {
645
- $scope.ngChange();
646
- }
647
- }, 100);
648
- };
649
- },
650
- template: `/*##client-side/directive/i-checklist.html*/`,
793
+ $scope.setDay = function () {
794
+ $scope.ngModel = new Date();
795
+ };
796
+ $scope.updateDate = function (date) {
797
+ if ($scope.ngModel1) {
798
+ $scope.ngModel = $scope.ngModel1;
799
+ $scope.editOnly = false;
800
+
801
+ if ($scope.ngChange) {
802
+ $scope.ngChange();
803
+ }
804
+ }
805
+ };
806
+ },
807
+ restrict: 'E',
808
+ require: 'ngModel',
809
+ scope: {
810
+ v: '@',
811
+ disabled: '@',
812
+ label: '@',
813
+ ngModel: '=',
814
+ },
815
+ template: `/*##client-side/directive/i-date.html*/`,
651
816
  };
652
- },
653
- ]);
817
+ });
654
818
 
655
- app.directive('iTime', [
656
- '$interval',
657
- '$timeout',
658
- function ($interval, $timeout) {
819
+ app.directive('iDatetime', function () {
659
820
  return {
660
- restrict: 'E',
661
- required: 'ngModel',
662
- scope: {
663
- label: '@',
664
- primary: '@',
665
- display: '@',
666
- class2: '@',
667
- ngModel: '=',
668
- items: '=',
669
- like: '&',
670
- ngChange: '&',
671
- },
672
- link: function ($scope, element, attrs, ctrl) {
673
- $scope.hourList = [];
674
- $scope.minuteList = [];
675
-
676
- for (let index = 0; index < 24; index++) {
677
- $scope.hourList.push({ id: index, name: site.addZero(index, 2).toString() });
678
- }
679
- $scope.hour = $scope.hourList[0];
680
- for (let index = 0; index < 60; index++) {
681
- $scope.minuteList.push({ id: index, name: site.addZero(index, 2).toString() });
682
- }
683
- $scope.minute = $scope.minuteList[0];
684
-
685
- $scope.$watch('ngModel', (ngModel) => {
686
- console.log(ngModel);
687
- if (ngModel && typeof ngModel.h !== 'undefined') {
688
- $scope.hour = $scope.hourList.find((h) => h.id == ngModel.h) || $scope.hourList[0];
689
- }
690
- if (ngModel && typeof ngModel.m !== 'undefined') {
691
- $scope.minute = $scope.minuteList.find((m) => m.id == ngModel.m) || $scope.minuteList[0];
692
- }
693
- });
694
-
695
- $scope.change = function () {
696
- $scope.ngModel = { h: $scope.hour.id || 0, m: $scope.minute.id || 0 };
697
- console.log($scope.ngModel);
698
- $timeout(() => {
699
- if ($scope.ngChange) {
700
- $scope.ngChange();
821
+ restrict: 'E',
822
+ required: 'ngModel',
823
+ scope: {
824
+ v: '@',
825
+ id2: '@',
826
+ label: '@',
827
+ type: '@',
828
+ class2: '@',
829
+ disabled: '@',
830
+ ngModel: '=',
831
+ ngChange: '&',
832
+ ngKeydown: '&',
833
+ },
834
+ link: function ($scope, element, attrs) {
835
+ $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
836
+ $scope.v = $scope.v || '';
837
+ $scope.requird = '';
838
+ if ($scope.v.like('*r*')) {
839
+ $scope.requird = '*';
840
+ }
841
+ if (typeof attrs.disabled !== 'undefined') {
842
+ attrs.disabled = 'disabled';
843
+ } else {
844
+ attrs.disabled = '';
845
+ }
846
+ $scope.class2 = $scope.class2 || '';
847
+
848
+ $scope.model = {};
849
+
850
+ $scope.lang = site.session ? site.session.language.id : 'En';
851
+ if ($scope.lang.contains('ar')) {
852
+ $scope.monthes = [
853
+ { id: 0, name: 'يناير' },
854
+ { id: 1, name: 'فبراير' },
855
+ { id: 2, name: 'مارس' },
856
+ { id: 3, name: 'ابريل' },
857
+ { id: 4, name: 'مايو' },
858
+ { id: 5, name: 'يونيو' },
859
+ { id: 6, name: 'يوليو' },
860
+ { id: 7, name: 'اغسطس' },
861
+ { id: 8, name: 'سبتمبر' },
862
+ { id: 9, name: 'اكتوبر' },
863
+ { id: 10, name: 'نوفمبر' },
864
+ { id: 11, name: 'ديسمبر' },
865
+ ];
866
+ } else {
867
+ $scope.monthes = [
868
+ { id: 0, name: 'January' },
869
+ { id: 1, name: 'February' },
870
+ { id: 2, name: 'March' },
871
+ { id: 3, name: 'April' },
872
+ { id: 4, name: 'May' },
873
+ { id: 5, name: 'June' },
874
+ { id: 6, name: 'July' },
875
+ { id: 7, name: 'August' },
876
+ { id: 8, name: 'September' },
877
+ { id: 9, name: 'October' },
878
+ { id: 10, name: 'November' },
879
+ { id: 11, name: 'December' },
880
+ ];
701
881
  }
702
- }, 100);
703
- };
704
- },
705
- template: `/*##client-side/directive/i-time.html*/`,
706
- };
707
- },
708
- ]);
709
882
 
710
- app.directive('iDate', function ($timeout) {
711
- return {
712
- restrict: 'E',
713
- required: 'ngModel',
714
- scope: {
715
- v: '@',
716
- id2: '@',
717
- label: '@',
718
- type: '@',
719
- class2: '@',
720
- disabled: '@',
721
- ngModel: '=',
722
- ngChange: '&',
723
- ngKeydown: '&',
724
- },
725
- link: function ($scope, element, attrs) {
726
- $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
727
- $scope.v = $scope.v || '';
728
- $scope.requird = '';
729
- if ($scope.v.like('*r*')) {
730
- $scope.requird = '*';
731
- }
732
- if (typeof attrs.disabled !== 'undefined') {
733
- attrs.disabled = 'disabled';
734
- } else {
735
- attrs.disabled = '';
736
- }
737
- $scope.class2 = $scope.class2 || '';
738
-
739
- $scope.model = {};
740
-
741
- $scope.lang = site.session ? site.session.language.id : 'En';
742
- if ($scope.lang.contains('ar')) {
743
- $scope.monthes = [
744
- { id: 0, name: 'يناير' },
745
- { id: 1, name: 'فبراير' },
746
- { id: 2, name: 'مارس' },
747
- { id: 3, name: 'ابريل' },
748
- { id: 4, name: 'مايو' },
749
- { id: 5, name: 'يونيو' },
750
- { id: 6, name: 'يوليو' },
751
- { id: 7, name: 'اغسطس' },
752
- { id: 8, name: 'سبتمبر' },
753
- { id: 9, name: 'اكتوبر' },
754
- { id: 10, name: 'نوفمبر' },
755
- { id: 11, name: 'ديسمبر' },
756
- ];
757
- } else {
758
- $scope.monthes = [
759
- { id: 0, name: 'January' },
760
- { id: 1, name: 'February' },
761
- { id: 2, name: 'March' },
762
- { id: 3, name: 'April' },
763
- { id: 4, name: 'May' },
764
- { id: 5, name: 'June' },
765
- { id: 6, name: 'July' },
766
- { id: 7, name: 'August' },
767
- { id: 8, name: 'September' },
768
- { id: 9, name: 'October' },
769
- { id: 10, name: 'November' },
770
- { id: 11, name: 'December' },
771
- ];
772
- }
773
-
774
- $scope.$watch('ngModel', function (ngModel) {
775
- if (ngModel) {
776
- ngModel = new Date(ngModel);
777
- $scope.model = $scope.model || {};
778
- $scope.model.selectedDay = site.addZero(ngModel.getDate(), 2);
779
- $scope.model.selectedMonth = $scope.monthes.find((m) => m.id == ngModel.getMonth());
780
- $scope.model.selectedYear = ngModel.getFullYear();
781
- $(element).attr('value', ngModel.getTime());
782
- $scope.ngModel1 = new Date(ngModel);
783
- } else {
784
- $scope.model = $scope.model || {};
785
- $scope.model.selectedDay = null;
786
- $scope.model.selectedMonth = null;
787
- $scope.model.selectedYear = null;
788
- $(element).attr('value', '');
789
- }
790
- });
791
-
792
- $scope.setDay = function () {
793
- $scope.ngModel = new Date();
794
- };
795
- $scope.updateDate = function (date) {
796
- if ($scope.ngModel1) {
797
- $scope.ngModel = $scope.ngModel1;
798
- $scope.editOnly = false;
799
-
800
- if ($scope.ngChange) {
801
- $scope.ngChange();
802
- }
803
- }
804
- };
805
- },
806
- restrict: 'E',
807
- require: 'ngModel',
808
- scope: {
809
- v: '@',
810
- disabled: '@',
811
- label: '@',
812
- ngModel: '=',
813
- },
814
- template: `/*##client-side/directive/i-date.html*/`,
815
- };
816
- });
883
+ $scope.$watch('ngModel', function (ngModel) {
884
+ if (ngModel) {
885
+ ngModel = new Date(ngModel);
886
+ $scope.model = $scope.model || {};
887
+ $scope.model.selectedDay = site.addZero(ngModel.getDate(), 2);
888
+ $scope.model.selectedMonth = $scope.monthes.find((m) => m.id == ngModel.getMonth());
889
+ $scope.model.selectedYear = ngModel.getFullYear();
890
+ $scope.model.selectedHour = site.addZero(ngModel.getHours(), 2);
891
+ $scope.model.selectedMinute = site.addZero(ngModel.getMinutes(), 2);
892
+
893
+ $scope.ngModel1 = new Date(ngModel);
894
+ $scope.ngModel2 = new Date(0, 0, 0, ngModel.getHours(), ngModel.getMinutes());
895
+ $(element).attr('value', ngModel.getTime());
896
+ } else {
897
+ $scope.model = $scope.model || {};
898
+ $scope.model.selectedDay = null;
899
+ $scope.model.selectedMonth = null;
900
+ $scope.model.selectedYear = null;
901
+ $scope.model.selectedHour = null;
902
+ $scope.model.selectedMinute = null;
903
+ $(element).attr('value', '');
904
+ }
905
+ });
817
906
 
818
- app.directive('iDatetime', function () {
819
- return {
820
- restrict: 'E',
821
- required: 'ngModel',
822
- scope: {
823
- v: '@',
824
- id2: '@',
825
- label: '@',
826
- type: '@',
827
- class2: '@',
828
- disabled: '@',
829
- ngModel: '=',
830
- ngChange: '&',
831
- ngKeydown: '&',
832
- },
833
- link: function ($scope, element, attrs) {
834
- $scope.id2 = $scope.id2 || 'input_' + Math.random().toString().replace('0.', '');
835
- $scope.v = $scope.v || '';
836
- $scope.requird = '';
837
- if ($scope.v.like('*r*')) {
838
- $scope.requird = '*';
839
- }
840
- if (typeof attrs.disabled !== 'undefined') {
841
- attrs.disabled = 'disabled';
842
- } else {
843
- attrs.disabled = '';
844
- }
845
- $scope.class2 = $scope.class2 || '';
846
-
847
- $scope.model = {};
848
-
849
- $scope.lang = site.session ? site.session.language.id : 'En';
850
- if ($scope.lang.contains('ar')) {
851
- $scope.monthes = [
852
- { id: 0, name: 'يناير' },
853
- { id: 1, name: 'فبراير' },
854
- { id: 2, name: 'مارس' },
855
- { id: 3, name: 'ابريل' },
856
- { id: 4, name: 'مايو' },
857
- { id: 5, name: 'يونيو' },
858
- { id: 6, name: 'يوليو' },
859
- { id: 7, name: 'اغسطس' },
860
- { id: 8, name: 'سبتمبر' },
861
- { id: 9, name: 'اكتوبر' },
862
- { id: 10, name: 'نوفمبر' },
863
- { id: 11, name: 'ديسمبر' },
864
- ];
865
- } else {
866
- $scope.monthes = [
867
- { id: 0, name: 'January' },
868
- { id: 1, name: 'February' },
869
- { id: 2, name: 'March' },
870
- { id: 3, name: 'April' },
871
- { id: 4, name: 'May' },
872
- { id: 5, name: 'June' },
873
- { id: 6, name: 'July' },
874
- { id: 7, name: 'August' },
875
- { id: 8, name: 'September' },
876
- { id: 9, name: 'October' },
877
- { id: 10, name: 'November' },
878
- { id: 11, name: 'December' },
879
- ];
880
- }
881
-
882
- $scope.$watch('ngModel', function (ngModel) {
883
- if (ngModel) {
884
- ngModel = new Date(ngModel);
885
- $scope.model = $scope.model || {};
886
- $scope.model.selectedDay = site.addZero(ngModel.getDate(), 2);
887
- $scope.model.selectedMonth = $scope.monthes.find((m) => m.id == ngModel.getMonth());
888
- $scope.model.selectedYear = ngModel.getFullYear();
889
- $scope.model.selectedHour = site.addZero(ngModel.getHours(), 2);
890
- $scope.model.selectedMinute = site.addZero(ngModel.getMinutes(), 2);
891
-
892
- $scope.ngModel1 = new Date(ngModel);
893
- $scope.ngModel2 = new Date(0, 0, 0, ngModel.getHours(), ngModel.getMinutes());
894
- $(element).attr('value', ngModel.getTime());
895
- } else {
896
- $scope.model = $scope.model || {};
897
- $scope.model.selectedDay = null;
898
- $scope.model.selectedMonth = null;
899
- $scope.model.selectedYear = null;
900
- $scope.model.selectedHour = null;
901
- $scope.model.selectedMinute = null;
902
- $(element).attr('value', '');
903
- }
904
- });
905
-
906
- $scope.setDay = function () {
907
- $scope.ngModel = new Date();
908
- };
909
-
910
- $scope.updateDate = function (date) {
911
- let time = $('#time_' + $scope.id2).val();
912
-
913
- if ($scope.ngModel1 && time) {
914
- $scope.ngModel = new Date($scope.ngModel1.getFullYear(), $scope.ngModel1.getMonth(), $scope.ngModel1.getDate(), time.split(':')[0], time.split(':')[1], 0);
915
- $scope.editOnly = false;
916
- $(element).attr('value', $scope.ngModel.getTime());
917
- if ($scope.ngChange) {
918
- $scope.ngChange();
919
- }
920
- }
921
- };
922
- },
923
- restrict: 'E',
924
- require: 'ngModel',
925
- scope: {
926
- v: '@',
927
- disabled: '@',
928
- label: '@',
929
- ngModel: '=',
930
- },
931
- template: `/*##client-side/directive/i-datetime.html*/`,
932
- };
907
+ $scope.setDay = function () {
908
+ $scope.ngModel = new Date();
909
+ };
910
+
911
+ $scope.updateDate = function (date) {
912
+ let time = $('#time_' + $scope.id2).val();
913
+
914
+ if ($scope.ngModel1 && time) {
915
+ $scope.ngModel = new Date($scope.ngModel1.getFullYear(), $scope.ngModel1.getMonth(), $scope.ngModel1.getDate(), time.split(':')[0], time.split(':')[1], 0);
916
+ $scope.editOnly = false;
917
+ $(element).attr('value', $scope.ngModel.getTime());
918
+ if ($scope.ngChange) {
919
+ $scope.ngChange();
920
+ }
921
+ }
922
+ };
923
+ },
924
+ restrict: 'E',
925
+ require: 'ngModel',
926
+ scope: {
927
+ v: '@',
928
+ disabled: '@',
929
+ label: '@',
930
+ ngModel: '=',
931
+ },
932
+ template: `/*##client-side/directive/i-datetime.html*/`,
933
+ };
933
934
  });
934
935
 
935
936
  app.directive('iFile', [
936
- '$interval',
937
- 'isite',
938
- '$timeout',
939
- function ($interval, isite, $timeout) {
940
- return {
941
- restrict: 'E',
942
- required: 'ngModel',
943
- scope: {
944
- label: '@',
945
- view: '@',
946
- accept: '@',
947
- folder: '@',
948
- ngModel: '=',
949
- ngClick: '&',
950
- onSelected: '&',
951
- ngChange: '&',
952
- },
953
- link: function ($scope, element, attrs, ctrl) {
954
- $scope.label = $scope.label || '';
955
- $scope.folder = $scope.folder || 'default';
956
- $scope.accept = $scope.accept ? $scope.accept : '';
957
- $scope.viewOnly = $scope.view === undefined ? false : true;
958
-
959
- let input = $(element).find('input')[0];
960
- let button = $(element).find('i-button')[0];
961
-
962
- let progress = $(element).find('.progress')[0];
963
- let progressBar = $(element).find('.progress-bar')[0];
964
- $(progress).hide();
965
-
966
- $scope.id = Math.random().toString().replace('.', '_');
967
-
968
- if (!$scope.viewOnly) {
969
- button.addEventListener('click', function () {
970
- input.click();
971
- });
972
- }
973
-
974
- input.addEventListener('change', function () {
975
- isite.uploadFile(
976
- this.files,
977
- {
978
- folder: $scope.folder,
937
+ '$interval',
938
+ 'isite',
939
+ '$timeout',
940
+ function ($interval, isite, $timeout) {
941
+ return {
942
+ restrict: 'E',
943
+ required: 'ngModel',
944
+ scope: {
945
+ label: '@',
946
+ view: '@',
947
+ accept: '@',
948
+ folder: '@',
949
+ ngModel: '=',
950
+ ngClick: '&',
951
+ onSelected: '&',
952
+ ngChange: '&',
979
953
  },
980
- (err, file, e) => {
981
- if (e) {
982
- $(progress).show();
983
- $scope.value = (e.loaded / e.total) * 100;
984
- progressBar.style.width = $scope.value + '%';
985
- $scope.max = e.total;
986
- if ($scope.value === 100) {
987
- $(progress).hide();
954
+ link: function ($scope, element, attrs, ctrl) {
955
+ $scope.label = $scope.label || '';
956
+ $scope.folder = $scope.folder || 'default';
957
+ $scope.accept = $scope.accept ? $scope.accept : '';
958
+ $scope.viewOnly = $scope.view === undefined ? false : true;
959
+
960
+ let input = $(element).find('input')[0];
961
+ let button = $(element).find('i-button')[0];
962
+
963
+ let progress = $(element).find('.progress')[0];
964
+ let progressBar = $(element).find('.progress-bar')[0];
965
+ $(progress).hide();
966
+
967
+ $scope.id = Math.random().toString().replace('.', '_');
968
+
969
+ if (!$scope.viewOnly) {
970
+ button.addEventListener('click', function () {
971
+ input.click();
972
+ });
988
973
  }
989
- }
990
974
 
991
- if (file) {
992
- $scope.ngModel = file;
993
- $scope.changed();
994
- }
995
- }
996
- );
997
- $scope.ngModel = this.files[0].path;
998
- $scope.onSelected(this.files[0].path);
999
- $scope.$applyAsync();
1000
- });
1001
-
1002
- $scope.$watch('ngModel', (ngModel) => {
1003
- if (ngModel) {
1004
- button.setAttribute('url', ngModel);
1005
- }
1006
- });
1007
-
1008
- $scope.changed = function () {
1009
- $timeout(() => {
1010
- if ($scope.ngChange) {
1011
- $scope.ngChange();
1012
- }
1013
- }, 200);
975
+ input.addEventListener('change', function () {
976
+ isite.uploadFile(
977
+ this.files,
978
+ {
979
+ folder: $scope.folder,
980
+ },
981
+ (err, file, e) => {
982
+ if (e) {
983
+ $(progress).show();
984
+ $scope.value = (e.loaded / e.total) * 100;
985
+ progressBar.style.width = $scope.value + '%';
986
+ $scope.max = e.total;
987
+ if ($scope.value === 100) {
988
+ $(progress).hide();
989
+ }
990
+ }
991
+
992
+ if (file) {
993
+ $scope.ngModel = file;
994
+ $scope.changed();
995
+ }
996
+ },
997
+ );
998
+ $scope.ngModel = this.files[0].path;
999
+ $scope.onSelected(this.files[0].path);
1000
+ $scope.$applyAsync();
1001
+ });
1002
+
1003
+ $scope.$watch('ngModel', (ngModel) => {
1004
+ if (ngModel) {
1005
+ button.setAttribute('url', ngModel);
1006
+ }
1007
+ });
1008
+
1009
+ $scope.changed = function () {
1010
+ $timeout(() => {
1011
+ if ($scope.ngChange) {
1012
+ $scope.ngChange();
1013
+ }
1014
+ }, 200);
1015
+ };
1016
+ },
1017
+ template: `/*##client-side/directive/i-file.html*/`,
1014
1018
  };
1015
- },
1016
- template: `/*##client-side/directive/i-file.html*/`,
1017
- };
1018
- },
1019
+ },
1019
1020
  ]);
1020
1021
 
1021
1022
  app.directive('iImage', [
1022
- '$interval',
1023
- 'isite',
1024
- '$timeout',
1025
- function ($interval, isite, $timeout) {
1026
- return {
1027
- restrict: 'E',
1028
- required: 'ngModel',
1029
- scope: {
1030
- folder: '@',
1031
- view: '@',
1032
- accept: '@',
1033
- ngModel: '=',
1034
- ngClick: '&',
1035
- ngChange: '&',
1036
- },
1037
- link: function ($scope, element, attrs, ctrl) {
1038
- $scope.accept = $scope.accept ? $scope.accept : 'image/*';
1039
- $scope.viewOnly = $scope.view === undefined ? false : true;
1040
-
1041
- let input = $(element).find('input')[0];
1042
- let img = $(element).find('img')[0];
1043
- let progress = $(element).find('.progress')[0];
1044
- $(progress).hide();
1045
-
1046
- $scope.upload = function () {
1047
- if (!$scope.viewOnly) {
1048
- input.click();
1049
- }
1050
- };
1051
- $scope.delete = function () {
1052
- img.src = null;
1053
- $scope.ngModel = null;
1054
- };
1023
+ '$interval',
1024
+ 'isite',
1025
+ '$timeout',
1026
+ function ($interval, isite, $timeout) {
1027
+ return {
1028
+ restrict: 'E',
1029
+ required: 'ngModel',
1030
+ scope: {
1031
+ folder: '@',
1032
+ view: '@',
1033
+ accept: '@',
1034
+ ngModel: '=',
1035
+ ngClick: '&',
1036
+ ngChange: '&',
1037
+ },
1038
+ link: function ($scope, element, attrs, ctrl) {
1039
+ $scope.accept = $scope.accept ? $scope.accept : 'image/*';
1040
+ $scope.viewOnly = $scope.view === undefined ? false : true;
1041
+
1042
+ let input = $(element).find('input')[0];
1043
+ let img = $(element).find('img')[0];
1044
+ let progress = $(element).find('.progress')[0];
1045
+ $(progress).hide();
1046
+
1047
+ $scope.upload = function () {
1048
+ if (!$scope.viewOnly) {
1049
+ input.click();
1050
+ }
1051
+ };
1052
+ $scope.delete = function () {
1053
+ img.src = null;
1054
+ $scope.ngModel = null;
1055
+ };
1056
+
1057
+ input.addEventListener('change', function () {
1058
+ isite.uploadImage(
1059
+ this.files,
1060
+ {
1061
+ folder: $scope.folder,
1062
+ },
1063
+ (err, image, e) => {
1064
+ if (e) {
1065
+ $(progress).show();
1066
+ $scope.value = (e.loaded / e.total) * 100;
1067
+ $scope.max = e.total;
1068
+ $(progress).css('width', $scope.value);
1069
+ if ($scope.value === 100) {
1070
+ $(progress).hide();
1071
+ }
1072
+ }
1073
+
1074
+ if (image) {
1075
+ $scope.ngModel = image;
1076
+ if ($scope.ngChange) {
1077
+ $timeout(() => {
1078
+ $scope.ngChange();
1079
+ }, 200);
1080
+ }
1081
+ }
1082
+ },
1083
+ );
1084
+ });
1055
1085
 
1056
- input.addEventListener('change', function () {
1057
- isite.uploadImage(
1058
- this.files,
1059
- {
1060
- folder: $scope.folder,
1086
+ $scope.$watch('ngModel', (ngModel) => {
1087
+ if (ngModel) {
1088
+ img.setAttribute('src', ngModel.url);
1089
+ }
1090
+ });
1061
1091
  },
1062
- (err, image, e) => {
1063
- if (e) {
1064
- $(progress).show();
1065
- $scope.value = (e.loaded / e.total) * 100;
1066
- $scope.max = e.total;
1067
- $(progress).css('width', $scope.value);
1068
- if ($scope.value === 100) {
1069
- $(progress).hide();
1070
- }
1071
- }
1072
-
1073
- if (image) {
1074
- $scope.ngModel = image;
1075
- if ($scope.ngChange) {
1076
- $timeout(() => {
1077
- $scope.ngChange();
1078
- }, 200);
1079
- }
1080
- }
1081
- }
1082
- );
1083
- });
1084
-
1085
- $scope.$watch('ngModel', (ngModel) => {
1086
- if (ngModel) {
1087
- img.setAttribute('src', ngModel.url);
1088
- }
1089
- });
1090
- },
1091
- template: `/*##client-side/directive/i-image.html*/`,
1092
- };
1093
- },
1092
+ template: `/*##client-side/directive/i-image.html*/`,
1093
+ };
1094
+ },
1094
1095
  ]);
1095
1096
 
1096
1097
  app.directive('iAudio', [
1097
- '$interval',
1098
- 'isite',
1099
- '$timeout',
1100
- function ($interval, isite, $timeout) {
1101
- return {
1102
- restrict: 'E',
1103
- required: 'ngModel',
1104
- scope: {
1105
- folder: '@',
1106
- view: '@',
1107
- accept: '@',
1108
- ngModel: '=',
1109
- ngClick: '&',
1110
- ngChange: '&',
1111
- },
1112
- link: function ($scope, element, attrs, ctrl) {
1113
- $scope.folder = $scope.folder || 'default';
1114
- $scope.accept = $scope.accept ? $scope.accept : '.mp3';
1115
- $scope.viewOnly = $scope.view === undefined ? false : true;
1116
-
1117
- let input = $(element).find('input')[0];
1118
- let audio = $(element).find('audio')[0];
1119
- let progress = $(element).find('.progress')[0];
1120
- $(progress).hide();
1121
-
1122
- $scope.upload = function () {
1123
- if (!$scope.viewOnly) {
1124
- input.click();
1125
- }
1126
- };
1127
- $scope.delete = function () {
1128
- $scope.ngModel = null;
1129
- audio.setAttribute('src', null);
1130
- };
1098
+ '$interval',
1099
+ 'isite',
1100
+ '$timeout',
1101
+ function ($interval, isite, $timeout) {
1102
+ return {
1103
+ restrict: 'E',
1104
+ required: 'ngModel',
1105
+ scope: {
1106
+ folder: '@',
1107
+ view: '@',
1108
+ accept: '@',
1109
+ ngModel: '=',
1110
+ ngClick: '&',
1111
+ ngChange: '&',
1112
+ },
1113
+ link: function ($scope, element, attrs, ctrl) {
1114
+ $scope.folder = $scope.folder || 'default';
1115
+ $scope.accept = $scope.accept ? $scope.accept : '.mp3';
1116
+ $scope.viewOnly = $scope.view === undefined ? false : true;
1117
+
1118
+ let input = $(element).find('input')[0];
1119
+ let audio = $(element).find('audio')[0];
1120
+ let progress = $(element).find('.progress')[0];
1121
+ $(progress).hide();
1122
+
1123
+ $scope.upload = function () {
1124
+ if (!$scope.viewOnly) {
1125
+ input.click();
1126
+ }
1127
+ };
1128
+ $scope.delete = function () {
1129
+ $scope.ngModel = null;
1130
+ audio.setAttribute('src', null);
1131
+ };
1132
+
1133
+ input.addEventListener('change', function () {
1134
+ isite.uploadAudio(
1135
+ this.files,
1136
+ {
1137
+ folder: $scope.folder,
1138
+ },
1139
+ (err, audio, e) => {
1140
+ if (e) {
1141
+ $(progress).show();
1142
+ $scope.value = (e.loaded / e.total) * 100;
1143
+ $scope.max = e.total;
1144
+ $(progress).css('width', $scope.value);
1145
+ if ($scope.value === 100) {
1146
+ $(progress).hide();
1147
+ }
1148
+ }
1149
+
1150
+ if (audio) {
1151
+ $scope.ngModel = audio;
1152
+ if ($scope.ngChange) {
1153
+ $timeout(() => {
1154
+ $scope.ngChange();
1155
+ }, 200);
1156
+ }
1157
+ }
1158
+ },
1159
+ );
1160
+ });
1131
1161
 
1132
- input.addEventListener('change', function () {
1133
- isite.uploadAudio(
1134
- this.files,
1135
- {
1136
- folder: $scope.folder,
1162
+ $scope.$watch('ngModel', (ngModel) => {
1163
+ if (ngModel) {
1164
+ audio.setAttribute('src', ngModel.url);
1165
+ audio.setAttribute('type', 'audio/mpeg');
1166
+ }
1167
+ });
1137
1168
  },
1138
- (err, audio, e) => {
1139
- if (e) {
1140
- $(progress).show();
1141
- $scope.value = (e.loaded / e.total) * 100;
1142
- $scope.max = e.total;
1143
- $(progress).css('width', $scope.value);
1144
- if ($scope.value === 100) {
1145
- $(progress).hide();
1146
- }
1147
- }
1148
-
1149
- if (audio) {
1150
- $scope.ngModel = audio;
1151
- if ($scope.ngChange) {
1152
- $timeout(() => {
1153
- $scope.ngChange();
1154
- }, 200);
1155
- }
1156
- }
1157
- }
1158
- );
1159
- });
1160
-
1161
- $scope.$watch('ngModel', (ngModel) => {
1162
- if (ngModel) {
1163
- audio.setAttribute('src', ngModel.url);
1164
- audio.setAttribute('type', 'audio/mpeg');
1165
- }
1166
- });
1167
- },
1168
- template: `/*##client-side/directive/i-audio.html*/`,
1169
- };
1170
- },
1169
+ template: `/*##client-side/directive/i-audio.html*/`,
1170
+ };
1171
+ },
1171
1172
  ]);
1172
1173
 
1173
1174
  app.directive('iVideo', [
1174
- '$interval',
1175
- 'isite',
1176
- '$timeout',
1177
- function ($interval, isite, $timeout) {
1178
- return {
1179
- restrict: 'E',
1180
- required: 'ngModel',
1181
- scope: {
1182
- folder: '@',
1183
- view: '@',
1184
- accept: '@',
1185
- ngModel: '=',
1186
- ngClick: '&',
1187
- ngChange: '&',
1188
- },
1189
- link: function ($scope, element, attrs, ctrl) {
1190
- $scope.folder = $scope.folder || 'default';
1191
- $scope.accept = $scope.accept ? $scope.accept : '.mp4';
1192
- $scope.viewOnly = $scope.view === undefined ? false : true;
1193
-
1194
- let input = $(element).find('input')[0];
1195
- let video = $(element).find('video')[0];
1196
- let progress = $(element).find('.progress')[0];
1197
- $(progress).hide();
1198
-
1199
- $scope.upload = function () {
1200
- if (!$scope.viewOnly) {
1201
- input.click();
1202
- }
1203
- };
1204
- $scope.delete = function () {
1205
- $scope.ngModel = null;
1206
- video.setAttribute('src', null);
1207
- };
1175
+ '$interval',
1176
+ 'isite',
1177
+ '$timeout',
1178
+ function ($interval, isite, $timeout) {
1179
+ return {
1180
+ restrict: 'E',
1181
+ required: 'ngModel',
1182
+ scope: {
1183
+ folder: '@',
1184
+ view: '@',
1185
+ accept: '@',
1186
+ ngModel: '=',
1187
+ ngClick: '&',
1188
+ ngChange: '&',
1189
+ },
1190
+ link: function ($scope, element, attrs, ctrl) {
1191
+ $scope.folder = $scope.folder || 'default';
1192
+ $scope.accept = $scope.accept ? $scope.accept : '.mp4';
1193
+ $scope.viewOnly = $scope.view === undefined ? false : true;
1194
+
1195
+ let input = $(element).find('input')[0];
1196
+ let video = $(element).find('video')[0];
1197
+ let progress = $(element).find('.progress')[0];
1198
+ $(progress).hide();
1199
+
1200
+ $scope.upload = function () {
1201
+ if (!$scope.viewOnly) {
1202
+ input.click();
1203
+ }
1204
+ };
1205
+ $scope.delete = function () {
1206
+ $scope.ngModel = null;
1207
+ video.setAttribute('src', null);
1208
+ };
1209
+
1210
+ input.addEventListener('change', function () {
1211
+ isite.uploadVideo(
1212
+ this.files,
1213
+ {
1214
+ folder: $scope.folder,
1215
+ },
1216
+ (err, video, e) => {
1217
+ if (e) {
1218
+ $(progress).show();
1219
+ $scope.value = (e.loaded / e.total) * 100;
1220
+ $scope.max = e.total;
1221
+ $(progress).css('width', $scope.value);
1222
+ if ($scope.value === 100) {
1223
+ $(progress).hide();
1224
+ }
1225
+ }
1226
+
1227
+ if (video) {
1228
+ $scope.ngModel = video;
1229
+ if ($scope.ngChange) {
1230
+ $timeout(() => {
1231
+ $scope.ngChange();
1232
+ }, 200);
1233
+ }
1234
+ }
1235
+ },
1236
+ );
1237
+ });
1208
1238
 
1209
- input.addEventListener('change', function () {
1210
- isite.uploadVideo(
1211
- this.files,
1212
- {
1213
- folder: $scope.folder,
1239
+ $scope.capture = function () {
1240
+ let canvas = document.createElement('canvas');
1241
+ canvas.width = video.videoWidth / 4;
1242
+ canvas.height = video.videoHeight / 4;
1243
+ canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
1244
+ $scope.ngModel.imageURL = canvas.toDataURL('image/jpeg');
1245
+ };
1246
+
1247
+ video.addEventListener(
1248
+ 'canplay',
1249
+ function (e) {
1250
+ $timeout(() => {
1251
+ $scope.capture();
1252
+ }, 2000);
1253
+ },
1254
+ false,
1255
+ );
1256
+
1257
+ $scope.$watch('ngModel', (ngModel) => {
1258
+ if (ngModel) {
1259
+ video.setAttribute('src', ngModel.url);
1260
+ video.setAttribute('type', 'video/mp4');
1261
+ video.load();
1262
+ }
1263
+ });
1214
1264
  },
1215
- (err, video, e) => {
1216
- if (e) {
1217
- $(progress).show();
1218
- $scope.value = (e.loaded / e.total) * 100;
1219
- $scope.max = e.total;
1220
- $(progress).css('width', $scope.value);
1221
- if ($scope.value === 100) {
1222
- $(progress).hide();
1223
- }
1224
- }
1225
-
1226
- if (video) {
1227
- $scope.ngModel = video;
1228
- if ($scope.ngChange) {
1229
- $timeout(() => {
1230
- $scope.ngChange();
1231
- }, 200);
1232
- }
1233
- }
1234
- }
1235
- );
1236
- });
1237
-
1238
- $scope.capture = function () {
1239
- let canvas = document.createElement('canvas');
1240
- canvas.width = video.videoWidth / 4;
1241
- canvas.height = video.videoHeight / 4;
1242
- canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
1243
- $scope.ngModel.imageURL = canvas.toDataURL('image/jpeg');
1265
+ template: `/*##client-side/directive/i-video.html*/`,
1244
1266
  };
1245
-
1246
- video.addEventListener(
1247
- 'canplay',
1248
- function (e) {
1249
- $timeout(() => {
1250
- $scope.capture();
1251
- }, 2000);
1252
- },
1253
- false
1254
- );
1255
-
1256
- $scope.$watch('ngModel', (ngModel) => {
1257
- if (ngModel) {
1258
- video.setAttribute('src', ngModel.url);
1259
- video.setAttribute('type', 'video/mp4');
1260
- video.load();
1261
- }
1262
- });
1263
- },
1264
- template: `/*##client-side/directive/i-video.html*/`,
1265
- };
1266
- },
1267
+ },
1267
1268
  ]);
1268
1269
 
1269
1270
  app.directive('iUpload', [
1270
- '$interval',
1271
- 'isite',
1272
- function ($interval, isite) {
1273
- return {
1274
- restrict: 'E',
1275
- scope: {
1276
- label: '@',
1277
- api: '@',
1278
- type: '@',
1279
- view: '@',
1280
- ngClick: '&',
1281
- onUploaded: '&',
1282
- },
1283
- link: function ($scope, element, attrs, ctrl) {
1284
- let input = $(element).find('input')[0];
1285
- let a = $(element).find('button')[0];
1286
- let progress = $(element).find('progress')[0];
1287
- $(progress).hide();
1288
-
1289
- if (attrs.view !== '') {
1290
- a.addEventListener('click', function () {
1291
- input.click();
1292
- });
1293
- }
1294
-
1295
- input.addEventListener('change', function () {
1296
- if ($scope.api) {
1297
- isite.upload(
1298
- this.files,
1299
- {
1300
- api: $scope.api,
1301
- },
1302
- (err, data, e) => {
1303
- if (e) {
1304
- $(progress).show();
1305
- progress.value = e.loaded;
1306
- progress.max = e.total;
1307
- } else if (data) {
1308
- if ($scope.onUploaded) {
1309
- $scope.onUploaded({ $data: data });
1310
- }
1271
+ '$interval',
1272
+ 'isite',
1273
+ function ($interval, isite) {
1274
+ return {
1275
+ restrict: 'E',
1276
+ scope: {
1277
+ label: '@',
1278
+ api: '@',
1279
+ type: '@',
1280
+ view: '@',
1281
+ ngClick: '&',
1282
+ onUploaded: '&',
1283
+ },
1284
+ link: function ($scope, element, attrs, ctrl) {
1285
+ let input = $(element).find('input')[0];
1286
+ let a = $(element).find('button')[0];
1287
+ let progress = $(element).find('progress')[0];
1288
+ $(progress).hide();
1289
+
1290
+ if (attrs.view !== '') {
1291
+ a.addEventListener('click', function () {
1292
+ input.click();
1293
+ });
1311
1294
  }
1312
- }
1313
- );
1314
- }
1315
- });
1316
- },
1317
- template: `/*##client-side/directive/i-upload.html*/`,
1318
- };
1319
- },
1320
- ]);
1321
1295
 
1322
- app.directive('iTreeview', [
1323
- '$interval',
1324
- '$timeout',
1325
- 'isite',
1326
- function ($interval, $timeout, isite) {
1327
- return {
1328
- restrict: 'E',
1329
- require: 'ngModel',
1330
- scope: {
1331
- v: '@',
1332
- label: '@',
1333
- display: '@',
1334
- display2: '@',
1335
- disabled: '@',
1336
- space: '@',
1337
- primary: '@',
1338
- ngValue: '@',
1339
- ngModel: '=',
1340
- ngSearch: '=',
1341
- ngChange: '&',
1342
- ngClick: '&',
1343
- ngAdd: '&',
1344
- ngNode: '&',
1345
- ngEdit: '&',
1346
- ngDelete: '&',
1347
- nodes: '=',
1348
- },
1349
- link: function ($scope, element, attrs, ctrl) {
1350
- attrs.display = attrs.display || 'name';
1351
- attrs.primary = attrs.primary || 'id';
1352
- attrs.space = attrs.space || ' ';
1353
- attrs.ngValue = attrs.ngValue || '';
1354
-
1355
- $scope.source = {};
1356
-
1357
- $scope.setNodes = function (v_node) {
1358
- v_node.nodes.forEach((v_node2) => {
1359
- v_node2.nodes = v_node2.nodes || [];
1360
- $scope.nodes.forEach((node) => {
1361
- if (node.$parent_id == v_node2.id) {
1362
- node.v_display = node.v_display || '';
1363
- node.v_display += node[attrs.display];
1364
-
1365
- let exist = !1;
1366
- v_node2.nodes.forEach((n) => {
1367
- if (n.id == node.id) {
1368
- exist = !0;
1369
- }
1296
+ input.addEventListener('change', function () {
1297
+ if ($scope.api) {
1298
+ isite.upload(
1299
+ this.files,
1300
+ {
1301
+ api: $scope.api,
1302
+ },
1303
+ (err, data, e) => {
1304
+ if (e) {
1305
+ $(progress).show();
1306
+ progress.value = e.loaded;
1307
+ progress.max = e.total;
1308
+ } else if (data) {
1309
+ if ($scope.onUploaded) {
1310
+ $scope.onUploaded({ $data: data });
1311
+ }
1312
+ }
1313
+ },
1314
+ );
1315
+ }
1370
1316
  });
1371
- if (!exist) {
1372
- v_node2.nodes.push(node);
1373
- }
1374
- }
1375
- });
1376
- $scope.setNodes(v_node2);
1377
- });
1317
+ },
1318
+ template: `/*##client-side/directive/i-upload.html*/`,
1378
1319
  };
1320
+ },
1321
+ ]);
1379
1322
 
1380
- $scope.v_nodes = [];
1381
-
1382
- $scope.$watch('ngModel', (ngModel) => {
1383
- if (ngModel) {
1384
- $scope.ngModel = ngModel;
1385
- $scope.ngModel.v_display = $scope.ngModel.v_display || ngModel[attrs.display];
1386
- }
1387
- });
1388
-
1389
- $scope.$watch('nodes', (nodes) => {
1390
- $scope.v_nodes = [];
1391
- if (nodes) {
1392
- nodes.forEach((node) => {
1393
- node.$parent_id = node.parent_id || node.parentId || 0;
1394
- node.v_display = node.v_display || '';
1395
- node.v_display += node[attrs.display];
1396
- if (node.$parent_id == 0) {
1397
- let exist = !1;
1398
- $scope.v_nodes.forEach((n) => {
1399
- if (n.id == node.id) {
1400
- exist = !0;
1401
- }
1323
+ app.directive('iTreeview', [
1324
+ '$interval',
1325
+ '$timeout',
1326
+ 'isite',
1327
+ function ($interval, $timeout, isite) {
1328
+ return {
1329
+ restrict: 'E',
1330
+ require: 'ngModel',
1331
+ scope: {
1332
+ v: '@',
1333
+ label: '@',
1334
+ display: '@',
1335
+ display2: '@',
1336
+ disabled: '@',
1337
+ space: '@',
1338
+ primary: '@',
1339
+ ngValue: '@',
1340
+ ngModel: '=',
1341
+ ngSearch: '=',
1342
+ ngChange: '&',
1343
+ ngClick: '&',
1344
+ ngAdd: '&',
1345
+ ngNode: '&',
1346
+ ngEdit: '&',
1347
+ ngDelete: '&',
1348
+ nodes: '=',
1349
+ },
1350
+ link: function ($scope, element, attrs, ctrl) {
1351
+ attrs.display = attrs.display || 'name';
1352
+ attrs.primary = attrs.primary || 'id';
1353
+ attrs.space = attrs.space || ' ';
1354
+ attrs.ngValue = attrs.ngValue || '';
1355
+
1356
+ $scope.source = {};
1357
+
1358
+ $scope.setNodes = function (v_node) {
1359
+ v_node.nodes.forEach((v_node2) => {
1360
+ v_node2.nodes = v_node2.nodes || [];
1361
+ $scope.nodes.forEach((node) => {
1362
+ if (node.$parent_id == v_node2.id) {
1363
+ node.v_display = node.v_display || '';
1364
+ node.v_display += node[attrs.display];
1365
+
1366
+ let exist = !1;
1367
+ v_node2.nodes.forEach((n) => {
1368
+ if (n.id == node.id) {
1369
+ exist = !0;
1370
+ }
1371
+ });
1372
+ if (!exist) {
1373
+ v_node2.nodes.push(node);
1374
+ }
1375
+ }
1376
+ });
1377
+ $scope.setNodes(v_node2);
1378
+ });
1379
+ };
1380
+
1381
+ $scope.v_nodes = [];
1382
+
1383
+ $scope.$watch('ngModel', (ngModel) => {
1384
+ if (ngModel) {
1385
+ $scope.ngModel = ngModel;
1386
+ $scope.ngModel.v_display = $scope.ngModel.v_display || ngModel[attrs.display];
1387
+ }
1402
1388
  });
1403
- if (!exist) {
1404
- $scope.v_nodes.push(node);
1405
- }
1406
- }
1407
- });
1408
-
1409
- $scope.v_nodes.forEach((v_node) => {
1410
- v_node.nodes = v_node.nodes || [];
1411
1389
 
1412
- nodes.forEach((node) => {
1413
- node.$parent_id = node.parent_id || node.parentId || 0;
1414
- if (node.$parent_id == v_node.id) {
1415
- node.v_display = node.v_display || '';
1416
- node.v_display += node[attrs.display];
1417
-
1418
- let exist = !1;
1419
- v_node.nodes.forEach((n) => {
1420
- if (n.id == node.id) {
1421
- exist = !0;
1390
+ $scope.$watch('nodes', (nodes) => {
1391
+ $scope.v_nodes = [];
1392
+ if (nodes) {
1393
+ nodes.forEach((node) => {
1394
+ node.$parent_id = node.parent_id || node.parentId || 0;
1395
+ node.v_display = node.v_display || '';
1396
+ node.v_display += node[attrs.display];
1397
+ if (node.$parent_id == 0) {
1398
+ let exist = !1;
1399
+ $scope.v_nodes.forEach((n) => {
1400
+ if (n.id == node.id) {
1401
+ exist = !0;
1402
+ }
1403
+ });
1404
+ if (!exist) {
1405
+ $scope.v_nodes.push(node);
1406
+ }
1407
+ }
1408
+ });
1409
+
1410
+ $scope.v_nodes.forEach((v_node) => {
1411
+ v_node.nodes = v_node.nodes || [];
1412
+
1413
+ nodes.forEach((node) => {
1414
+ node.$parent_id = node.parent_id || node.parentId || 0;
1415
+ if (node.$parent_id == v_node.id) {
1416
+ node.v_display = node.v_display || '';
1417
+ node.v_display += node[attrs.display];
1418
+
1419
+ let exist = !1;
1420
+ v_node.nodes.forEach((n) => {
1421
+ if (n.id == node.id) {
1422
+ exist = !0;
1423
+ }
1424
+ });
1425
+ if (!exist) {
1426
+ v_node.nodes.push(node);
1427
+ }
1428
+ }
1429
+ });
1430
+
1431
+ $scope.setNodes(v_node);
1432
+ });
1422
1433
  }
1423
- });
1424
- if (!exist) {
1425
- v_node.nodes.push(node);
1426
- }
1427
- }
1428
- });
1429
-
1430
- $scope.setNodes(v_node);
1431
- });
1432
- }
1433
- });
1434
- },
1435
- template: `/*##client-side/directive/i-treeview.html*/`,
1436
- };
1437
- },
1434
+ });
1435
+ },
1436
+ template: `/*##client-side/directive/i-treeview.html*/`,
1437
+ };
1438
+ },
1438
1439
  ]);
1439
1440
 
1440
1441
  app.directive('iTreenode', [
1441
- '$interval',
1442
- '$timeout',
1443
- 'isite',
1444
- function ($interval, $timeout, isite) {
1445
- return {
1446
- restrict: 'E',
1447
- require: 'ngModel',
1448
- scope: {
1449
- v: '@',
1450
- label: '@',
1451
- display: '@',
1452
- display2: '@',
1453
- disabled: '@',
1454
- space: '@',
1455
- primary: '@',
1456
- ngValue: '@',
1457
- ngChange: '&',
1458
- ngClick: '&',
1459
- ngAdd: '&',
1460
- ngEdit: '&',
1461
- ngDelete: '&',
1462
- ngModel: '=',
1463
- ngSearch: '=',
1464
- nodes: '=',
1465
- nodes: '=',
1466
- },
1467
- link: function ($scope, element, attrs, ctrl) {
1468
- attrs.display = attrs.display || 'name';
1469
- attrs.primary = attrs.primary || 'id';
1470
- attrs.space = attrs.space || ' ';
1471
- attrs.ngValue = attrs.ngValue || '';
1472
- $scope.nodes = $scope.nodes || [];
1473
-
1474
- $scope.v_nodes = [];
1475
-
1476
- $scope.$watch('nodes', (nodes) => {
1477
- $scope.v_nodes = [];
1478
- if (nodes) {
1479
- nodes.forEach((node, i) => {
1480
- if (node.nodes) {
1481
- node.nodes.forEach((node2, i) => {
1482
- node2.$parent_id = node2.parent_id || node.id;
1483
- node2.v_display = node.v_display || ' ';
1484
- node2.v_display += ' - ' + node2[attrs.display];
1442
+ '$interval',
1443
+ '$timeout',
1444
+ 'isite',
1445
+ function ($interval, $timeout, isite) {
1446
+ return {
1447
+ restrict: 'E',
1448
+ require: 'ngModel',
1449
+ scope: {
1450
+ v: '@',
1451
+ label: '@',
1452
+ display: '@',
1453
+ display2: '@',
1454
+ disabled: '@',
1455
+ space: '@',
1456
+ primary: '@',
1457
+ ngValue: '@',
1458
+ ngChange: '&',
1459
+ ngClick: '&',
1460
+ ngAdd: '&',
1461
+ ngEdit: '&',
1462
+ ngDelete: '&',
1463
+ ngModel: '=',
1464
+ ngSearch: '=',
1465
+ nodes: '=',
1466
+ nodes: '=',
1467
+ },
1468
+ link: function ($scope, element, attrs, ctrl) {
1469
+ attrs.display = attrs.display || 'name';
1470
+ attrs.primary = attrs.primary || 'id';
1471
+ attrs.space = attrs.space || ' ';
1472
+ attrs.ngValue = attrs.ngValue || '';
1473
+ $scope.nodes = $scope.nodes || [];
1474
+
1475
+ $scope.v_nodes = [];
1476
+
1477
+ $scope.$watch('nodes', (nodes) => {
1478
+ $scope.v_nodes = [];
1479
+ if (nodes) {
1480
+ nodes.forEach((node, i) => {
1481
+ if (node.nodes) {
1482
+ node.nodes.forEach((node2, i) => {
1483
+ node2.$parent_id = node2.parent_id || node.id;
1484
+ node2.v_display = node.v_display || ' ';
1485
+ node2.v_display += ' - ' + node2[attrs.display];
1486
+ });
1487
+ }
1488
+ });
1489
+ }
1485
1490
  });
1486
- }
1487
- });
1488
- }
1489
- });
1490
-
1491
- $scope.updateParentModal = function (parent, node) {
1492
- if (parent) {
1493
- parent.ngModel = node;
1494
- if (parent.$parent) {
1495
- $scope.updateParentModal(parent.$parent, node);
1496
- }
1497
- }
1498
- };
1499
1491
 
1500
- $scope.unSelectParent = function (parent) {
1501
- if (parent && parent.nodes) {
1502
- parent.nodes.forEach((node) => {
1503
- node.$selected = !1;
1504
- });
1505
- if (parent.$parent) {
1506
- $scope.unSelectParent(parent.$parent);
1507
- }
1508
- }
1509
- };
1510
-
1511
- $scope.unSelectNodes = function (nodes) {
1512
- if (nodes) {
1513
- nodes.forEach((node) => {
1514
- node.$selected = !1;
1515
- if (node.nodes) {
1516
- $scope.unSelectNodes(node.nodes);
1517
- }
1518
- });
1519
- }
1520
- };
1492
+ $scope.updateParentModal = function (parent, node) {
1493
+ if (parent) {
1494
+ parent.ngModel = node;
1495
+ if (parent.$parent) {
1496
+ $scope.updateParentModal(parent.$parent, node);
1497
+ }
1498
+ }
1499
+ };
1500
+
1501
+ $scope.unSelectParent = function (parent) {
1502
+ if (parent && parent.nodes) {
1503
+ parent.nodes.forEach((node) => {
1504
+ node.$selected = !1;
1505
+ });
1506
+ if (parent.$parent) {
1507
+ $scope.unSelectParent(parent.$parent);
1508
+ }
1509
+ }
1510
+ };
1511
+
1512
+ $scope.unSelectNodes = function (nodes) {
1513
+ if (nodes) {
1514
+ nodes.forEach((node) => {
1515
+ node.$selected = !1;
1516
+ if (node.nodes) {
1517
+ $scope.unSelectNodes(node.nodes);
1518
+ }
1519
+ });
1520
+ }
1521
+ };
1521
1522
 
1522
- $scope.updateModal = function (node) {
1523
- $scope.ngModel = node;
1524
- $scope.updateParentModal($scope.$parent, node);
1525
- };
1523
+ $scope.updateModal = function (node) {
1524
+ $scope.ngModel = node;
1525
+ $scope.updateParentModal($scope.$parent, node);
1526
+ };
1526
1527
 
1527
- $scope.selected = function (node) {
1528
- $scope.unSelectParent($scope.$parent);
1529
- $scope.unSelectNodes($scope.nodes);
1528
+ $scope.selected = function (node) {
1529
+ $scope.unSelectParent($scope.$parent);
1530
+ $scope.unSelectNodes($scope.nodes);
1530
1531
 
1531
- if (node.nodes) {
1532
- node.nodes.forEach((itm) => {
1533
- itm.$selected = !1;
1534
- });
1535
- }
1532
+ if (node.nodes) {
1533
+ node.nodes.forEach((itm) => {
1534
+ itm.$selected = !1;
1535
+ });
1536
+ }
1536
1537
 
1537
- node.$selected = !0;
1538
+ node.$selected = !0;
1539
+ };
1540
+ },
1541
+ template: `/*##client-side/directive/i-treenode.html*/`,
1538
1542
  };
1539
- },
1540
- template: `/*##client-side/directive/i-treenode.html*/`,
1541
- };
1542
- },
1543
+ },
1543
1544
  ]);