Browse Source

fix: update regex

pull/6323/head
DarkPhoenix2704 1 year ago
parent
commit
7a945ac5b2
  1. 4
      packages/nc-gui/components/smartsheet/column/DefaultValue.vue
  2. 2
      packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
  3. 13
      packages/nocodb-sdk/src/lib/Api.ts
  4. 2
      packages/nocodb/src/db/sql-client/lib/pg/PgClient.ts

4
packages/nc-gui/components/smartsheet/column/DefaultValue.vue

@ -21,7 +21,7 @@ const rowRef = ref({
const cdfValue = computed({
get: () => {
if (vModel.value.uidt === UITypes.MultiSelect || vModel.value.uidt === UITypes.SingleSelect) {
return (vModel.value.cdf ?? '').replaceAll("'", '')
return (vModel.value.cdf ?? '').replace(/^'|'$/g, '')
} else if (
vModel.value.uidt === UITypes.SingleLineText ||
vModel.value.uidt === UITypes.LongText ||
@ -33,7 +33,7 @@ const cdfValue = computed({
vModel.value.uidt === UITypes.Year ||
vModel.value.uidt === UITypes.Date
) {
return (vModel.value.cdf ?? '').replace(/^'/, '').replace(/'$/, '')
return (vModel.value.cdf ?? '').replace(/^'|'$/g, '')
}
return vModel.value.cdf
},

2
packages/nc-gui/components/smartsheet/column/EditOrAdd.vue

@ -263,7 +263,7 @@ if (props.fromTableExplorer) {
</a-select-option>
</a-select>
</a-form-item>
<div v-if="!props.hideType" class="mt-2 cursor-pointer" @click="predictColumnType()">
<div v-if="isEeUI && !props.hideType" class="mt-2 cursor-pointer" @click="predictColumnType()">
<GeneralIcon icon="magic" :class="{ 'nc-animation-pulse': loadMagic }" class="w-full flex mt-2 text-orange-400" />
</div>
</div>

13
packages/nocodb-sdk/src/lib/Api.ts

@ -321,7 +321,7 @@ export interface ColumnType {
/** Column Comment */
cc?: string;
/** Column Default */
cdf?: StringOrNullType;
cdf?: StringOrNullOrBooleanOrNumberType;
/** Character Maximum Length */
clen?: number | null | string;
/** Column Options */
@ -1690,7 +1690,7 @@ export interface NormalColumnRequestType {
/** Column Comment */
cc?: StringOrNullType;
/** Column Default Value */
cdf?: StringOrNullType;
cdf?: StringOrNullOrBooleanOrNumberType;
/** Column Name */
column_name: string;
/** Model for StringOrNull */
@ -2280,6 +2280,15 @@ export interface SortReqType {
*/
export type StringOrNullType = string | null;
/**
* Model for StringOrNullOrBooleanOrNumber
*/
export type StringOrNullOrBooleanOrNumberType =
| string
| null
| boolean
| number;
/**
* Model for Table
*/

2
packages/nocodb/src/db/sql-client/lib/pg/PgClient.ts

@ -877,7 +877,7 @@ class PGClient extends KnexClient {
// column['unique'] = response.rows[i]['cst'].indexOf('UNIQUE') === -1 ? false : true;
column.cdf = response.rows[i].cdf
? response.rows[i].cdf.split('::')[0].replace(/'/g, '')
? response.rows[i].cdf.replace(/::\w+$/, '').replace(/^'|'$/g, '')
: response.rows[i].cdf;
// todo : need to find column comment

Loading…
Cancel
Save