@hpcc-js/other 3.5.4 → 3.5.6

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.
package/src/Persist.ts CHANGED
@@ -1,151 +1,151 @@
1
- export function discover(widget) {
2
- return widget.publishedProperties(false, true);
3
- }
4
-
5
- export function widgetArrayWalker(widgets, visitor) {
6
- if (!widgets)
7
- return;
8
- widgets.forEach(function (widget) {
9
- widget.widgetWalker(visitor);
10
- });
11
- }
12
-
13
- export function widgetPropertyWalker(widget2, visitor, filter?) {
14
- widget2.widgetWalker(function (widget) {
15
- widget.propertyWalker(visitor, filter);
16
- });
17
- }
18
-
19
- export function serializeTheme(widget, filter) {
20
- return JSON.stringify(serializeThemeToObject(widget, filter));
21
- }
22
-
23
- export function serializeThemeToObject(widget2, filter?) {
24
- filter = filter || ["surface", "Color", "Font", "palette"];
25
-
26
- const propObj = {};
27
- widgetPropertyWalker(widget2, null, function (widget, item) {
28
- if (widget[item.id + "_modified"]() || widget.publishedProperty(item.id).origDefaultValue !== widget.publishedProperty(item.id).defaultValue) {
29
- if (_isFilterMatch(item.id, filter)) {
30
- const classParts = widget._class.trim().split(" ");
31
- for (const i in classParts) {
32
- if (classParts.HasOwnProperty(i)) {
33
- if (propObj[classParts[i]] === undefined) {
34
- propObj[classParts[i]] = {};
35
- }
36
- if (propObj[classParts[i]][item.id] === undefined) {
37
- propObj[classParts[i]][item.id] = widget[item.id]();
38
- break;
39
- } else if (propObj[classParts[i]][item.id] === widget[item.id]()) {
40
- break;
41
- }
42
- }
43
- }
44
- }
45
- }
46
- });
47
-
48
- function _isFilterMatch(str, arr) {
49
- let ret = false;
50
- for (const i in arr) {
51
- if (str.indexOf(arr[i]) !== -1) {
52
- ret = true;
53
- break;
54
- }
55
- }
56
- return ret;
57
- }
58
- return propObj;
59
- }
60
- export function removeTheme(widget2, callback) {
61
- widgetPropertyWalker(widget2, null, function (widget, item) {
62
- widget.publishedProperty(item.id).defaultValue = widget.publishedProperty(item.id).origDefaultValue;
63
- });
64
-
65
- if (typeof (callback) === "function") {
66
- callback.call(this);
67
- }
68
- }
69
- export function applyTheme(widget2, themeObj, callback) {
70
- const context = this;
71
- widgetPropertyWalker(widget2, null, function (widget3, item) {
72
- switch (item.type) {
73
- case "widget":
74
- context.applyTheme(widget3[item.id](), themeObj);
75
- return true;
76
- case "widgetArray":
77
- const widgetArray = widget3[item.id]();
78
- widgetArray.forEach(function (widget) {
79
- context.applyTheme(widget, themeObj);
80
- }, this);
81
- return true;
82
- default:
83
- widget3.applyTheme(themeObj);
84
- break;
85
- }
86
- });
87
- if (typeof (callback) === "function") {
88
- callback.call(this);
89
- }
90
- }
91
-
92
- export function serializeToObject(widget, filter?, includeData?, includeState?) {
93
- const retVal: any = {
94
- __class: widget.classID()
95
- };
96
- if (widget._id.indexOf(widget._idSeed) !== 0) {
97
- retVal.__id = widget._id;
98
- }
99
- if (widget.version) {
100
- retVal.__version = widget.version();
101
- }
102
- retVal.__properties = {};
103
-
104
- widget.propertyWalker((childWwidget2, item) => {
105
- if (childWwidget2[item.id + "_modified"]()) {
106
- switch (item.type) {
107
- case "widget":
108
- retVal.__properties[item.id] = serializeToObject(childWwidget2[item.id](), null, includeData, includeState && !widget.serializeState); // Only include state once
109
- return true;
110
- case "widgetArray":
111
- case "propertyArray":
112
- retVal.__properties[item.id] = [];
113
- const widgetArray = childWwidget2[item.id]();
114
- widgetArray.forEach((childWwidget) => {
115
- retVal.__properties[item.id].push(serializeToObject(childWwidget, null, includeData, includeState && !widget.serializeState)); // Only include state once
116
- });
117
- return true;
118
- default:
119
- retVal.__properties[item.id] = childWwidget2[item.id]();
120
- break;
121
- }
122
- }
123
- }, filter);
124
-
125
- if (widget.classID() === "marshaller_Graph") {
126
- const vertices = widget.data().vertices;
127
- if (vertices) {
128
- this.__vertices = vertices.map(item => {
129
- return serializeToObject(item, null, includeData, includeState && !widget.serializeState);
130
- });
131
- }
132
- }
133
- if (includeData && widget.data) {
134
- if (!retVal.__data) retVal.__data = {};
135
- retVal.__data.data = widget.data();
136
- }
137
- if (includeState) {
138
- if (widget.serializeState) {
139
- retVal.__state = widget.serializeState();
140
- } else if (widget.data) {
141
- retVal.__state = {
142
- data: widget.data()
143
- };
144
- }
145
- }
146
- return retVal;
147
- }
148
-
149
- export function serialize(widget, filter?, includeData?, includeState?) {
150
- return JSON.stringify(serializeToObject(widget, filter, includeData, includeState));
151
- }
1
+ export function discover(widget) {
2
+ return widget.publishedProperties(false, true);
3
+ }
4
+
5
+ export function widgetArrayWalker(widgets, visitor) {
6
+ if (!widgets)
7
+ return;
8
+ widgets.forEach(function (widget) {
9
+ widget.widgetWalker(visitor);
10
+ });
11
+ }
12
+
13
+ export function widgetPropertyWalker(widget2, visitor, filter?) {
14
+ widget2.widgetWalker(function (widget) {
15
+ widget.propertyWalker(visitor, filter);
16
+ });
17
+ }
18
+
19
+ export function serializeTheme(widget, filter) {
20
+ return JSON.stringify(serializeThemeToObject(widget, filter));
21
+ }
22
+
23
+ export function serializeThemeToObject(widget2, filter?) {
24
+ filter = filter || ["surface", "Color", "Font", "palette"];
25
+
26
+ const propObj = {};
27
+ widgetPropertyWalker(widget2, null, function (widget, item) {
28
+ if (widget[item.id + "_modified"]() || widget.publishedProperty(item.id).origDefaultValue !== widget.publishedProperty(item.id).defaultValue) {
29
+ if (_isFilterMatch(item.id, filter)) {
30
+ const classParts = widget._class.trim().split(" ");
31
+ for (const i in classParts) {
32
+ if (classParts.HasOwnProperty(i)) {
33
+ if (propObj[classParts[i]] === undefined) {
34
+ propObj[classParts[i]] = {};
35
+ }
36
+ if (propObj[classParts[i]][item.id] === undefined) {
37
+ propObj[classParts[i]][item.id] = widget[item.id]();
38
+ break;
39
+ } else if (propObj[classParts[i]][item.id] === widget[item.id]()) {
40
+ break;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ });
47
+
48
+ function _isFilterMatch(str, arr) {
49
+ let ret = false;
50
+ for (const i in arr) {
51
+ if (str.indexOf(arr[i]) !== -1) {
52
+ ret = true;
53
+ break;
54
+ }
55
+ }
56
+ return ret;
57
+ }
58
+ return propObj;
59
+ }
60
+ export function removeTheme(widget2, callback) {
61
+ widgetPropertyWalker(widget2, null, function (widget, item) {
62
+ widget.publishedProperty(item.id).defaultValue = widget.publishedProperty(item.id).origDefaultValue;
63
+ });
64
+
65
+ if (typeof (callback) === "function") {
66
+ callback.call(this);
67
+ }
68
+ }
69
+ export function applyTheme(widget2, themeObj, callback) {
70
+ const context = this;
71
+ widgetPropertyWalker(widget2, null, function (widget3, item) {
72
+ switch (item.type) {
73
+ case "widget":
74
+ context.applyTheme(widget3[item.id](), themeObj);
75
+ return true;
76
+ case "widgetArray":
77
+ const widgetArray = widget3[item.id]();
78
+ widgetArray.forEach(function (widget) {
79
+ context.applyTheme(widget, themeObj);
80
+ }, this);
81
+ return true;
82
+ default:
83
+ widget3.applyTheme(themeObj);
84
+ break;
85
+ }
86
+ });
87
+ if (typeof (callback) === "function") {
88
+ callback.call(this);
89
+ }
90
+ }
91
+
92
+ export function serializeToObject(widget, filter?, includeData?, includeState?) {
93
+ const retVal: any = {
94
+ __class: widget.classID()
95
+ };
96
+ if (widget._id.indexOf(widget._idSeed) !== 0) {
97
+ retVal.__id = widget._id;
98
+ }
99
+ if (widget.version) {
100
+ retVal.__version = widget.version();
101
+ }
102
+ retVal.__properties = {};
103
+
104
+ widget.propertyWalker((childWwidget2, item) => {
105
+ if (childWwidget2[item.id + "_modified"]()) {
106
+ switch (item.type) {
107
+ case "widget":
108
+ retVal.__properties[item.id] = serializeToObject(childWwidget2[item.id](), null, includeData, includeState && !widget.serializeState); // Only include state once
109
+ return true;
110
+ case "widgetArray":
111
+ case "propertyArray":
112
+ retVal.__properties[item.id] = [];
113
+ const widgetArray = childWwidget2[item.id]();
114
+ widgetArray.forEach((childWwidget) => {
115
+ retVal.__properties[item.id].push(serializeToObject(childWwidget, null, includeData, includeState && !widget.serializeState)); // Only include state once
116
+ });
117
+ return true;
118
+ default:
119
+ retVal.__properties[item.id] = childWwidget2[item.id]();
120
+ break;
121
+ }
122
+ }
123
+ }, filter);
124
+
125
+ if (widget.classID() === "marshaller_Graph") {
126
+ const vertices = widget.data().vertices;
127
+ if (vertices) {
128
+ this.__vertices = vertices.map(item => {
129
+ return serializeToObject(item, null, includeData, includeState && !widget.serializeState);
130
+ });
131
+ }
132
+ }
133
+ if (includeData && widget.data) {
134
+ if (!retVal.__data) retVal.__data = {};
135
+ retVal.__data.data = widget.data();
136
+ }
137
+ if (includeState) {
138
+ if (widget.serializeState) {
139
+ retVal.__state = widget.serializeState();
140
+ } else if (widget.data) {
141
+ retVal.__state = {
142
+ data: widget.data()
143
+ };
144
+ }
145
+ }
146
+ return retVal;
147
+ }
148
+
149
+ export function serialize(widget, filter?, includeData?, includeState?) {
150
+ return JSON.stringify(serializeToObject(widget, filter, includeData, includeState));
151
+ }
@@ -1,180 +1,180 @@
1
- .other_PropertyEditor {
2
- overflow-y: scroll;
3
- height: 100%;
4
- width: 100%;
5
- }
6
-
7
- .other_PropertyEditor .other_PropertyEditor {
8
- overflow: hidden;
9
- }
10
-
11
- .other_PropertyEditor .property-table {
12
- width: 100%;
13
- border: 1px solid #ddd;
14
- border-width: 0 0 0 1px;
15
- }
16
-
17
- .other_PropertyEditor thead>tr>th {
18
- background-color: #333;
19
- }
20
-
21
- .other_PropertyEditor .other_PropertyEditor th {
22
- background-color: #444;
23
- }
24
-
25
- .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor th {
26
- background-color: #555;
27
- }
28
-
29
- .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor th {
30
- background-color: #666;
31
- }
32
-
33
- .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor th {
34
- background-color: #777;
35
- }
36
-
37
- .other_PropertyEditor .headerRow {
38
- background-color: #eee;
39
- }
40
-
41
- .other_PropertyEditor .other_PropertyEditor .headerRow {
42
- background-color: #ddd;
43
- }
44
-
45
- .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .headerRow {
46
- background-color: #ccc;
47
- }
48
-
49
- .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .headerRow {
50
- background-color: #bbb;
51
- }
52
-
53
- .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .headerRow {
54
- background-color: #aaa;
55
- }
56
-
57
- .other_PropertyEditor .fa {
58
- font-size: 14px;
59
- width: 14px
60
- }
61
-
62
- .other_PropertyEditor div.property-table-collapsed {
63
- display: none;
64
- }
65
-
66
- .other_PropertyEditor .headerRow>.peInput {
67
- padding-top: 2px;
68
- }
69
-
70
- .other_PropertyEditor .headerRow>.peInput>span {
71
- font-weight: bold;
72
- padding-left: 2px;
73
- }
74
-
75
- .other_PropertyEditor .headerRow>.peInput>i {
76
- float: right;
77
- padding-top: 2px;
78
- padding-bottom: 2px;
79
- }
80
-
81
- .other_PropertyEditor .headerRow>span>i:hover {
82
- background-color: #555;
83
- cursor: pointer;
84
- }
85
-
86
- .other_PropertyEditor .property-table thead>tr>th {
87
- text-align: left;
88
- background-color: #333;
89
- color: #fff;
90
- padding-top: 2px;
91
- padding-left: 4px;
92
- }
93
-
94
- .other_PropertyEditor .property-table thead>tr>th>i {
95
- float: right;
96
- padding-top: 2px;
97
- padding-right: 4px;
98
- padding-bottom: 2px;
99
- }
100
-
101
- .other_PropertyEditor .property-table thead>tr>th>i:hover {
102
- background-color: #555;
103
- cursor: pointer;
104
- }
105
-
106
- .other_PropertyEditor .property-table tbody>tr:nth-child(even) {
107
- background-color: #F9F9F9;
108
- }
109
-
110
- .other_PropertyEditor .property-table tbody>tr:nth-child(odd) {
111
- background-color: #FFF;
112
- }
113
-
114
- .other_PropertyEditor .property-table tbody>tr>td {
115
- text-align: left;
116
- color: #333;
117
- padding: 0 0 0 2px;
118
- }
119
-
120
- .other_PropertyEditor .property-table tbody>tr.disabled>td {
121
- color: gray;
122
- }
123
-
124
- .other_PropertyEditor .property-table tbody>tr.invalid>td {
125
- color: red;
126
- }
127
-
128
- .other_PropertyEditor .property-input-cell>div {
129
- padding-left: 8px;
130
- }
131
-
132
- .other_PropertyEditor .property-label {
133
- padding-right: 4px;
134
- box-sizing: border-box;
135
- height: 20px;
136
- }
137
-
138
- .other_PropertyEditor td.property-input-cell {
139
- text-align: left;
140
- height: 20px;
141
- padding: 1px 0;
142
- width: 80%
143
- }
144
-
145
- .other_PropertyEditor .property-input-cell>input,
146
- .other_PropertyEditor .property-input-cell>textarea {
147
- width: 100%;
148
- box-sizing: border-box;
149
- }
150
-
151
- .other_PropertyEditor .property-input-cell>input {
152
- height: 20px;
153
- }
154
-
155
- .other_PropertyEditor .property-input-cell>textarea {
156
- height: 120px;
157
- }
158
-
159
- .other_PropertyEditor .property-input-cell.boolean-cell {
160
- width: auto;
161
- margin: 0;
162
- position: relative;
163
- }
164
-
165
- .other_PropertyEditor .property-input-cell>input[type="checkbox"] {
166
- width: auto;
167
- margin: 0;
168
- position: absolute;
169
- top: 0;
170
- }
171
-
172
- .other_PropertyEditor .html-color-cell>input {
173
- width: 80%;
174
- }
175
-
176
- .other_PropertyEditor .html-color-cell>input[type="color"] {
177
- width: 20%;
178
- position: relative;
179
- top: -1px;
1
+ .other_PropertyEditor {
2
+ overflow-y: scroll;
3
+ height: 100%;
4
+ width: 100%;
5
+ }
6
+
7
+ .other_PropertyEditor .other_PropertyEditor {
8
+ overflow: hidden;
9
+ }
10
+
11
+ .other_PropertyEditor .property-table {
12
+ width: 100%;
13
+ border: 1px solid #ddd;
14
+ border-width: 0 0 0 1px;
15
+ }
16
+
17
+ .other_PropertyEditor thead>tr>th {
18
+ background-color: #333;
19
+ }
20
+
21
+ .other_PropertyEditor .other_PropertyEditor th {
22
+ background-color: #444;
23
+ }
24
+
25
+ .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor th {
26
+ background-color: #555;
27
+ }
28
+
29
+ .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor th {
30
+ background-color: #666;
31
+ }
32
+
33
+ .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor th {
34
+ background-color: #777;
35
+ }
36
+
37
+ .other_PropertyEditor .headerRow {
38
+ background-color: #eee;
39
+ }
40
+
41
+ .other_PropertyEditor .other_PropertyEditor .headerRow {
42
+ background-color: #ddd;
43
+ }
44
+
45
+ .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .headerRow {
46
+ background-color: #ccc;
47
+ }
48
+
49
+ .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .headerRow {
50
+ background-color: #bbb;
51
+ }
52
+
53
+ .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .other_PropertyEditor .headerRow {
54
+ background-color: #aaa;
55
+ }
56
+
57
+ .other_PropertyEditor .fa {
58
+ font-size: 14px;
59
+ width: 14px
60
+ }
61
+
62
+ .other_PropertyEditor div.property-table-collapsed {
63
+ display: none;
64
+ }
65
+
66
+ .other_PropertyEditor .headerRow>.peInput {
67
+ padding-top: 2px;
68
+ }
69
+
70
+ .other_PropertyEditor .headerRow>.peInput>span {
71
+ font-weight: bold;
72
+ padding-left: 2px;
73
+ }
74
+
75
+ .other_PropertyEditor .headerRow>.peInput>i {
76
+ float: right;
77
+ padding-top: 2px;
78
+ padding-bottom: 2px;
79
+ }
80
+
81
+ .other_PropertyEditor .headerRow>span>i:hover {
82
+ background-color: #555;
83
+ cursor: pointer;
84
+ }
85
+
86
+ .other_PropertyEditor .property-table thead>tr>th {
87
+ text-align: left;
88
+ background-color: #333;
89
+ color: #fff;
90
+ padding-top: 2px;
91
+ padding-left: 4px;
92
+ }
93
+
94
+ .other_PropertyEditor .property-table thead>tr>th>i {
95
+ float: right;
96
+ padding-top: 2px;
97
+ padding-right: 4px;
98
+ padding-bottom: 2px;
99
+ }
100
+
101
+ .other_PropertyEditor .property-table thead>tr>th>i:hover {
102
+ background-color: #555;
103
+ cursor: pointer;
104
+ }
105
+
106
+ .other_PropertyEditor .property-table tbody>tr:nth-child(even) {
107
+ background-color: #F9F9F9;
108
+ }
109
+
110
+ .other_PropertyEditor .property-table tbody>tr:nth-child(odd) {
111
+ background-color: #FFF;
112
+ }
113
+
114
+ .other_PropertyEditor .property-table tbody>tr>td {
115
+ text-align: left;
116
+ color: #333;
117
+ padding: 0 0 0 2px;
118
+ }
119
+
120
+ .other_PropertyEditor .property-table tbody>tr.disabled>td {
121
+ color: gray;
122
+ }
123
+
124
+ .other_PropertyEditor .property-table tbody>tr.invalid>td {
125
+ color: red;
126
+ }
127
+
128
+ .other_PropertyEditor .property-input-cell>div {
129
+ padding-left: 8px;
130
+ }
131
+
132
+ .other_PropertyEditor .property-label {
133
+ padding-right: 4px;
134
+ box-sizing: border-box;
135
+ height: 20px;
136
+ }
137
+
138
+ .other_PropertyEditor td.property-input-cell {
139
+ text-align: left;
140
+ height: 20px;
141
+ padding: 1px 0;
142
+ width: 80%
143
+ }
144
+
145
+ .other_PropertyEditor .property-input-cell>input,
146
+ .other_PropertyEditor .property-input-cell>textarea {
147
+ width: 100%;
148
+ box-sizing: border-box;
149
+ }
150
+
151
+ .other_PropertyEditor .property-input-cell>input {
152
+ height: 20px;
153
+ }
154
+
155
+ .other_PropertyEditor .property-input-cell>textarea {
156
+ height: 120px;
157
+ }
158
+
159
+ .other_PropertyEditor .property-input-cell.boolean-cell {
160
+ width: auto;
161
+ margin: 0;
162
+ position: relative;
163
+ }
164
+
165
+ .other_PropertyEditor .property-input-cell>input[type="checkbox"] {
166
+ width: auto;
167
+ margin: 0;
168
+ position: absolute;
169
+ top: 0;
170
+ }
171
+
172
+ .other_PropertyEditor .html-color-cell>input {
173
+ width: 80%;
174
+ }
175
+
176
+ .other_PropertyEditor .html-color-cell>input[type="color"] {
177
+ width: 20%;
178
+ position: relative;
179
+ top: -1px;
180
180
  }