@zohodesk/library-platform 1.0.0-exp.4 → 1.0.0-exp.5
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/bc/zlist/Constants.js +1 -6
- package/es/bc/zrecord/Constants.js +0 -5
- package/es/cc/fields/boolean/Model.js +1 -3
- package/es/desk-frameworks/table-connected/frameworks/ListSdkFactory.js +3 -17
- package/es/library/behaviours/sort-by/adapters/controllers/Initialize.js +14 -0
- package/es/library/custom-component/adapters/gateways/validator/jsonValidator.js +5 -0
- package/es/library/custom-component/entities/getRef.js +10 -0
- package/es/library/dot/components/action-location/adapters/gateway/RepositoryOld.js +32 -0
- package/es/library/dot/components/table-list/frameworks/ui/css/TableList.module.css +1 -1
- package/es/library/dot/legacy-to-new-arch/field-components/checkbox-field/frameworks/ui/CheckboxField.js +13 -0
- package/es/library/dot/legacy-to-new-arch/field-components/checkbox-field/frameworks/ui/CheckboxFieldView.js +19 -0
- package/es/library/dot/legacy-to-new-arch/field-components/checkbox-field/frameworks/ui/EventHandlersFactory.js +29 -0
- package/es/library/dot/legacy-to-new-arch/field-components/email-field/frameworks/ui/EmailField.js +11 -0
- package/es/library/dot/legacy-to-new-arch/field-components/email-field/frameworks/ui/EmailFieldView.js +15 -0
- package/es/library/dot/legacy-to-new-arch/field-components/index.js +15 -0
- package/es/library/dot/legacy-to-new-arch/field-components/lookup-field/frameworks/ui/LookupField.js +11 -0
- package/es/library/dot/legacy-to-new-arch/field-components/lookup-field/frameworks/ui/LookupFieldView.js +19 -0
- package/es/library/dot/legacy-to-new-arch/field-components/multiselect-field/frameworks/ui/MultiSelectField.js +11 -0
- package/es/library/dot/legacy-to-new-arch/field-components/multiselect-field/frameworks/ui/MultiSelectFieldView.js +21 -0
- package/es/library/dot/legacy-to-new-arch/field-components/phone-field/frameworks/ui/PhoneField.js +11 -0
- package/es/library/dot/legacy-to-new-arch/field-components/phone-field/frameworks/ui/PhoneFieldView.js +22 -0
- package/es/library/dot/legacy-to-new-arch/field-components/picklist-field/frameworks/ui/PickListField.js +11 -0
- package/es/library/dot/legacy-to-new-arch/field-components/picklist-field/frameworks/ui/PickListFieldView.js +19 -0
- package/es/library/dot/legacy-to-new-arch/field-components/switch-field/frameworks/ui/EventHandlersFactory.js +29 -0
- package/es/library/dot/legacy-to-new-arch/field-components/switch-field/frameworks/ui/SwitchField.js +13 -0
- package/es/library/dot/legacy-to-new-arch/field-components/switch-field/frameworks/ui/SwitchFieldView.js +18 -0
- package/es/library/dot/legacy-to-new-arch/field-components/text-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/field-components/text-field/frameworks/ui/TextField.js +13 -0
- package/es/library/dot/legacy-to-new-arch/field-components/text-field/frameworks/ui/TextFieldView.js +16 -0
- package/es/library/dot/legacy-to-new-arch/field-components/url-field/frameworks/ui/EventHandlersFactory.js +26 -0
- package/es/library/dot/legacy-to-new-arch/field-components/url-field/frameworks/ui/UrlField.js +13 -0
- package/es/library/dot/legacy-to-new-arch/field-components/url-field/frameworks/ui/UrlFieldView.js +18 -0
- package/es/platform/zfield/entities/api-template/APITemplate.js +2 -19
- package/es/platform/zfield/entities/interfaces/FieldTypes.js +20 -0
- package/es/platform/zfield/usecases/entity-factory/FieldBuilder.js +109 -0
- package/es/platform/zfield/usecases/entity-factory/FieldFactory.js +10 -0
- package/es/platform/zfield/usecases/entity-factory/FieldsManagerBuilder.js +49 -0
- package/es/platform/zhttp/adapters/controllers/FetchController.js +1 -3
- package/es/platform/zhttp/usecases/interactors/FetchUseCase.js +19 -47
- package/es/platform/zlist/adapters/gateways/Service.js +0 -12
- package/es/platform/zlist/adapters/presenters/translators/ColumnTranslator.js +1 -3
- package/es/platform/zlist/adapters/presenters/translators/fields/BooleanFieldTranslator.js +1 -2
- package/es/platform/zlist/entities/List.js +2 -90
- package/es/platform/zlist/frameworks/EventHandlersFactory.js +1 -11
- package/es/platform/zrecord/adapters/gateways/Service.js +0 -4
- package/es/platform/zrecord/entities/APITemplate.js +10 -26
- package/es/platform/zrecord/entities/RecordsManager.js +37 -247
- package/es/platform/zrecord/entities/interfaces/MetaData.js +1 -1
- package/es/platform/zrecord/frameworks/ActionsHandlersFactory.js +1 -4
- package/es/platform/zrecord/usecases/interactors/ExecuteActionUseCase.js +2 -6
- package/es/platform/zrecord/usecases/interactors/FailureUseCase.js +5 -7
- package/es/platform/zrecord/usecases/interactors/FetchMoreUseCase.js +1 -1
- package/es/platform/zrecord/usecases/interactors/NoContentUseCase.js +0 -1
- package/es/platform/zrecord/usecases/interactors/SuccessUseCase.js +4 -11
- package/package.json +1 -1
- package/es/platform/data-broker/http-template/deleteRecord.js +0 -27
- package/es/platform/zlist/adapters/controllers/DeleteSingleRecordController.js +0 -23
- package/es/platform/zlist/adapters/controllers/RecordExecuteFailedController.js +0 -25
- package/es/platform/zlist/adapters/controllers/RecordExecuteSucceededController.js +0 -25
- package/es/platform/zlist/entities/interfaces/RecordExecuteAfterMetaData.js +0 -1
- package/es/platform/zlist/usecases/interactors/DeleteSingleRecordUseCase.js +0 -19
- package/es/platform/zlist/usecases/interactors/RecordExecuteFailedUseCase.js +0 -22
- package/es/platform/zlist/usecases/interactors/RecordExecuteSucceededUseCase.js +0 -22
- package/es/platform/zlist/usecases/interfaces/input/DeleteSingleRecordUseCaseInput.js +0 -1
- package/es/platform/zlist/usecases/interfaces/input/RecordExecuteFailedUseCaseInput.js +0 -1
- package/es/platform/zlist/usecases/interfaces/input/RecordExecuteSucceededUseCaseInput.js +0 -1
- package/es/platform/zrecord/adapters/controllers/SetRecordsController.js +0 -29
- package/es/platform/zrecord/usecases/interactors/SetRecordsUseCase.js +0 -22
- package/es/platform/zrecord/usecases/interfaces/input/SetRecordsInputModel.js +0 -1
package/es/bc/zlist/Constants.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export const ZLIST_DELETE_RECORDS = 'ZLIST#DELETE_RECORDS';
|
|
2
|
-
export const ZLIST_DELETE_RECORD = 'ZLIST#DELETE_RECORD';
|
|
3
2
|
export const ZLIST_RECORD_UPDATE = 'ZLIST#RECORD_UPDATE';
|
|
4
3
|
export const ZLIST_FETCH_MORE = 'ZLIST#FETCH_MORE';
|
|
5
|
-
export const ZLIST_FETCH_SORTED = 'ZLIST#FETCH_SORTED';
|
|
6
|
-
export const ZLIST_RECORD_UPDATE_SUCCEEDED = 'ZLIST#RECORD_UPDATE_SUCCEEDED';
|
|
7
|
-
export const ZLIST_RECORD_UPDATE_FAILED = 'ZLIST#RECORD_UPDATE_FAILED';
|
|
8
|
-
export const ZLIST_RECORD_DELETE_SUCCEEDED = 'ZLIST#RECORD_DELETE_SUCCEEDED';
|
|
9
|
-
export const ZLIST_RECORD_DELETE_FAILED = 'ZLIST#RECORD_DELETE_FAILED';
|
|
4
|
+
export const ZLIST_FETCH_SORTED = 'ZLIST#FETCH_SORTED';
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
3
|
export const RECORD_EXECUTE = 'RECORD#EXECUTE';
|
|
4
|
-
export const RECORD_EXECUTE_SUCCEEDED = 'RECORD#EXECUTE_SUCCEEDED';
|
|
5
|
-
export const RECORD_EXECUTE_FAILED = 'RECORD#EXECUTE_FAILED';
|
|
6
4
|
export const RECORD_REFETCH = 'RECORD#REFETCH';
|
|
7
5
|
export const RECORD_FETCH_MORE = 'RECORD#FETCH_MORE';
|
|
8
6
|
export const RECORD_FIELD_CHANGE = 'RECORD#FIELD_CHANGE';
|
|
9
7
|
export const RECORD_LOCAL_UPDATE = 'RECORD#LOCAL_UPDATE';
|
|
10
8
|
export const RECORD_LOCAL_MULTIPLE_DELETE = 'RECORD#LOCAL_MULTIPLE_DELETE';
|
|
11
9
|
export const APPEND_RECORDS = 'RECORD#APPEND_RECORDS';
|
|
12
|
-
export const SET_RECORDS = 'RECORD#SET_RECORDS';
|
|
13
10
|
export class RecordApiActionName {}
|
|
14
11
|
|
|
15
12
|
_defineProperty(RecordApiActionName, "GET_RECORDS", 'getRecords');
|
|
16
13
|
|
|
17
14
|
_defineProperty(RecordApiActionName, "DELETE_RECORDS", 'deleteRecords');
|
|
18
15
|
|
|
19
|
-
_defineProperty(RecordApiActionName, "DELETE_RECORD", 'deleteRecord');
|
|
20
|
-
|
|
21
16
|
_defineProperty(RecordApiActionName, "UPDATE_RECORD", 'updateRecord');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ZLIST_DELETE_RECORDS, ZLIST_RECORD_UPDATE } from "../../../bc/zlist/Constants";
|
|
2
2
|
/* eslint-disable max-lines-per-function */
|
|
3
3
|
|
|
4
4
|
export default class ListSdkFactory {
|
|
@@ -15,21 +15,6 @@ export default class ListSdkFactory {
|
|
|
15
15
|
return (_state$behaviours = state.behaviours) === null || _state$behaviours === void 0 ? void 0 : _state$behaviours.zrecord.records;
|
|
16
16
|
},
|
|
17
17
|
|
|
18
|
-
getRecord(recordId) {
|
|
19
|
-
var _state$behaviours2, _state$behaviours2$zr;
|
|
20
|
-
|
|
21
|
-
return (_state$behaviours2 = state.behaviours) === null || _state$behaviours2 === void 0 ? void 0 : (_state$behaviours2$zr = _state$behaviours2.zrecord.records) === null || _state$behaviours2$zr === void 0 ? void 0 : _state$behaviours2$zr.find(r => r.id === recordId);
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
deleteRecord(recordId) {
|
|
25
|
-
dispatch({
|
|
26
|
-
type: ZLIST_DELETE_RECORD,
|
|
27
|
-
payload: {
|
|
28
|
-
recordId
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
|
|
33
18
|
deleteRecords(recordIds) {
|
|
34
19
|
dispatch({
|
|
35
20
|
type: ZLIST_DELETE_RECORDS,
|
|
@@ -49,7 +34,8 @@ export default class ListSdkFactory {
|
|
|
49
34
|
});
|
|
50
35
|
}
|
|
51
36
|
|
|
52
|
-
}
|
|
37
|
+
},
|
|
38
|
+
zrecord: {}
|
|
53
39
|
};
|
|
54
40
|
}
|
|
55
41
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import ActionLocationEntity from "../../entities/ActionLocationEntity";
|
|
4
|
+
export default class Repository {
|
|
5
|
+
constructor() {
|
|
6
|
+
_defineProperty(this, "element", void 0);
|
|
7
|
+
|
|
8
|
+
_defineProperty(this, "dispatch", void 0);
|
|
9
|
+
|
|
10
|
+
_defineProperty(this, "state", void 0);
|
|
11
|
+
|
|
12
|
+
this.element = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
updateDependencies(element, state, dispatch) {
|
|
16
|
+
this.element = element;
|
|
17
|
+
this.dispatch = dispatch;
|
|
18
|
+
this.state = state;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getActionLocation() {
|
|
22
|
+
const {
|
|
23
|
+
actions
|
|
24
|
+
} = this.state.properties;
|
|
25
|
+
const {
|
|
26
|
+
handlers
|
|
27
|
+
} = this.state;
|
|
28
|
+
const actionLocation = new ActionLocationEntity(handlers, actions, this.element, this.dispatch);
|
|
29
|
+
return actionLocation;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import BooleanProperties from "../../../../../../../cc/fields/boolean/Properties";
|
|
3
|
+
import BooleanEvents from "../../../../../../../cc/fields/boolean/Events";
|
|
4
|
+
import CheckboxFieldView from "./CheckboxFieldView";
|
|
5
|
+
import { EventHandlersFactory } from "./EventHandlersFactory";
|
|
6
|
+
const CheckboxField = createCustomComponent({
|
|
7
|
+
name: 'CheckboxField',
|
|
8
|
+
View: CheckboxFieldView,
|
|
9
|
+
properties: BooleanProperties,
|
|
10
|
+
events: BooleanEvents,
|
|
11
|
+
eventHandlers: EventHandlersFactory.create()
|
|
12
|
+
});
|
|
13
|
+
export default CheckboxField;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Checkbox } from "../../../..";
|
|
3
|
+
export default function CheckboxFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value
|
|
10
|
+
} = state.properties;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
12
|
+
getRef: ref,
|
|
13
|
+
checked: value,
|
|
14
|
+
disabled: false,
|
|
15
|
+
readonly: false,
|
|
16
|
+
label: "",
|
|
17
|
+
tooltip: ""
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import CheckboxConstants from "../../../../../../../cc/checkbox/Constants";
|
|
2
|
+
import FieldConstants from "../../../../../../../cc/fields/field/Constants";
|
|
3
|
+
export class EventHandlersFactory {
|
|
4
|
+
static create() {
|
|
5
|
+
const changeHandler = input => {
|
|
6
|
+
const {
|
|
7
|
+
state,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
name: fieldName,
|
|
12
|
+
value: currentValue
|
|
13
|
+
} = state.properties;
|
|
14
|
+
const toggledValue = !currentValue;
|
|
15
|
+
dispatch({
|
|
16
|
+
type: FieldConstants.FIELD_CHANGED,
|
|
17
|
+
payload: {
|
|
18
|
+
fieldName,
|
|
19
|
+
value: toggledValue
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
[CheckboxConstants.CHECKBOX_TOGGLED]: changeHandler
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
package/es/library/dot/legacy-to-new-arch/field-components/email-field/frameworks/ui/EmailField.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import EmailProperties from "../../../../../../../cc/fields/email/Properties";
|
|
3
|
+
import { EmailFieldView } from "./EmailFieldView";
|
|
4
|
+
const EmailField = createCustomComponent({
|
|
5
|
+
name: 'EmailField',
|
|
6
|
+
View: EmailFieldView,
|
|
7
|
+
properties: EmailProperties,
|
|
8
|
+
actions: [],
|
|
9
|
+
actionHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default EmailField;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Email } from "../../../..";
|
|
3
|
+
export function EmailFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value
|
|
10
|
+
} = state.properties;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Email, {
|
|
12
|
+
getRef: ref,
|
|
13
|
+
email: value
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as CheckboxField } from "./checkbox-field/frameworks/ui/CheckboxField";
|
|
2
|
+
export { default as SwitchField } from "./switch-field/frameworks/ui/SwitchField";
|
|
3
|
+
export { default as SingleLineField } from "./text-field/frameworks/ui/TextField";
|
|
4
|
+
export { default as EmailField } from "./email-field/frameworks/ui/EmailField";
|
|
5
|
+
export { default as URLField } from "./url-field/frameworks/ui/UrlField";
|
|
6
|
+
export { default as PhoneField } from "./phone-field/frameworks/ui/PhoneField";
|
|
7
|
+
export { default as CurrencyField } from "./text-field/frameworks/ui/TextField";
|
|
8
|
+
export { default as LookUpField } from "./lookup-field/frameworks/ui/LookupField";
|
|
9
|
+
export { default as PickListField } from "./text-field/frameworks/ui/TextField";
|
|
10
|
+
export { default as PercentageField } from "./text-field/frameworks/ui/TextField";
|
|
11
|
+
export { default as DateField } from "./text-field/frameworks/ui/TextField";
|
|
12
|
+
export { default as DateTimeField } from "./text-field/frameworks/ui/TextField";
|
|
13
|
+
export { default as MultiSelectField } from "./multiselect-field/frameworks/ui/MultiSelectField"; // export { default as DateTimeField } from './date-time-field/frameworks/ui/DateTimeField';
|
|
14
|
+
// export { default as ColoredPickListField } from './colored-picklist-field/frameworks/ui/ColoredPickListField';
|
|
15
|
+
// export { default as ColoredMultiSelectField } from './colored-multi-select-field/frameworks/ui/ColoredMultiSelectField';
|
package/es/library/dot/legacy-to-new-arch/field-components/lookup-field/frameworks/ui/LookupField.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import LookupProperties from "../../../../../../../cc/fields/lookup/Properties";
|
|
3
|
+
import { LookupFieldView } from "./LookupFieldView";
|
|
4
|
+
const LookupField = createCustomComponent({
|
|
5
|
+
name: 'LookupField',
|
|
6
|
+
View: LookupFieldView,
|
|
7
|
+
properties: LookupProperties,
|
|
8
|
+
actions: [],
|
|
9
|
+
actionHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default LookupField;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Avatar } from "../../../..";
|
|
3
|
+
export function LookupFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
name,
|
|
10
|
+
photoURL
|
|
11
|
+
} = state.properties.value;
|
|
12
|
+
return /*#__PURE__*/React.createElement(Avatar, {
|
|
13
|
+
getRef: ref,
|
|
14
|
+
name: name,
|
|
15
|
+
label: name,
|
|
16
|
+
imageSrc: photoURL,
|
|
17
|
+
tooltip: ""
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import MultiSelectProperties from "../../../../../../../cc/fields/multi-select/Properties";
|
|
3
|
+
import { MultiSelectFieldView } from "./MultiSelectFieldView";
|
|
4
|
+
const MultiSelectField = createCustomComponent({
|
|
5
|
+
name: 'MultiSelectField',
|
|
6
|
+
View: MultiSelectFieldView,
|
|
7
|
+
properties: MultiSelectProperties,
|
|
8
|
+
actions: [],
|
|
9
|
+
actionHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default MultiSelectField;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tags } from "../../../..";
|
|
3
|
+
export function MultiSelectFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
options
|
|
11
|
+
} = state.properties; // const selectedOptions = options.find(option => value.includes(option.value));
|
|
12
|
+
|
|
13
|
+
const selectedOptions = value.map(item => ({
|
|
14
|
+
id: item,
|
|
15
|
+
label: item
|
|
16
|
+
}));
|
|
17
|
+
return /*#__PURE__*/React.createElement(Tags, {
|
|
18
|
+
getRef: ref,
|
|
19
|
+
tags: selectedOptions
|
|
20
|
+
});
|
|
21
|
+
}
|
package/es/library/dot/legacy-to-new-arch/field-components/phone-field/frameworks/ui/PhoneField.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import UrlProperties from "../../../../../../../cc/fields/url/Properties";
|
|
3
|
+
import PhoneFieldView from "./PhoneFieldView";
|
|
4
|
+
const PhoneField = createCustomComponent({
|
|
5
|
+
name: 'PhoneField',
|
|
6
|
+
View: PhoneFieldView,
|
|
7
|
+
properties: UrlProperties,
|
|
8
|
+
actions: [],
|
|
9
|
+
actionHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default PhoneField;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from "../../../..";
|
|
3
|
+
|
|
4
|
+
function PhoneFieldView(_ref, ref) {
|
|
5
|
+
let {
|
|
6
|
+
state,
|
|
7
|
+
helpers
|
|
8
|
+
} = _ref;
|
|
9
|
+
const {
|
|
10
|
+
value
|
|
11
|
+
} = state.properties;
|
|
12
|
+
const href = `tel:${value}`;
|
|
13
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
14
|
+
getRef: ref,
|
|
15
|
+
label: value,
|
|
16
|
+
href: href,
|
|
17
|
+
variant: "secondary",
|
|
18
|
+
opensNewTab: true
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default PhoneFieldView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import PickListProperties from "../../../../../../../cc/fields/pick-list/Properties";
|
|
3
|
+
import { PickListFieldView } from "./PickListFieldView";
|
|
4
|
+
const PickListField = createCustomComponent({
|
|
5
|
+
name: 'PickListField',
|
|
6
|
+
View: PickListFieldView,
|
|
7
|
+
properties: PickListProperties,
|
|
8
|
+
actions: [],
|
|
9
|
+
actionHandlers: {}
|
|
10
|
+
});
|
|
11
|
+
export default PickListField;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HighlightedValue } from "../../../..";
|
|
3
|
+
export function PickListFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
options
|
|
11
|
+
} = state.properties;
|
|
12
|
+
const selectedOptions = options.find(option => value === option.value);
|
|
13
|
+
return /*#__PURE__*/React.createElement(HighlightedValue, {
|
|
14
|
+
getRef: ref,
|
|
15
|
+
text: value,
|
|
16
|
+
color: selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.colorCode,
|
|
17
|
+
tooltip: ""
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import SwitchConstants from "../../../../../../../cc/switch/Constants";
|
|
2
|
+
import FieldConstants from "../../../../../../../cc/fields/field/Constants";
|
|
3
|
+
export class EventHandlersFactory {
|
|
4
|
+
static create() {
|
|
5
|
+
const changeHandler = input => {
|
|
6
|
+
const {
|
|
7
|
+
state,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
name: fieldName,
|
|
12
|
+
value: currentValue
|
|
13
|
+
} = state.properties;
|
|
14
|
+
const toggledValue = !currentValue;
|
|
15
|
+
dispatch({
|
|
16
|
+
type: FieldConstants.FIELD_CHANGED,
|
|
17
|
+
payload: {
|
|
18
|
+
fieldName,
|
|
19
|
+
value: toggledValue
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
[SwitchConstants.SWITCH_TOGGLED]: changeHandler
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
package/es/library/dot/legacy-to-new-arch/field-components/switch-field/frameworks/ui/SwitchField.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import BooleanProperties from "../../../../../../../cc/fields/boolean/Properties";
|
|
3
|
+
import BooleanEvents from "../../../../../../../cc/fields/boolean/Events";
|
|
4
|
+
import SwitchFieldView from "./SwitchFieldView";
|
|
5
|
+
import { EventHandlersFactory } from "./EventHandlersFactory";
|
|
6
|
+
const SwitchField = createCustomComponent({
|
|
7
|
+
name: 'SwitchField',
|
|
8
|
+
View: SwitchFieldView,
|
|
9
|
+
properties: BooleanProperties,
|
|
10
|
+
events: BooleanEvents,
|
|
11
|
+
eventHandlers: EventHandlersFactory.create()
|
|
12
|
+
});
|
|
13
|
+
export default SwitchField;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Switch } from "../../../..";
|
|
3
|
+
export default function SwitchFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value
|
|
10
|
+
} = state.properties;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Switch, {
|
|
12
|
+
getRef: ref,
|
|
13
|
+
checked: value,
|
|
14
|
+
disabled: false,
|
|
15
|
+
size: 'small',
|
|
16
|
+
tooltip: ""
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import TextConstants from "../../../../../../../cc/text/Constants";
|
|
2
|
+
import FieldConstants from "../../../../../../../cc/fields/field/Constants";
|
|
3
|
+
export class EventHandlersFactory {
|
|
4
|
+
static create() {
|
|
5
|
+
const clickHandler = input => {
|
|
6
|
+
const {
|
|
7
|
+
state,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
name: fieldName
|
|
12
|
+
} = state.properties;
|
|
13
|
+
dispatch({
|
|
14
|
+
type: FieldConstants.FIELD_CLICKED,
|
|
15
|
+
payload: {
|
|
16
|
+
fieldName
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
[TextConstants.TEXT_CLICKED]: clickHandler
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
package/es/library/dot/legacy-to-new-arch/field-components/text-field/frameworks/ui/TextField.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import TextProperties from "../../../../../../../cc/fields/text/Properties";
|
|
3
|
+
import TextEvents from "../../../../../../../cc/fields/text/Events";
|
|
4
|
+
import { TextFieldView } from "./TextFieldView";
|
|
5
|
+
import { EventHandlersFactory } from "./EventHandlersFactory";
|
|
6
|
+
const TextField = createCustomComponent({
|
|
7
|
+
name: 'TextField',
|
|
8
|
+
View: TextFieldView,
|
|
9
|
+
properties: TextProperties,
|
|
10
|
+
events: TextEvents,
|
|
11
|
+
eventHandlers: EventHandlersFactory.create()
|
|
12
|
+
});
|
|
13
|
+
export default TextField;
|
package/es/library/dot/legacy-to-new-arch/field-components/text-field/frameworks/ui/TextFieldView.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from "../../../..";
|
|
3
|
+
export function TextFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value
|
|
10
|
+
} = state.properties;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
12
|
+
getRef: ref,
|
|
13
|
+
text: value,
|
|
14
|
+
tooltip: ""
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import LinkConstants from "../../../../../../../cc/link/Constants";
|
|
2
|
+
import FieldConstants from "../../../../../../../cc/fields/field/Constants";
|
|
3
|
+
export class EventHandlersFactory {
|
|
4
|
+
static create() {
|
|
5
|
+
const clickHandler = input => {
|
|
6
|
+
const {
|
|
7
|
+
state,
|
|
8
|
+
dispatch
|
|
9
|
+
} = input;
|
|
10
|
+
const {
|
|
11
|
+
name: fieldName
|
|
12
|
+
} = state.properties;
|
|
13
|
+
dispatch({
|
|
14
|
+
type: FieldConstants.FIELD_CLICKED,
|
|
15
|
+
payload: {
|
|
16
|
+
fieldName
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
[LinkConstants.LINK_CLICKED]: clickHandler
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
package/es/library/dot/legacy-to-new-arch/field-components/url-field/frameworks/ui/UrlField.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCustomComponent } from "../../../../../../custom-component";
|
|
2
|
+
import UrlProperties from "../../../../../../../cc/fields/url/Properties";
|
|
3
|
+
import UrlEvents from "../../../../../../../cc/fields/url/Events";
|
|
4
|
+
import { UrlFieldView } from "./UrlFieldView";
|
|
5
|
+
import { EventHandlersFactory } from "./EventHandlersFactory";
|
|
6
|
+
const UrlField = createCustomComponent({
|
|
7
|
+
name: 'UrlField',
|
|
8
|
+
View: UrlFieldView,
|
|
9
|
+
properties: UrlProperties,
|
|
10
|
+
events: UrlEvents,
|
|
11
|
+
eventHandlers: EventHandlersFactory.create()
|
|
12
|
+
});
|
|
13
|
+
export default UrlField;
|
package/es/library/dot/legacy-to-new-arch/field-components/url-field/frameworks/ui/UrlFieldView.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from "../../../..";
|
|
3
|
+
export function UrlFieldView(_ref, ref) {
|
|
4
|
+
let {
|
|
5
|
+
state,
|
|
6
|
+
helpers
|
|
7
|
+
} = _ref;
|
|
8
|
+
const {
|
|
9
|
+
value
|
|
10
|
+
} = state.properties;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
12
|
+
getRef: ref,
|
|
13
|
+
label: value,
|
|
14
|
+
href: value,
|
|
15
|
+
variant: "secondary",
|
|
16
|
+
opensNewTab: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -16,11 +16,8 @@ class APITemplate {
|
|
|
16
16
|
|
|
17
17
|
_defineProperty(this, "helper", void 0);
|
|
18
18
|
|
|
19
|
-
_defineProperty(this, "getResponseInTemplate", void 0);
|
|
20
|
-
|
|
21
19
|
this.input = input;
|
|
22
20
|
this.api = input.api;
|
|
23
|
-
this.getResponseInTemplate = input.getResponse;
|
|
24
21
|
this.payload = input.requestBody;
|
|
25
22
|
this.parameters = input.parameters;
|
|
26
23
|
this.type = API_METHODS[input.type];
|
|
@@ -51,28 +48,14 @@ class APITemplate {
|
|
|
51
48
|
const queryObj = JSON.parse(this.getParameter(obj));
|
|
52
49
|
const query = this.helper.objectToQueryString(queryObj);
|
|
53
50
|
return `${this.getApi(obj)}?${query}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
51
|
+
}
|
|
56
52
|
|
|
57
53
|
getApiDetails(obj) {
|
|
58
|
-
|
|
54
|
+
return {
|
|
59
55
|
url: this.constructURL(obj),
|
|
60
56
|
type: this.type,
|
|
61
57
|
payload: this.getPayload(obj)
|
|
62
58
|
};
|
|
63
|
-
|
|
64
|
-
if (this.getResponseInTemplate) {
|
|
65
|
-
apiDetails.getResponse = () => {
|
|
66
|
-
const payload = this.getPayload(obj);
|
|
67
|
-
const params = JSON.parse(this.getParameter(obj));
|
|
68
|
-
return this.getResponseInTemplate({
|
|
69
|
-
payload,
|
|
70
|
-
params
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return apiDetails;
|
|
76
59
|
}
|
|
77
60
|
|
|
78
61
|
getTransformer() {
|