@talxis/base-controls 1.2406.2 → 1.2406.3

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.
Files changed (178) hide show
  1. package/examples/Currency/package.json +1 -1
  2. package/examples/DateTime/package.json +1 -1
  3. package/examples/Decimal/package.json +1 -1
  4. package/examples/Duration/package.json +1 -1
  5. package/examples/Grid/package.json +1 -1
  6. package/examples/Lookup/package.json +1 -1
  7. package/examples/MultiSelectOptionSet/package.json +1 -1
  8. package/examples/OptionSet/package.json +1 -1
  9. package/examples/TwoOptions/package.json +1 -1
  10. package/package.json +1 -1
  11. package/.env +0 -1
  12. package/.eslintrc +0 -117
  13. package/.npmgitignore +0 -9
  14. package/.vscode/settings.json +0 -3
  15. package/.yalcignore +0 -2
  16. package/azure-pipelines.yml +0 -44
  17. package/examples/Currency/package-lock.json +0 -15900
  18. package/examples/Currency/tsconfig.json +0 -7
  19. package/examples/DateTime/package-lock.json +0 -15900
  20. package/examples/DateTime/tsconfig.json +0 -7
  21. package/examples/Decimal/package-lock.json +0 -15900
  22. package/examples/Decimal/tsconfig.json +0 -7
  23. package/examples/Duration/package-lock.json +0 -15900
  24. package/examples/Duration/tsconfig.json +0 -7
  25. package/examples/Grid/package-lock.json +0 -15901
  26. package/examples/Grid/tsconfig.json +0 -7
  27. package/examples/Lookup/package-lock.json +0 -15900
  28. package/examples/Lookup/tsconfig.json +0 -8
  29. package/examples/MultiSelectOptionSet/package-lock.json +0 -15900
  30. package/examples/MultiSelectOptionSet/tsconfig.json +0 -7
  31. package/examples/OptionSet/package-lock.json +0 -15900
  32. package/examples/OptionSet/tsconfig.json +0 -7
  33. package/examples/TwoOptions/package-lock.json +0 -15900
  34. package/examples/TwoOptions/tsconfig.json +0 -7
  35. package/public/index.html +0 -43
  36. package/public/manifest.json +0 -25
  37. package/rollup.config.js +0 -44
  38. package/src/components/DateTime/DateTime.tsx +0 -97
  39. package/src/components/DateTime/components/Calendar.tsx +0 -80
  40. package/src/components/DateTime/hooks/useDateTime.ts +0 -144
  41. package/src/components/DateTime/index.ts +0 -2
  42. package/src/components/DateTime/interfaces.ts +0 -22
  43. package/src/components/DateTime/styles.ts +0 -37
  44. package/src/components/DateTime/translations.ts +0 -18
  45. package/src/components/Decimal/Decimal.tsx +0 -120
  46. package/src/components/Decimal/index.ts +0 -2
  47. package/src/components/Decimal/interfaces.ts +0 -20
  48. package/src/components/Duration/Duration.tsx +0 -143
  49. package/src/components/Duration/index.ts +0 -2
  50. package/src/components/Duration/interfaces.ts +0 -22
  51. package/src/components/Duration/translations.ts +0 -30
  52. package/src/components/Grid/Grid.tsx +0 -24
  53. package/src/components/Grid/core/components/AgGrid/AgGrid.tsx +0 -206
  54. package/src/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/EmptyRecords.tsx +0 -16
  55. package/src/components/Grid/core/components/AgGrid/components/EmptyRecordsOverlay/styles.ts +0 -20
  56. package/src/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.tsx +0 -7
  57. package/src/components/Grid/core/components/AgGrid/controllers/useAgGridController.ts +0 -68
  58. package/src/components/Grid/core/components/AgGrid/model/AgGrid.ts +0 -100
  59. package/src/components/Grid/core/components/AgGrid/styles.ts +0 -72
  60. package/src/components/Grid/core/components/Cell/Commands/Commands.tsx +0 -32
  61. package/src/components/Grid/core/components/Cell/Commands/Icon.tsx +0 -17
  62. package/src/components/Grid/core/components/Cell/Commands/styles.ts +0 -21
  63. package/src/components/Grid/core/components/Cell/Commands/useCommands.tsx +0 -53
  64. package/src/components/Grid/core/components/Cell/EditableCell/EditableCell.tsx +0 -140
  65. package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.tsx +0 -176
  66. package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/ReadOnlyOptionSet.tsx +0 -67
  67. package/src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyOptionSet/styles.ts +0 -24
  68. package/src/components/Grid/core/components/Cell/ReadOnlyCell/styles.ts +0 -56
  69. package/src/components/Grid/core/components/ColumnHeader/ColumnHeader.tsx +0 -71
  70. package/src/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/GlobalCheckbox.tsx +0 -31
  71. package/src/components/Grid/core/components/ColumnHeader/components/GlobalCheckbox/styles.ts +0 -16
  72. package/src/components/Grid/core/components/ColumnHeader/styles.ts +0 -40
  73. package/src/components/Grid/core/components/Component/Component.tsx +0 -59
  74. package/src/components/Grid/core/components/Component/controller/useComponentController.ts +0 -39
  75. package/src/components/Grid/core/components/Component/model/Component.ts +0 -251
  76. package/src/components/Grid/core/components/Dialog/Constants.tsx +0 -8
  77. package/src/components/Grid/core/components/Dialog/Styles.tsx +0 -61
  78. package/src/components/Grid/core/components/Dialog/index.tsx +0 -22
  79. package/src/components/Grid/core/components/Dialog/interfaces/index.d.ts +0 -7
  80. package/src/components/Grid/core/components/Save/Save.tsx +0 -74
  81. package/src/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.tsx +0 -63
  82. package/src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.tsx +0 -153
  83. package/src/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.ts +0 -52
  84. package/src/components/Grid/core/components/Save/components/ChangeEditor/styles.ts +0 -34
  85. package/src/components/Grid/core/components/Save/hooks/useSave.ts +0 -59
  86. package/src/components/Grid/core/components/Save/styles.ts +0 -41
  87. package/src/components/Grid/core/controllers/useGridController.ts +0 -46
  88. package/src/components/Grid/core/enums/ConditionOperator.ts +0 -46
  89. package/src/components/Grid/core/enums/DataType.ts +0 -25
  90. package/src/components/Grid/core/hooks/useGridInstance.ts +0 -7
  91. package/src/components/Grid/core/hooks/useRefreshCallback.ts +0 -20
  92. package/src/components/Grid/core/hooks/useRerender.ts +0 -15
  93. package/src/components/Grid/core/interfaces/IGridColumn.ts +0 -19
  94. package/src/components/Grid/core/interfaces/IGridContext.ts +0 -7
  95. package/src/components/Grid/core/model/Grid.ts +0 -250
  96. package/src/components/Grid/core/model/GridDependency.ts +0 -34
  97. package/src/components/Grid/core/model/Metadata.ts +0 -20
  98. package/src/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.ts +0 -36
  99. package/src/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.ts +0 -222
  100. package/src/components/Grid/filtering/components/FilterCallout/FilterCallout.tsx +0 -83
  101. package/src/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.tsx +0 -66
  102. package/src/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.tsx +0 -48
  103. package/src/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.ts +0 -120
  104. package/src/components/Grid/filtering/components/FilterCallout/styles.ts +0 -37
  105. package/src/components/Grid/filtering/constants.ts +0 -48
  106. package/src/components/Grid/filtering/controller/useColumnFilterConditionController.ts +0 -63
  107. package/src/components/Grid/filtering/model/Condition.ts +0 -309
  108. package/src/components/Grid/filtering/model/Filtering.ts +0 -78
  109. package/src/components/Grid/filtering/utils/FilteringUtilts.ts +0 -190
  110. package/src/components/Grid/interfaces.ts +0 -109
  111. package/src/components/Grid/paging/components/Paging/Paging.tsx +0 -76
  112. package/src/components/Grid/paging/components/Paging/styles.ts +0 -38
  113. package/src/components/Grid/paging/controllers/usePagingController.ts +0 -34
  114. package/src/components/Grid/paging/model/Paging.ts +0 -49
  115. package/src/components/Grid/selection/controllers/useSelectionController.ts +0 -25
  116. package/src/components/Grid/selection/model/Selection.ts +0 -60
  117. package/src/components/Grid/sorting/Sorting.ts +0 -30
  118. package/src/components/Grid/sorting/components/SortingContextualMenu/SortingContextualMenu.tsx +0 -126
  119. package/src/components/Grid/sorting/components/SortingContextualMenu/styles.ts +0 -12
  120. package/src/components/Grid/sorting/controllers/useColumnSortingController.ts +0 -26
  121. package/src/components/Grid/translations.ts +0 -80
  122. package/src/components/Grid/validation/controllers/useRecordValidationController.ts +0 -31
  123. package/src/components/Grid/validation/model/ColumnValidation.ts +0 -81
  124. package/src/components/Lookup/Lookup.tsx +0 -199
  125. package/src/components/Lookup/components/RecordCreator.tsx +0 -53
  126. package/src/components/Lookup/components/TargetSelector.tsx +0 -43
  127. package/src/components/Lookup/hooks/useFetchXml.ts +0 -31
  128. package/src/components/Lookup/hooks/useLoadedEntities.ts +0 -23
  129. package/src/components/Lookup/hooks/useLookup.ts +0 -126
  130. package/src/components/Lookup/index.ts +0 -2
  131. package/src/components/Lookup/interfaces.ts +0 -45
  132. package/src/components/Lookup/lib.ts +0 -3110
  133. package/src/components/Lookup/styles.ts +0 -106
  134. package/src/components/Lookup/translations.ts +0 -28
  135. package/src/components/MultiSelectOptionSet/MultiSelectOptionSet.tsx +0 -83
  136. package/src/components/MultiSelectOptionSet/index.ts +0 -2
  137. package/src/components/MultiSelectOptionSet/interfaces.ts +0 -14
  138. package/src/components/OptionSet/OptionSet.tsx +0 -67
  139. package/src/components/OptionSet/index.ts +0 -2
  140. package/src/components/OptionSet/interfaces.ts +0 -17
  141. package/src/components/TextField/TextField.tsx +0 -58
  142. package/src/components/TextField/hooks/useTextField.ts +0 -42
  143. package/src/components/TextField/index.ts +0 -2
  144. package/src/components/TextField/interfaces.ts +0 -20
  145. package/src/components/TwoOptions/TwoOptions.tsx +0 -43
  146. package/src/components/TwoOptions/index.ts +0 -2
  147. package/src/components/TwoOptions/interfaces.ts +0 -17
  148. package/src/hooks/index.ts +0 -1
  149. package/src/hooks/useComponent.ts +0 -83
  150. package/src/hooks/useFocusIn.ts +0 -23
  151. package/src/hooks/useInputBasedComponent.ts +0 -71
  152. package/src/hooks/useMouseOver.ts +0 -23
  153. package/src/index.tsx +0 -12
  154. package/src/interfaces/context.ts +0 -21
  155. package/src/interfaces/index.ts +0 -12
  156. package/src/interfaces/parameters.ts +0 -26
  157. package/src/interfaces/property.ts +0 -111
  158. package/src/sandbox/index.tsx +0 -137
  159. package/src/sandbox/mock/Context.ts +0 -18
  160. package/src/sandbox/mock/Formatting.ts +0 -186
  161. package/src/sandbox/mock/Mode.ts +0 -25
  162. package/src/sandbox/mock/UserSettings.ts +0 -31
  163. package/src/sandbox/mock/Utility.ts +0 -14
  164. package/src/sandbox/shared/durationList.tsx +0 -24
  165. package/src/sandbox/shared/multiSelectOptionList.tsx +0 -5
  166. package/src/sandbox/shared/optionList.tsx +0 -5
  167. package/src/stories/Introduction.stories.mdx +0 -122
  168. package/src/stories/assets/code-brackets.svg +0 -1
  169. package/src/stories/assets/colors.svg +0 -1
  170. package/src/stories/assets/comments.svg +0 -1
  171. package/src/stories/assets/direction.svg +0 -1
  172. package/src/stories/assets/flow.svg +0 -1
  173. package/src/stories/assets/plugin.svg +0 -1
  174. package/src/stories/assets/repo.svg +0 -1
  175. package/src/stories/assets/stackalt.svg +0 -1
  176. package/src/types/index.ts +0 -3
  177. package/src/utils/NumeralPCF.ts +0 -62
  178. package/tsconfig.json +0 -28
