Izara Frontend Lib - Core - Tabled Data

From Izara Wiki
Jump to navigation Jump to search

TabledDataSchema

{
	objectType: { // matches searchType/filterType
		fields: {
			fieldName: { // fieldName used in logical elements and findData
				presentation:{ // can standardize these according to hard-coded settings, eg 
					"type" => "", // "integer" / "float" / "string" / "timestamp" / currencyValue / ...
					"defaultWidth" => 8, // affects width of column and filter field, default when adding as a new field
					"canTotal" => FALSE, // whether the column can be set to be totalled
					"emptyIfZero" => TRUE, // whether 0 shows in the table as "0" or empty
				}
				timeRange:{
					defaultStartValue: "15", // the default timerange value when adding as a new field
					defaultEndValue: "15", // the default timerange value when adding as a new field
					defaultTimeRangeType: "days", // default unit of time for time range
				}
			},
			//..
		},
		bulkActions: {
		}
		defaultFields: [
			// array of fieldName and settings when creating a new table of this objectType
		]
		defaultFilters: [
			// array of fieldName and filter settings when creating a new table of this objectType
		],
		defaultSortFields:[
			// set when creating a new table of this objectType
		],
		noResultsHook: // some sort of function that can output a link or any other code when no records are found
	},
	//..
}
  • serviceName to send sortedResult requests to is set in a standard location in each micro-frontend, allowing each objectType to set a serviceName or have a default for any that do not set their serviceName
  • maybe each micro-frontend should publish it's tabled data scheme to a fixed url, which eg the page/menu config service can point to for each services to find all available schemas in the project

Currency conversions

  • have a findData field that returns the base value and currency
  • have a second findData field that returns the value converted to a set currency, this field would be used for sorting values
  • converted field probably not need to return currency, as client should have this recorded
  • maybe send a decimals setting as well, set by the client/tableCfg
  • presentation config sets the format of currency values, eg showing "$" and currency code, set by the client/tableCfg