@servicetitan/dte-unlayer 0.157.0 → 0.159.0
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/dist/api-core.js +22 -29
- package/dist/api-core.js.map +1 -1
- package/dist/api-custom-tools.js +23 -29
- package/dist/api-custom-tools.js.map +1 -1
- package/dist/business-calendar/BusinessCalendarDrawer.d.ts +19 -0
- package/dist/business-calendar/BusinessCalendarDrawer.d.ts.map +1 -0
- package/dist/business-calendar/BusinessCalendarDrawer.js +41 -0
- package/dist/business-calendar/BusinessCalendarDrawer.js.map +1 -0
- package/dist/business-calendar/business-calendar-requests.d.ts +25 -0
- package/dist/business-calendar/business-calendar-requests.d.ts.map +1 -0
- package/dist/business-calendar/business-calendar-requests.js +46 -0
- package/dist/business-calendar/business-calendar-requests.js.map +1 -0
- package/dist/business-calendar/business-calendar-state.d.ts +22 -0
- package/dist/business-calendar/business-calendar-state.d.ts.map +1 -0
- package/dist/business-calendar/business-calendar-state.js +74 -0
- package/dist/business-calendar/business-calendar-state.js.map +1 -0
- package/dist/business-calendar/useBusinessCalendarRequests.d.ts +15 -0
- package/dist/business-calendar/useBusinessCalendarRequests.d.ts.map +1 -0
- package/dist/business-calendar/useBusinessCalendarRequests.js +30 -0
- package/dist/business-calendar/useBusinessCalendarRequests.js.map +1 -0
- package/dist/display-conditions/ConditionGroup.js +15 -89
- package/dist/display-conditions/ConditionGroup.js.map +1 -1
- package/dist/display-conditions/ConditionGroupsSection.js +2 -70
- package/dist/display-conditions/ConditionGroupsSection.js.map +1 -1
- package/dist/display-conditions/ConditionRow.d.ts.map +1 -1
- package/dist/display-conditions/ConditionRow.js +71 -296
- package/dist/display-conditions/ConditionRow.js.map +1 -1
- package/dist/display-conditions/DisplayConditionModal.js +40 -190
- package/dist/display-conditions/DisplayConditionModal.js.map +1 -1
- package/dist/display-conditions/LookupValueControl.d.ts.map +1 -1
- package/dist/display-conditions/LookupValueControl.js +42 -109
- package/dist/display-conditions/LookupValueControl.js.map +1 -1
- package/dist/display-conditions/SeparatorWithChip.js +1 -10
- package/dist/display-conditions/SeparatorWithChip.js.map +1 -1
- package/dist/display-conditions/constants.js +15 -20
- package/dist/display-conditions/constants.js.map +1 -1
- package/dist/display-conditions/displayConditionController.js +5 -8
- package/dist/display-conditions/displayConditionController.js.map +1 -1
- package/dist/display-conditions/lookupOptionsController.js +16 -16
- package/dist/display-conditions/lookupOptionsController.js.map +1 -1
- package/dist/display-conditions/nunjucks.js +98 -116
- package/dist/display-conditions/nunjucks.js.map +1 -1
- package/dist/display-conditions/schemaDataPoints.js +13 -11
- package/dist/display-conditions/schemaDataPoints.js.map +1 -1
- package/dist/display-conditions/types.js +23 -67
- package/dist/display-conditions/types.js.map +1 -1
- package/dist/display-conditions/useConditionForms.js +38 -56
- package/dist/display-conditions/useConditionForms.js.map +1 -1
- package/dist/display-conditions/useLookupOptions.js +24 -44
- package/dist/display-conditions/useLookupOptions.js.map +1 -1
- package/dist/e-sign-offset/ESignDateSignedOffsetModal.d.ts.map +1 -1
- package/dist/e-sign-offset/ESignDateSignedOffsetModal.js +48 -156
- package/dist/e-sign-offset/ESignDateSignedOffsetModal.js.map +1 -1
- package/dist/e-sign-offset/ESignOffsetRuleRow.d.ts +3 -1
- package/dist/e-sign-offset/ESignOffsetRuleRow.d.ts.map +1 -1
- package/dist/e-sign-offset/ESignOffsetRuleRow.js +12 -71
- package/dist/e-sign-offset/ESignOffsetRuleRow.js.map +1 -1
- package/dist/e-sign-offset/eSignOffsetController.js +5 -8
- package/dist/e-sign-offset/eSignOffsetController.js.map +1 -1
- package/dist/editor-core-source.d.ts +2 -2
- package/dist/editor-core-source.d.ts.map +1 -1
- package/dist/editor-core-source.js +3 -3
- package/dist/editor-core-source.js.map +1 -1
- package/dist/editor-core.js +2 -2
- package/dist/editor-core.js.map +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +56 -118
- package/dist/editor.js.map +1 -1
- package/dist/image-upload-error.js +3 -3
- package/dist/image-upload-error.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/loadScript.js +7 -8
- package/dist/loadScript.js.map +1 -1
- package/dist/log.js +2 -3
- package/dist/log.js.map +1 -1
- package/dist/merge-tags.js +18 -17
- package/dist/merge-tags.js.map +1 -1
- package/dist/shared/configs.js +1 -2
- package/dist/shared/configs.js.map +1 -1
- package/dist/shared/const.d.ts +72 -0
- package/dist/shared/const.d.ts.map +1 -1
- package/dist/shared/const.js +13 -4
- package/dist/shared/const.js.map +1 -1
- package/dist/shared/date-calc.d.ts +32 -13
- package/dist/shared/date-calc.d.ts.map +1 -1
- package/dist/shared/date-calc.js +130 -76
- package/dist/shared/date-calc.js.map +1 -1
- package/dist/shared/e-sign-offset.js +46 -63
- package/dist/shared/e-sign-offset.js.map +1 -1
- package/dist/shared/edit-icon.js +0 -1
- package/dist/shared/edit-icon.js.map +1 -1
- package/dist/shared/fonts.js +16 -17
- package/dist/shared/fonts.js.map +1 -1
- package/dist/shared/forms.js +16 -38
- package/dist/shared/forms.js.map +1 -1
- package/dist/shared/instance-id.d.ts +3 -0
- package/dist/shared/instance-id.d.ts.map +1 -1
- package/dist/shared/instance-id.js +10 -7
- package/dist/shared/instance-id.js.map +1 -1
- package/dist/shared/nunjucks-helpers.js +2 -5
- package/dist/shared/nunjucks-helpers.js.map +1 -1
- package/dist/shared/schema.js +52 -96
- package/dist/shared/schema.js.map +1 -1
- package/dist/shared/tools.js +6 -13
- package/dist/shared/tools.js.map +1 -1
- package/dist/store.d.ts +15 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +851 -547
- package/dist/store.js.map +1 -1
- package/dist/tools.js +133 -143
- package/dist/tools.js.map +1 -1
- package/dist/unlayer-interface.d.ts +25 -1
- package/dist/unlayer-interface.d.ts.map +1 -1
- package/dist/unlayer-interface.js +1 -2
- package/dist/unlayer-interface.js.map +1 -1
- package/dist/unlayer.js +86 -113
- package/dist/unlayer.js.map +1 -1
- package/dist/vendor/dte-shared/business-calendar-validation.utils.d.ts +25 -0
- package/dist/vendor/dte-shared/business-calendar-validation.utils.js +80 -0
- package/dist/vendor/dte-shared/components/business-calendar-section.d.ts +15 -0
- package/dist/vendor/dte-shared/components/business-calendar-section.js +14 -0
- package/dist/vendor/dte-shared/components/schedule-drawer.d.ts +18 -0
- package/dist/vendor/dte-shared/components/schedule-drawer.js +119 -0
- package/dist/vendor/dte-shared/components/schedule-picker.d.ts +8 -0
- package/dist/vendor/dte-shared/components/schedule-picker.js +88 -0
- package/dist/vendor/dte-shared/constants.d.ts +31 -0
- package/dist/vendor/dte-shared/constants.js +34 -0
- package/dist/vendor/dte-shared/field-schedule-editor-context.d.ts +31 -0
- package/dist/vendor/dte-shared/field-schedule-editor-context.js +110 -0
- package/dist/vendor/dte-shared/index.d.ts +8 -0
- package/dist/vendor/dte-shared/index.js +7 -0
- package/dist/vendor/dte-shared/schedule-bindings.utils.d.ts +22 -0
- package/dist/vendor/dte-shared/schedule-bindings.utils.js +31 -0
- package/dist/vendor/dte-shared/styles/schedule.css +19 -0
- package/dist/vendor/dte-shared/types.d.ts +129 -0
- package/dist/vendor/dte-shared/types.js +1 -0
- package/package.json +7 -1
- package/src/__tests__/business-calendar-drawer.test.tsx +183 -0
- package/src/__tests__/business-calendar-requests.test.ts +166 -0
- package/src/__tests__/business-calendar-state.test.tsx +142 -0
- package/src/__tests__/condition-row.test.tsx +131 -0
- package/src/__tests__/date-calc.test.ts +145 -0
- package/src/__tests__/e-sign-offset-modal.test.tsx +124 -0
- package/src/__tests__/instance-id.test.ts +49 -0
- package/src/__tests__/store.business-calendar.test.ts +185 -0
- package/src/__tests__/unlayer.e-sign-types.test.ts +30 -0
- package/src/business-calendar/BusinessCalendarDrawer.tsx +76 -0
- package/src/business-calendar/business-calendar-requests.ts +80 -0
- package/src/business-calendar/business-calendar-state.ts +113 -0
- package/src/business-calendar/useBusinessCalendarRequests.ts +49 -0
- package/src/display-conditions/ConditionRow.tsx +102 -175
- package/src/display-conditions/LookupValueControl.tsx +1 -12
- package/src/e-sign-offset/ESignDateSignedOffsetModal.tsx +20 -12
- package/src/e-sign-offset/ESignOffsetRuleRow.tsx +7 -2
- package/src/editor-core-source.ts +2 -2
- package/src/editor.tsx +15 -0
- package/src/index.ts +10 -0
- package/src/shared/const.ts +61 -0
- package/src/shared/date-calc.ts +155 -78
- package/src/shared/instance-id.ts +6 -1
- package/src/store.ts +68 -5
- package/src/unlayer-interface.tsx +25 -1
- package/src/unlayer.tsx +5 -5
package/dist/shared/schema.js
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
export const schemaNodeAvailableTypes = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'string',
|
|
5
|
-
'number',
|
|
6
|
-
'date'
|
|
7
|
-
];
|
|
8
|
-
export const schemaNodeStringSubTypes = [
|
|
9
|
-
'string',
|
|
10
|
-
'text',
|
|
11
|
-
'html',
|
|
12
|
-
'image'
|
|
13
|
-
];
|
|
14
|
-
export const schemaIsAvailableType = (type)=>schemaNodeAvailableTypes.includes(type);
|
|
1
|
+
export const schemaNodeAvailableTypes = ['object', 'array', 'string', 'number', 'date'];
|
|
2
|
+
export const schemaNodeStringSubTypes = ['string', 'text', 'html', 'image'];
|
|
3
|
+
export const schemaIsAvailableType = (type) => schemaNodeAvailableTypes.includes(type);
|
|
15
4
|
export const schemaArrayRootKey = '[]';
|
|
16
|
-
export const schemaIsObject = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'object';
|
|
17
|
-
export const schemaIsArrayOfObjects = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'array' && (node === null || node === void 0 ? void 0 : node.items.type) === 'object';
|
|
18
|
-
export const schemaIsArray = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'array';
|
|
19
|
-
export const schemaIsString = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'string';
|
|
20
|
-
export const schemaIsNumber = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'number';
|
|
21
|
-
export const schemaIsDate = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'date';
|
|
22
|
-
export const schemaIsStringHtml = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'html';
|
|
23
|
-
export const schemaIsStringImage = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'image';
|
|
24
|
-
export const schemaFindNode = (schema, key)=>{
|
|
25
|
-
const nodeFinder = (node, keys)=>{
|
|
5
|
+
export const schemaIsObject = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'object';
|
|
6
|
+
export const schemaIsArrayOfObjects = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'array' && (node === null || node === void 0 ? void 0 : node.items.type) === 'object';
|
|
7
|
+
export const schemaIsArray = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'array';
|
|
8
|
+
export const schemaIsString = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'string';
|
|
9
|
+
export const schemaIsNumber = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'number';
|
|
10
|
+
export const schemaIsDate = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'date';
|
|
11
|
+
export const schemaIsStringHtml = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'html';
|
|
12
|
+
export const schemaIsStringImage = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'image';
|
|
13
|
+
export const schemaFindNode = (schema, key) => {
|
|
14
|
+
const nodeFinder = (node, keys) => {
|
|
26
15
|
if (!node) {
|
|
27
16
|
return undefined;
|
|
28
17
|
}
|
|
@@ -46,115 +35,82 @@ export const schemaFindNode = (schema, key)=>{
|
|
|
46
35
|
};
|
|
47
36
|
return nodeFinder(schema, key.split('.'));
|
|
48
37
|
};
|
|
49
|
-
export const schemaFindParentNode = (schema, key)=>{
|
|
38
|
+
export const schemaFindParentNode = (schema, key) => {
|
|
50
39
|
const keys = key.split('.');
|
|
51
40
|
keys.pop();
|
|
52
|
-
return keys.length
|
|
41
|
+
return keys.length
|
|
42
|
+
? schemaFindNode(schema, keys.join('.'))
|
|
43
|
+
: schemaIsObject(schema) && schema.properties[key]
|
|
44
|
+
? schema
|
|
45
|
+
: undefined;
|
|
53
46
|
};
|
|
54
|
-
export const schemaGetFieldKey = (fullKey)=>{
|
|
55
|
-
|
|
56
|
-
return (_fullKey_split_pop = fullKey.split('.').pop()) !== null && _fullKey_split_pop !== void 0 ? _fullKey_split_pop : '';
|
|
57
|
-
};
|
|
58
|
-
export const schemaBuildNode = (type, arrayItemType)=>{
|
|
47
|
+
export const schemaGetFieldKey = (fullKey) => { var _a; return (_a = fullKey.split('.').pop()) !== null && _a !== void 0 ? _a : ''; };
|
|
48
|
+
export const schemaBuildNode = (type, arrayItemType) => {
|
|
59
49
|
if (type === 'object') {
|
|
60
|
-
return {
|
|
61
|
-
type: 'object',
|
|
62
|
-
properties: {},
|
|
63
|
-
options: {}
|
|
64
|
-
};
|
|
50
|
+
return { type: 'object', properties: {}, options: {} };
|
|
65
51
|
}
|
|
66
52
|
if (type === 'array') {
|
|
67
|
-
return {
|
|
68
|
-
type: 'array',
|
|
69
|
-
items: schemaBuildNode(arrayItemType !== null && arrayItemType !== void 0 ? arrayItemType : 'object'),
|
|
70
|
-
options: {}
|
|
71
|
-
};
|
|
53
|
+
return { type: 'array', items: schemaBuildNode(arrayItemType !== null && arrayItemType !== void 0 ? arrayItemType : 'object'), options: {} };
|
|
72
54
|
}
|
|
73
|
-
return {
|
|
74
|
-
type,
|
|
75
|
-
options: {}
|
|
76
|
-
};
|
|
55
|
+
return { type, options: {} };
|
|
77
56
|
};
|
|
78
|
-
export const schemaBuildMap = (schema)=>{
|
|
57
|
+
export const schemaBuildMap = (schema) => {
|
|
79
58
|
const fieldsMap = {};
|
|
80
59
|
const dummyData = {};
|
|
81
|
-
const processNode = (node, nodeKey, parentNodes, isArrayed, dummyDataNode)=>{
|
|
82
|
-
var
|
|
83
|
-
const nodeLabel = (
|
|
60
|
+
const processNode = (node, nodeKey, parentNodes, isArrayed, dummyDataNode) => {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
62
|
+
const nodeLabel = (_a = node.title) !== null && _a !== void 0 ? _a : nodeKey;
|
|
84
63
|
const isArrayRoot = nodeKey === schemaArrayRootKey;
|
|
85
64
|
if (nodeKey) {
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
...parentNodes.map((n)=>n.key),
|
|
89
|
-
nodeKey
|
|
90
|
-
].join('.');
|
|
91
|
-
const fullTitle = [
|
|
92
|
-
...parentNodes.map((n)=>n.title),
|
|
93
|
-
nodeLabel
|
|
94
|
-
].join(' - ');
|
|
65
|
+
const fullKey = [...parentNodes.map(n => n.key), nodeKey].join('.');
|
|
66
|
+
const fullTitle = [...parentNodes.map(n => n.title), nodeLabel].join(' - ');
|
|
95
67
|
fieldsMap[fullKey] = {
|
|
96
68
|
fieldKey: nodeKey,
|
|
97
69
|
fullKey,
|
|
98
70
|
fullTitle,
|
|
99
|
-
title: ((
|
|
71
|
+
title: ((_b = node.title) !== null && _b !== void 0 ? _b : isArrayed) ? nodeLabel : fullTitle,
|
|
100
72
|
node,
|
|
101
73
|
isArrayed,
|
|
102
|
-
isValue: !schemaIsObject(node) && !schemaIsArray(node)
|
|
74
|
+
isValue: !schemaIsObject(node) && !schemaIsArray(node),
|
|
103
75
|
};
|
|
104
76
|
}
|
|
105
77
|
if (schemaIsObject(node)) {
|
|
106
|
-
|
|
107
|
-
const properties = (_node_properties = node.properties) !== null && _node_properties !== void 0 ? _node_properties : {};
|
|
78
|
+
const properties = (_c = node.properties) !== null && _c !== void 0 ? _c : {};
|
|
108
79
|
const keys = Object.keys(properties !== null && properties !== void 0 ? properties : {}).sort();
|
|
109
80
|
let dummyDataObject = {};
|
|
110
81
|
if (isArrayRoot) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
82
|
+
(_d = dummyDataNode.push) === null || _d === void 0 ? void 0 : _d.call(dummyDataNode, dummyDataObject);
|
|
83
|
+
}
|
|
84
|
+
else if (nodeKey) {
|
|
114
85
|
dummyDataNode[nodeKey] = dummyDataObject;
|
|
115
|
-
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
116
88
|
dummyDataObject = dummyDataNode;
|
|
117
89
|
}
|
|
118
|
-
for (const key of keys){
|
|
119
|
-
processNode(properties[key], key, nodeKey ? [
|
|
120
|
-
...parentNodes,
|
|
121
|
-
{
|
|
122
|
-
key: nodeKey,
|
|
123
|
-
title: nodeLabel
|
|
124
|
-
}
|
|
125
|
-
] : [], isArrayed, dummyDataObject);
|
|
90
|
+
for (const key of keys) {
|
|
91
|
+
processNode(properties[key], key, nodeKey ? [...parentNodes, { key: nodeKey, title: nodeLabel }] : [], isArrayed, dummyDataObject);
|
|
126
92
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const items = (
|
|
93
|
+
}
|
|
94
|
+
else if (schemaIsArray(node)) {
|
|
95
|
+
const items = (_e = node.items) !== null && _e !== void 0 ? _e : {};
|
|
130
96
|
dummyDataNode[nodeKey] = [];
|
|
131
|
-
processNode(items, schemaArrayRootKey, nodeKey ? [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
] : [], true, dummyDataNode[nodeKey]);
|
|
138
|
-
} else if (nodeKey) {
|
|
139
|
-
var _node_options, _node_options1;
|
|
140
|
-
const sampleData = node === null || node === void 0 ? void 0 : (_node_options = node.options) === null || _node_options === void 0 ? void 0 : _node_options.sampleData;
|
|
141
|
-
const placeholder = node === null || node === void 0 ? void 0 : (_node_options1 = node.options) === null || _node_options1 === void 0 ? void 0 : _node_options1.placeholder;
|
|
97
|
+
processNode(items, schemaArrayRootKey, nodeKey ? [...parentNodes, { key: nodeKey, title: nodeLabel }] : [], true, dummyDataNode[nodeKey]);
|
|
98
|
+
}
|
|
99
|
+
else if (nodeKey) {
|
|
100
|
+
const sampleData = (_f = node === null || node === void 0 ? void 0 : node.options) === null || _f === void 0 ? void 0 : _f.sampleData;
|
|
101
|
+
const placeholder = (_g = node === null || node === void 0 ? void 0 : node.options) === null || _g === void 0 ? void 0 : _g.placeholder;
|
|
142
102
|
const value = sampleData !== undefined ? sampleData : placeholder;
|
|
143
103
|
if (value !== undefined) {
|
|
144
104
|
if (isArrayRoot) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
105
|
+
(_h = dummyDataNode.push) === null || _h === void 0 ? void 0 : _h.call(dummyDataNode, value);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
148
108
|
dummyDataNode[nodeKey] = value;
|
|
149
109
|
}
|
|
150
110
|
}
|
|
151
111
|
}
|
|
152
112
|
};
|
|
153
113
|
processNode(schema, '', [], false, dummyData);
|
|
154
|
-
return {
|
|
155
|
-
map: fieldsMap,
|
|
156
|
-
dummyData
|
|
157
|
-
};
|
|
114
|
+
return { map: fieldsMap, dummyData };
|
|
158
115
|
};
|
|
159
|
-
|
|
160
116
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shared/schema.ts"],"sourcesContent":["export type SchemaNodeAvailableTypes = 'object' | 'array' | 'string' | 'number' | 'date';\nexport const schemaNodeAvailableTypes = ['object', 'array', 'string', 'number', 'date'];\n\nexport type SchemaNodeStringSubTypes = 'string' | 'text' | 'html' | 'image';\nexport const schemaNodeStringSubTypes = ['string', 'text', 'html', 'image'];\n\nexport const schemaIsAvailableType = (type: string): type is SchemaNodeAvailableTypes =>\n schemaNodeAvailableTypes.includes(type);\n\nexport interface SchemaFieldBaseOptions {\n placeholder?: any;\n description?: any;\n sampleData?: any;\n showInEditor?: boolean;\n useInCalculatedFields?: boolean;\n useInConditionals?: boolean;\n isHighlighted?: boolean;\n fieldLookupSource?: string;\n}\n\ninterface SchemaNodeProps {\n title?: string;\n options?: SchemaFieldBaseOptions;\n}\n\nexport interface SchemaObject extends SchemaNodeProps {\n type: 'object';\n properties: Record<string, SchemaNode>;\n}\n\nexport interface SchemaArray extends SchemaNodeProps {\n type: 'array';\n items: SchemaNode;\n}\n\nexport interface SchemaSimpleString extends SchemaNodeProps {\n type: 'string';\n subType?: SchemaNodeStringSubTypes;\n}\n\nexport interface SchemaSimpleNumber extends SchemaNodeProps {\n type: 'number';\n}\n\nexport interface SchemaSimpleDate extends SchemaNodeProps {\n type: 'date';\n}\n\nexport type SchemaSimple = SchemaSimpleString | SchemaSimpleNumber | SchemaSimpleDate;\n\nexport const schemaArrayRootKey = '[]';\nexport type SchemaNode = SchemaObject | SchemaArray | SchemaSimple;\n\nexport const schemaIsObject = (node?: SchemaNode): node is SchemaObject => node?.type === 'object';\nexport const schemaIsArrayOfObjects = (node?: SchemaNode): node is SchemaArray =>\n node?.type === 'array' && node?.items.type === 'object';\nexport const schemaIsArray = (node?: SchemaNode): node is SchemaArray => node?.type === 'array';\nexport const schemaIsString = (node?: SchemaNode): node is SchemaSimpleString =>\n node?.type === 'string';\nexport const schemaIsNumber = (node?: SchemaNode): node is SchemaSimpleNumber =>\n node?.type === 'number';\nexport const schemaIsDate = (node?: SchemaNode): node is SchemaSimpleDate => node?.type === 'date';\nexport const schemaIsStringHtml = (node?: SchemaNode): node is SchemaSimpleString =>\n node?.type === 'string' && node?.subType === 'html';\n\nexport const schemaIsStringImage = (node?: SchemaNode): node is SchemaSimpleString =>\n node?.type === 'string' && node?.subType === 'image';\n\nexport const schemaFindNode = (schema: SchemaNode, key: string): SchemaNode | undefined => {\n const nodeFinder = (node: SchemaNode, keys: string[]): SchemaNode | undefined => {\n if (!node) {\n return undefined;\n }\n\n if (!keys.length) {\n return node;\n }\n\n const key = keys.shift();\n\n if (!key) {\n return undefined;\n }\n\n if (key === schemaArrayRootKey) {\n return schemaIsArray(node) ? nodeFinder(node.items, keys) : undefined;\n }\n\n if (schemaIsObject(node)) {\n return nodeFinder(node.properties[key], keys);\n }\n\n if (schemaIsArrayOfObjects(node)) {\n return nodeFinder(((node as SchemaArray)?.items as SchemaObject).properties[key], keys);\n }\n\n return undefined;\n };\n\n return nodeFinder(schema, key.split('.'));\n};\n\nexport const schemaFindParentNode = (schema: SchemaNode, key: string): SchemaNode | undefined => {\n const keys = key.split('.');\n\n keys.pop();\n\n return keys.length\n ? schemaFindNode(schema, keys.join('.'))\n : schemaIsObject(schema) && schema.properties[key]\n ? schema\n : undefined;\n};\n\nexport const schemaGetFieldKey = (fullKey: string): string => fullKey.split('.').pop() ?? '';\n\nexport const schemaBuildNode = (\n type: SchemaNodeAvailableTypes,\n arrayItemType?: SchemaNodeAvailableTypes,\n): SchemaNode => {\n if (type === 'object') {\n return { type: 'object', properties: {}, options: {} };\n }\n if (type === 'array') {\n return { type: 'array', items: schemaBuildNode(arrayItemType ?? 'object'), options: {} };\n }\n\n return { type, options: {} };\n};\n\nexport interface SchemaMetaField {\n fieldKey: string;\n fullKey: string;\n node: SchemaNode;\n title: string; // node.title or fullTitle\n fullTitle: string; // joined title of all parents and field\n isArrayed: boolean;\n isValue: boolean;\n}\n\nexport type SchemaMap = Record<string, SchemaMetaField>;\n\nexport const schemaBuildMap = (schema: SchemaObject): { map: SchemaMap; dummyData: any } => {\n const fieldsMap: Record<string, SchemaMetaField> = {};\n const dummyData: any = {};\n\n const processNode = (\n node: SchemaNode,\n nodeKey: string,\n parentNodes: { key: string; title: string }[],\n isArrayed: boolean,\n dummyDataNode: any,\n ) => {\n const nodeLabel = node.title ?? nodeKey;\n const isArrayRoot = nodeKey === schemaArrayRootKey;\n\n if (nodeKey) {\n const fullKey = [...parentNodes.map(n => n.key), nodeKey].join('.');\n const fullTitle = [...parentNodes.map(n => n.title), nodeLabel].join(' - ');\n\n fieldsMap[fullKey] = {\n fieldKey: nodeKey,\n fullKey,\n fullTitle,\n title: (node.title ?? isArrayed) ? nodeLabel : fullTitle,\n node,\n isArrayed,\n isValue: !schemaIsObject(node) && !schemaIsArray(node),\n };\n }\n\n if (schemaIsObject(node)) {\n const properties = node.properties ?? {};\n const keys = Object.keys(properties ?? {}).sort();\n let dummyDataObject = {};\n\n if (isArrayRoot) {\n dummyDataNode.push?.(dummyDataObject);\n } else if (nodeKey) {\n dummyDataNode[nodeKey] = dummyDataObject;\n } else {\n dummyDataObject = dummyDataNode;\n }\n\n for (const key of keys) {\n processNode(\n properties[key],\n key,\n nodeKey ? [...parentNodes, { key: nodeKey, title: nodeLabel }] : [],\n isArrayed,\n dummyDataObject,\n );\n }\n } else if (schemaIsArray(node)) {\n const items = node.items ?? {};\n\n dummyDataNode[nodeKey] = [];\n processNode(\n items,\n schemaArrayRootKey,\n nodeKey ? [...parentNodes, { key: nodeKey, title: nodeLabel }] : [],\n true,\n dummyDataNode[nodeKey],\n );\n } else if (nodeKey) {\n const sampleData = node?.options?.sampleData;\n const placeholder = node?.options?.placeholder;\n const value = sampleData !== undefined ? sampleData : placeholder;\n\n if (value !== undefined) {\n if (isArrayRoot) {\n dummyDataNode.push?.(value);\n } else {\n dummyDataNode[nodeKey] = value;\n }\n }\n }\n };\n\n processNode(schema, '', [], false, dummyData);\n\n return { map: fieldsMap, dummyData };\n};\n"],"names":["schemaNodeAvailableTypes","schemaNodeStringSubTypes","schemaIsAvailableType","type","includes","schemaArrayRootKey","schemaIsObject","node","schemaIsArrayOfObjects","items","schemaIsArray","schemaIsString","schemaIsNumber","schemaIsDate","schemaIsStringHtml","subType","schemaIsStringImage","schemaFindNode","schema","key","nodeFinder","keys","undefined","length","shift","properties","split","schemaFindParentNode","pop","join","schemaGetFieldKey","fullKey","schemaBuildNode","arrayItemType","options","schemaBuildMap","fieldsMap","dummyData","processNode","nodeKey","parentNodes","isArrayed","dummyDataNode","nodeLabel","title","isArrayRoot","map","n","fullTitle","fieldKey","isValue","Object","sort","dummyDataObject","push","sampleData","placeholder","value"],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I,uBAAJ,IAAI,CAAE,OAAO,0CAAE,UAAU,CAAC;YAC7C,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,WAAW,CAAC;YAC/C,MAAM,KAAK,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;YAElE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtB,IAAI,WAAW,EAAE,CAAC;oBACd,MAAA,aAAa,CAAC,IAAI,8DAAG,KAAK,CAAC,CAAC;gBAChC,CAAC;qBAAM,CAAC;oBACJ,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;gBACnC,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC,CAAC;IAEF,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAE9C,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AACzC,CAAC,CAAC"}
|
package/dist/shared/tools.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
export const unlayerToolsGenerateUnitKey = (unitId, unitGeneric)
|
|
2
|
-
export const unlayerToolsParseUnitKey = (toolKey)=>{
|
|
1
|
+
export const unlayerToolsGenerateUnitKey = (unitId, unitGeneric) => `${unitGeneric}:unit:${unitId}`;
|
|
2
|
+
export const unlayerToolsParseUnitKey = (toolKey) => {
|
|
3
3
|
const [generic, type, id] = (toolKey !== null && toolKey !== void 0 ? toolKey : '').split(':');
|
|
4
4
|
if (type === 'unit' && generic && id) {
|
|
5
|
-
return {
|
|
6
|
-
id,
|
|
7
|
-
generic
|
|
8
|
-
};
|
|
5
|
+
return { id, generic };
|
|
9
6
|
}
|
|
10
7
|
};
|
|
11
|
-
export const unlayerToolsGenerateTwinKey = (toolType, toolSlug)
|
|
12
|
-
export const unlayerToolsParseTwinKey = (toolKey)=>{
|
|
8
|
+
export const unlayerToolsGenerateTwinKey = (toolType, toolSlug) => `|twin|${toolType}|${toolSlug !== null && toolSlug !== void 0 ? toolSlug : ''}|${Date.now()}${Math.round(Math.random() * 10000)}`;
|
|
9
|
+
export const unlayerToolsParseTwinKey = (toolKey) => {
|
|
13
10
|
const [, twin, type, slug] = (toolKey !== null && toolKey !== void 0 ? toolKey : '').split('|');
|
|
14
11
|
if (twin === 'twin' && type) {
|
|
15
|
-
return {
|
|
16
|
-
type,
|
|
17
|
-
slug: slug || undefined
|
|
18
|
-
};
|
|
12
|
+
return { type, slug: slug || undefined };
|
|
19
13
|
}
|
|
20
14
|
};
|
|
21
|
-
|
|
22
15
|
//# sourceMappingURL=tools.js.map
|
package/dist/shared/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shared/tools.ts"],"
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/shared/tools.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAE,EAAE,CAC/E,GAAG,WAAW,SAAS,MAAM,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAAe,EAC4B,EAAE;IAC7C,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvD,IAAI,IAAI,KAAK,MAAM,IAAI,OAAO,IAAI,EAAE,EAAE,CAAC;QACnC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,QAAgB,EAAE,QAAiB,EAAE,EAAE,CAC/E,SAAS,QAAQ,IAAI,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AAE5F,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAAe,EAC4B,EAAE;IAC7C,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAExD,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC;QAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,SAAS,EAAE,CAAC;IAC7C,CAAC;AACL,CAAC,CAAC"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type UnlayerEditorTwin, type UnlayerEventBusinessCalendarResult, type UnlayerEventBusinessCalendarState } from './shared/const';
|
|
2
2
|
import { FormFieldInfo, FormInfo } from './shared/forms';
|
|
3
3
|
import { CreateUnlayerEditorProps, UnlayerDesignFormat, UnlayerEditorMergeTagInfo, UnlayerRef } from './unlayer-interface';
|
|
4
4
|
export interface UnlayerDesignChangeInfo {
|
|
@@ -21,6 +21,9 @@ export declare class UnlayerStore {
|
|
|
21
21
|
private isEditorReady;
|
|
22
22
|
private isMergeTagsApplied;
|
|
23
23
|
private mergeTagsConfig?;
|
|
24
|
+
/** Latest `--business-calendar-state` payload, and the last one sent to the iframe. */
|
|
25
|
+
private businessCalendarStateJson?;
|
|
26
|
+
private sentBusinessCalendarStateJson?;
|
|
24
27
|
private onMessageCB?;
|
|
25
28
|
private onChangeCB?;
|
|
26
29
|
private onSnapshotSaveCB?;
|
|
@@ -30,6 +33,7 @@ export declare class UnlayerStore {
|
|
|
30
33
|
private onFormSelectCB?;
|
|
31
34
|
private onCalcFieldOpenCB?;
|
|
32
35
|
private onCalcFieldSelectCB?;
|
|
36
|
+
private onBusinessCalendarRequestCB?;
|
|
33
37
|
constructor(props: CreateUnlayerEditorProps);
|
|
34
38
|
init: (container: HTMLDivElement) => Promise<void>;
|
|
35
39
|
destroy: () => void;
|
|
@@ -44,6 +48,14 @@ export declare class UnlayerStore {
|
|
|
44
48
|
setOnFormSelect: (onFormSelect?: UnlayerStore["onFormSelectCB"]) => void;
|
|
45
49
|
setOnCalcFieldOpen: (onCalcFieldOpen?: UnlayerStore["onCalcFieldOpenCB"]) => void;
|
|
46
50
|
setOnCalcFieldSelect: (onCalcFieldSelect?: UnlayerStore["onCalcFieldSelectCB"]) => void;
|
|
51
|
+
setOnBusinessCalendarRequest: (onBusinessCalendarRequest?: UnlayerStore["onBusinessCalendarRequestCB"]) => void;
|
|
52
|
+
/** Tells the iframe how a schedule `delete` request ended. */
|
|
53
|
+
sendBusinessCalendarResult: (result: UnlayerEventBusinessCalendarResult) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Keeps the schedule state for the iframe and sends it once the tools core has loaded (it
|
|
56
|
+
* goes out again right after `--config`). An unchanged state isn't sent again.
|
|
57
|
+
*/
|
|
58
|
+
setBusinessCalendarState: (state: UnlayerEventBusinessCalendarState) => void;
|
|
47
59
|
sendFormList: (forms: FormInfo[]) => void;
|
|
48
60
|
sendFormFields: (formId: number, fields: FormFieldInfo[]) => void;
|
|
49
61
|
sendCalcFieldLabels: (labels: Record<string, string>) => void;
|
|
@@ -61,6 +73,8 @@ export declare class UnlayerStore {
|
|
|
61
73
|
private onDesignUpdated;
|
|
62
74
|
private onPostMessage;
|
|
63
75
|
private openESignOffsetRules;
|
|
76
|
+
private routeBusinessCalendarRequest;
|
|
77
|
+
private sendBusinessCalendarState;
|
|
64
78
|
private updateFormFieldSamples;
|
|
65
79
|
private collectCalculatedFieldKeys;
|
|
66
80
|
private resolveDemoValue;
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,KAAK,iBAAiB,EAEtB,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EAIzC,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACH,aAAa,EACb,QAAQ,EAGX,MAAM,gBAAgB,CAAC;AAcxB,OAAO,EACH,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,UAAU,EACb,MAAM,qBAAqB,CAAC;AA0I7B,MAAM,WAAW,uBAAuB;IACpC,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAmBD,qBAAa,YAAY;IAgCT,QAAQ,CAAC,KAAK,EAAE,wBAAwB;IA/BpD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0B;IAC1D,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAc;IAElD,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAC,CAAoB;IACnC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,eAAe,CAAC,CAAyB;IACjD,uFAAuF;IACvF,OAAO,CAAC,yBAAyB,CAAC,CAAS;IAC3C,OAAO,CAAC,6BAA6B,CAAC,CAAS;IAE/C,OAAO,CAAC,WAAW,CAAC,CAAoC;IACxD,OAAO,CAAC,UA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