@limetech/lime-web-components 4.48.2 → 4.49.1-alpha.4
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/CHANGELOG.md +145 -1
- package/README.md +1 -1
- package/dist/application/decorators/application.d.ts +8 -0
- package/dist/application/decorators/application.js +18 -0
- package/dist/application/decorators/index.d.ts +3 -0
- package/dist/application/decorators/index.js +3 -0
- package/dist/application/decorators/session.d.ts +8 -0
- package/dist/application/decorators/session.js +18 -0
- package/dist/application/decorators/user.d.ts +8 -0
- package/dist/application/decorators/user.js +18 -0
- package/dist/application/index.d.ts +4 -0
- package/dist/application/index.js +4 -0
- package/dist/application/session.d.ts +67 -0
- package/dist/application/session.js +1 -0
- package/dist/application/types.d.ts +14 -0
- package/dist/application/types.js +3 -0
- package/dist/application/user.d.ts +59 -0
- package/dist/application/user.js +1 -0
- package/dist/commandbus/commandbus.d.ts +112 -0
- package/dist/commandbus/commandbus.js +63 -0
- package/dist/commandbus/index.d.ts +2 -0
- package/dist/commandbus/index.js +2 -0
- package/dist/commandbus/types.d.ts +14 -0
- package/dist/commandbus/types.js +3 -0
- package/dist/config/decorator.d.ts +14 -0
- package/dist/config/decorator.js +14 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +3 -0
- package/dist/config/repository.d.ts +17 -0
- package/dist/config/repository.js +1 -0
- package/dist/config/types.d.ts +14 -0
- package/dist/config/types.js +3 -0
- package/dist/core/context.d.ts +17 -0
- package/dist/core/context.js +1 -0
- package/dist/core/decorators/factory.d.ts +29 -0
- package/dist/core/decorators/factory.js +243 -0
- package/dist/core/decorators/factory.spec.d.ts +1 -0
- package/dist/core/decorators/factory.spec.js +337 -0
- package/dist/core/decorators/index.d.ts +1 -0
- package/dist/core/decorators/index.js +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +6 -0
- package/dist/core/lime-web-component.d.ts +15 -0
- package/dist/core/lime-web-component.js +1 -0
- package/dist/core/platform.d.ts +38 -0
- package/dist/core/platform.js +6 -0
- package/dist/core/plugin-loader.d.ts +28 -0
- package/dist/core/plugin-loader.js +1 -0
- package/dist/core/state.d.ts +39 -0
- package/dist/core/state.js +1 -0
- package/dist/device/decorator.d.ts +16 -0
- package/dist/device/decorator.js +16 -0
- package/dist/device/device.d.ts +21 -0
- package/dist/device/device.js +1 -0
- package/dist/device/index.d.ts +3 -0
- package/dist/device/index.js +3 -0
- package/dist/device/types.d.ts +14 -0
- package/dist/device/types.js +3 -0
- package/dist/dialog/dialog.d.ts +41 -0
- package/dist/dialog/dialog.js +1 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/types.d.ts +14 -0
- package/dist/dialog/types.js +3 -0
- package/dist/es5/application/decorators/application.js +18 -0
- package/dist/es5/application/decorators/index.js +6 -0
- package/dist/es5/application/decorators/session.js +18 -0
- package/dist/es5/application/decorators/user.js +18 -0
- package/dist/es5/application/index.js +7 -0
- package/dist/es5/application/session.js +2 -0
- package/dist/es5/application/types.js +5 -0
- package/dist/es5/application/user.js +2 -0
- package/dist/es5/commandbus/commandbus.js +31 -0
- package/dist/es5/commandbus/index.js +5 -0
- package/dist/es5/commandbus/types.js +5 -0
- package/dist/es5/config/decorator.js +12 -0
- package/dist/es5/config/index.js +6 -0
- package/dist/es5/config/repository.js +2 -0
- package/dist/es5/config/types.js +5 -0
- package/dist/es5/core/context.js +2 -0
- package/dist/es5/core/decorators/factory.js +213 -0
- package/dist/es5/core/decorators/factory.spec.js +495 -0
- package/dist/es5/core/decorators/index.js +2 -0
- package/dist/es5/core/index.js +9 -0
- package/dist/es5/core/lime-web-component.js +2 -0
- package/dist/es5/core/platform.js +6 -0
- package/dist/es5/core/plugin-loader.js +2 -0
- package/dist/es5/core/state.js +2 -0
- package/dist/es5/device/decorator.js +13 -0
- package/dist/es5/device/device.js +2 -0
- package/dist/es5/device/index.js +6 -0
- package/dist/es5/device/types.js +5 -0
- package/dist/es5/dialog/dialog.js +2 -0
- package/dist/es5/dialog/index.js +5 -0
- package/dist/es5/dialog/types.js +5 -0
- package/dist/es5/eventdispatcher/eventdispatcher.js +2 -0
- package/dist/es5/eventdispatcher/index.js +5 -0
- package/dist/es5/eventdispatcher/types.js +5 -0
- package/dist/es5/filter/decorator.js +13 -0
- package/dist/es5/filter/index.js +6 -0
- package/dist/es5/filter/repository.js +2 -0
- package/dist/es5/filter/types.js +5 -0
- package/dist/es5/http/http.js +2 -0
- package/dist/es5/http/index.js +5 -0
- package/dist/es5/http/types.js +5 -0
- package/dist/es5/index.js +22 -0
- package/dist/es5/keybindings/index.js +5 -0
- package/dist/es5/keybindings/registry.js +2 -0
- package/dist/es5/keybindings/types.js +5 -0
- package/dist/es5/limeobject/commands/bulk-create-dialog.js +17 -0
- package/dist/es5/limeobject/commands/create-dialog.js +17 -0
- package/dist/es5/limeobject/commands/delete-object.js +16 -0
- package/dist/es5/limeobject/commands/index.js +8 -0
- package/dist/es5/limeobject/commands/object-access.js +16 -0
- package/dist/es5/limeobject/commands/save-object.js +17 -0
- package/dist/es5/limeobject/decorator.js +38 -0
- package/dist/es5/limeobject/error.js +2 -0
- package/dist/es5/limeobject/index.js +9 -0
- package/dist/es5/limeobject/limeobject.js +2 -0
- package/dist/es5/limeobject/repository.js +2 -0
- package/dist/es5/limeobject/types.js +5 -0
- package/dist/es5/limetype/acl.js +2 -0
- package/dist/es5/limetype/decorator.js +28 -0
- package/dist/es5/limetype/index.js +8 -0
- package/dist/es5/limetype/limetype.js +2 -0
- package/dist/es5/limetype/property.js +40 -0
- package/dist/es5/limetype/types.js +5 -0
- package/dist/es5/navigator/decorator.js +13 -0
- package/dist/es5/navigator/index.js +6 -0
- package/dist/es5/navigator/navigator.js +2 -0
- package/dist/es5/navigator/types.js +5 -0
- package/dist/es5/notifications/index.js +5 -0
- package/dist/es5/notifications/notifications.js +2 -0
- package/dist/es5/notifications/types.js +5 -0
- package/dist/es5/query/index.js +6 -0
- package/dist/es5/query/query.js +17 -0
- package/dist/es5/query/service.js +2 -0
- package/dist/es5/query/types.js +5 -0
- package/dist/es5/routeregistry/index.js +5 -0
- package/dist/es5/routeregistry/registry.js +2 -0
- package/dist/es5/routeregistry/types.js +5 -0
- package/dist/es5/task/index.js +5 -0
- package/dist/es5/task/repository.js +17 -0
- package/dist/es5/task/types.js +5 -0
- package/dist/es5/testing/component-testing.js +102 -0
- package/dist/es5/testing/index.js +10 -0
- package/dist/es5/testing/limeobjects/company.js +660 -0
- package/dist/es5/testing/limeobjects/coworker.js +110 -0
- package/dist/es5/testing/limeobjects/deal.js +447 -0
- package/dist/es5/testing/limeobjects/document.js +82 -0
- package/dist/es5/testing/limeobjects/index.js +55 -0
- package/dist/es5/testing/limeobjects/person.js +1162 -0
- package/dist/es5/testing/limetypes/campaign.js +486 -0
- package/dist/es5/testing/limetypes/company.js +621 -0
- package/dist/es5/testing/limetypes/consent.js +237 -0
- package/dist/es5/testing/limetypes/consenttype.js +194 -0
- package/dist/es5/testing/limetypes/coworker.js +579 -0
- package/dist/es5/testing/limetypes/deal.js +422 -0
- package/dist/es5/testing/limetypes/document.js +343 -0
- package/dist/es5/testing/limetypes/helpdesk.js +426 -0
- package/dist/es5/testing/limetypes/helpdesktype.js +142 -0
- package/dist/es5/testing/limetypes/history.js +349 -0
- package/dist/es5/testing/limetypes/index.js +69 -0
- package/dist/es5/testing/limetypes/infotiles.js +514 -0
- package/dist/es5/testing/limetypes/localize.js +287 -0
- package/dist/es5/testing/limetypes/mailing.js +218 -0
- package/dist/es5/testing/limetypes/office.js +388 -0
- package/dist/es5/testing/limetypes/participant.js +195 -0
- package/dist/es5/testing/limetypes/person.js +535 -0
- package/dist/es5/testing/limetypes/recipient.js +175 -0
- package/dist/es5/testing/limetypes/solutionimprovement.js +353 -0
- package/dist/es5/testing/limetypes/successplan.js +215 -0
- package/dist/es5/testing/limetypes/target.js +181 -0
- package/dist/es5/testing/limetypes/todo.js +429 -0
- package/dist/es5/testing/platform/index.js +53 -0
- package/dist/es5/testing/platform/platform.spec.js +44 -0
- package/dist/es5/translator/index.js +5 -0
- package/dist/es5/translator/translator.js +2 -0
- package/dist/es5/translator/types.js +5 -0
- package/dist/es5/userdata/decorator.js +13 -0
- package/dist/es5/userdata/index.js +6 -0
- package/dist/es5/userdata/repository.js +2 -0
- package/dist/es5/userdata/types.js +5 -0
- package/dist/eventdispatcher/eventdispatcher.d.ts +26 -0
- package/dist/eventdispatcher/eventdispatcher.js +1 -0
- package/dist/eventdispatcher/index.d.ts +2 -0
- package/dist/eventdispatcher/index.js +2 -0
- package/dist/eventdispatcher/types.d.ts +14 -0
- package/dist/eventdispatcher/types.js +3 -0
- package/dist/filter/decorator.d.ts +15 -0
- package/dist/filter/decorator.js +14 -0
- package/dist/filter/index.d.ts +3 -0
- package/dist/filter/index.js +3 -0
- package/dist/filter/repository.d.ts +18 -0
- package/dist/filter/repository.js +1 -0
- package/dist/filter/types.d.ts +14 -0
- package/dist/filter/types.js +3 -0
- package/dist/http/http.d.ts +72 -0
- package/dist/http/http.js +1 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +2 -0
- package/dist/http/types.d.ts +14 -0
- package/dist/http/types.js +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/keybindings/index.d.ts +2 -0
- package/dist/keybindings/index.js +2 -0
- package/dist/keybindings/registry.d.ts +79 -0
- package/dist/keybindings/registry.js +1 -0
- package/dist/keybindings/types.d.ts +17 -0
- package/dist/keybindings/types.js +3 -0
- package/dist/limeobject/commands/bulk-create-dialog.d.ts +49 -0
- package/dist/limeobject/commands/bulk-create-dialog.js +48 -0
- package/dist/limeobject/commands/create-dialog.d.ts +28 -0
- package/dist/limeobject/commands/create-dialog.js +26 -0
- package/dist/limeobject/commands/delete-object.d.ts +10 -0
- package/dist/limeobject/commands/delete-object.js +15 -0
- package/dist/limeobject/commands/index.d.ts +5 -0
- package/dist/limeobject/commands/index.js +5 -0
- package/dist/limeobject/commands/object-access.d.ts +10 -0
- package/dist/limeobject/commands/object-access.js +15 -0
- package/dist/limeobject/commands/save-object.d.ts +16 -0
- package/dist/limeobject/commands/save-object.js +21 -0
- package/dist/limeobject/decorator.d.ts +32 -0
- package/dist/limeobject/decorator.js +42 -0
- package/dist/limeobject/error.d.ts +4 -0
- package/dist/limeobject/error.js +1 -0
- package/dist/limeobject/index.d.ts +6 -0
- package/dist/limeobject/index.js +6 -0
- package/dist/limeobject/limeobject.d.ts +43 -0
- package/dist/limeobject/limeobject.js +1 -0
- package/dist/limeobject/repository.d.ts +113 -0
- package/dist/limeobject/repository.js +1 -0
- package/dist/limeobject/types.d.ts +14 -0
- package/dist/limeobject/types.js +3 -0
- package/dist/limetype/acl.d.ts +6 -0
- package/dist/limetype/acl.js +1 -0
- package/dist/limetype/decorator.d.ts +21 -0
- package/dist/limetype/decorator.js +32 -0
- package/dist/limetype/index.d.ts +5 -0
- package/dist/limetype/index.js +5 -0
- package/dist/limetype/limetype.d.ts +25 -0
- package/dist/limetype/limetype.js +1 -0
- package/dist/limetype/property.d.ts +32 -0
- package/dist/limetype/property.js +32 -0
- package/dist/limetype/types.d.ts +14 -0
- package/dist/limetype/types.js +3 -0
- package/dist/navigator/decorator.d.ts +18 -0
- package/dist/navigator/decorator.js +15 -0
- package/dist/navigator/index.d.ts +3 -0
- package/dist/navigator/index.js +3 -0
- package/dist/navigator/navigator.d.ts +158 -0
- package/dist/navigator/navigator.js +1 -0
- package/dist/navigator/types.d.ts +17 -0
- package/dist/navigator/types.js +3 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/notifications.d.ts +101 -0
- package/dist/notifications/notifications.js +1 -0
- package/dist/notifications/types.d.ts +14 -0
- package/dist/notifications/types.js +3 -0
- package/dist/query/index.d.ts +3 -0
- package/dist/query/index.js +3 -0
- package/dist/query/query.d.ts +46 -0
- package/dist/query/query.js +14 -0
- package/dist/query/service.d.ts +12 -0
- package/dist/query/service.js +1 -0
- package/dist/query/types.d.ts +14 -0
- package/dist/query/types.js +3 -0
- package/dist/routeregistry/index.d.ts +2 -0
- package/dist/routeregistry/index.js +2 -0
- package/dist/routeregistry/registry.d.ts +92 -0
- package/dist/routeregistry/registry.js +1 -0
- package/dist/routeregistry/types.d.ts +17 -0
- package/dist/routeregistry/types.js +3 -0
- package/dist/task/index.d.ts +2 -0
- package/dist/task/index.js +2 -0
- package/dist/task/repository.d.ts +82 -0
- package/dist/task/repository.js +49 -0
- package/dist/task/types.d.ts +14 -0
- package/dist/task/types.js +3 -0
- package/dist/testing/component-testing.d.ts +53 -0
- package/dist/testing/component-testing.js +162 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/limeobjects/company.d.ts +55 -0
- package/dist/testing/limeobjects/company.js +656 -0
- package/dist/testing/limeobjects/coworker.d.ts +22 -0
- package/dist/testing/limeobjects/coworker.js +106 -0
- package/dist/testing/limeobjects/deal.d.ts +41 -0
- package/dist/testing/limeobjects/deal.js +443 -0
- package/dist/testing/limeobjects/document.d.ts +20 -0
- package/dist/testing/limeobjects/document.js +78 -0
- package/dist/testing/limeobjects/index.d.ts +177 -0
- package/dist/testing/limeobjects/index.js +50 -0
- package/dist/testing/limeobjects/person.d.ts +20 -0
- package/dist/testing/limeobjects/person.js +1158 -0
- package/dist/testing/limetypes/campaign.d.ts +417 -0
- package/dist/testing/limetypes/campaign.js +477 -0
- package/dist/testing/limetypes/company.d.ts +591 -0
- package/dist/testing/limetypes/company.js +614 -0
- package/dist/testing/limetypes/consent.d.ts +199 -0
- package/dist/testing/limetypes/consent.js +232 -0
- package/dist/testing/limetypes/consenttype.d.ts +188 -0
- package/dist/testing/limetypes/consenttype.js +189 -0
- package/dist/testing/limetypes/coworker.d.ts +563 -0
- package/dist/testing/limetypes/coworker.js +564 -0
- package/dist/testing/limetypes/deal.d.ts +391 -0
- package/dist/testing/limetypes/deal.js +419 -0
- package/dist/testing/limetypes/document.d.ts +309 -0
- package/dist/testing/limetypes/document.js +332 -0
- package/dist/testing/limetypes/helpdesk.d.ts +394 -0
- package/dist/testing/limetypes/helpdesk.js +417 -0
- package/dist/testing/limetypes/helpdesktype.d.ts +136 -0
- package/dist/testing/limetypes/helpdesktype.js +137 -0
- package/dist/testing/limetypes/history.d.ts +308 -0
- package/dist/testing/limetypes/history.js +346 -0
- package/dist/testing/limetypes/index.d.ts +5 -0
- package/dist/testing/limetypes/index.js +63 -0
- package/dist/testing/limetypes/infotiles.d.ts +387 -0
- package/dist/testing/limetypes/infotiles.js +509 -0
- package/dist/testing/limetypes/localize.d.ts +283 -0
- package/dist/testing/limetypes/localize.js +284 -0
- package/dist/testing/limetypes/mailing.d.ts +212 -0
- package/dist/testing/limetypes/mailing.js +213 -0
- package/dist/testing/limetypes/office.d.ts +384 -0
- package/dist/testing/limetypes/office.js +385 -0
- package/dist/testing/limetypes/participant.d.ts +165 -0
- package/dist/testing/limetypes/participant.js +188 -0
- package/dist/testing/limetypes/person.d.ts +472 -0
- package/dist/testing/limetypes/person.js +530 -0
- package/dist/testing/limetypes/recipient.d.ts +147 -0
- package/dist/testing/limetypes/recipient.js +170 -0
- package/dist/testing/limetypes/solutionimprovement.d.ts +302 -0
- package/dist/testing/limetypes/solutionimprovement.js +344 -0
- package/dist/testing/limetypes/successplan.d.ts +209 -0
- package/dist/testing/limetypes/successplan.js +210 -0
- package/dist/testing/limetypes/target.d.ts +160 -0
- package/dist/testing/limetypes/target.js +178 -0
- package/dist/testing/limetypes/todo.d.ts +386 -0
- package/dist/testing/limetypes/todo.js +426 -0
- package/dist/testing/platform/index.d.ts +8 -0
- package/dist/testing/platform/index.js +61 -0
- package/dist/testing/platform/platform.spec.d.ts +1 -0
- package/dist/testing/platform/platform.spec.js +41 -0
- package/dist/translator/index.d.ts +2 -0
- package/dist/translator/index.js +2 -0
- package/dist/translator/translator.d.ts +13 -0
- package/dist/translator/translator.js +1 -0
- package/dist/translator/types.d.ts +14 -0
- package/dist/translator/types.js +3 -0
- package/dist/userdata/decorator.d.ts +17 -0
- package/dist/userdata/decorator.js +14 -0
- package/dist/userdata/index.d.ts +3 -0
- package/dist/userdata/index.js +3 -0
- package/dist/userdata/repository.d.ts +29 -0
- package/dist/userdata/repository.js +1 -0
- package/dist/userdata/types.d.ts +14 -0
- package/dist/userdata/types.js +3 -0
- package/package.json +11 -6
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// eslint-disable-next-line no-shadow
|
|
2
|
+
export var TaskState;
|
|
3
|
+
(function (TaskState) {
|
|
4
|
+
/**
|
|
5
|
+
* Task state is unknown
|
|
6
|
+
*/
|
|
7
|
+
TaskState["Pending"] = "PENDING";
|
|
8
|
+
/**
|
|
9
|
+
* Task was started by a worker
|
|
10
|
+
*/
|
|
11
|
+
TaskState["Started"] = "STARTED";
|
|
12
|
+
/**
|
|
13
|
+
* Task is waiting for retry
|
|
14
|
+
*/
|
|
15
|
+
TaskState["Retry"] = "RETRY";
|
|
16
|
+
/**
|
|
17
|
+
* Task succeeded
|
|
18
|
+
*/
|
|
19
|
+
TaskState["Success"] = "SUCCESS";
|
|
20
|
+
/**
|
|
21
|
+
* Task failed
|
|
22
|
+
*/
|
|
23
|
+
TaskState["Failure"] = "FAILURE";
|
|
24
|
+
})(TaskState || (TaskState = {}));
|
|
25
|
+
/**
|
|
26
|
+
* Events dispatched by the task service
|
|
27
|
+
*/
|
|
28
|
+
// eslint-disable-next-line no-shadow
|
|
29
|
+
export var TaskEventType;
|
|
30
|
+
(function (TaskEventType) {
|
|
31
|
+
/**
|
|
32
|
+
* Dispatched when a task has been created.
|
|
33
|
+
*
|
|
34
|
+
* @detail { task }
|
|
35
|
+
*/
|
|
36
|
+
TaskEventType["Created"] = "task.created";
|
|
37
|
+
/**
|
|
38
|
+
* Dispatched when the task has successfully been completed
|
|
39
|
+
*
|
|
40
|
+
* @detail { task }
|
|
41
|
+
*/
|
|
42
|
+
TaskEventType["Success"] = "task.success";
|
|
43
|
+
/**
|
|
44
|
+
* Dispatched if an error occured while running the task
|
|
45
|
+
*
|
|
46
|
+
* @detail { task | error? }
|
|
47
|
+
*/
|
|
48
|
+
TaskEventType["Failed"] = "task.failed";
|
|
49
|
+
})(TaskEventType || (TaskEventType = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TaskRepository as Service } from './repository';
|
|
2
|
+
declare const SERVICE_NAME = "state.tasks";
|
|
3
|
+
declare module '../core/platform' {
|
|
4
|
+
interface PlatformServiceName {
|
|
5
|
+
/**
|
|
6
|
+
* @see {@link Service TaskRepository}
|
|
7
|
+
*/
|
|
8
|
+
TaskRepository: typeof SERVICE_NAME;
|
|
9
|
+
}
|
|
10
|
+
interface LimeWebComponentPlatform {
|
|
11
|
+
get(name: PlatformServiceName['TaskRepository']): Service;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SpecPage } from '@stencil/core/testing';
|
|
2
|
+
export interface ComponentProps {
|
|
3
|
+
[name: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface ComponentListeners {
|
|
6
|
+
[name: string]: (event: CustomEvent<any>) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface ComponentConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Tag name of the component
|
|
11
|
+
*/
|
|
12
|
+
tag: string;
|
|
13
|
+
/**
|
|
14
|
+
* The props to give the component when it is created
|
|
15
|
+
*/
|
|
16
|
+
props?: ComponentProps;
|
|
17
|
+
/**
|
|
18
|
+
* The initial state to give the component when it is created
|
|
19
|
+
*/
|
|
20
|
+
state?: object;
|
|
21
|
+
/**
|
|
22
|
+
* Any listeners to attach to the component
|
|
23
|
+
*/
|
|
24
|
+
listeners?: ComponentListeners;
|
|
25
|
+
/**
|
|
26
|
+
* A list of elements to append to the created component before it's inserted into the DOM
|
|
27
|
+
*/
|
|
28
|
+
children?: HTMLElement[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a new component
|
|
32
|
+
*
|
|
33
|
+
* @param {*} component the component class
|
|
34
|
+
* @param {SpecPage} page the page to create the component on
|
|
35
|
+
* @param {ComponentConfig} config component configuration
|
|
36
|
+
* @returns {HTMLElement} the component
|
|
37
|
+
*/
|
|
38
|
+
export declare function createComponent(component: any, page: SpecPage, config: ComponentConfig): HTMLElement;
|
|
39
|
+
/**
|
|
40
|
+
* Destroy a component that was created by the `createComponent` function
|
|
41
|
+
*
|
|
42
|
+
* @param {HTMLElement} component the component to destroy
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
export declare function destroyComponent(component: HTMLElement): void;
|
|
46
|
+
/**
|
|
47
|
+
* Set a state variable on the component
|
|
48
|
+
*
|
|
49
|
+
* @param {HTMLElement} component the component
|
|
50
|
+
* @param {object} state the state variables to set along with their values
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
export declare function setState(component: HTMLElement, state: object): void;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { getElement } from '@stencil/core';
|
|
2
|
+
import { defaultContext, createPlatform } from './platform';
|
|
3
|
+
const componentConfigs = new WeakMap();
|
|
4
|
+
const componentInstances = new WeakMap();
|
|
5
|
+
const originalHooks = new WeakMap();
|
|
6
|
+
const destroyFunctions = new WeakMap();
|
|
7
|
+
/**
|
|
8
|
+
* Create a new component
|
|
9
|
+
*
|
|
10
|
+
* @param {*} component the component class
|
|
11
|
+
* @param {SpecPage} page the page to create the component on
|
|
12
|
+
* @param {ComponentConfig} config component configuration
|
|
13
|
+
* @returns {HTMLElement} the component
|
|
14
|
+
*/
|
|
15
|
+
export function createComponent(component, page, config) {
|
|
16
|
+
componentConfigs.set(component.prototype, config);
|
|
17
|
+
extendLifecycleHook(component.prototype, 'componentWillLoad', initComponent);
|
|
18
|
+
const element = page.doc.createElement(config.tag);
|
|
19
|
+
const props = config.props || {};
|
|
20
|
+
const listeners = config.listeners || {};
|
|
21
|
+
const children = config.children || [];
|
|
22
|
+
setDefault(props);
|
|
23
|
+
addProps(props, element);
|
|
24
|
+
addListeners(listeners, element);
|
|
25
|
+
addChildren(element, children);
|
|
26
|
+
destroyFunctions.set(element, () => {
|
|
27
|
+
removeListeners(listeners, element);
|
|
28
|
+
});
|
|
29
|
+
page.body.appendChild(element);
|
|
30
|
+
return element;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Destroy a component that was created by the `createComponent` function
|
|
34
|
+
*
|
|
35
|
+
* @param {HTMLElement} component the component to destroy
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
export function destroyComponent(component) {
|
|
39
|
+
if (!component) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const destroyFunction = destroyFunctions.get(component);
|
|
43
|
+
if (!destroyFunction) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
destroyFunction();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Set a state variable on the component
|
|
50
|
+
*
|
|
51
|
+
* @param {HTMLElement} component the component
|
|
52
|
+
* @param {object} state the state variables to set along with their values
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
export function setState(component, state) {
|
|
56
|
+
const instance = componentInstances.get(component);
|
|
57
|
+
Object.assign(instance, state);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Init a component that is under test
|
|
61
|
+
*
|
|
62
|
+
* This is called just before the `componentWillLoad` lifecycle hook
|
|
63
|
+
* of the component and is a good place to save the component instance
|
|
64
|
+
* and set the initial state
|
|
65
|
+
*
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
68
|
+
function initComponent() {
|
|
69
|
+
const element = getElement(this);
|
|
70
|
+
componentInstances.set(element, this);
|
|
71
|
+
const config = componentConfigs.get(this.constructor.prototype);
|
|
72
|
+
if (config === null || config === void 0 ? void 0 : config.state) {
|
|
73
|
+
setState(element, config.state);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extend a lifecycle hook on a component
|
|
78
|
+
*
|
|
79
|
+
* @param {*} component the prototype of the component
|
|
80
|
+
* @param {string} name the name of the hook
|
|
81
|
+
* @param {Function} hook the function to run before the original hook
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
function extendLifecycleHook(component, name, hook) {
|
|
85
|
+
if (!originalHooks.has(component)) {
|
|
86
|
+
originalHooks.set(component, {});
|
|
87
|
+
}
|
|
88
|
+
const hooks = originalHooks.get(component);
|
|
89
|
+
if (!hooks[name]) {
|
|
90
|
+
hooks[name] = component[name];
|
|
91
|
+
}
|
|
92
|
+
component[name] = function (...args) {
|
|
93
|
+
hook.apply(this, args);
|
|
94
|
+
if (hooks[name]) {
|
|
95
|
+
return hooks[name].apply(this, args);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sets a default props on the component
|
|
101
|
+
*
|
|
102
|
+
* Will set a default platform and context if not already set
|
|
103
|
+
*
|
|
104
|
+
* @param {ComponentProps} props the component props
|
|
105
|
+
* @returns {void}
|
|
106
|
+
*/
|
|
107
|
+
function setDefault(props) {
|
|
108
|
+
if (!('platform' in props)) {
|
|
109
|
+
props.platform = createPlatform();
|
|
110
|
+
}
|
|
111
|
+
if (!('context' in props)) {
|
|
112
|
+
props.context = defaultContext;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Add properties to a web component
|
|
117
|
+
*
|
|
118
|
+
* @param {ComponentProps} props the properties to set
|
|
119
|
+
* @param {HTMLElement} component the web component
|
|
120
|
+
* @returns {void}
|
|
121
|
+
*/
|
|
122
|
+
function addProps(props, component) {
|
|
123
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
124
|
+
component[key] = value;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Add event listeners to a web component
|
|
129
|
+
*
|
|
130
|
+
* @param {ComponentListeners} listeners the events to listen to
|
|
131
|
+
* @param {HTMLElement} component the web component
|
|
132
|
+
* @returns {void}
|
|
133
|
+
*/
|
|
134
|
+
function addListeners(listeners, component) {
|
|
135
|
+
Object.entries(listeners).forEach(([key, value]) => {
|
|
136
|
+
component.addEventListener(key, value);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Remove event listeners from a web component
|
|
141
|
+
*
|
|
142
|
+
* @param {ComponentListeners} listeners the events to listen to
|
|
143
|
+
* @param {HTMLElement} component the web component
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
function removeListeners(listeners, component) {
|
|
147
|
+
Object.entries(listeners).forEach(([key, value]) => {
|
|
148
|
+
component.removeEventListener(key, value);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Appends children to an html element
|
|
153
|
+
*
|
|
154
|
+
* @param {HTMLElement} parent the parent element
|
|
155
|
+
* @param {HTMLElement[]} children the child elements to add
|
|
156
|
+
* @returns {void}
|
|
157
|
+
*/
|
|
158
|
+
function addChildren(parent, children = []) {
|
|
159
|
+
[].slice.call(children).forEach((child) => {
|
|
160
|
+
parent.appendChild(child);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const company: ({
|
|
2
|
+
getLimetype: () => import("../..").LimeType;
|
|
3
|
+
getValue: (property: string) => any;
|
|
4
|
+
name: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
www: string;
|
|
7
|
+
postaladdress1: string;
|
|
8
|
+
visitingaddress1: string;
|
|
9
|
+
registrationno: string;
|
|
10
|
+
postalzipcode: string;
|
|
11
|
+
postalcity: string;
|
|
12
|
+
visitingzipcode: string;
|
|
13
|
+
visitingcity: string;
|
|
14
|
+
postaladdress2: string;
|
|
15
|
+
visitingaddress2: string;
|
|
16
|
+
country: string;
|
|
17
|
+
inactive: boolean;
|
|
18
|
+
buyingstatus: string;
|
|
19
|
+
fullpostaladdress: string;
|
|
20
|
+
fullvisitingaddress: string;
|
|
21
|
+
id: number;
|
|
22
|
+
createdtime: string;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
descriptive: string;
|
|
25
|
+
coworker: number;
|
|
26
|
+
createduser?: undefined;
|
|
27
|
+
updateduser?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
getLimetype: () => import("../..").LimeType;
|
|
30
|
+
getValue: (property: string) => any;
|
|
31
|
+
name: string;
|
|
32
|
+
phone: string;
|
|
33
|
+
www: string;
|
|
34
|
+
postaladdress1: string;
|
|
35
|
+
visitingaddress1: string;
|
|
36
|
+
registrationno: string;
|
|
37
|
+
coworker: any;
|
|
38
|
+
postalzipcode: string;
|
|
39
|
+
postalcity: string;
|
|
40
|
+
visitingzipcode: string;
|
|
41
|
+
visitingcity: string;
|
|
42
|
+
postaladdress2: string;
|
|
43
|
+
visitingaddress2: string;
|
|
44
|
+
country: string;
|
|
45
|
+
inactive: boolean;
|
|
46
|
+
buyingstatus: string;
|
|
47
|
+
fullpostaladdress: string;
|
|
48
|
+
fullvisitingaddress: string;
|
|
49
|
+
id: number;
|
|
50
|
+
createduser: number;
|
|
51
|
+
createdtime: string;
|
|
52
|
+
updateduser: number;
|
|
53
|
+
timestamp: string;
|
|
54
|
+
descriptive: string;
|
|
55
|
+
})[];
|