@zohodesk/library-platform 1.1.10-exp.5 → 1.1.10-exp.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/es/library/analytics/Analytics.js +1 -1
- package/es/library/custom-component/adapters/gateways/event-manager/EventManager.js +23 -20
- package/es/library/custom-component/applications/usecases/UpdateStateUseCase.js +2 -4
- package/es/library/custom-component/domain/entities/ComponentProperties.js +0 -1
- package/es/library/custom-component/domain/entities/Logger.js +43 -37
- package/es/library/custom-component/frameworks/ui/ComponentRegistry.js +2 -2
- package/es/library/custom-component/frameworks/ui/CreateCustomComponent.js +1 -1
- package/es/library/dot/components/section/frameworks/ui/RenderField.js +1 -1
- package/es/library/dot/components/table-list/frameworks/ui/sub-components/field/FieldComponent.js +1 -1
- package/es/platform/components/table-connected/adapters/resources/ErrorPrinter.js +14 -11
- package/es/platform/components/table-connected/frameworks/EventHandlersFactory.js +0 -2
- package/es/platform/components/table-connected/frameworks/TableConnectedFactory.js +1 -1
- package/es/platform/data-source/http-template/fetchDependencyMappings.js +18 -0
- package/es/platform/data-source/http-template/fetchLayoutRules.js +29 -0
- package/es/platform/data-source/http-template/fetchMyForm.js +19 -0
- package/es/platform/data-source/http-template/fetchMyFormLayout.js +43 -0
- package/es/platform/data-source/http-template/fetchValidationRules.js +30 -0
- package/es/platform/data-source/utils/validation-rules/TransFormValidationRules.js +0 -1
- package/es/platform/sdk/domain/entities/ResourceManager.js +3 -3
- package/es/platform/zform/adapters/presenter/translators/SectionTranslator.js +1 -2
- package/es/platform/zform/domain/ZForm.js +2 -6
- package/es/platform/zform/frameworks/validation-rules/Validator.js +1 -1
- package/es/platform/zlist/adapters/presenters/TableTranslator.js +1 -1
- package/es/platform/zlist/adapters/presenters/translators/ColumnAlignmentTranslator.js +11 -0
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +2 -2
- package/es/platform/zlist/adapters/presenters/translators/FieldVariations.js +25 -0
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ class Analytics {
|
|
|
19
19
|
push(metric) {
|
|
20
20
|
if (typeof this.pushCallback !== 'function') {
|
|
21
21
|
if (!this.warningShown) {
|
|
22
|
-
console.warn('Push callback is not initialized. Please call init() first.');
|
|
22
|
+
__DEVELOPMENT__ && console.warn('Push callback is not initialized. Please call init() first.');
|
|
23
23
|
this.warningShown = true; // ✅ Set flag after logging once
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -55,10 +55,10 @@ class EventManager {
|
|
|
55
55
|
metaData,
|
|
56
56
|
type
|
|
57
57
|
} = event;
|
|
58
|
-
this.log(type, payload, metaData);
|
|
58
|
+
__DEVELOPMENT__ && this.log(type, payload, metaData);
|
|
59
59
|
|
|
60
60
|
if (!this._element) {
|
|
61
|
-
console.error('Error: Element `ref` not found!', this._element, type, {
|
|
61
|
+
__DEVELOPMENT__ && console.error('Error: Element `ref` not found!', this._element, type, {
|
|
62
62
|
payload,
|
|
63
63
|
metaData
|
|
64
64
|
});
|
|
@@ -110,25 +110,28 @@ class EventManager {
|
|
|
110
110
|
|
|
111
111
|
printEventPayloadSchemaInvalidError(eventName, error) {
|
|
112
112
|
let dataName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '(root)';
|
|
113
|
-
const {
|
|
114
|
-
msg,
|
|
115
|
-
styles: nameStyles
|
|
116
|
-
} = this.eventNameConsoleStyle(eventName);
|
|
117
|
-
console.group(`${msg}%c's ${dataName} Validation Errors:`, ...nameStyles, 'color: initial; font-weight: initial');
|
|
118
|
-
|
|
119
|
-
if (error.code === ErrorCode.InvalidSchema) {
|
|
120
|
-
console.error(`%cInvalid Schema:`, 'color: #FF6F61; font-weight: bold;', error.error);
|
|
121
|
-
} else if (error.code === ErrorCode.InvalidData) {
|
|
122
|
-
error.errors.forEach((_ref, i) => {
|
|
123
|
-
let {
|
|
124
|
-
dataPath,
|
|
125
|
-
message
|
|
126
|
-
} = _ref;
|
|
127
|
-
console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
113
|
|
|
131
|
-
|
|
114
|
+
if (__DEVELOPMENT__) {
|
|
115
|
+
const {
|
|
116
|
+
msg,
|
|
117
|
+
styles: nameStyles
|
|
118
|
+
} = this.eventNameConsoleStyle(eventName);
|
|
119
|
+
console.group(`${msg}%c's ${dataName} Validation Errors:`, ...nameStyles, 'color: initial; font-weight: initial');
|
|
120
|
+
|
|
121
|
+
if (error.code === ErrorCode.InvalidSchema) {
|
|
122
|
+
console.error(`%cInvalid Schema:`, 'color: #FF6F61; font-weight: bold;', error.error);
|
|
123
|
+
} else if (error.code === ErrorCode.InvalidData) {
|
|
124
|
+
error.errors.forEach((_ref, i) => {
|
|
125
|
+
let {
|
|
126
|
+
dataPath,
|
|
127
|
+
message
|
|
128
|
+
} = _ref;
|
|
129
|
+
console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.groupEnd();
|
|
134
|
+
}
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
verifyEventPayload(event) {
|
|
@@ -8,11 +8,9 @@ class UpdateStateUseCase extends AbstractUseCase {
|
|
|
8
8
|
eventManager
|
|
9
9
|
} = this.dependencies;
|
|
10
10
|
let component = repository.getComponent();
|
|
11
|
-
let preState = component.getState();
|
|
12
|
-
|
|
11
|
+
let preState = component.getState();
|
|
13
12
|
component.updateState(newState);
|
|
14
|
-
let state = component.getState();
|
|
15
|
-
|
|
13
|
+
let state = component.getState();
|
|
16
14
|
presenter.render(state);
|
|
17
15
|
eventManager.dispatch(component.getStateUpdatedAction({
|
|
18
16
|
state,
|
|
@@ -43,7 +43,6 @@ export default class ComponentProperties {
|
|
|
43
43
|
} = this.validateProperties(jsonValidator, newProps);
|
|
44
44
|
|
|
45
45
|
if (!isValid) {
|
|
46
|
-
// console.log({ isValid, componentName: this.componentName, validationResults });
|
|
47
46
|
throw {
|
|
48
47
|
code: ErrorCodes.PROPERTY_VALIDATION_FAILED,
|
|
49
48
|
message: `Properties validation failed for component ${this.componentName}`,
|
|
@@ -12,55 +12,61 @@ export default class Logger {
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
logPropertiesValidation(validationResults) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
if (__DEVELOPMENT__) {
|
|
16
|
+
console.group(`%cProperties Validation: %c${this.componentName}`, ERROR_PRIMARY, ERROR_SECONDARY, validationResults);
|
|
17
|
+
validationResults.forEach(_ref => {
|
|
18
|
+
let {
|
|
19
|
+
key,
|
|
20
|
+
errors,
|
|
21
|
+
warnings,
|
|
22
|
+
value
|
|
23
|
+
} = _ref;
|
|
24
|
+
errors?.forEach(error => {
|
|
25
|
+
this.printResult(key, error, 'error');
|
|
26
|
+
});
|
|
27
|
+
warnings?.forEach(warning => {
|
|
28
|
+
this.printResult(key, warning, 'warning');
|
|
29
|
+
});
|
|
30
|
+
console.log('%cBut, Given is:', 'color: white;font-weight: bold;', {
|
|
31
|
+
[key]: value
|
|
32
|
+
});
|
|
25
33
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
console.log('%cBut, Given is:', 'color: white;font-weight: bold;', {
|
|
30
|
-
[key]: value
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
console.groupEnd();
|
|
34
|
+
console.groupEnd();
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
logError(error) {
|
|
37
|
-
|
|
39
|
+
if (__DEVELOPMENT__) {
|
|
40
|
+
console.log('Logging Error in ComponentProperties - logError');
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if (error.code === ErrorCodes.PROPERTY_VALIDATION_FAILED) {
|
|
43
|
+
this.logPropertiesValidation(error.errorDetails?.validationResults);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
console.group(`%cError Occurred: %c${this.componentName}`, ERROR_PRIMARY, ERROR_SECONDARY, error);
|
|
48
|
+
console.error(`%cError Code: %c${error.code}`, ERROR_PRIMARY, ERROR_SECONDARY);
|
|
49
|
+
console.error(`%cError Message: %c${error.message}`, ERROR_PRIMARY, ERROR_SECONDARY);
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
if (error.errorDetails?.originalError) {
|
|
52
|
+
console.error(error.errorDetails.originalError);
|
|
53
|
+
}
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
console.groupEnd();
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
printResult(key, errorOrWarning, type) {
|
|
56
|
-
|
|
60
|
+
if (__DEVELOPMENT__) {
|
|
61
|
+
const log = type === 'error' ? console.error : console.warn;
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
if (errorOrWarning.dataPath) {
|
|
64
|
+
log(`Invalid Property %c${key}%c${errorOrWarning.dataPath} %c${errorOrWarning.message}`, ERROR_PRIMARY, ERROR_SECONDARY, 'color: white;');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
log(`Invalid Property %c${key} : %c${errorOrWarning.message}`, ERROR_PRIMARY, 'color: white;');
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
eventNameConsoleStyle(type) {
|
|
@@ -81,7 +87,7 @@ export default class Logger {
|
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
logEvent(type, data) {
|
|
84
|
-
if (this.isLoggingEnabledAndTypePresent(type)) {
|
|
90
|
+
if (__DEVELOPMENT__ && this.isLoggingEnabledAndTypePresent(type)) {
|
|
85
91
|
const {
|
|
86
92
|
msg,
|
|
87
93
|
styles: nameStyles
|
|
@@ -13,11 +13,11 @@ class ComponentRegistry {
|
|
|
13
13
|
|
|
14
14
|
register(name, component) {
|
|
15
15
|
if (this.components.has(name)) {
|
|
16
|
-
console.warn(`Component with name "${name}" is already registered. Overwriting the existing component.`);
|
|
16
|
+
__DEVELOPMENT__ && console.warn(`Component with name "${name}" is already registered. Overwriting the existing component.`);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (this.components.has(name) && this.get(name) !== component) {
|
|
20
|
-
console.warn(`Component with name "${name}" is already registered with a different instance. Overwriting the existing component.`);
|
|
20
|
+
__DEVELOPMENT__ && console.warn(`Component with name "${name}" is already registered with a different instance. Overwriting the existing component.`);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
this.components.set(name, component);
|
|
@@ -77,7 +77,7 @@ const createCustomComponent = input => {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
componentDidCatch(error, errorInfo) {
|
|
80
|
-
console.log('Error', error, errorInfo, errorInfo.componentStack);
|
|
80
|
+
__DEVELOPMENT__ && console.log('Error', error, errorInfo, errorInfo.componentStack);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
@@ -10,7 +10,7 @@ export function renderField(field, key) {
|
|
|
10
10
|
const Component = ComponentRegistry.get(type);
|
|
11
11
|
|
|
12
12
|
if (!Component) {
|
|
13
|
-
console.warn(`Component for type "${type}" not found.`);
|
|
13
|
+
__DEVELOPMENT__ && console.warn(`Component for type "${type}" not found.`);
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
|
package/es/library/dot/components/table-list/frameworks/ui/sub-components/field/FieldComponent.js
CHANGED
|
@@ -12,7 +12,7 @@ const FieldComponent = props => {
|
|
|
12
12
|
const Component = FieldComponents[type] || ComponentRegistry.get(type);
|
|
13
13
|
|
|
14
14
|
if (!Component) {
|
|
15
|
-
console.error(`Field Component type ${type} not found`);
|
|
15
|
+
__DEVELOPMENT__ && console.error(`Field Component type ${type} not found`);
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
export default class ErrorPrinter {
|
|
2
2
|
static printError(error) {
|
|
3
|
-
console.error('Error occurred:', error);
|
|
3
|
+
__DEVELOPMENT__ && console.error('Error occurred:', error);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
static displaySchemaErrors(title, errors) {
|
|
7
7
|
let dataName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '(root)';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
|
|
9
|
+
if (__DEVELOPMENT__) {
|
|
10
|
+
console.group(title.msg, ...title.styles);
|
|
11
|
+
errors.forEach((_ref, i) => {
|
|
12
|
+
let {
|
|
13
|
+
dataPath,
|
|
14
|
+
keyword,
|
|
15
|
+
message
|
|
16
|
+
} = _ref;
|
|
17
|
+
console.error(`%c${i + 1}. %c${dataName + dataPath}%c → ${keyword} ${message}`, 'color: initial;', 'color: #FF6F61; font-weight: bold;', 'color: #FFA500;');
|
|
18
|
+
});
|
|
19
|
+
console.groupEnd();
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
}
|
|
@@ -54,7 +54,6 @@ export default class EventHandlersFactory {
|
|
|
54
54
|
const wrapped = EventHandlersFactory.getSdkWrappedEventHandler(eventHandlers); // Generic addMetrics handler
|
|
55
55
|
|
|
56
56
|
const addMetrics = args => {
|
|
57
|
-
// console.log({ ...args }, "Arguments update Here");
|
|
58
57
|
const {
|
|
59
58
|
action
|
|
60
59
|
} = args;
|
|
@@ -257,7 +256,6 @@ export default class EventHandlersFactory {
|
|
|
257
256
|
|
|
258
257
|
const metrics = [smartTableRendered, smartTableFeatures, smartTableCustomComponents, smartTableSortApplied, ...smartTableColumnResized, smartTableRowsSelected, ...smartTableColumnVisibilityToggled, ...smartTableColumnReordered];
|
|
259
258
|
metrics.forEach(metric => {
|
|
260
|
-
// console.log("Pushing metric:", metric);
|
|
261
259
|
Analytics.push(metric);
|
|
262
260
|
});
|
|
263
261
|
};
|
|
@@ -52,7 +52,7 @@ export default class TableConnectedFactory {
|
|
|
52
52
|
} = _ref;
|
|
53
53
|
|
|
54
54
|
if (dataBroker) {
|
|
55
|
-
console.warn('Desk Platform Warning: dataBroker is deprecated, use dataSource instead');
|
|
55
|
+
__DEVELOPMENT__ && console.warn('Desk Platform Warning: dataBroker is deprecated, use dataSource instead');
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const _dataSource = combineDataSourceWithDefault(dataBroker ? dataBroker : dataSource);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const fetchDependencyMappings = {
|
|
2
|
+
name: 'fetchDependencyMappings',
|
|
3
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/dependencyMappings',
|
|
4
|
+
parameters: `{"layoutId":"{{layoutId}}"}`,
|
|
5
|
+
type: 'GET',
|
|
6
|
+
transformer: data => data,
|
|
7
|
+
properties: {
|
|
8
|
+
layoutId: {
|
|
9
|
+
required: true,
|
|
10
|
+
typeMetadata: {
|
|
11
|
+
schema: {
|
|
12
|
+
type: 'string'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default fetchDependencyMappings;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Assuming GetTemplate interface is defined
|
|
2
|
+
const fetchLayoutRules = {
|
|
3
|
+
name: 'fetchLayoutRules',
|
|
4
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/layoutRules',
|
|
5
|
+
parameters: `{"activeRulesOnly":{{activeRulesOnly}}}`,
|
|
6
|
+
type: 'GET',
|
|
7
|
+
transformer: data => data,
|
|
8
|
+
properties: {
|
|
9
|
+
layoutId: {
|
|
10
|
+
required: true,
|
|
11
|
+
typeMetadata: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
activeRulesOnly: {
|
|
18
|
+
required: true,
|
|
19
|
+
typeMetadata: {
|
|
20
|
+
schema: {
|
|
21
|
+
type: 'boolean'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultValue: true // Assuming true as a default if parameter is optional
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export default fetchLayoutRules;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Assuming similar structure to PatchTemplate
|
|
2
|
+
const fetchMyForm = {
|
|
3
|
+
name: 'myFormFetch',
|
|
4
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/myForm',
|
|
5
|
+
parameters: `{"layoutId":"{{layoutId}}"}`,
|
|
6
|
+
type: 'GET',
|
|
7
|
+
transformer: data => data,
|
|
8
|
+
properties: {
|
|
9
|
+
layoutId: {
|
|
10
|
+
required: true,
|
|
11
|
+
typeMetadata: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export default fetchMyForm;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Assumed you have a GetTemplate interface similar to PatchTemplate
|
|
2
|
+
const fetchMyLayouts = {
|
|
3
|
+
name: 'myLayoutsFetch',
|
|
4
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/myLayouts',
|
|
5
|
+
parameters: `{"module":"{{module}}","departmentId":"{{departmentId}}","from":"{{from}}","limit":"{{limit}}"}`,
|
|
6
|
+
type: 'GET',
|
|
7
|
+
transformer: data => data,
|
|
8
|
+
properties: {
|
|
9
|
+
module: {
|
|
10
|
+
required: true,
|
|
11
|
+
typeMetadata: {
|
|
12
|
+
schema: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
departmentId: {
|
|
18
|
+
required: true,
|
|
19
|
+
typeMetadata: {
|
|
20
|
+
schema: {
|
|
21
|
+
type: 'string'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
from: {
|
|
26
|
+
required: true,
|
|
27
|
+
typeMetadata: {
|
|
28
|
+
schema: {
|
|
29
|
+
type: 'string'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
limit: {
|
|
34
|
+
required: true,
|
|
35
|
+
typeMetadata: {
|
|
36
|
+
schema: {
|
|
37
|
+
type: 'string'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export default fetchMyLayouts;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Assuming GetTemplate interface is similar to PatchTemplate
|
|
2
|
+
import { transFormValidationRules } from "../utils/validation-rules/TransFormValidationRules";
|
|
3
|
+
const fetchValidationRules = {
|
|
4
|
+
name: 'fetchValidationRules',
|
|
5
|
+
api: '/{{servicePrefix}}/{{orgName}}/api/v1/layouts/{{layoutId}}/validationRules',
|
|
6
|
+
parameters: `{"activeRulesOnly":{{activeRulesOnly}}}`,
|
|
7
|
+
type: 'GET',
|
|
8
|
+
transformer: transFormValidationRules,
|
|
9
|
+
properties: {
|
|
10
|
+
layoutId: {
|
|
11
|
+
required: true,
|
|
12
|
+
typeMetadata: {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'string'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
activeRulesOnly: {
|
|
19
|
+
required: true,
|
|
20
|
+
typeMetadata: {
|
|
21
|
+
schema: {
|
|
22
|
+
type: 'boolean'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultValue: true // Assuming default behavior if not provided
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export default fetchValidationRules;
|
|
@@ -30,7 +30,7 @@ export class ResourceManager {
|
|
|
30
30
|
const ResourceClass = resources[resourceName];
|
|
31
31
|
|
|
32
32
|
if (!ResourceClass) {
|
|
33
|
-
console.warn(`Resource class not found for: ${resourceName}`);
|
|
33
|
+
__DEVELOPMENT__ && console.warn(`Resource class not found for: ${resourceName}`);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -54,7 +54,7 @@ export class ResourceManager {
|
|
|
54
54
|
instance.destroy();
|
|
55
55
|
delete resourceInstances[resourceName][instanceName];
|
|
56
56
|
} else {
|
|
57
|
-
console.warn(`No resource instance found for: ${resourceName} - ${instanceName}`);
|
|
57
|
+
__DEVELOPMENT__ && console.warn(`No resource instance found for: ${resourceName} - ${instanceName}`);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ export class ResourceManager {
|
|
|
64
64
|
} = this;
|
|
65
65
|
|
|
66
66
|
if (resources[resourceName]) {
|
|
67
|
-
console.warn(`Resource with name "${resourceName}" already exists. Overwriting.`);
|
|
67
|
+
__DEVELOPMENT__ && console.warn(`Resource with name "${resourceName}" already exists. Overwriting.`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
resources[resourceName] = resource;
|
|
@@ -58,8 +58,7 @@ function SectionTranslator(_ref) {
|
|
|
58
58
|
label: field.toolTip,
|
|
59
59
|
fieldName: field.apiName
|
|
60
60
|
}));
|
|
61
|
-
}
|
|
62
|
-
|
|
61
|
+
}
|
|
63
62
|
|
|
64
63
|
if (field.isPHI === true && ephiFields.includes(field.type)) {
|
|
65
64
|
defaultActions.fieldLabelActions.push(getDefaultFieldEphiActionTemplate({
|
|
@@ -170,8 +170,6 @@ export default class ZForm {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
constructApiErrorEvent(error, actionName, isBreaking) {
|
|
173
|
-
console.log('Error in action: ', actionName, error);
|
|
174
|
-
|
|
175
173
|
if (error.code === ZHttpErrorCode.ApiError) {
|
|
176
174
|
return {
|
|
177
175
|
code: ErrorCodes.API_FAILED,
|
|
@@ -413,8 +411,6 @@ export default class ZForm {
|
|
|
413
411
|
formData: this.getFormData()
|
|
414
412
|
});
|
|
415
413
|
this.applyLayoutRulesResult(sectionResult, fieldResult);
|
|
416
|
-
} else {
|
|
417
|
-
console.log('Layout rules are fetching or my form is fetching');
|
|
418
414
|
}
|
|
419
415
|
}
|
|
420
416
|
|
|
@@ -436,7 +432,7 @@ export default class ZForm {
|
|
|
436
432
|
let visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
|
|
437
433
|
|
|
438
434
|
if (visited.has(parentId)) {
|
|
439
|
-
console.warn(`Loop detected at field ${parentId}, skipping...`);
|
|
435
|
+
__DEVELOPMENT__ && console.warn(`Loop detected at field ${parentId}, skipping...`);
|
|
440
436
|
return;
|
|
441
437
|
}
|
|
442
438
|
|
|
@@ -448,7 +444,7 @@ export default class ZForm {
|
|
|
448
444
|
let childField = fields.find(f => f.getId() === childId || f.getApiName() === childId);
|
|
449
445
|
|
|
450
446
|
if (!childField) {
|
|
451
|
-
console.warn(`Child field not found for id/apiName: ${childId}`);
|
|
447
|
+
__DEVELOPMENT__ && console.warn(`Child field not found for id/apiName: ${childId}`);
|
|
452
448
|
return;
|
|
453
449
|
}
|
|
454
450
|
|
|
@@ -57,7 +57,7 @@ export default class Validator {
|
|
|
57
57
|
};
|
|
58
58
|
return script(arg).then(handleResult).catch(handleResult);
|
|
59
59
|
} else {
|
|
60
|
-
console.warn(`Custom validator "${scriptId}" not found in customValidators`, customValidators);
|
|
60
|
+
__DEVELOPMENT__ && console.warn(`Custom validator "${scriptId}" not found in customValidators`, customValidators);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return null;
|
|
@@ -158,7 +158,7 @@ function mapClientActions(clientActions) {
|
|
|
158
158
|
const allowedActingLocations = ['header_actions', 'field_actions', 'row_actions', null];
|
|
159
159
|
clientActions.forEach(action => {
|
|
160
160
|
if (!allowedActingLocations.includes(action.location)) {
|
|
161
|
-
console.warn('Client action without location:', action.location);
|
|
161
|
+
__DEVELOPMENT__ && console.warn('Client action without location:', action.location);
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
return {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Alignment } from "../../../../../cc/table-list/data-types/Header";
|
|
2
|
+
|
|
3
|
+
function ColumnAlignmentTranslator(type) {
|
|
4
|
+
if (type === 'Boolean') {
|
|
5
|
+
return Alignment.Center;
|
|
6
|
+
} else {
|
|
7
|
+
return Alignment.Left;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default ColumnAlignmentTranslator;
|
|
@@ -29,7 +29,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
29
29
|
const fieldEntry = fieldComponentMapping[name];
|
|
30
30
|
|
|
31
31
|
if (typeof fieldEntry == 'string') {
|
|
32
|
-
console.warn(`The string format for componentMapping will soon be deprecated. Please update to the new JSON format. REF : ${JSON.stringify(fieldEntry)}`);
|
|
32
|
+
__DEVELOPMENT__ && console.warn(`The string format for componentMapping will soon be deprecated. Please update to the new JSON format. REF : ${JSON.stringify(fieldEntry)}`);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
let tempValue = undefined;
|
|
@@ -54,7 +54,7 @@ function ColumnTranslator(field, record, fieldComponentMapping, fieldActions, co
|
|
|
54
54
|
const fieldTranslator = nameFieldsConfig.isEnabled && nameFieldTypes.includes(field.type) && moduleApiKeyCheck ? FieldTranslators['NameField'] : FieldTranslators[type];
|
|
55
55
|
|
|
56
56
|
if (!fieldTranslator) {
|
|
57
|
-
console.error(`Field type ${type} not supported`);
|
|
57
|
+
__DEVELOPMENT__ && console.error(`Field type ${type} not supported`);
|
|
58
58
|
return EmptyViewModel(name);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import FieldTypes from "../../../../../cc/fields/field/Types";
|
|
2
|
+
const variationsMap = {
|
|
3
|
+
'Boolean': [FieldTypes.CheckboxField, FieldTypes.SwitchField] // 'Date': ['DatePicker', 'DateTimePicker'],
|
|
4
|
+
// 'Text': ['SingleLineText', 'MultiLineText', 'RichText'],
|
|
5
|
+
// Add more field types and their variations as needed
|
|
6
|
+
|
|
7
|
+
};
|
|
8
|
+
export const isValidFieldVariation = (fieldType, uiType) => {
|
|
9
|
+
const validVariations = variationsMap[fieldType];
|
|
10
|
+
return validVariations ? validVariations.includes(uiType) : false;
|
|
11
|
+
};
|
|
12
|
+
/*
|
|
13
|
+
|
|
14
|
+
Smart Table Field UI Variants:
|
|
15
|
+
• Boolean - CheckBox, Switch, Text
|
|
16
|
+
• Lookup - Link, Tag (Chip), LabeledAvatar
|
|
17
|
+
• SingleLine - Text, Link (Name field)
|
|
18
|
+
• MultiPicklist - TagsList, TagsDropdown
|
|
19
|
+
• ColoredMultiPicklist - TagsList
|
|
20
|
+
• ColoredPicklist - ColoredTag
|
|
21
|
+
• URL - Link, Text
|
|
22
|
+
• Email - Email
|
|
23
|
+
• Date, DateTime, Picklist, Currency, Integer, Decimal, Phone, Percentage - Text
|
|
24
|
+
|
|
25
|
+
*/
|