@newageerp/v3.app.mvc.ui-builder
Advanced tools
Comparing version 0.2.18 to 0.2.19
@@ -1,2 +0,1 @@ | ||
export { UiBuilder, useUIBuilder } from './ui-builder'; | ||
export type { UiBuilderProps } from './ui-builder'; | ||
export { UiBuilder } from './ui-builder'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useUIBuilder = exports.UiBuilder = void 0; | ||
exports.UiBuilder = void 0; | ||
var ui_builder_1 = require("./ui-builder"); | ||
Object.defineProperty(exports, "UiBuilder", { enumerable: true, get: function () { return ui_builder_1.UiBuilder; } }); | ||
Object.defineProperty(exports, "useUIBuilder", { enumerable: true, get: function () { return ui_builder_1.useUIBuilder; } }); | ||
//# sourceMappingURL=index.js.map |
import React from 'react'; | ||
export interface UIBuilderProviderValue { | ||
config: IUIBuilderRecordItem[]; | ||
widgets: IUIBuilderWidgetRecordItem[]; | ||
tabs: IUIBuilderTabItem[]; | ||
edit: IUIBuilderEditItem[]; | ||
view: IUIBuilderViewItem[]; | ||
defaults: IUIBuilderDefaultsItem[]; | ||
settings: any; | ||
getTabFromSchemaAndType: (schema: string, type?: string) => any; | ||
} | ||
export declare const UIBuilderProviderContext: React.Context<UIBuilderProviderValue>; | ||
export declare const useUIBuilder: () => UIBuilderProviderValue; | ||
export interface UiBuilderProps { | ||
children: any; | ||
baseUrl?: string; | ||
} | ||
export declare const UiBuilder: (props: UiBuilderProps) => React.JSX.Element; | ||
export interface IUIBuilderViewItem { | ||
title: string; | ||
tag: string; | ||
config: IUIBuilderViewOptions; | ||
id: string; | ||
} | ||
export interface IUIBuilderEditItem { | ||
title: string; | ||
tag: string; | ||
config: IUIBuilderEditOptions; | ||
id: string; | ||
} | ||
export interface IUIBuilderDefaultsItem { | ||
title: string; | ||
tag: string; | ||
config: IUIBuilderDefaultsOptions; | ||
id: string; | ||
} | ||
export interface IUIBuilderRecordItem { | ||
title: string; | ||
tag: string; | ||
config: IUIBuilderItem[]; | ||
id: string; | ||
} | ||
export interface IUIBuilderWidgetRecordItem { | ||
title: string; | ||
tag: string; | ||
config: IUIBuilderWidgetOptions; | ||
id: string; | ||
} | ||
export interface IUIBuilderTabItem { | ||
title: string; | ||
tag: string; | ||
config: IUIBuilderTabOptions; | ||
id: string; | ||
} | ||
export interface IUIBuilderViewOptions { | ||
title: string; | ||
schema: string; | ||
type: string; | ||
fields: MainListViewField[]; | ||
fieldsToReturn?: string[]; | ||
} | ||
export interface IUIBuilderEditOptions { | ||
title: string; | ||
schema: string; | ||
type: string; | ||
fields: MainListEditField[]; | ||
} | ||
export interface IUIBuilderDefaultsOptions { | ||
schema: string; | ||
defaultSort: string; | ||
defaultQuickSearch: string; | ||
defaultPath: string; | ||
fields: IUIBuilderDefaultsField[]; | ||
} | ||
export interface IUIBuilderItem { | ||
type: string; | ||
props: any; | ||
children?: any; | ||
} | ||
export interface IUIBuilderWidgetOptions { | ||
schema: string; | ||
type: string; | ||
builderId: string; | ||
sort: number; | ||
hideScopes: string; | ||
showScopes: string; | ||
} | ||
export interface IUIBuilderTabOptions { | ||
title: string; | ||
tabGroup: string; | ||
tabGroupTitle: string; | ||
schema: string; | ||
type: string; | ||
predefinedFilter: string; | ||
quickSearchFilterKeys: string; | ||
columns: MainListColumn[]; | ||
sort: string; | ||
disableCreate: boolean; | ||
filterDateKey?: string; | ||
pageSize?: number; | ||
hideWithoutFilter?: boolean; | ||
} | ||
export interface MainListViewField { | ||
path: string; | ||
titlePath?: string; | ||
customTitle?: string; | ||
hideLabel?: boolean; | ||
text?: string; | ||
type: string; | ||
arrayRelTab?: string; | ||
relKeyExtraSelect?: string; | ||
lineGroup?: string; | ||
extraFieldsToReturn?: string; | ||
} | ||
export interface MainListColumn { | ||
path: string; | ||
titlePath?: string; | ||
sortPath?: string; | ||
filterPath?: string; | ||
customTitle?: string; | ||
link?: number; | ||
builderId?: string; | ||
editable?: false; | ||
extraFieldsToReturn?: string; | ||
} | ||
export interface IUIBuilderDefaultsField { | ||
path: string; | ||
} | ||
export interface MainListEditField { | ||
path: string; | ||
titlePath?: string; | ||
customTitle?: string; | ||
hideLabel?: boolean; | ||
text?: string; | ||
type: string; | ||
lineGroup?: string; | ||
fieldDependency?: string; | ||
inputClassName?: string; | ||
labelClassName?: string; | ||
arrayRelTab?: string; | ||
relKeyExtraSelect?: string; | ||
extraFieldsToReturn?: string; | ||
} | ||
export declare const UiBuilder: () => React.JSX.Element; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UiBuilder = exports.useUIBuilder = exports.UIBuilderProviderContext = void 0; | ||
const react_1 = __importStar(require("react")); | ||
const v3_utils_socket_service_1 = require("@newageerp/v3.utils.socket-service"); | ||
exports.UIBuilderProviderContext = react_1.default.createContext({ | ||
config: [], | ||
widgets: [], | ||
tabs: [], | ||
edit: [], | ||
view: [], | ||
defaults: [], | ||
getTabFromSchemaAndType: (schema, type) => { }, | ||
settings: {}, | ||
}); | ||
const useUIBuilder = () => (0, react_1.useContext)(exports.UIBuilderProviderContext); | ||
exports.useUIBuilder = useUIBuilder; | ||
const UiBuilder = (props) => { | ||
const [loaded, setLoaded] = (0, react_1.useState)(false); | ||
const [data, setData] = (0, react_1.useState)({ | ||
builder: [], | ||
widgets: [], | ||
tabs: [], | ||
edit: [], | ||
view: [], | ||
defaults: [], | ||
settings: {}, | ||
}); | ||
(0, react_1.useEffect)(() => { | ||
const url = `${props.baseUrl ? props.baseUrl : ''}/app/nae-core/config-cache/getLocalConfig`; | ||
fetch(url) | ||
.then((res) => res.json()) | ||
.then((res) => { | ||
setData(res.data); | ||
setLoaded(true); | ||
if (res.data.main.title || res.data.settings.pageTitle) { | ||
window.document.title = res.data.main.title ? res.data.main.title : res.data.settings.pageTitle; | ||
} | ||
if (res.data.main.allowSocket) { | ||
v3_utils_socket_service_1.SocketService.connect(); | ||
} | ||
}); | ||
}, []); | ||
const builderData = data.builder; | ||
const widgetData = data.widgets; | ||
const tabsData = data.tabs; | ||
const editData = data.edit; | ||
const viewData = data.view; | ||
const defaultsData = data.defaults; | ||
const getTabFromSchemaAndType = (schema, type = 'main') => { | ||
const tabs = tabsData.map((t) => configTabToInaeTab(t, defaultsData)); | ||
const founded = tabs.filter((tab) => tab.schema === schema && tab.type === type); | ||
if (founded.length > 0) { | ||
return founded[0]; | ||
} | ||
return { | ||
fields: [], | ||
schema: schema, | ||
type: type, | ||
sort: [], | ||
}; | ||
}; | ||
return (react_1.default.createElement(exports.UIBuilderProviderContext.Provider, { value: { | ||
config: builderData, | ||
widgets: widgetData, | ||
tabs: tabsData, | ||
edit: editData, | ||
view: viewData, | ||
defaults: defaultsData, | ||
getTabFromSchemaAndType: getTabFromSchemaAndType, | ||
settings: data.settings | ||
} }, loaded ? props.children : react_1.default.createElement(react_1.Fragment, null))); | ||
exports.UiBuilder = void 0; | ||
const react_1 = __importDefault(require("react")); | ||
const UiBuilder = () => { | ||
return react_1.default.createElement("div", null, "Deprecated"); | ||
}; | ||
exports.UiBuilder = UiBuilder; | ||
const configTabToInaeTab = (tab, builderDefaults) => { | ||
const defaultRecords = builderDefaults | ||
? builderDefaults.filter((f) => f.config.schema === tab.config.schema) | ||
: []; | ||
const f = tab.config; | ||
let tabSort = []; | ||
let tabQuickSearch = undefined; | ||
if (f.sort) { | ||
try { | ||
tabSort = JSON.parse(f.sort); | ||
} | ||
catch (e) { | ||
console.log('configTabToInaeTab error', f.sort, e); | ||
} | ||
} | ||
if (f.quickSearchFilterKeys) { | ||
try { | ||
tabQuickSearch = JSON.parse(f.quickSearchFilterKeys); | ||
} | ||
catch (e) { | ||
console.log('configTabToInaeTab error', f.quickSearchFilterKeys, e); | ||
} | ||
} | ||
if (defaultRecords.length > 0) { | ||
const defaultRecord = defaultRecords[0]; | ||
if (defaultRecord) { | ||
if (!tabSort && defaultRecord.config.defaultSort) { | ||
try { | ||
tabSort = JSON.parse(defaultRecord.config.defaultSort); | ||
} | ||
catch (e) { | ||
console.log('configTabToInaeTab error', defaultRecord.config.defaultSort, e); | ||
} | ||
} | ||
if (!tabQuickSearch && defaultRecord.config.defaultQuickSearch) { | ||
try { | ||
tabQuickSearch = JSON.parse(defaultRecord.config.defaultQuickSearch); | ||
} | ||
catch (e) { | ||
console.log('configTabToInaeTab error', defaultRecord.config.defaultQuickSearch, e); | ||
} | ||
} | ||
} | ||
} | ||
let filterDateKey = undefined; | ||
if (f.filterDateKey) { | ||
let filterDateKeyTmp = f.filterDateKey.split('.'); | ||
filterDateKeyTmp[0] = 'i'; | ||
filterDateKey = filterDateKeyTmp.join('.'); | ||
} | ||
let tabResponse = { | ||
filterDateKey: filterDateKey, | ||
schema: f.schema, | ||
type: f.type, | ||
sort: tabSort, | ||
predefinedFilter: f.predefinedFilter | ||
? JSON.parse(f.predefinedFilter) | ||
: undefined, | ||
quickSearchFilterKeys: tabQuickSearch, | ||
tabGroup: f.tabGroup, | ||
tabGroupTitle: f.tabGroupTitle, | ||
title: f.title, | ||
fields: f.columns.map((c) => { | ||
const newF = { | ||
key: c.path.split('.').slice(1).join('.'), | ||
titlePath: c.titlePath | ||
? c.titlePath.split('.').slice(1).join('.') | ||
: undefined, | ||
sortPath: c.sortPath, | ||
filterPath: c.filterPath, | ||
link: !!c.link && c.link > 0, | ||
editable: c.editable, | ||
}; | ||
if (c.extraFieldsToReturn) { | ||
if (!newF.custom) { | ||
newF.custom = {}; | ||
} | ||
newF.custom.fieldsToReturn = JSON.parse(c.extraFieldsToReturn); | ||
} | ||
return newF; | ||
}), | ||
disableCreate: f.disableCreate, | ||
pageSize: f.pageSize ? f.pageSize : undefined, | ||
hideWithoutFilter: f.hideWithoutFilter, | ||
}; | ||
return tabResponse; | ||
}; | ||
//# sourceMappingURL=ui-builder.js.map |
{ | ||
"name": "@newageerp/v3.app.mvc.ui-builder", | ||
"version": "0.2.18", | ||
"version": "0.2.19", | ||
"homepage": "https://bit.dev/newageerp/v3/app/mvc/ui-builder", | ||
@@ -9,7 +9,6 @@ "main": "dist/index.js", | ||
"name": "v3/app/mvc/ui-builder", | ||
"version": "0.2.18" | ||
"version": "0.2.19" | ||
}, | ||
"dependencies": { | ||
"core-js": "^3.0.0", | ||
"@newageerp/v3.utils.socket-service": "0.2.5" | ||
"core-js": "^3.0.0" | ||
}, | ||
@@ -16,0 +15,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
1
27133
13
64
- Removed@newageerp/v3.utils.socket-service@0.2.5(transitive)
- Removedafter@0.8.2(transitive)
- Removedarraybuffer.slice@0.0.7(transitive)
- Removedbacko2@1.0.2(transitive)
- Removedbase64-arraybuffer@0.1.4(transitive)
- Removedblob@0.0.5(transitive)
- Removedcomponent-bind@1.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcomponent-inherit@0.0.3(transitive)
- Removeddebug@3.1.0(transitive)
- Removedengine.io-client@3.5.4(transitive)
- Removedengine.io-parser@2.2.1(transitive)
- Removedhas-binary2@1.0.3(transitive)
- Removedhas-cors@1.1.0(transitive)
- Removedindexof@0.0.1(transitive)
- Removedisarray@2.0.1(transitive)
- Removedms@2.0.0(transitive)
- Removedparseqs@0.0.6(transitive)
- Removedparseuri@0.0.6(transitive)
- Removedsocket.io-client@2.5.0(transitive)
- Removedsocket.io-parser@3.3.4(transitive)
- Removedto-array@0.1.4(transitive)
- Removedws@7.5.10(transitive)
- Removedxmlhttprequest-ssl@1.6.3(transitive)
- Removedyeast@0.1.2(transitive)