@wavemaker/angular-codegen 12.0.0-next.25480 → 12.0.0-next.28533

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.
@@ -146174,6 +146174,7 @@ var FormWidgetType$1;
146174
146174
  FormWidgetType["CUSTOMWIDGET"] = "custom-widget";
146175
146175
  FormWidgetType["DATE"] = "date";
146176
146176
  FormWidgetType["DATETIME"] = "datetime";
146177
+ FormWidgetType["ICONBUTTONTOGGLE"] = "iconbutton-toggle";
146177
146178
  FormWidgetType["NUMBER"] = "number";
146178
146179
  FormWidgetType["PASSWORD"] = "password";
146179
146180
  FormWidgetType["RADIOSET"] = "radioset";
@@ -148014,6 +148015,7 @@ const $watch$1 = (expr, $scope, $locals, listener, identifier = watchIdGenerator
148014
148015
  const fn = $parseExpr$1();
148015
148016
  const scopeType = getScopeType$1($scope);
148016
148017
  const scopeName = getScopeName$1($scope, scopeType);
148018
+ const destroyFn = () => $unwatch$1(identifier);
148017
148019
  const watchInfo = {
148018
148020
  fn: fn.bind(null, $scope, $locals),
148019
148021
  listener,
@@ -148022,7 +148024,8 @@ const $watch$1 = (expr, $scope, $locals, listener, identifier = watchIdGenerator
148022
148024
  doNotClone,
148023
148025
  isMuted,
148024
148026
  scopeType,
148025
- scopeName
148027
+ scopeName,
148028
+ destroyFn
148026
148029
  };
148027
148030
  // Store in registry
148028
148031
  const widgetId = getWidgetId$1(identifier);
@@ -148037,7 +148040,7 @@ const $watch$1 = (expr, $scope, $locals, listener, identifier = watchIdGenerator
148037
148040
  else {
148038
148041
  registry$1.set(identifier, watchInfo);
148039
148042
  }
148040
- return () => $unwatch$1(identifier);
148043
+ return destroyFn;
148041
148044
  };
148042
148045
  /**
148043
148046
  * Unwatches a single identifier
@@ -148047,6 +148050,7 @@ const $unwatch$1 = (identifier) => {
148047
148050
  if (widgetId) {
148048
148051
  const propertyName = getPropertyName$1(identifier);
148049
148052
  const widgetGroup = registry$1.get(widgetId);
148053
+ //@ts-ignore
148050
148054
  if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
148051
148055
  const watchInfo = widgetGroup[propertyName];
148052
148056
  if (watchInfo) {
@@ -149493,7 +149497,10 @@ const getAppSetting$1 = (key, defaultValue) => {
149493
149497
  const setListClass$1 = (scope) => {
149494
149498
  let temp = '';
149495
149499
  if (scope.itemsperrow) {
149496
- if (isNaN(parseInt(scope.itemsperrow, 10))) {
149500
+ if (scope.itemsperrow === "auto") {
149501
+ scope.itemsPerRowClass = "";
149502
+ }
149503
+ else if (isNaN(parseInt(scope.itemsperrow, 10))) {
149497
149504
  // handling itemsperrow containing string of classes
149498
149505
  split$1(scope.itemsperrow, ' ').forEach((cls) => {
149499
149506
  const keys = split$1(cls, '-');
@@ -203037,6 +203044,7 @@ var FormWidgetType;
203037
203044
  FormWidgetType["CUSTOMWIDGET"] = "custom-widget";
203038
203045
  FormWidgetType["DATE"] = "date";
203039
203046
  FormWidgetType["DATETIME"] = "datetime";
203047
+ FormWidgetType["ICONBUTTONTOGGLE"] = "iconbutton-toggle";
203040
203048
  FormWidgetType["NUMBER"] = "number";
203041
203049
  FormWidgetType["PASSWORD"] = "password";
203042
203050
  FormWidgetType["RADIOSET"] = "radioset";
@@ -203812,6 +203820,7 @@ const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.n
203812
203820
  const fn = $parseExpr();
203813
203821
  const scopeType = getScopeType($scope);
203814
203822
  const scopeName = getScopeName($scope, scopeType);
203823
+ const destroyFn = () => $unwatch(identifier);
203815
203824
  const watchInfo = {
203816
203825
  fn: fn.bind(null, $scope, $locals),
203817
203826
  listener,
@@ -203820,7 +203829,8 @@ const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.n
203820
203829
  doNotClone,
203821
203830
  isMuted,
203822
203831
  scopeType,
203823
- scopeName
203832
+ scopeName,
203833
+ destroyFn
203824
203834
  };
203825
203835
  // Store in registry
203826
203836
  const widgetId = getWidgetId(identifier);
@@ -203835,7 +203845,7 @@ const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.n
203835
203845
  else {
203836
203846
  registry.set(identifier, watchInfo);
203837
203847
  }
203838
- return () => $unwatch(identifier);
203848
+ return destroyFn;
203839
203849
  };
203840
203850
  /**
203841
203851
  * Unwatches a single identifier
@@ -203845,6 +203855,7 @@ const $unwatch = (identifier) => {
203845
203855
  if (widgetId) {
203846
203856
  const propertyName = getPropertyName(identifier);
203847
203857
  const widgetGroup = registry.get(widgetId);
203858
+ //@ts-ignore
203848
203859
  if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
203849
203860
  const watchInfo = widgetGroup[propertyName];
203850
203861
  if (watchInfo) {
@@ -205291,7 +205302,10 @@ const getAppSetting = (key, defaultValue) => {
205291
205302
  const setListClass = (scope) => {
205292
205303
  let temp = '';
205293
205304
  if (scope.itemsperrow) {
205294
- if (isNaN(parseInt(scope.itemsperrow, 10))) {
205305
+ if (scope.itemsperrow === "auto") {
205306
+ scope.itemsPerRowClass = "";
205307
+ }
205308
+ else if (isNaN(parseInt(scope.itemsperrow, 10))) {
205295
205309
  // handling itemsperrow containing string of classes
205296
205310
  split(scope.itemsperrow, ' ').forEach((cls) => {
205297
205311
  const keys = split(cls, '-');
@@ -99358,6 +99358,7 @@ var FormWidgetType;
99358
99358
  FormWidgetType["CUSTOMWIDGET"] = "custom-widget";
99359
99359
  FormWidgetType["DATE"] = "date";
99360
99360
  FormWidgetType["DATETIME"] = "datetime";
99361
+ FormWidgetType["ICONBUTTONTOGGLE"] = "iconbutton-toggle";
99361
99362
  FormWidgetType["NUMBER"] = "number";
99362
99363
  FormWidgetType["PASSWORD"] = "password";
99363
99364
  FormWidgetType["RADIOSET"] = "radioset";
@@ -99487,6 +99488,9 @@ const getFormWidgetTemplate = (widgetType, innerTmpl, attrs, options = {}) => {
99487
99488
  case FormWidgetType.TOGGLE:
99488
99489
  tmpl = `<div wmCheckbox ${innerTmpl} ${attrs.get('required') === 'true' ? 'required=true' : ''} type="toggle" ${showTmpl}></div>`;
99489
99490
  break;
99491
+ case FormWidgetType.ICONBUTTONTOGGLE:
99492
+ tmpl = `<div wmCheckbox ${innerTmpl} ${attrs.get('required') === 'true' ? 'required=true' : ''} type="button" ${showTmpl}></div>`;
99493
+ break;
99490
99494
  case FormWidgetType.SLIDER:
99491
99495
  tmpl = `<div wmSlider ${innerTmpl} ${showTmpl}></div>`;
99492
99496
  break;
@@ -99578,6 +99582,7 @@ const getRequiredFormWidget = (widgetType) => {
99578
99582
  return 'wm-textarea';
99579
99583
  case FormWidgetType.CHECKBOX:
99580
99584
  case FormWidgetType.TOGGLE:
99585
+ case FormWidgetType.ICONBUTTONTOGGLE:
99581
99586
  return 'wm-checkbox';
99582
99587
  case FormWidgetType.UPLOAD:
99583
99588
  return 'wm-fileupload';
@@ -100422,6 +100427,7 @@ const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.n
100422
100427
  const fn = $parseExpr();
100423
100428
  const scopeType = getScopeType($scope);
100424
100429
  const scopeName = getScopeName($scope, scopeType);
100430
+ const destroyFn = () => $unwatch(identifier);
100425
100431
  const watchInfo = {
100426
100432
  fn: fn.bind(null, $scope, $locals),
100427
100433
  listener,
@@ -100430,7 +100436,8 @@ const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.n
100430
100436
  doNotClone,
100431
100437
  isMuted,
100432
100438
  scopeType,
100433
- scopeName
100439
+ scopeName,
100440
+ destroyFn
100434
100441
  };
100435
100442
  // Store in registry
100436
100443
  const widgetId = getWidgetId(identifier);
@@ -100445,7 +100452,7 @@ const $watch = (expr, $scope, $locals, listener, identifier = watchIdGenerator.n
100445
100452
  else {
100446
100453
  registry.set(identifier, watchInfo);
100447
100454
  }
100448
- return () => $unwatch(identifier);
100455
+ return destroyFn;
100449
100456
  };
100450
100457
  /**
100451
100458
  * Unwatches a single identifier
@@ -100455,6 +100462,7 @@ const $unwatch = (identifier) => {
100455
100462
  if (widgetId) {
100456
100463
  const propertyName = getPropertyName(identifier);
100457
100464
  const widgetGroup = registry.get(widgetId);
100465
+ //@ts-ignore
100458
100466
  if (widgetGroup && typeof widgetGroup === 'object' && !widgetGroup.fn) {
100459
100467
  const watchInfo = widgetGroup[propertyName];
100460
100468
  if (watchInfo) {
@@ -101897,7 +101905,10 @@ const getAppSetting = (key, defaultValue) => {
101897
101905
  const setListClass = (scope) => {
101898
101906
  let temp = '';
101899
101907
  if (scope.itemsperrow) {
101900
- if (isNaN(parseInt(scope.itemsperrow, 10))) {
101908
+ if (scope.itemsperrow === "auto") {
101909
+ scope.itemsPerRowClass = "";
101910
+ }
101911
+ else if (isNaN(parseInt(scope.itemsperrow, 10))) {
101901
101912
  // handling itemsperrow containing string of classes
101902
101913
  split(scope.itemsperrow, ' ').forEach((cls) => {
101903
101914
  const keys = split(cls, '-');
@@ -104656,7 +104667,14 @@ var button_build$1 = /*#__PURE__*/Object.freeze({
104656
104667
  const tagName$Q = 'div';
104657
104668
  register('wm-checkbox', () => {
104658
104669
  return {
104659
- pre: attrs => `<${tagName$Q} wmCheckbox ${getFormMarkupAttr(attrs)} ${getChildAttrs(attrs)} ${getNgModelAttr(attrs)} style="height:100%">`,
104670
+ pre: attrs => {
104671
+ if (attrs.get('type') === 'button') {
104672
+ return `<${tagName$Q} wmCheckbox ${getFormMarkupAttr(attrs)} ${getChildAttrs(attrs)} ${getNgModelAttr(attrs)}>`;
104673
+ }
104674
+ else {
104675
+ return `<${tagName$Q} wmCheckbox ${getFormMarkupAttr(attrs)} ${getChildAttrs(attrs)} ${getNgModelAttr(attrs)} style="height:100%">`;
104676
+ }
104677
+ },
104660
104678
  post: () => `</${tagName$Q}>`
104661
104679
  };
104662
104680
  });
@@ -38,14 +38,21 @@ const downloadNPMPackage = async (packageInfo) => {
38
38
  if (!packageInfo.baseDir) { // going to install in the .wm folder if baseDir is not defined(optimizeUIBuild true)
39
39
  // To check node modules.
40
40
  if (!isNPMPackageExist(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg)) {
41
+ fs.mkdirSync(PATH_NPM_PACKAGE, { recursive: true });
41
42
  // Check if another process is already installing
42
43
  if (fs.existsSync(LOCK_FILE)) {
43
44
  console.log(`Waiting for another build to complete npm install... for package ${packageInfo.name}`);
44
45
  await waitForLock(LOCK_FILE, 20 * 60 * 1000); // Wait for 20 minutes (timeout in milliseconds)
46
+ // After waiting, check if installation completed
47
+ if (!isNPMPackageExist(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg)) {
48
+ console.log(`[LOCK] Previous install for ${packageInfo.name} was incomplete. Re-installing...`);
49
+ createPidLock(LOCK_FILE);
50
+ await processPackage(packageInfo, PATH_NPM_PACKAGE);
51
+ fs.writeFileSync(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg);
52
+ }
45
53
  } else {
46
- // Acquire the lock
47
- fs.mkdirSync(PATH_NPM_PACKAGE, { recursive: true });
48
- fs.writeFileSync(LOCK_FILE, "PROGRESS");
54
+ // Create PID lock and Acquire the lock
55
+ createPidLock(LOCK_FILE);
49
56
 
50
57
  await processPackage(packageInfo, PATH_NPM_PACKAGE);
51
58
 
@@ -115,6 +122,31 @@ const deleteFiles = (files) => {
115
122
  });
116
123
  }
117
124
 
125
+ /**
126
+ * Check if a process with given PID is still running.
127
+ * @param {number} pid Process ID to verify
128
+ * @returns {boolean} True if process is alive, false otherwise
129
+ */
130
+ const isProcessRunning = (pid) => {
131
+ try {
132
+ process.kill(pid, 0); // check only, does NOT kill
133
+ return true;
134
+ } catch {
135
+ return false; // PID not running
136
+ }
137
+ }
138
+
139
+
140
+ /**
141
+ * Create a lock file containing the current process PID.
142
+ * @param {string} lockFile Full path to the .LOCK file
143
+ */
144
+ const createPidLock = (lockFile) => {
145
+ fs.mkdirSync(path.dirname(lockFile), { recursive: true });
146
+ fs.writeFileSync(lockFile, String(process.pid));
147
+ console.log(`[LOCK] Created lock for PID ${process.pid}`);
148
+ }
149
+
118
150
  /**
119
151
  *
120
152
  * @param lockFile
@@ -125,9 +157,25 @@ const waitForLock = async (lockFile, timeout) => {
125
157
  timeout = timeout || 20 * 60 * 1000 // Wait for 20 minutes (timeout in milliseconds)
126
158
  // Helper function to wait for the lock to be released with a timeout
127
159
  const startTime = Date.now();
128
- while (fs.existsSync(lockFile)) {
160
+ while (true) {
161
+ if (!fs.existsSync(lockFile)) return; // lock free
162
+ let pid = null;
163
+ try {
164
+ pid = Number(fs.readFileSync(lockFile, "utf8"));
165
+ } catch {
166
+ // corrupt lock → remove
167
+ fs.unlinkSync(lockFile);
168
+ return;
169
+ }
170
+ // stale lock → PID dead
171
+ if (!isProcessRunning(pid)) {
172
+ console.log(`[LOCK] Removing stale lock from PID ${pid}`);
173
+ fs.unlinkSync(lockFile);
174
+ return;
175
+ }
176
+ // still locked → wait
129
177
  if (Date.now() - startTime > timeout) {
130
- console.error('Timeout!! - waiting for the lock to be released. Exiting...');
178
+ console.error(`[LOCK] Timeout!! - waiting for the lock for PID ${pid} to be released. Exiting...`);
131
179
  process.exit(1); // Terminate the process with an error code
132
180
  }
133
181
  await sleep(1000); // Wait for 1 second before checking again