Browse code

new build from home

Louis Jonget authored on18/03/2023 14:55:56
Showing1 changed files
... ...
@@ -1,180 +1,180 @@
1
-'use strict';
2
-
3
-var _ = require('../vendor/minified')._;
4
-
5
-/**
6
- * @returns {ClayItem|ClayEvents}
7
- * @extends {ClayItem}
8
- */
9
-function disable() {
10
-  if (this.$manipulatorTarget.get('disabled')) { return this; }
11
-  this.$element.set('+disabled');
12
-  this.$manipulatorTarget.set('disabled', true);
13
-  return this.trigger('disabled');
14
-}
15
-
16
-/**
17
- * @returns {ClayItem|ClayEvents}
18
- * @extends {ClayItem}
19
- */
20
-function enable() {
21
-  if (!this.$manipulatorTarget.get('disabled')) { return this; }
22
-  this.$element.set('-disabled');
23
-  this.$manipulatorTarget.set('disabled', false);
24
-  return this.trigger('enabled');
25
-}
26
-
27
-/**
28
- * @returns {ClayItem|ClayEvents}
29
- * @extends {ClayItem}
30
- */
31
-function hide() {
32
-  if (this.$element[0].classList.contains('hide')) { return this; }
33
-  this.$element.set('+hide');
34
-  return this.trigger('hide');
35
-}
36
-
37
-/**
38
- * @returns {ClayItem|ClayEvents}
39
- * @extends {ClayItem}
40
- */
41
-function show() {
42
-  if (!this.$element[0].classList.contains('hide')) { return this; }
43
-  this.$element.set('-hide');
44
-  return this.trigger('show');
45
-}
46
-
47
-module.exports = {
48
-  html: {
49
-    get: function() {
50
-      return this.$manipulatorTarget.get('innerHTML');
51
-    },
52
-    set: function(value) {
53
-      if (this.get() === value.toString(10)) { return this; }
54
-      this.$manipulatorTarget.set('innerHTML', value);
55
-      return this.trigger('change');
56
-    },
57
-    hide: hide,
58
-    show: show
59
-  },
60
-  button: {
61
-    get: function() {
62
-      return this.$manipulatorTarget.get('innerHTML');
63
-    },
64
-    set: function(value) {
65
-      if (this.get() === value.toString(10)) { return this; }
66
-      this.$manipulatorTarget.set('innerHTML', value);
67
-      return this.trigger('change');
68
-    },
69
-    disable: disable,
70
-    enable: enable,
71
-    hide: hide,
72
-    show: show
73
-  },
74
-  val: {
75
-    get: function() {
76
-      return this.$manipulatorTarget.get('value');
77
-    },
78
-    set: function(value) {
79
-      if (this.get() === value.toString(10)) { return this; }
80
-      this.$manipulatorTarget.set('value', value);
81
-      return this.trigger('change');
82
-    },
83
-    disable: disable,
84
-    enable: enable,
85
-    hide: hide,
86
-    show: show
87
-  },
88
-  slider: {
89
-    get: function() {
90
-      return parseFloat(this.$manipulatorTarget.get('value'));
91
-    },
92
-    set: function(value) {
93
-      var initVal = this.get();
94
-      this.$manipulatorTarget.set('value', value);
95
-      if (this.get() === initVal) { return this; }
96
-      return this.trigger('change');
97
-    },
98
-    disable: disable,
99
-    enable: enable,
100
-    hide: hide,
101
-    show: show
102
-  },
103
-  checked: {
104
-    get: function() {
105
-      return this.$manipulatorTarget.get('checked');
106
-    },
107
-    set: function(value) {
108
-      if (!this.get() === !value) { return this; }
109
-      this.$manipulatorTarget.set('checked', !!value);
110
-      return this.trigger('change');
111
-    },
112
-    disable: disable,
113
-    enable: enable,
114
-    hide: hide,
115
-    show: show
116
-  },
117
-  radiogroup: {
118
-    get: function() {
119
-      return this.$element.select('input:checked').get('value');
120
-    },
121
-    set: function(value) {
122
-      if (this.get() === value.toString(10)) { return this; }
123
-      this.$element
124
-        .select('input[value="' + value.replace('"', '\\"') + '"]')
125
-        .set('checked', true);
126
-      return this.trigger('change');
127
-    },
128
-    disable: disable,
129
-    enable: enable,
130
-    hide: hide,
131
-    show: show
132
-  },
133
-  checkboxgroup: {
134
-    get: function() {
135
-      var result = [];
136
-      this.$element.select('input').each(function(item) {
137
-        result.push(!!item.checked);
138
-      });
139
-      return result;
140
-    },
141
-    set: function(values) {
142
-      var self = this;
143
-      values = Array.isArray(values) ? values : [];
144
-
145
-      while (values.length < this.get().length) {
146
-        values.push(false);
147
-      }
148
-
149
-      if (_.equals(this.get(), values)) { return this; }
150
-
151
-      self.$element.select('input')
152
-        .set('checked', false)
153
-        .each(function(item, index) {
154
-          item.checked = !!values[index];
155
-        });
156
-
157
-      return self.trigger('change');
158
-    },
159
-    disable: disable,
160
-    enable: enable,
161
-    hide: hide,
162
-    show: show
163
-  },
164
-  color: {
165
-    get: function() {
166
-      return parseInt(this.$manipulatorTarget.get('value'), 10) || 0;
167
-    },
168
-    set: function(value) {
169
-      value = this.roundColorToLayout(value || 0);
170
-
171
-      if (this.get() === value) { return this; }
172
-      this.$manipulatorTarget.set('value', value);
173
-      return this.trigger('change');
174
-    },
175
-    disable: disable,
176
-    enable: enable,
177
-    hide: hide,
178
-    show: show
179
-  }
180
-};
1
+'use strict';
2
+
3
+var _ = require('../vendor/minified')._;
4
+
5
+/**
6
+ * @returns {ClayItem|ClayEvents}
7
+ * @extends {ClayItem}
8
+ */
9
+function disable() {
10
+  if (this.$manipulatorTarget.get('disabled')) { return this; }
11
+  this.$element.set('+disabled');
12
+  this.$manipulatorTarget.set('disabled', true);
13
+  return this.trigger('disabled');
14
+}
15
+
16
+/**
17
+ * @returns {ClayItem|ClayEvents}
18
+ * @extends {ClayItem}
19
+ */
20
+function enable() {
21
+  if (!this.$manipulatorTarget.get('disabled')) { return this; }
22
+  this.$element.set('-disabled');
23
+  this.$manipulatorTarget.set('disabled', false);
24
+  return this.trigger('enabled');
25
+}
26
+
27
+/**
28
+ * @returns {ClayItem|ClayEvents}
29
+ * @extends {ClayItem}
30
+ */
31
+function hide() {
32
+  if (this.$element[0].classList.contains('hide')) { return this; }
33
+  this.$element.set('+hide');
34
+  return this.trigger('hide');
35
+}
36
+
37
+/**
38
+ * @returns {ClayItem|ClayEvents}
39
+ * @extends {ClayItem}
40
+ */
41
+function show() {
42
+  if (!this.$element[0].classList.contains('hide')) { return this; }
43
+  this.$element.set('-hide');
44
+  return this.trigger('show');
45
+}
46
+
47
+module.exports = {
48
+  html: {
49
+    get: function() {
50
+      return this.$manipulatorTarget.get('innerHTML');
51
+    },
52
+    set: function(value) {
53
+      if (this.get() === value.toString(10)) { return this; }
54
+      this.$manipulatorTarget.set('innerHTML', value);
55
+      return this.trigger('change');
56
+    },
57
+    hide: hide,
58
+    show: show
59
+  },
60
+  button: {
61
+    get: function() {
62
+      return this.$manipulatorTarget.get('innerHTML');
63
+    },
64
+    set: function(value) {
65
+      if (this.get() === value.toString(10)) { return this; }
66
+      this.$manipulatorTarget.set('innerHTML', value);
67
+      return this.trigger('change');
68
+    },
69
+    disable: disable,
70
+    enable: enable,
71
+    hide: hide,
72
+    show: show
73
+  },
74
+  val: {
75
+    get: function() {
76
+      return this.$manipulatorTarget.get('value');
77
+    },
78
+    set: function(value) {
79
+      if (this.get() === value.toString(10)) { return this; }
80
+      this.$manipulatorTarget.set('value', value);
81
+      return this.trigger('change');
82
+    },
83
+    disable: disable,
84
+    enable: enable,
85
+    hide: hide,
86
+    show: show
87
+  },
88
+  slider: {
89
+    get: function() {
90
+      return parseFloat(this.$manipulatorTarget.get('value'));
91
+    },
92
+    set: function(value) {
93
+      var initVal = this.get();
94
+      this.$manipulatorTarget.set('value', value);
95
+      if (this.get() === initVal) { return this; }
96
+      return this.trigger('change');
97
+    },
98
+    disable: disable,
99
+    enable: enable,
100
+    hide: hide,
101
+    show: show
102
+  },
103
+  checked: {
104
+    get: function() {
105
+      return this.$manipulatorTarget.get('checked');
106
+    },
107
+    set: function(value) {
108
+      if (!this.get() === !value) { return this; }
109
+      this.$manipulatorTarget.set('checked', !!value);
110
+      return this.trigger('change');
111
+    },
112
+    disable: disable,
113
+    enable: enable,
114
+    hide: hide,
115
+    show: show
116
+  },
117
+  radiogroup: {
118
+    get: function() {
119
+      return this.$element.select('input:checked').get('value');
120
+    },
121
+    set: function(value) {
122
+      if (this.get() === value.toString(10)) { return this; }
123
+      this.$element
124
+        .select('input[value="' + value.replace('"', '\\"') + '"]')
125
+        .set('checked', true);
126
+      return this.trigger('change');
127
+    },
128
+    disable: disable,
129
+    enable: enable,
130
+    hide: hide,
131
+    show: show
132
+  },
133
+  checkboxgroup: {
134
+    get: function() {
135
+      var result = [];
136
+      this.$element.select('input').each(function(item) {
137
+        result.push(!!item.checked);
138
+      });
139
+      return result;
140
+    },
141
+    set: function(values) {
142
+      var self = this;
143
+      values = Array.isArray(values) ? values : [];
144
+
145
+      while (values.length < this.get().length) {
146
+        values.push(false);
147
+      }
148
+
149
+      if (_.equals(this.get(), values)) { return this; }
150
+
151
+      self.$element.select('input')
152
+        .set('checked', false)
153
+        .each(function(item, index) {
154
+          item.checked = !!values[index];
155
+        });
156
+
157
+      return self.trigger('change');
158
+    },
159
+    disable: disable,
160
+    enable: enable,
161
+    hide: hide,
162
+    show: show
163
+  },
164
+  color: {
165
+    get: function() {
166
+      return parseInt(this.$manipulatorTarget.get('value'), 10) || 0;
167
+    },
168
+    set: function(value) {
169
+      value = this.roundColorToLayout(value || 0);
170
+
171
+      if (this.get() === value) { return this; }
172
+      this.$manipulatorTarget.set('value', value);
173
+      return this.trigger('change');
174
+    },
175
+    disable: disable,
176
+    enable: enable,
177
+    hide: hide,
178
+    show: show
179
+  }
180
+};
Browse code

