@talxis/base-controls 1.2512.4 → 1.2601.2
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/DatasetControl/Filtering/DatasetColumnFiltering.js +14 -11
- package/dist/components/DatasetControl/Filtering/DatasetColumnFiltering.js.map +1 -1
- package/dist/components/DatasetControl/Filtering/DatasetColumnFilteringModel.d.ts +14 -2
- package/dist/components/DatasetControl/Filtering/DatasetColumnFilteringModel.js +41 -7
- package/dist/components/DatasetControl/Filtering/DatasetColumnFilteringModel.js.map +1 -1
- package/dist/components/DatasetControl/Header/Header.js +9 -2
- package/dist/components/DatasetControl/Header/Header.js.map +1 -1
- package/dist/components/DatasetControl/interfaces.d.ts +3 -1
- package/dist/components/Grid/cells/cell/Cell.js +17 -6
- package/dist/components/Grid/cells/cell/Cell.js.map +1 -1
- package/dist/components/Grid/grid/Grid.js +26 -13
- package/dist/components/Grid/grid/Grid.js.map +1 -1
- package/dist/components/Grid/grid/GridModel.d.ts +0 -1
- package/dist/components/Grid/grid/GridModel.js +1 -7
- package/dist/components/Grid/grid/GridModel.js.map +1 -1
- package/dist/components/Grid/grid/styles.d.ts +3 -0
- package/dist/components/Grid/grid/styles.js +3 -0
- package/dist/components/Grid/grid/styles.js.map +1 -1
- package/dist/components/Grid/interfaces.d.ts +1 -8
- package/dist/components/Grid/overlays/loading/LoadingOverlay.js +11 -3
- package/dist/components/Grid/overlays/loading/LoadingOverlay.js.map +1 -1
- package/dist/components/Grid/overlays/loading/styles.d.ts +10 -0
- package/dist/components/Grid/overlays/loading/styles.js +17 -0
- package/dist/components/Grid/overlays/loading/styles.js.map +1 -0
- package/dist/components/Lookup/hooks/useFetchXml.js +32 -7
- package/dist/components/Lookup/hooks/useFetchXml.js.map +1 -1
- package/dist/components/Lookup/hooks/useLookup.js +4 -4
- package/dist/components/Lookup/hooks/useLookup.js.map +1 -1
- package/dist/index.d.ts +5 -10
- package/package.json +2 -2
|
@@ -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, IMetadata } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\nimport { ITheme } from \"@talxis/react-components\";\nimport dayjs from \"dayjs\";\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: window.Xrm.Utility.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 const aliasEntityMap: { aliasAttribute: string, entityAttribute: string }[] = [];\n const domParser = new DOMParser();\n for (const [entityName, fetchXml] of fetchXmlMap) {\n const fetchXMLresult = await fetchXml;\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((fetchXMLresult))}`))\n //parsing of link entities from fetchXML\n const xml = domParser.parseFromString(fetchXMLresult, \"application/xml\");\n const linkEntities = xml.querySelectorAll(`link-entity`);\n for (const linkEntity of linkEntities) {\n const aliasAttribute = linkEntity.getAttribute('alias');\n const entityAttribute = linkEntity.getAttribute('name');\n if (entityAttribute) {\n aliasEntityMap.push({ aliasAttribute: aliasAttribute ?? entityAttribute, entityAttribute: entityAttribute })\n }\n else {\n throw Error(\"Link-entity without name property is not supported. Offedning query: \" + fetchXMLresult);\n }\n }\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 //Mapping link-entities' logical names to layout's Cell \n if (layout.Rows.some(x => x.Cells.some(x => x.Name.includes(\".\")))) {\n const cellsToModify = layout.Rows.flatMap(row => row.Cells)\n .filter(cell => cell.Name.includes(\".\"));\n\n cellsToModify.forEach(cell => {\n const alias = cell.Name.split(\".\")[0]\n cell.RelatedEntityName = aliasEntityMap.find(x => x.aliasAttribute === alias)?.entityAttribute ?? \"\";\n });\n }\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: await getPrimaryName(entity, entityName, layout.Rows?.[0]?.Cells?.[0]?.Name, layout),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const getPrimaryName = async (\n entity: ComponentFramework.WebApi.Entity,\n entityName: string,\n attribute: string,\n layout: ILayout\n ): Promise<string> => {\n let targetEntityName = entityName;\n let targetAttribute = attribute;\n //checking for attributes pointing to related entity attribute, given by convention of using dot as separator\n if (attribute.includes(\".\")) {\n targetEntityName = layout.Rows.find(x => x.Cells)?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || entityName;\n targetAttribute = attribute.split(\".\")[1]\n }\n const entityMetadata: ComponentFramework.PropertyHelper.EntityMetadata = await window.Xrm.Utility.getEntityMetadata(targetEntityName, [targetAttribute]);\n const attributetype: string = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;\n let primaryName: string;\n switch (attributetype.toLowerCase()) {\n case \"lookup\":\n case \"partylist\":\n case \"owner\":\n case \"customer\":\n primaryName = entity[`_${targetAttribute}_value@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"optionset\":\n case \"picklist\":\n case \"state\":\n case \"status\":\n case \"boolean\":\n case \"integer\":\n case \"bigint\":\n case \"decimal\":\n case \"money\":\n //TODO: Introduce user formatting, this approach takes format from application user setting\n primaryName = entity[`${targetAttribute}@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"datetime\":\n primaryName = props.context.formatting.formatTime(dayjs(entity[targetAttribute]).toDate(), 1);\n break\n default:\n primaryName = entity[targetAttribute];\n };\n return (\n primaryName ??\n entity[entityMetadata.PrimaryNameAttribute] ??\n labels.noName()\n );\n };\n\n const createRecord = async (entityName: string) => {\n const formParameters = props.onGetOnCreateFormParameters?.(entityName)\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n }, formParameters);\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":";;;;;;AAQa,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,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACjG,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAE7D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAY,MAAK;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AAC,CAAC;AACnB,QAAA,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE;YAC9B,OAAO;AACV,SAAA;AACD,QAAA,qBAAqB,CAAC;AAClB,YAAA,KAAK,EAAE;AACH,gBAAA,GAAG,UAAU;gBACb,GAAG,MAAM,CAAC,oBAAoB;AACjC,aAAA;AACJ,SAAA,CAAC,CAAC;AACP,KAAC,CAAA;AAED,IAAA,MAAM,cAAc,GAAG,CAAC,MAAsC,KAAI;QAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAyC,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,QAAA,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;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, IMetadata } from \"../interfaces\";\nimport { lookupTranslations } from \"../translations\";\nimport { useFetchXml } from \"./useFetchXml\";\nimport { ITheme } from \"@talxis/react-components\";\nimport dayjs from \"dayjs\";\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: window.Xrm.Utility.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 const aliasEntityMap: { aliasAttribute: string, entityAttribute: string }[] = [];\n const domParser = new DOMParser();\n for (const [entityName, fetchXml] of fetchXmlMap) {\n const fetchXMLresult = await fetchXml;\n responsePromiseMap.set(entityName, context.webAPI.retrieveMultipleRecords(entityName, `?$top=25&fetchXml=${encodeURIComponent((fetchXMLresult))}`))\n //parsing of link entities from fetchXML\n const xml = domParser.parseFromString(fetchXMLresult, \"application/xml\");\n const linkEntities = xml.querySelectorAll(`link-entity`);\n for (const linkEntity of linkEntities) {\n const aliasAttribute = linkEntity.getAttribute('alias');\n const entityAttribute = linkEntity.getAttribute('name');\n if (entityAttribute) {\n aliasEntityMap.push({ aliasAttribute: aliasAttribute ?? entityAttribute, entityAttribute: entityAttribute })\n }\n else {\n throw Error(\"Link-entity without name property is not supported. Offedning query: \" + fetchXMLresult);\n }\n }\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 //Mapping link-entities' logical names to layout's Cell \n if (layout.Rows.some(x => x.Cells.some(x => x.Name.includes(\".\")))) {\n const cellsToModify = layout.Rows.flatMap(row => row.Cells)\n .filter(cell => cell.Name.includes(\".\"));\n\n cellsToModify.forEach(cell => {\n const alias = cell.Name.split(\".\")[0]\n cell.RelatedEntityName = aliasEntityMap.find(x => x.aliasAttribute === alias)?.entityAttribute ?? \"\";\n });\n }\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: await getPrimaryName(entity, entityName, layout.Rows?.[0]?.Cells?.[0]?.Name, layout),\n entityData: entity,\n layout: layout\n });\n }\n }\n return result;\n }\n\n const getPrimaryName = async (\n entity: ComponentFramework.WebApi.Entity,\n entityName: string,\n attribute: string,\n layout: ILayout\n ): Promise<string> => {\n let targetEntityName = entityName;\n let targetAttribute = attribute;\n //checking for attributes pointing to related entity attribute, given by convention of using dot as separator\n if (attribute.includes(\".\")) {\n targetEntityName = layout.Rows.find(x => x.Cells)?.Cells?.find(y => y.Name === attribute)?.RelatedEntityName || entityName;\n targetAttribute = attribute.split(\".\")[1]\n }\n const entityMetadata: ComponentFramework.PropertyHelper.EntityMetadata = await window.Xrm.Utility.getEntityMetadata(targetEntityName, [targetAttribute]);\n const attributetype: string = entityMetadata.Attributes.get(targetAttribute).AttributeTypeName;\n let primaryName: string;\n switch (attributetype.toLowerCase()) {\n case \"lookup\":\n case \"partylist\":\n case \"owner\":\n case \"customer\":\n primaryName = entity[`_${attribute}_value@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"optionset\":\n case \"picklist\":\n case \"state\":\n case \"status\":\n case \"boolean\":\n case \"integer\":\n case \"bigint\":\n case \"decimal\":\n case \"money\":\n //TODO: Introduce user formatting, this approach takes format from application user setting\n primaryName = entity[`${attribute}@OData.Community.Display.V1.FormattedValue`];\n break;\n case \"datetime\":\n primaryName = props.context.formatting.formatTime(dayjs(entity[attribute]).toDate(), 1);\n break\n default:\n primaryName = entity[attribute];\n };\n return (\n primaryName ??\n entity[entityMetadata.PrimaryNameAttribute] ??\n labels.noName()\n );\n };\n\n const createRecord = async (entityName: string) => {\n const formParameters = props.onGetOnCreateFormParameters?.(entityName)\n const result = await context.navigation.openForm({\n entityName: entityName,\n useQuickCreateForm: true\n }, formParameters);\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":";;;;;;AAQa,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,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACjG,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,GAAG,CAAC,MAAM,IAAG;YACxB,OAAO;AACH,gBAAA,UAAU,EAAE,MAAM;AAClB,gBAAA,QAAQ,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK;AAC7C,gBAAA,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,EAAE,CAAQ;aACpE,CAAA;AACL,SAAC,CAAC,CAAA;AACN,KAAC,CAAC,CAAC;AAEH,IAAA,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC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E,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,QAAA,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;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;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -341,14 +341,7 @@ declare const gridTranslations: {
|
|
|
341
341
|
};
|
|
342
342
|
};
|
|
343
343
|
|
|
344
|
-
interface
|
|
345
|
-
agGrid: AgGridReactProps;
|
|
346
|
-
registerRowGroupingModule: boolean;
|
|
347
|
-
container: any;
|
|
348
|
-
pagingProps: any;
|
|
349
|
-
licenseKey?: string;
|
|
350
|
-
}
|
|
351
|
-
interface IGrid extends IControl<IGridParameters, IGridOutputs, Partial<ITranslation<typeof gridTranslations>>, IGridComponentProps> {
|
|
344
|
+
interface IGrid extends IControl<IGridParameters, IGridOutputs, Partial<ITranslation<typeof gridTranslations>>, AgGridReactProps> {
|
|
352
345
|
}
|
|
353
346
|
interface IGridParameters extends IParameters {
|
|
354
347
|
Grid: IDataset;
|
|
@@ -485,7 +478,7 @@ interface IDatasetControl extends EventEmitter<IDatasetControlEvents> {
|
|
|
485
478
|
|
|
486
479
|
interface IDatasetControlProps extends Omit<IControl<IDatasetControlParameters, IGridOutputs, Partial<ITranslation<typeof datasetControlTranslations & typeof gridTranslations>>, IDatasetControlComponentProps>, 'parameters' | 'context' | 'state'> {
|
|
487
480
|
/**
|
|
488
|
-
*
|
|
481
|
+
* Used to provide the Dataset control instance.
|
|
489
482
|
*/
|
|
490
483
|
onGetDatasetControlInstance: () => IDatasetControl;
|
|
491
484
|
/**
|
|
@@ -532,6 +525,8 @@ interface IHeaderProps {
|
|
|
532
525
|
}
|
|
533
526
|
interface IRibbonQuickFindWrapperProps {
|
|
534
527
|
ribbonQuickFindContainerProps: React$1.HTMLAttributes<HTMLDivElement>;
|
|
528
|
+
isRibbonVisible: boolean;
|
|
529
|
+
isQuickFindVisible: boolean;
|
|
535
530
|
onRenderQuickFind: (props: IQuickFindProps, defaultRender: (props: IQuickFindProps) => React$1.ReactElement) => React$1.ReactElement;
|
|
536
531
|
onRenderRibbon: IRibbonComponentProps['onRender'];
|
|
537
532
|
}
|
|
@@ -1489,4 +1484,4 @@ declare const useMouseOver: (ref: React.RefObject<HTMLElement>) => boolean;
|
|
|
1489
1484
|
|
|
1490
1485
|
declare const useEventEmitter: <T extends { [K in keyof T]: (...args: any[]) => any; }>(emitter: IEventEmitter<T>, event: keyof T | (keyof T)[], callback: T[keyof T]) => void;
|
|
1491
1486
|
|
|
1492
|
-
export { BaseControl, BaseControls, ControlTheme, DatasetAdapter, DatasetControl, DateTime, Decimal, Duration, Grid, GridCellRenderer, GridInlineRibbon, IBinding, IColorfulOptionSetValueRendererProps, IColorfulOptionValueRendererProps, IComponentProps$1 as IComponentProps, IContext, IControl, IControlController, IControlStates, IDatasetControlComponentProps, IDatasetControlParameters, IDatasetControlProps, IDateTime, IDateTimeOutputs, IDateTimeParameters, IDateTimeProperty, IDecimal, IDecimalNumberProperty, IDecimalOutputs, IDecimalParameters, IDefaultTranslations, IDuration, IDurationOutputs, IDurationParameters, IEntity, IFileProperty, IFileRendererProps, IFluentDesignState, IFooterProps, IGrid, IGridCellRenderer, IGridCellRendererComponentProps, IGridCellRendererParameters,
|
|
1487
|
+
export { BaseControl, BaseControls, ControlTheme, DatasetAdapter, DatasetControl, DateTime, Decimal, Duration, Grid, GridCellRenderer, GridInlineRibbon, IBinding, IColorfulOptionSetValueRendererProps, IColorfulOptionValueRendererProps, IComponentProps$1 as IComponentProps, IContext, IControl, IControlController, IControlStates, IDatasetControlComponentProps, IDatasetControlParameters, IDatasetControlProps, IDateTime, IDateTimeOutputs, IDateTimeParameters, IDateTimeProperty, IDecimal, IDecimalNumberProperty, IDecimalOutputs, IDecimalParameters, IDefaultTranslations, IDuration, IDurationOutputs, IDurationParameters, IEntity, IFileProperty, IFileRendererProps, IFluentDesignState, IFooterProps, IGrid, IGridCellRenderer, IGridCellRendererComponentProps, IGridCellRendererParameters, IGridInlineRibbon, IGridOutputs, IGridParameters, IHeaderProps, ILayout, ILookup, ILookupOutputs, ILookupParameters, ILookupProperty, IMetadata, IMultiSelectOptionSet, IMultiSelectOptionSetOutputs, IMultiSelectOptionSetParameters, IMultiSelectOptionSetProperty, INestedControlRenderer, INestedControlRendererComponentProps, INestedControlRendererParameters, IOptionSet, IOptionSetOutputs, IOptionSetParameters, IOptionSetProperty, IOutputs, IPaginationProps, IParameters, IProperty, IQuickFindProps, IRibbonParameters, IRibbonQuickFindWrapperProps, IStringProperty, ITextField, ITextFieldOutputs, ITextFieldParameters, ITranslation, ITranslations, ITwoOptions, ITwoOptionsOutputs, ITwoOptionsParameters, ITwoOptionsProperty, IValueRendererProps, IWholeNumberProperty, Lookup, MultiSelectOptionSet, NestedControlRenderer, OptionSet, TextField, ThemeWrapper, TwoOptions, VirtualDatasetAdapter, useControl, useControlLabels, useControlSizing, useControlTheme, useControlThemeGenerator, useDateTime, useEventEmitter, useFocusIn, useInputBasedControl, useLookup, useMouseOver };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talxis/base-controls",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2601.2",
|
|
4
4
|
"description": "Set of React components that natively work with Power Apps Component Framework APIs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"@fluentui/react": "<=8.121.5",
|
|
97
|
+
"@talxis/client-libraries": "1.2601.1",
|
|
97
98
|
"@talxis/react-components": "1.2505.2",
|
|
98
|
-
"@talxis/client-libraries": "1.2512.3",
|
|
99
99
|
"react": "^16.8.6 || ^17.0.2",
|
|
100
100
|
"react-dom": "^16.8.6 || ^17.0.2"
|
|
101
101
|
}
|