@talxis/base-controls 1.2501.9 → 1.2502.1
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/components/DateTime/translations.d.ts +1 -1
- package/dist/components/Duration/durationOptions.d.ts +1 -1
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.d.ts +1 -1
- package/dist/components/Grid/core/model/Grid.d.ts +1 -1
- package/dist/components/Grid/core/model/GridDependency.d.ts +1 -1
- package/dist/components/Grid/core/model/Metadata.d.ts +1 -1
- package/dist/components/Grid/filtering/model/Condition.d.ts +1 -1
- package/dist/components/Grid/interfaces.d.ts +1 -1
- package/dist/components/Grid/sorting/Sorting.d.ts +1 -1
- package/dist/components/Grid/sorting/controllers/useColumnSortingController.d.ts +1 -1
- package/dist/components/Lookup/hooks/useFetchXml.d.ts +1 -1
- package/dist/components/Lookup/hooks/useLookup.d.ts +1 -1
- package/dist/components/Lookup/hooks/useLookup.js +4 -1
- package/dist/components/Lookup/hooks/useLookup.js.map +1 -1
- package/dist/components/Lookup/interfaces.d.ts +1 -1
- package/dist/hooks/useControlSizing.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/interfaces/context.d.ts +1 -1
- package/dist/interfaces/property.d.ts +1 -1
- package/dist/utils/theme/ControlTheme.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
export declare const getDefaultDateTimeTranslations: (dateFormattingInfo: ComponentFramework.UserSettingApi.DateFormattingInfo) => {
|
|
3
3
|
time: {
|
|
4
4
|
1029: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
export declare const durationOptions: ComponentFramework.PropertyHelper.OptionMetadata[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="powerapps-component-framework" />
|
|
2
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
3
3
|
import { ColDef, GridApi } from "@ag-grid-community/core";
|
|
4
4
|
import { Grid } from "../../../model/Grid";
|
|
5
5
|
import { GridDependency } from "../../../model/GridDependency";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { IDataset, IRecord } from "@talxis/client-libraries";
|
|
3
3
|
import { Filtering } from "../../filtering/model/Filtering";
|
|
4
4
|
import { IGrid } from "../../interfaces";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { GridDependency } from "./GridDependency";
|
|
3
3
|
export declare class Metadata extends GridDependency {
|
|
4
4
|
get(columnName: string): Promise<ComponentFramework.PropertyHelper.EntityMetadata>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { DatasetConditionOperator } from "../../core/enums/ConditionOperator";
|
|
3
3
|
import { IGridColumn } from "../../core/interfaces/IGridColumn";
|
|
4
4
|
import { Grid } from "../../core/model/Grid";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { AgGridReactProps } from "@ag-grid-community/react";
|
|
3
3
|
import { ITranslation } from "../../hooks";
|
|
4
4
|
import { IParameters, IStringProperty, ITwoOptionsProperty, IWholeNumberProperty } from "../../interfaces";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { IGridColumn } from "../core/interfaces/IGridColumn";
|
|
3
3
|
import { GridDependency } from "../core/model/GridDependency";
|
|
4
4
|
export declare class Sorting extends GridDependency {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { IGridColumn } from "../../core/interfaces/IGridColumn";
|
|
3
3
|
interface ISortingController {
|
|
4
4
|
value: ComponentFramework.PropertyHelper.DataSetApi.SortStatus | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { IEntity } from "../interfaces";
|
|
3
3
|
export declare const useFetchXml: (context: ComponentFramework.Context<any>) => [(viewId: string) => Promise<{
|
|
4
4
|
fetchxml: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { ITranslation } from "../../../hooks";
|
|
3
3
|
import { IEntity, ILayout, ILookup } from "../interfaces";
|
|
4
4
|
import { ITheme } from "@talxis/react-components";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLookup.js","sources":["../../../../src/components/Lookup/hooks/useLookup.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { ITranslation, useControl } from \"../../../hooks\";\nimport { IEntity, ILayout, ILookup } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\nimport { ITheme } from \"@talxis/react-components\";\n\nexport const useLookup = (props: ILookup): [\n ComponentFramework.LookupValue[],\n IEntity[],\n ITranslation<Required<ILookup>['translations']>,\n {\n create: (entityName: string) => void,\n select: (record: ComponentFramework.LookupValue[] | undefined) => void,\n deselect: (record: ComponentFramework.LookupValue) => void,\n },\n (entityName: string | null) => void,\n (query: string) => Promise<(ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[]>,\n ITheme\n] => {\n\n const targets = props.parameters.value.attributes.Targets;\n const boundValue = props.parameters.value.raw;\n const context = props.context;\n const {labels, theme, onNotifyOutputChanged} = useControl('Lookup', props, lookupTranslations);\n const [getFetchXml, applyLookupQuery] = useFetchXml(context);\n \n const [entities, setEntities] = useState<IEntity[]>(() => {\n return targets.map(target => {\n return {\n entityName: target,\n selected: targets.length === 1 ? true : false,\n metadata: props.context.utils.getEntityMetadata(target, []) as any,\n }\n })\n });\n\n const selectedEntity = entities.find(x => x.selected);\n\n const selectEntity = (entityName: string | null) => {\n setEntities([...entities as IEntity[]].map(entity => {\n return {\n entityName: entity.entityName,\n metadata: entity.metadata,\n selected: entity.entityName === entityName\n }\n }))\n }\n\n const selectRecords = (records: ComponentFramework.LookupValue[] | undefined) => {\n onNotifyOutputChanged({\n value: records\n })\n }\n const getSearchFetchXml = async (entityName: string, query: string, viewIdCallBack: (id: string) => void): Promise<string> => {\n const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);\n if (!response?.viewId) {\n throw new Error(`Entity ${entityName} does not have a default view id!`);\n }\n viewIdCallBack(response.viewId);\n let fetchXml = response?.fetchXml\n if(!fetchXml) {\n fetchXml = (await getFetchXml(response.viewId)).fetchxml;\n }\n return applyLookupQuery(entities.find(x => x.entityName === entityName)!, fetchXml, query);\n\n }\n const getSearchResults = async (query: string): Promise<(ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[]> => {\n if(props.onSearch) { \n return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query) as any;\n }\n const fetchXmlMap = new Map<string, Promise<string>>();\n const entityViewIdMap = new Map<string, string>();\n if(selectedEntity) {\n fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query, (viewId) => entityViewIdMap.set(selectedEntity.entityName, viewId)))\n }\n else {\n for (const entity of targets) {\n fetchXmlMap.set(entity, getSearchFetchXml(entity, query, (viewId) => entityViewIdMap.set(entity, viewId)))\n }\n }\n await Promise.all(fetchXmlMap.values());\n const responsePromiseMap = new Map<string, Promise<ComponentFramework.WebApi.RetrieveMultipleResponse>>()\n for (const [entityName, fetchXml] of fetchXmlMap) {\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((await fetchXml))}`))\n }\n await Promise.all(responsePromiseMap.values());\n const result: (ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[] = [];\n for (const [entityName, response] of responsePromiseMap) {\n const layout: ILayout = JSON.parse((await getFetchXml(entityViewIdMap.get(entityName)!)).layoutjson ?? \"{}\");\n for (const entity of (await response).entities) {\n const entityMetadata = await entities.find(x => x.entityName === entityName)!.metadata;\n result.push({\n entityType: entityName,\n id: entity[entityMetadata.PrimaryIdAttribute],\n name: entity[layout.Rows?.[0]?.Cells?.[0]?.Name] ?? entity[entityMetadata.PrimaryNameAttribute] ?? labels.noName(),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const createRecord = async (entityName: string) => {\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n });\n if (!result.savedEntityReference) {\n return;\n }\n onNotifyOutputChanged({\n value: result.savedEntityReference\n })\n }\n\n const deselectRecord = (record: ComponentFramework.LookupValue) => {\n const map = new Map<string, ComponentFramework.LookupValue>(boundValue.map(value => [value.id, value]));\n map.delete(record.id);\n onNotifyOutputChanged({\n value: [...map.values()]\n })\n }\n\n return [\n boundValue, entities, labels, {\n create: createRecord,\n deselect: deselectRecord,\n select: selectRecords\n },\n selectEntity,\n getSearchResults,\n theme\n ];\n};"],"names":[],"mappings":";;;;;AAOa,MAAA,SAAS,GAAG,CAAC,KAAc,KAYpC;IAEA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;IAC1D,MAAM,UAAU,GAAG,KAAK,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;AACtB,QAAA,qBAAqB,CAAC;AAClB,YAAA,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;AAC3B,SAAA,CAAC,CAAA;AACN,KAAC,CAAA;IAED,OAAO;AACH,QAAA,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC1B,YAAA,MAAM,EAAE,YAAY;AACpB,YAAA,QAAQ,EAAE,cAAc;AACxB,YAAA,MAAM,EAAE,aAAa;AACxB,SAAA;QACD,YAAY;QACZ,gBAAgB;QAChB,KAAK;KACR,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"useLookup.js","sources":["../../../../src/components/Lookup/hooks/useLookup.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { ITranslation, useControl } from \"../../../hooks\";\nimport { IEntity, ILayout, ILookup } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\nimport { ITheme } from \"@talxis/react-components\";\n\nexport const useLookup = (props: ILookup): [\n ComponentFramework.LookupValue[],\n IEntity[],\n ITranslation<Required<ILookup>['translations']>,\n {\n create: (entityName: string) => void,\n select: (record: ComponentFramework.LookupValue[] | undefined) => void,\n deselect: (record: ComponentFramework.LookupValue) => void,\n },\n (entityName: string | null) => void,\n (query: string) => Promise<(ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[]>,\n ITheme\n] => {\n\n const targets = props.parameters.value.attributes.Targets;\n const boundValue = props.parameters.value.raw;\n const context = props.context;\n const {labels, theme, onNotifyOutputChanged} = useControl('Lookup', props, lookupTranslations);\n const [getFetchXml, applyLookupQuery] = useFetchXml(context);\n \n const [entities, setEntities] = useState<IEntity[]>(() => {\n return targets.map(target => {\n return {\n entityName: target,\n selected: targets.length === 1 ? true : false,\n metadata: props.context.utils.getEntityMetadata(target, []) as any,\n }\n })\n });\n\n const selectedEntity = entities.find(x => x.selected);\n\n const selectEntity = (entityName: string | null) => {\n setEntities([...entities as IEntity[]].map(entity => {\n return {\n entityName: entity.entityName,\n metadata: entity.metadata,\n selected: entity.entityName === entityName\n }\n }))\n }\n\n const selectRecords = (records: ComponentFramework.LookupValue[] | undefined) => {\n onNotifyOutputChanged({\n value: records\n })\n }\n const getSearchFetchXml = async (entityName: string, query: string, viewIdCallBack: (id: string) => void): Promise<string> => {\n const response = (await props.parameters.value.getAllViews(entityName)).find(x => x.isDefault);\n if (!response?.viewId) {\n throw new Error(`Entity ${entityName} does not have a default view id!`);\n }\n viewIdCallBack(response.viewId);\n let fetchXml = response?.fetchXml\n if(!fetchXml) {\n fetchXml = (await getFetchXml(response.viewId)).fetchxml;\n }\n return applyLookupQuery(entities.find(x => x.entityName === entityName)!, fetchXml, query);\n\n }\n const getSearchResults = async (query: string): Promise<(ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[]> => {\n if(props.onSearch) { \n return props.onSearch(selectedEntity ? [selectedEntity?.entityName] : targets, query) as any;\n }\n const fetchXmlMap = new Map<string, Promise<string>>();\n const entityViewIdMap = new Map<string, string>();\n if(selectedEntity) {\n fetchXmlMap.set(selectedEntity.entityName, getSearchFetchXml(selectedEntity.entityName, query, (viewId) => entityViewIdMap.set(selectedEntity.entityName, viewId)))\n }\n else {\n for (const entity of targets) {\n fetchXmlMap.set(entity, getSearchFetchXml(entity, query, (viewId) => entityViewIdMap.set(entity, viewId)))\n }\n }\n await Promise.all(fetchXmlMap.values());\n const responsePromiseMap = new Map<string, Promise<ComponentFramework.WebApi.RetrieveMultipleResponse>>()\n for (const [entityName, fetchXml] of fetchXmlMap) {\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((await fetchXml))}`))\n }\n await Promise.all(responsePromiseMap.values());\n const result: (ComponentFramework.LookupValue & {entityData: {[key: string]: any}, layout: ILayout})[] = [];\n for (const [entityName, response] of responsePromiseMap) {\n const layout: ILayout = JSON.parse((await getFetchXml(entityViewIdMap.get(entityName)!)).layoutjson ?? \"{}\");\n for (const entity of (await response).entities) {\n const entityMetadata = await entities.find(x => x.entityName === entityName)!.metadata;\n result.push({\n entityType: entityName,\n id: entity[entityMetadata.PrimaryIdAttribute],\n name: entity[layout.Rows?.[0]?.Cells?.[0]?.Name] ?? entity[entityMetadata.PrimaryNameAttribute] ?? labels.noName(),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const createRecord = async (entityName: string) => {\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n });\n if (!result.savedEntityReference) {\n return;\n }\n onNotifyOutputChanged({\n value: [\n ...boundValue,\n ...result.savedEntityReference\n ]\n })\n }\n\n const deselectRecord = (record: ComponentFramework.LookupValue) => {\n const map = new Map<string, ComponentFramework.LookupValue>(boundValue.map(value => [value.id, value]));\n map.delete(record.id);\n onNotifyOutputChanged({\n value: [...map.values()]\n })\n }\n\n return [\n boundValue, entities, labels, {\n create: createRecord,\n deselect: deselectRecord,\n select: selectRecords\n },\n selectEntity,\n getSearchResults,\n theme\n ];\n};"],"names":[],"mappings":";;;;;AAOa,MAAA,SAAS,GAAG,CAAC,KAAc,KAYpC;IAEA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;IAC1D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9C,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9B,IAAA,MAAM,EAAC,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IAC/F,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAE7D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAY,MAAK;AACrD,QAAA,OAAO,OAAO,CAAC,GA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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { ITagPickerProps } from "@talxis/react-components";
|
|
3
3
|
import { ILookupProperty, ITwoOptionsProperty } from "../../interfaces";
|
|
4
4
|
import { IControl, IOutputs, ITranslations } from "../../interfaces/context";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import { ITheme, IDatePickerProps, ITextFieldProps, IComboBoxProps, ITagPickerProps } from '@talxis/react-components';
|
|
4
4
|
import { DeepPartial, IDataset } from '@talxis/client-libraries';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
type ExcludedProps = Pick<ComponentFramework.PropertyTypes.Property, 'formatted'>;
|
|
3
3
|
export interface IProperty extends Omit<Partial<ComponentFramework.PropertyTypes.Property>, keyof ExcludedProps | 'attributes'> {
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="powerapps-component-framework" />
|
|
1
|
+
/// <reference types="@types/powerapps-component-framework" />
|
|
2
2
|
import { ITheme } from "@talxis/react-components";
|
|
3
3
|
import { DeepPartial } from "@talxis/client-libraries";
|
|
4
4
|
export interface IFluentDesignState extends ComponentFramework.FluentDesignState {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talxis/base-controls",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2502.1",
|
|
4
4
|
"description": "Set of React components that natively work with Power Apps Component Framework API's",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"react": "^16.8.6 || ^17.0.2",
|
|
87
87
|
"react-dom": "^16.8.6 || ^17.0.2",
|
|
88
|
-
"@talxis/react-components": "^1.
|
|
89
|
-
"@talxis/client-libraries": "^1.
|
|
88
|
+
"@talxis/react-components": "^1.2502.5",
|
|
89
|
+
"@talxis/client-libraries": "^1.2502.2",
|
|
90
90
|
"@fluentui/react": "<=8.121.5"
|
|
91
91
|
}
|
|
92
92
|
}
|