@@ -1,71 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { IComponent, IOutputs, ITranslations } from "../interfaces/context";
3
- import { useComponent } from "./useComponent";
4
- import React from 'react';
5
- import { IInputParameters } from "../interfaces/parameters";
6
- import { StringProps } from "../types";
7
-
8
- /**
9
- * Description
10
- * @param {any} value:any
11
- * @returns {any}
12
- */
13
- interface IComponentOptions<TTranslations> {
14
- defaultTranslations?: TTranslations,
15
- /**
16
- * Formatting function that will format the bound value every time a new one comes from the props.
17
- */
18
- formatter?: (value: any) => any,
19
- valueExtractor?: (value: any) => any
20
- }
21
-
22
- /**
23
- * Use when working with components that need to store value changes internally before triggering `notifyOutputChanged`.
24
- * An example of this is a standard Decimal component - we do not want to trigger `notifyOutputChanged` on every value change,
25
- * since this would trigger decimal validation on every keystroke which would result in a bad UX. In this case, the `notifyOutputChanged` should
26
- * be triggered when the user looses focus on the component (`onBlur` event).
27
- * @returns {[]} The hook returns an array with three props. First `value` prop is a value that will will always be in sync with the value that comes from the `value` parameter.
28
- * Use this for displaying the up-to-date value to the user.
29
- * Second prop contains the translations for this component.
30
- *
31
- * Third prop is a method that can be used to change the current value. The new value will get propagated to the `value` variable returned from this hook. This method wont propagate the value to the framework.
32
- *
33
- * The last prop is a method that will notify the framework that you wish to write changes.
34
- * The method will notify the framework only if the provided output differs from the current inputs.
35
- */
36
-
37
- export const useInputBasedComponent = <TValue, TParameters extends IInputParameters, TOutputs extends IOutputs, TTranslations extends ITranslations>(name: string, props: IComponent<TParameters, TOutputs, TTranslations>, options?: IComponentOptions<TTranslations>): [
38
- TValue,
39
- Required<StringProps<TTranslations>>,
40
- (value: TValue) => void,
41
- (outputs: TOutputs) => void,
42
- ] => {
43
- const {formatter, valueExtractor} = {...options};
44
- const rawValue = props.parameters.value.raw;
45
- const [value, setValue] = useState<TValue>(formatter?.(rawValue) ?? rawValue);
46
- const valueRef = useRef<TValue>(rawValue);
47
- const [labels, onNotifyOutputChanged] = useComponent(name, props, options?.defaultTranslations);
48
-
49
- useEffect(() => {
50
- const formattedValue = formatter?.(rawValue);
51
- setValue(formattedValue ?? rawValue);
52
- //console.log(`Updating component ${name} with new value: ${formattedValue ?? rawValue}`);
53
- }, [rawValue]);
54
-
55
- useEffect(() => {
56
- valueRef.current = value;
57
- }, [value]);
58
-
59
- useEffect(() => {
60
- return () => {
61
- if(props.parameters.NotifyOutputChangedOnUnmount?.raw === true) {
62
- onNotifyOutputChanged({
63
- value: valueExtractor?.(valueRef.current) ?? valueRef.current
64
- } as any);
65
- }
66
- };
67
- }, []);
68
-
69
- return [value, labels, setValue, onNotifyOutputChanged];
70
-
71
- };
@@ -1,23 +0,0 @@
1
- import { useEffect, useState } from "react";
2
-
3
- export const useMouseOver = (ref: React.RefObject<HTMLElement>): boolean => {
4
- const [isMouseOver, setIsMouseOver] = useState<boolean>(false);
5
-
6
- useEffect(() => {
7
- const onMouseEnter = () => {
8
- setIsMouseOver(true);
9
- }
10
- const onMouseLeave = () => {
11
- setIsMouseOver(false);
12
- }
13
- ref.current?.addEventListener('mouseenter', onMouseEnter);
14
- ref.current?.addEventListener('mouseleave', onMouseLeave);
15
-
16
- return () => {
17
- ref.current?.removeEventListener('mouseenter',onMouseEnter);
18
- ref.current?.removeEventListener('mouseleave', onMouseLeave);
19
- }
20
- }, []);
21
-
22
- return isMouseOver;
23
- };
package/src/index.tsx DELETED
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import { Sandbox } from './sandbox';
4
-
5
- ReactDOM.render(
6
- <React.StrictMode>
7
- <Sandbox />
8
- </React.StrictMode>,
9
- document.getElementById('root')
10
- );
11
-
12
- export * from './hooks';
@@ -1,21 +0,0 @@
1
- export interface IOutputs {
2
- [key: string]: any
3
- }
4
-
5
- export interface IComponent<TParameters, TOutputs, TTranslations> {
6
- context: ComponentFramework.Context<TParameters>;
7
- parameters: TParameters;
8
- translations?: TTranslations;
9
- state?: ComponentFramework.Dictionary;
10
- /**
11
- * Fires when the component changes the parameter value. It is usually fired directly after the change occurs in the value.
12
- * Exceptions are input based component where it fires on the blur event.
13
- */
14
- onNotifyOutputChanged?: (outputs: TOutputs) => void;
15
- }
16
-
17
- export interface ITranslations {
18
- [key: string]: {
19
- [LCID: number]: string | string[]
20
- } | undefined
21
- }
@@ -1,12 +0,0 @@
1
- import { IProperty } from './property';
2
-
3
- export * from './context';
4
- export * from './property';
5
-
6
- export interface IOutputs {
7
- [key: string]: any
8
- }
9
-
10
- export interface IParameters {
11
- [key: string]: IProperty | undefined;
12
- }
@@ -1,26 +0,0 @@
1
- import { IProperty, ITwoOptionsProperty } from "./property";
2
-
3
- export interface IParameters {
4
- [key: string]: IProperty | undefined;
5
- }
6
-
7
- export interface IInputParameters extends IBaseParameters {
8
- value: IProperty;
9
- /**
10
- * Tells the component to trigger `notifyOutputChanged` on it's unmount changes occured in bound parameter value.
11
- * Should only be use in edge cases in input based components where the notifyOutputChanged cannot be called naturally via the blur event.
12
- */
13
- NotifyOutputChangedOnUnmount?: Omit<ITwoOptionsProperty, 'attributes'>;
14
- EnableCopyButton?: Omit<ITwoOptionsProperty, 'attributes'>;
15
- EnableDeleteButton?: Omit<ITwoOptionsProperty, 'attributes'>;
16
- }
17
-
18
- export interface IBaseParameters extends IParameters {
19
- /** default `true` */
20
- EnableBorder?: Omit<ITwoOptionsProperty, 'attributes'>;
21
- /**
22
- * Decides whether the input should get focus on first render.
23
- */
24
- AutoFocus?: Omit<ITwoOptionsProperty, 'attributes'>;
25
- ForceDisable?: Omit<ITwoOptionsProperty, 'attributes'>;
26
- }
@@ -1,111 +0,0 @@
1
- import { IEntityColumn, IEntityRecord } from "../components/Grid/interfaces";
2
-
3
- type ExcludedProps = Pick<ComponentFramework.PropertyTypes.Property, 'formatted'>;
4
-
5
- export interface IProperty extends Omit<Partial<ComponentFramework.PropertyTypes.Property>, keyof ExcludedProps | 'attributes'> {
6
- }
7
-
8
- export interface IStringProperty extends IProperty, Partial<ComponentFramework.PropertyTypes.StringProperty> {
9
- raw: string | null;
10
- }
11
-
12
- export interface ITwoOptionsProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.TwoOptionsProperty>, 'attributes'> {
13
- raw: boolean,
14
- attributes: Omit<Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.OptionSetMetadata>, 'DefaultValue'> & {
15
- Options: [ComponentFramework.PropertyHelper.OptionMetadata, ComponentFramework.PropertyHelper.OptionMetadata]
16
- };
17
- }
18
-
19
- export interface IDecimalNumberProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.DecimalNumberProperty>, 'attributes'> {
20
- raw: number | null;
21
- type: 'Whole.None' | 'Decimal' | 'Currency',
22
- formatted?: string;
23
- attributes?: Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.DecimalNumberMetadata>
24
- }
25
-
26
- export interface IWholeNumberProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.WholeNumberProperty>, 'attributes'> {
27
- raw: number | null;
28
- }
29
-
30
- //@ts-ignore - IMEMode is mandatory, but no longer supported in modern browsers - https://learn.microsoft.com/en-us/power-apps/maker/data-platform/create-edit-field-portal
31
- export interface IDateTimeProperty extends IProperty, Partial<ComponentFramework.PropertyTypes.DateTimeProperty> {
32
- raw: Date | null,
33
- attributes: Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.DateTimeMetadata> & {
34
- Behavior: ComponentFramework.FormattingApi.Types.DateTimeFieldBehavior
35
- Format: string;
36
- };
37
- }
38
-
39
- export interface IOptionSetProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.OptionSetProperty>, 'attributes'> {
40
- raw: number | null,
41
- attributes: Omit<Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.OptionSetMetadata>, 'DefaultValue'> & {
42
- Options: ComponentFramework.PropertyHelper.OptionMetadata[]
43
- };
44
- }
45
-
46
- export interface ITwoOptionsProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.TwoOptionsProperty>, 'attributes'> {
47
- raw: boolean,
48
- attributes: Omit<Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.OptionSetMetadata>, 'DefaultValue'> & {
49
- Options: [ComponentFramework.PropertyHelper.OptionMetadata, ComponentFramework.PropertyHelper.OptionMetadata]
50
- };
51
- }
52
-
53
- export interface IMultiSelectOptionSetProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.MultiSelectOptionSetProperty>, 'attributes'> {
54
- raw: number[] | null,
55
- attributes: Omit<Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.OptionSetMetadata>, 'DefaultValue'> & {
56
- Options: ComponentFramework.PropertyHelper.OptionMetadata[]
57
- };
58
- }
59
-
60
- export interface ILookupProperty extends IProperty, Omit<Partial<ComponentFramework.PropertyTypes.LookupProperty>, 'attributes' | 'getViewId'> {
61
- raw: ComponentFramework.LookupValue[];
62
- attributes: Partial<ComponentFramework.PropertyHelper.FieldPropertyMetadata.LookupMetadata> & {
63
- Targets: string[]
64
- };
65
- /**
66
- * Returns the default lookup viewId. Works only for Microsoft PCF's
67
- */
68
- getDefaultViewId: (entityName: string) => string,
69
- /**
70
- * Gets all views for entity (including non-lookup ones).
71
- */
72
- getAllViews: (entityName: string) => Promise<{
73
- isAvailableInOffline: boolean;
74
- isDefault: boolean;
75
- isPinned: boolean;
76
- isUserView: boolean;
77
- relatedEntityName: string;
78
- viewId: string;
79
- viewName: string;
80
- fetchXml?: string;
81
- }[]>
82
- }
83
-
84
- export interface IDatasetProperty extends IProperty, Omit<ComponentFramework.PropertyTypes.DataSet, 'error' | 'errorMessage'> {
85
- columns: IEntityColumn[],
86
- records: {
87
- [id: string]: IEntityRecord;
88
- }
89
- paging: ComponentFramework.PropertyHelper.DataSetApi.Paging & {
90
- pageNumber: number
91
- }
92
- retrieveRecordCommand: (recordIds: string[], specificCommands?: string[], filterByPriority?: boolean, useNestedFormat?: boolean, refreshAllRules?: boolean) => {
93
- canExecute: boolean;
94
- /**
95
- * Seems to be always empty - buttons present in Flyout and SplitButton are put on first level (the array of buttons is flattened).
96
- */
97
- children: any[];
98
- commandId: string;
99
- commandButtonId: string;
100
- controlType: any;
101
- icon: string;
102
- label: string;
103
- shouldBeVisible: boolean;
104
- tooltip: string;
105
- /**
106
- * Temp portal property
107
- */
108
- __isInline?: boolean;
109
- execute: () => Promise<void>;
110
- }[]
111
- }
@@ -1,137 +0,0 @@
1
- import { initializeIcons, Label, TagPicker } from "@fluentui/react";
2
- import React, { useState } from "react";
3
- import { Context } from "./mock/Context";
4
- import { Decimal } from "../components/Decimal/Decimal";
5
- import { OptionSet } from "../components/OptionSet";
6
- import { IDecimalNumberProperty, IMultiSelectOptionSetProperty, IOptionSetProperty, ITwoOptionsProperty, IWholeNumberProperty } from "../interfaces";
7
- import { options } from './shared/optionList';
8
- import { multiSelectOptions } from './shared/multiSelectOptionList';
9
- import { MultiSelectOptionSet } from "../components/MultiSelectOptionSet";
10
- import { TwoOptions } from "../components/TwoOptions";
11
- import { Duration } from "../components/Duration";
12
- initializeIcons();
13
-
14
- export const Sandbox: React.FC = () => {
15
- //const [value, setValue] = useState<string | Date | undefined>("shit");
16
- const [value, setValue] = useState<string | Date | undefined>(new Date('2016-08-04T17:14:00Z'));
17
- const [decimalValue, setDecimalValue] = useState<number>();
18
- const [selectedValue, setSelectedValue] = useState<number | null>();
19
- const [selectedKeys, setSelectedKeys] = useState<number[] | undefined>();
20
- const [twoOptionValue, setTwoOptionValue] = useState<number | undefined>();
21
- const [duration, setDuration] = useState<number | undefined>();
22
- const [isMounted, setIsMounted] = useState<boolean>(true);
23
- const [test, setTest] = useState("");
24
- const context = new Context();
25
-
26
- return (
27
- <>
28
- <Label>Outside change</Label>
29
- {/* <TalxisTextField value={value} onChange={(e, value) => setValue(value)} /> */}
30
- <Decimal
31
- context={context}
32
- parameters={{
33
- EnableBorder: { raw: true },
34
- EnableCopyButton: { raw: false },
35
- value: {
36
- attributes: {
37
- Precision: 2
38
- },
39
- raw: decimalValue ?? null
40
- } as IDecimalNumberProperty,
41
- }}
42
- onNotifyOutputChanged={(outputs) => {
43
- setDecimalValue(outputs.value);
44
- }}
45
- />
46
- <Label>Component</Label>
47
- <OptionSet
48
- context={context}
49
- parameters={{
50
- EnableCopyButton: {
51
- raw: true
52
- },
53
- EnableDeleteButton: {
54
- raw: true
55
- },
56
- AutoFocus: {
57
- raw: true
58
- },
59
- value: {
60
- raw: selectedValue ?? null,
61
- attributes: {
62
- DefaultValue: -1,
63
- Options: options
64
- }
65
- } as IOptionSetProperty
66
- }}
67
- onNotifyOutputChanged={(outputs) => {
68
- setSelectedValue(outputs.value);
69
- }} />
70
-
71
- <Label>Component</Label>
72
- <MultiSelectOptionSet
73
- context={context}
74
- parameters={{
75
- value: {
76
- raw: selectedKeys,
77
- attributes: {
78
- DefaultValue: -1,
79
- Options: multiSelectOptions
80
- }
81
- } as IMultiSelectOptionSetProperty
82
- }}
83
- onNotifyOutputChanged={(outputs) => {
84
- setSelectedKeys(outputs.value);
85
- }}
86
- />
87
-
88
- <Label>Component</Label>
89
- <TwoOptions
90
- context={context}
91
- parameters={{
92
- value: {
93
- raw: Boolean(twoOptionValue),
94
- attributes: {
95
- Options: [
96
- {
97
- Label: 'No',
98
- Value: 0,
99
- Color: ''
100
- },
101
- {
102
- Label: 'Yes',
103
- Value: 1,
104
- Color: ''
105
- }
106
- ],
107
- DisplayName: 'YesNoColumn'
108
- }
109
- } as ITwoOptionsProperty
110
- }}
111
- onNotifyOutputChanged={(outputs) => {
112
- //setTwoOptionValue(outputs.value);
113
- }}
114
- />
115
- <Label>Component</Label>
116
- <Duration
117
- context={context}
118
- parameters={{
119
- EnableCopyButton: {
120
- raw: true
121
- },
122
- EnableDeleteButton: {
123
- raw: true
124
- },
125
- AutoFocus: {
126
- raw: false
127
- },
128
- value: {
129
- raw: duration ?? null,
130
- } as IWholeNumberProperty
131
- }}
132
- onNotifyOutputChanged={(outputs) => {
133
- setDuration(outputs.value);
134
- }} />
135
- </>
136
- );
137
- };
@@ -1,18 +0,0 @@
1
- import { Formatting } from "./Formatting";
2
- import { Mode } from "./Mode";
3
- import { UserSettings } from "./UserSettings";
4
- import { Utility } from "./Utility";
5
-
6
- export class Context implements Context {
7
- mode: ComponentFramework.Mode;
8
- userSettings: ComponentFramework.UserSettings;
9
- formatting: ComponentFramework.Formatting;
10
- utils: ComponentFramework.Utility;
11
-
12
- constructor() {
13
- this.mode = new Mode();
14
- this.userSettings = new UserSettings();
15
- this.formatting = new Formatting();
16
- this.utils = new Utility();
17
- }
18
- }
@@ -1,186 +0,0 @@
1
- import dayjs from "dayjs";
2
-
3
- export class Formatting implements ComponentFramework.Formatting {
4
-
5
- formatCurrency(value: number, precision: number = 2, symbol: string = '$'): string {
6
- return symbol + value.toFixed(precision);
7
- }
8
-
9
- formatDecimal(value: number, precision: number = 2): string {
10
- return value.toFixed(precision);
11
- }
12
-
13
- formatDateAsFilterStringInUTC(value: Date, includeTime: boolean = false): string {
14
- const year = value.getUTCFullYear();
15
- const month = (value.getUTCMonth() + 1).toString().padStart(2, '0');
16
- const day = value.getUTCDate().toString().padStart(2, '0');
17
- let formattedDate = `${year}-${month}-${day}`;
18
- if (includeTime) {
19
- const hours = value.getUTCHours().toString().padStart(2, '0');
20
- const minutes = value.getUTCMinutes().toString().padStart(2, '0');
21
- const seconds = value.getUTCSeconds().toString().padStart(2, '0');
22
- formattedDate += ` ${hours}:${minutes}:${seconds}`;
23
- }
24
- return formattedDate;
25
- }
26
-
27
- formatDateLong(value: Date): string {
28
- return value.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
29
- }
30
-
31
- formatDateLongAbbreviated(value: Date): string {
32
- return value.toLocaleDateString('en-US', { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' });
33
- }
34
-
35
- formatDateShort(value: Date, includeTime: boolean = false): string {
36
- let options: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'short', day: 'numeric' };
37
- if (includeTime) {
38
- options = { ...options, hour: 'numeric', minute: 'numeric' };
39
- }
40
- return value.toLocaleDateString('en-US', options);
41
- }
42
-
43
- formatDateYearMonth(value: Date): string {
44
- return value.toLocaleDateString('en-US', { year: 'numeric', month: 'long' });
45
- }
46
-
47
- formatInteger(value: number): string {
48
- return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
49
- }
50
-
51
- formatLanguage(value: number): string {
52
- // Assuming value corresponds to a language code and returns language name
53
- return 'Language'; // Placeholder, replace with actual implementation
54
- }
55
-
56
- formatTime(value: Date, behavior: ComponentFramework.FormattingApi.Types.DateTimeFieldBehavior): string {
57
- return dayjs(value).format('DD.MM.YYYY HH:mm')
58
- // Implementation depends on behavior, e.g., 12-hour clock, 24-hour clock, etc.
59
- return value.toLocaleTimeString('en-US');
60
- }
61
-
62
- getWeekOfYear(value: Date): number {
63
- const startOfYear = new Date(value.getFullYear(), 0, 0);
64
- const diff = value.getTime() - startOfYear.getTime();
65
- const oneWeek = 1000 * 60 * 60 * 24 * 7;
66
- return Math.floor(diff / oneWeek);
67
- }
68
-
69
- }
70
-
71
- export class NumberFormattingInfo implements ComponentFramework.UserSettingApi.NumberFormattingInfo {
72
- currencyDecimalDigits: number;
73
- currencyDecimalSeparator: string;
74
- currencyGroupSeparator: string;
75
- currencyGroupSizes: number[];
76
- currencyNegativePattern: number;
77
- currencyPositivePattern: number;
78
- currencySymbol: string;
79
- nanSymbol: string;
80
- nativeDigits: string[];
81
- negativeInfinitySymbol: string;
82
- negativeSign: string;
83
- numberDecimalDigits: number;
84
- numberDecimalSeparator: string;
85
- numberGroupSeparator: string;
86
- numberGroupSizes: number[];
87
- numberNegativePattern: number;
88
- perMilleSymbol: string;
89
- percentDecimalDigits: number;
90
- percentDecimalSeparator: string;
91
- percentGroupSeparator: string;
92
- percentGroupSizes: number[];
93
- percentNegativePattern: number;
94
- percentPositivePattern: number;
95
- percentSymbol: string;
96
- positiveInfinitySymbol: string;
97
- positiveSign: string;
98
-
99
- constructor() {
100
- this.currencyDecimalDigits = 2;
101
- this.currencyDecimalSeparator = '.';
102
- this.currencyGroupSeparator = ',';
103
- this.currencyGroupSizes = [3];
104
- this.currencyNegativePattern = 1;
105
- this.currencyPositivePattern = 0;
106
- this.currencySymbol = '$';
107
- this.nanSymbol = 'NaN';
108
- this.nativeDigits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
109
- this.negativeInfinitySymbol = '-Infinity';
110
- this.negativeSign = '-';
111
- this.numberDecimalDigits = 2;
112
- this.numberDecimalSeparator = ',';
113
- this.numberGroupSeparator = ' ';
114
- this.numberGroupSizes = [3];
115
- this.numberNegativePattern = 1;
116
- this.perMilleSymbol = '%';
117
- this.percentDecimalDigits = 2;
118
- this.percentDecimalSeparator = '.';
119
- this.percentGroupSeparator = ',';
120
- this.percentGroupSizes = [3];
121
- this.percentNegativePattern = 1;
122
- this.percentPositivePattern = 1;
123
- this.percentSymbol = '%';
124
- this.positiveInfinitySymbol = 'Infinity';
125
- this.positiveSign = '+';
126
- }
127
- }
128
-
129
- export class DateFormattingInfo implements ComponentFramework.UserSettingApi.DateFormattingInfo {
130
- amDesignator: string;
131
- abbreviatedDayNames: string[];
132
- abbreviatedMonthGenitiveNames: string[];
133
- abbreviatedMonthNames: string[];
134
- calendarWeekRule: number;
135
- calendar: ComponentFramework.UserSettingApi.Calendar;
136
- dateSeparator: string;
137
- dayNames: string[];
138
- firstDayOfWeek: ComponentFramework.UserSettingApi.Types.DayOfWeek;
139
- fullDateTimePattern: string;
140
- longDatePattern: string;
141
- longTimePattern: string;
142
- monthDayPattern: string;
143
- monthGenitiveNames: string[];
144
- monthNames: string[];
145
- pmDesignator: string;
146
- shortDatePattern: string;
147
- shortTimePattern: string;
148
- shortestDayNames: string[];
149
- sortableDateTimePattern: string;
150
- timeSeparator: string;
151
- universalSortableDateTimePattern: string;
152
- yearMonthPattern: string;
153
-
154
- constructor() {
155
- this.amDesignator = 'AM';
156
- this.abbreviatedDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
157
- this.abbreviatedMonthGenitiveNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
158
- this.abbreviatedMonthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
159
- this.calendarWeekRule = 0;
160
- this.calendar = {
161
- minSupportedDateTime: new Date(-62135568000000),
162
- maxSupportedDateTime: new Date(253402300799999),
163
- algorithmType: 1,
164
- calendarType: 1,
165
- twoDigitYearMax: 2029
166
- }
167
- this.dateSeparator = '.';
168
- this.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
169
- this.firstDayOfWeek = 0;
170
- this.fullDateTimePattern = 'dddd, MMMM d, yyyy h:mm:ss tt';
171
- this.longDatePattern = 'dddd, MMMM d, yyyy';
172
- this.longTimePattern = 'h:mm:ss tt';
173
- this.monthDayPattern = 'MMMM d';
174
- this.monthGenitiveNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
175
- this.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
176
- this.pmDesignator = 'PM';
177
- this.shortDatePattern = 'dd/MM/yyyy';
178
- this.shortTimePattern = 'h:mm';
179
- this.shortestDayNames = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
180
- this.sortableDateTimePattern = 'yyyy-MM-ddTHH:mm:ss';
181
- this.timeSeparator = ':';
182
- this.universalSortableDateTimePattern = 'yyyy-MM-dd HH:mm:ssZ';
183
- this.yearMonthPattern = 'MMMM yyyy';
184
- }
185
- }
186
-
@@ -1,25 +0,0 @@
1
- export class Mode implements ComponentFramework.Mode {
2
- allocatedHeight: number;
3
- allocatedWidth: number;
4
- isControlDisabled: boolean;
5
- isVisible: boolean;
6
- label: string;
7
-
8
- constructor() {
9
- this.allocatedHeight = 42;
10
- this.allocatedWidth = 260;
11
- this.isControlDisabled = false;
12
- this.isVisible = true;
13
- this.label = 'Label'
14
- }
15
- setControlState(state: ComponentFramework.Dictionary): boolean {
16
- throw new Error("Method not implemented.");
17
- }
18
- setFullScreen(value: boolean): void {
19
- throw new Error("Method not implemented.");
20
- }
21
- trackContainerResize(value: boolean): void {
22
- throw new Error("Method not implemented.");
23
- }
24
-
25
- }