init commit

louis.jonget authored on30/09/2022 18:58:18
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,180 @@
1
+'use strict';
2
+
3
+var _ = require('../vendor/minified')._;
4
+
5
+/**
6
+ * @returns {ClayItem|ClayEvents}
7
+ * @extends {ClayItem}
8
+ */
9
+function disable() {
10
+  if (this.$manipulatorTarget.get('disabled')) { return this; }
11
+  this.$element.set('+disabled');
12
+  this.$manipulatorTarget.set('disabled', true);
13
+  return this.trigger('disabled');
14
+}
15
+
16
+/**
17
+ * @returns {ClayItem|ClayEvents}
18
+ * @extends {ClayItem}
19
+ */
20
+function enable() {
21
+  if (!this.$manipulatorTarget.get('disabled')) { return this; }
22
+  this.$element.set('-disabled');
23
+  this.$manipulatorTarget.set('disabled', false);
24
+  return this.trigger('enabled');
25
+}
26
+
27
+/**
28
+ * @returns {ClayItem|ClayEvents}
29
+ * @extends {ClayItem}
30
+ */
31
+function hide() {
32
+  if (this.$element[0].classList.contains('hide')) { return this; }
33
+  this.$element.set('+hide');
34
+  return this.trigger('hide');
35
+}
36
+
37
+/**
38
+ * @returns {ClayItem|ClayEvents}
39
+ * @extends {ClayItem}
40
+ */
41
+function show() {
42
+  if (!this.$element[0].classList.contains('hide')) { return this; }
43
+  this.$element.set('-hide');
44
+  return this.trigger('show');
45
+}
46
+
47
+module.exports = {
48
+  html: {
49
+    get: function() {
50
+      return this.$manipulatorTarget.get('innerHTML');
51
+    },
52
+    set: function(value) {
53
+      if (this.get() === value.toString(10)) { return this; }
54
+      this.$manipulatorTarget.set('innerHTML', value);
55
+      return this.trigger('change');
56
+    },
57
+    hide: hide,
58
+    show: show
59
+  },
60
+  button: {
61
+    get: function() {
62
+      return this.$manipulatorTarget.get('innerHTML');
63
+    },
64
+    set: function(value) {
65
+      if (this.get() === value.toString(10)) { return this; }
66
+      this.$manipulatorTarget.set('innerHTML', value);
67
+      return this.trigger('change');
68
+    },
69
+    disable: disable,
70
+    enable: enable,
71
+    hide: hide,
72
+    show: show
73
+  },
74
+  val: {
75
+    get: function() {
76
+      return this.$manipulatorTarget.get('value');
77
+    },
78
+    set: function(value) {
79
+      if (this.get() === value.toString(10)) { return this; }
80
+      this.$manipulatorTarget.set('value', value);
81
+      return this.trigger('change');
82
+    },
83
+    disable: disable,
84
+    enable: enable,
85
+    hide: hide,
86
+    show: show
87
+  },
88
+  slider: {
89
+    get: function() {
90
+      return parseFloat(this.$manipulatorTarget.get('value'));
91
+    },
92
+    set: function(value) {
93
+      var initVal = this.get();
94
+      this.$manipulatorTarget.set('value', value);
95
+      if (this.get() === initVal) { return this; }
96
+      return this.trigger('change');
97
+    },
98
+    disable: disable,
99
+    enable: enable,
100
+    hide: hide,
101
+    show: show
102
+  },
103
+  checked: {
104
+    get: function() {
105
+      return this.$manipulatorTarget.get('checked');
106
+    },
107
+    set: function(value) {
108
+      if (!this.get() === !value) { return this; }
109
+      this.$manipulatorTarget.set('checked', !!value);
110
+      return this.trigger('change');
111
+    },
112
+    disable: disable,
113
+    enable: enable,
114
+    hide: hide,
115
+    show: show
116
+  },
117
+  radiogroup: {
118
+    get: function() {
119
+      return this.$element.select('input:checked').get('value');
120
+    },
121
+    set: function(value) {
122
+      if (this.get() === value.toString(10)) { return this; }
123
+      this.$element
124
+        .select('input[value="' + value.replace('"', '\\"') + '"]')
125
+        .set('checked', true);
126
+      return this.trigger('change');
127
+    },
128
+    disable: disable,
129
+    enable: enable,
130
+    hide: hide,
131
+    show: show
132
+  },
133
+  checkboxgroup: {
134
+    get: function() {
135
+      var result = [];
136
+      this.$element.select('input').each(function(item) {
137
+        result.push(!!item.checked);
138
+      });
139
+      return result;
140
+    },
141
+    set: function(values) {
142
+      var self = this;
143
+      values = Array.isArray(values) ? values : [];
144
+
145
+      while (values.length < this.get().length) {
146
+        values.push(false);
147
+      }
148
+
149
+      if (_.equals(this.get(), values)) { return this; }
150
+
151
+      self.$element.select('input')
152
+        .set('checked', false)
153
+        .each(function(item, index) {
154
+          item.checked = !!values[index];
155
+        });
156
+
157
+      return self.trigger('change');
158
+    },
159
+    disable: disable,
160
+    enable: enable,
161
+    hide: hide,
162
+    show: show
163
+  },
164
+  color: {
165
+    get: function() {
166
+      return parseInt(this.$manipulatorTarget.get('value'), 10) || 0;
167
+    },
168
+    set: function(value) {
169
+      value = this.roundColorToLayout(value || 0);
170
+
171
+      if (this.get() === value) { return this; }
172
+      this.$manipulatorTarget.set('value', value);
173
+      return this.trigger('change');
174
+    },
175
+    disable: disable,
176
+    enable: enable,
177
+    hide: hide,
178
+    show: show
179
+  }
180
+};